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:
authorJacques Lucke <mail@jlucke.com>2019-04-15 11:24:47 +0300
committerJacques Lucke <mail@jlucke.com>2019-04-15 11:24:47 +0300
commita628f1842b216254a07b8f12eed4eba9c13f0a32 (patch)
tree83c5f02202bd192d0ad0c307737aa22a72f8b60d /source/blender
parent158425fc61cebb41739aed614caa9599dd107eec (diff)
parentefd319f543e3d38867cdd133ea8b4ceecbcdf822 (diff)
Merge branch 'master' into functions
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/alembic/CMakeLists.txt5
-rw-r--r--source/blender/alembic/intern/abc_exporter.cc36
-rw-r--r--source/blender/alembic/intern/abc_exporter.h4
-rw-r--r--source/blender/alembic/intern/abc_mball.cc48
-rw-r--r--source/blender/alembic/intern/abc_mball.h18
-rw-r--r--source/blender/alembic/intern/abc_mesh.cc9
-rw-r--r--source/blender/alembic/intern/abc_mesh.h1
-rw-r--r--source/blender/alembic/intern/abc_object.cc10
-rw-r--r--source/blender/alembic/intern/abc_util.cc5
-rw-r--r--source/blender/alembic/intern/abc_util.h2
-rw-r--r--source/blender/alembic/intern/alembic_capi.cc2
-rw-r--r--source/blender/avi/CMakeLists.txt5
-rw-r--r--source/blender/blenfont/CMakeLists.txt5
-rw-r--r--source/blender/blenfont/intern/blf_font.c3
-rw-r--r--source/blender/blenkernel/BKE_armature.h8
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h22
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h29
-rw-r--r--source/blender/blenkernel/BKE_modifier.h2
-rw-r--r--source/blender/blenkernel/BKE_scene.h1
-rw-r--r--source/blender/blenkernel/CMakeLists.txt5
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c405
-rw-r--r--source/blender/blenkernel/intern/armature_update.c205
-rw-r--r--source/blender/blenkernel/intern/collection.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c118
-rw-r--r--source/blender/blenkernel/intern/crazyspace.c7
-rw-r--r--source/blender/blenkernel/intern/font.c11
-rw-r--r--source/blender/blenkernel/intern/gpencil.c50
-rw-r--r--source/blender/blenkernel/intern/image.c10
-rw-r--r--source/blender/blenkernel/intern/key.c4
-rw-r--r--source/blender/blenkernel/intern/library_query.c6
-rw-r--r--source/blender/blenkernel/intern/mesh.c1
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c9
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c11
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/object.c14
-rw-r--r--source/blender/blenkernel/intern/object_update.c8
-rw-r--r--source/blender/blenkernel/intern/pbvh.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c31
-rw-r--r--source/blender/blenkernel/intern/softbody.c5
-rw-r--r--source/blender/blenkernel/intern/tracking_stabilize.c13
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h7
-rw-r--r--source/blender/blenlib/BLI_string.h48
-rw-r--r--source/blender/blenlib/CMakeLists.txt5
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c4
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c2
-rw-r--r--source/blender/blenlib/intern/edgehash.c2
-rw-r--r--source/blender/blenlib/intern/listbase.c2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c76
-rw-r--r--source/blender/blenlib/intern/path_util.c12
-rw-r--r--source/blender/blenlib/intern/threads.c12
-rw-r--r--source/blender/blenlib/intern/winstuff_dir.c7
-rw-r--r--source/blender/blenloader/CMakeLists.txt5
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/blenloader/intern/versioning_280.c111
-rw-r--r--source/blender/blentranslation/CMakeLists.txt5
-rw-r--r--source/blender/bmesh/CMakeLists.txt5
-rw-r--r--source/blender/collada/BCAnimationSampler.cpp6
-rw-r--r--source/blender/collada/CMakeLists.txt5
-rw-r--r--source/blender/compositor/CMakeLists.txt5
-rw-r--r--source/blender/depsgraph/CMakeLists.txt5
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc50
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc4
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc1
-rw-r--r--source/blender/draw/CMakeLists.txt5
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_cache_utils.c42
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c9
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl3
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c10
-rw-r--r--source/blender/draw/engines/workbench/workbench_render.c4
-rw-r--r--source/blender/draw/intern/DRW_render.h4
-rw-r--r--source/blender/draw/intern/draw_armature.c13
-rw-r--r--source/blender/draw/intern/draw_cache.c3
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c4
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c8
-rw-r--r--source/blender/draw/intern/draw_manager.c8
-rw-r--r--source/blender/draw/modes/edit_armature_mode.c5
-rw-r--r--source/blender/draw/modes/edit_mesh_mode.c6
-rw-r--r--source/blender/draw/modes/object_mode.c15
-rw-r--r--source/blender/draw/modes/overlay_mode.c4
-rw-r--r--source/blender/draw/modes/pose_mode.c15
-rw-r--r--source/blender/editors/animation/CMakeLists.txt5
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c4
-rw-r--r--source/blender/editors/animation/anim_intern.h2
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/keyframes_general.c5
-rw-r--r--source/blender/editors/animation/keyframing.c157
-rw-r--r--source/blender/editors/animation/keyingsets.c34
-rw-r--r--source/blender/editors/armature/CMakeLists.txt5
-rw-r--r--source/blender/editors/armature/armature_select.c4
-rw-r--r--source/blender/editors/armature/armature_skinning.c2
-rw-r--r--source/blender/editors/armature/armature_utils.c17
-rw-r--r--source/blender/editors/armature/pose_lib.c2
-rw-r--r--source/blender/editors/armature/pose_slide.c4
-rw-r--r--source/blender/editors/armature/pose_utils.c4
-rw-r--r--source/blender/editors/curve/CMakeLists.txt5
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt7
-rw-r--r--source/blender/editors/gizmo_library/CMakeLists.txt5
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c2
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt7
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c5
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c26
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_armature.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_ops_versioning.c (renamed from source/blender/editors/gpencil/gpencil_old.c)68
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c26
-rw-r--r--source/blender/editors/include/ED_datafiles.h4
-rw-r--r--source/blender/editors/include/ED_keyframing.h9
-rw-r--r--source/blender/editors/include/ED_numinput.h21
-rw-r--r--source/blender/editors/include/ED_transform.h4
-rw-r--r--source/blender/editors/include/ED_view3d.h7
-rw-r--r--source/blender/editors/include/UI_interface.h6
-rw-r--r--source/blender/editors/interface/CMakeLists.txt5
-rw-r--r--source/blender/editors/interface/interface_align.c2
-rw-r--r--source/blender/editors/interface/interface_region_popover.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c10
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/io/CMakeLists.txt5
-rw-r--r--source/blender/editors/lattice/CMakeLists.txt5
-rw-r--r--source/blender/editors/lattice/editlattice_tools.c10
-rw-r--r--source/blender/editors/mask/CMakeLists.txt5
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt5
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c2
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c4
-rw-r--r--source/blender/editors/mesh/editmesh_select.c18
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c6
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c6
-rw-r--r--source/blender/editors/metaball/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/CMakeLists.txt5
-rw-r--r--source/blender/editors/physics/particle_edit.c8
-rw-r--r--source/blender/editors/render/CMakeLists.txt5
-rw-r--r--source/blender/editors/render/render_preview.c76
-rw-r--r--source/blender/editors/scene/CMakeLists.txt5
-rw-r--r--source/blender/editors/screen/CMakeLists.txt5
-rw-r--r--source/blender/editors/screen/area.c6
-rw-r--r--source/blender/editors/screen/glutil.c7
-rw-r--r--source/blender/editors/screen/screen_edit.c6
-rw-r--r--source/blender/editors/screen/screen_ops.c23
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/sound/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_action/action_draw.c37
-rw-r--r--source/blender/editors/space_action/space_action.c1
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_clip/clip_editor.c2
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/filesel.c20
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_edit.c4
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_node/node_relationships.c2
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c2
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_statusbar/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_text/text_draw.c18
-rw-r--r--source/blender/editors/space_text/text_format_lua.c12
-rw-r--r--source/blender/editors/space_text/text_format_pov.c12
-rw-r--r--source/blender/editors/space_text/text_format_pov_ini.c6
-rw-r--r--source/blender/editors/space_text/text_format_py.c6
-rw-r--r--source/blender/editors/space_topbar/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_userpref/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_armature.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c21
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_forcefield.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_light.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c9
-rw-r--r--source/blender/editors/transform/CMakeLists.txt5
-rw-r--r--source/blender/editors/transform/transform.c90
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c32
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c195
-rw-r--r--source/blender/editors/transform/transform_ops.c55
-rw-r--r--source/blender/editors/transform/transform_snap_object.c28
-rw-r--r--source/blender/editors/undo/CMakeLists.txt5
-rw-r--r--source/blender/editors/util/CMakeLists.txt5
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt5
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c8
-rw-r--r--source/blender/freestyle/CMakeLists.txt5
-rw-r--r--source/blender/gpencil_modifiers/CMakeLists.txt5
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c2
-rw-r--r--source/blender/gpu/CMakeLists.txt5
-rw-r--r--source/blender/gpu/GPU_framebuffer.h2
-rw-r--r--source/blender/gpu/GPU_immediate.h6
-rw-r--r--source/blender/gpu/GPU_legacy_stubs.h2
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c2
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c2
-rw-r--r--source/blender/gpu/intern/gpu_uniformbuffer.c2
-rw-r--r--source/blender/ikplugin/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/cineon/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/dds/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/oiio/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt5
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesdna/DNA_material_types.h18
-rw-r--r--source/blender/makesdna/DNA_object_force_types.h11
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h10
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h151
-rw-r--r--source/blender/makesdna/intern/CMakeLists.txt14
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c23
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt5
-rw-r--r--source/blender/makesrna/intern/rna_access.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c4
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c8
-rw-r--r--source/blender/makesrna/intern/rna_material.c12
-rw-r--r--source/blender/makesrna/intern/rna_object.c11
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_pose_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_render.c4
-rw-r--r--source/blender/makesrna/intern/rna_scene.c22
-rw-r--r--source/blender/makesrna/intern/rna_space.c86
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/modifiers/CMakeLists.txt5
-rw-r--r--source/blender/nodes/CMakeLists.txt5
-rw-r--r--source/blender/nodes/NOD_static_types.h425
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c2
-rw-r--r--source/blender/physics/CMakeLists.txt5
-rw-r--r--source/blender/physics/intern/implicit_blender.c12
-rw-r--r--source/blender/python/bmesh/CMakeLists.txt5
-rw-r--r--source/blender/python/generic/CMakeLists.txt5
-rw-r--r--source/blender/python/gpu/CMakeLists.txt5
-rw-r--r--source/blender/python/intern/CMakeLists.txt5
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/mathutils/CMakeLists.txt5
-rw-r--r--source/blender/render/CMakeLists.txt5
-rw-r--r--source/blender/render/extern/include/RE_engine.h1
-rw-r--r--source/blender/render/intern/source/multires_bake.c13
-rw-r--r--source/blender/shader_fx/CMakeLists.txt5
-rw-r--r--source/blender/windowmanager/CMakeLists.txt5
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo.c12
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c15
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c21
-rw-r--r--source/blender/windowmanager/intern/wm.c9
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c25
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c54
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c36
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c324
-rw-r--r--source/blender/windowmanager/intern/wm_files.c65
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c18
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c52
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c33
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c14
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c99
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c206
-rw-r--r--source/blender/windowmanager/intern/wm_keymap_utils.c6
-rw-r--r--source/blender/windowmanager/intern/wm_menu_type.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c15
-rw-r--r--source/blender/windowmanager/intern/wm_operator_type.c26
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c155
-rw-r--r--source/blender/windowmanager/intern/wm_panel_type.c6
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c91
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c30
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c8
-rw-r--r--source/blender/windowmanager/intern/wm_window.c115
305 files changed, 3534 insertions, 2157 deletions
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index 813653b74c0..e6badc27110 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -72,8 +72,11 @@ set(SRC
intern/abc_util.h
)
+set(LIB
+)
+
if(WITH_ALEMBIC_HDF5)
add_definitions(-DWITH_ALEMBIC_HDF5)
endif()
-blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 3f2ccab203d..f37dbab3b57 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -145,18 +145,20 @@ static bool object_type_is_exportable(Scene *scene, Object *ob)
* This ignores selection and layer visibility,
* and assumes that the dupli-object itself (e.g. the group-instantiating empty) is exported.
*/
-static bool export_object(const ExportSettings * const settings, const Base * const ob_base,
+static bool export_object(const ExportSettings * const settings, const Base * const base,
bool is_duplicated)
{
if (!is_duplicated) {
+ View3D *v3d = NULL;
+
/* These two tests only make sense when the object isn't being instanced
* into the scene. When it is, its exportability is determined by
* its dupli-object and the DupliObject::no_draw property. */
- if (settings->selected_only && !object_selected(ob_base)) {
+ if (settings->selected_only && !BASE_SELECTED(v3d, base)) {
return false;
}
// FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead.
- if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLE) == 0) {
+ if (settings->visible_layers_only && !BASE_VISIBLE(v3d, base)) {
return false;
}
}
@@ -371,21 +373,21 @@ void AbcExporter::createTransformWritersHierarchy()
/* We do not export transforms for objects of these classes. */
break;
default:
- exploreTransform(base, ob->parent, NULL);
+ exploreTransform(base, ob, ob->parent, NULL);
}
}
}
}
-void AbcExporter::exploreTransform(Base *ob_base, Object *parent, Object *dupliObParent)
+void AbcExporter::exploreTransform(Base *base, Object *object, Object *parent, Object *dupliObParent)
{
/* If an object isn't exported itself, its duplilist shouldn't be
* exported either. */
- if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) {
+ if (!export_object(&m_settings, base, dupliObParent != NULL)) {
return;
}
- Object *ob = DEG_get_evaluated_object(m_settings.depsgraph, ob_base->object);
+ Object *ob = DEG_get_evaluated_object(m_settings.depsgraph, object);
if (object_type_is_exportable(m_settings.scene, ob)) {
createTransformWriter(ob, parent, dupliObParent);
}
@@ -393,9 +395,6 @@ void AbcExporter::exploreTransform(Base *ob_base, Object *parent, Object *dupliO
ListBase *lb = object_duplilist(m_settings.depsgraph, m_settings.scene, ob);
if (lb) {
- Base fake_base = *ob_base; // copy flags (like selection state) from the real object.
- fake_base.next = fake_base.prev = NULL;
-
DupliObject *link = static_cast<DupliObject *>(lb->first);
Object *dupli_ob = NULL;
Object *dupli_parent = NULL;
@@ -410,8 +409,7 @@ void AbcExporter::exploreTransform(Base *ob_base, Object *parent, Object *dupliO
dupli_ob = link->ob;
dupli_parent = (dupli_ob->parent) ? dupli_ob->parent : ob;
- fake_base.object = dupli_ob;
- exploreTransform(&fake_base, dupli_parent, ob);
+ exploreTransform(base, dupli_ob, dupli_parent, ob);
}
}
@@ -491,27 +489,24 @@ AbcTransformWriter *AbcExporter::createTransformWriter(Object *ob, Object *paren
void AbcExporter::createShapeWriters()
{
for (Base *base = static_cast<Base *>(m_settings.view_layer->object_bases.first); base; base = base->next) {
- exploreObject(base, NULL);
+ exploreObject(base, base->object, NULL);
}
}
-void AbcExporter::exploreObject(Base *ob_base, Object *dupliObParent)
+void AbcExporter::exploreObject(Base *base, Object *object, Object *dupliObParent)
{
/* If an object isn't exported itself, its duplilist shouldn't be
* exported either. */
- if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) {
+ if (!export_object(&m_settings, base, dupliObParent != NULL)) {
return;
}
- Object *ob = DEG_get_evaluated_object(m_settings.depsgraph, ob_base->object);
+ Object *ob = DEG_get_evaluated_object(m_settings.depsgraph, object);
createShapeWriter(ob, dupliObParent);
ListBase *lb = object_duplilist(m_settings.depsgraph, m_settings.scene, ob);
if (lb) {
- Base fake_base = *ob_base; // copy flags (like selection state) from the real object.
- fake_base.next = fake_base.prev = NULL;
-
DupliObject *link = static_cast<DupliObject *>(lb->first);
for (; link; link = link->next) {
@@ -520,8 +515,7 @@ void AbcExporter::exploreObject(Base *ob_base, Object *dupliObParent)
continue;
}
if (link->type == OB_DUPLICOLLECTION) {
- fake_base.object = link->ob;
- exploreObject(&fake_base, ob);
+ exploreObject(base, link->ob, ob);
}
}
diff --git a/source/blender/alembic/intern/abc_exporter.h b/source/blender/alembic/intern/abc_exporter.h
index d9628317036..5e00ccdff07 100644
--- a/source/blender/alembic/intern/abc_exporter.h
+++ b/source/blender/alembic/intern/abc_exporter.h
@@ -116,8 +116,8 @@ private:
void createTransformWritersHierarchy();
AbcTransformWriter *createTransformWriter(Object *ob, Object *parent, Object *dupliObParent);
- void exploreTransform(Base *ob_base, Object *parent, Object *dupliObParent);
- void exploreObject(Base *ob_base, Object *dupliObParent);
+ void exploreTransform(Base *base, Object *object, Object *parent, Object *dupliObParent);
+ void exploreObject(Base *base, Object *object, Object *dupliObParent);
void createShapeWriters();
void createShapeWriter(Object *ob, Object *dupliObParent);
void createParticleSystemsWriters(Object *ob, AbcTransformWriter *xform);
diff --git a/source/blender/alembic/intern/abc_mball.cc b/source/blender/alembic/intern/abc_mball.cc
index d31c251f64d..bb6ab57643f 100644
--- a/source/blender/alembic/intern/abc_mball.cc
+++ b/source/blender/alembic/intern/abc_mball.cc
@@ -44,49 +44,33 @@ AbcMBallWriter::AbcMBallWriter(
AbcTransformWriter *parent,
uint32_t time_sampling,
ExportSettings &settings)
- : AbcObjectWriter(ob, time_sampling, settings, parent)
+ : AbcGenericMeshWriter(ob, parent, time_sampling, settings)
, m_bmain(bmain)
{
m_is_animated = isAnimated();
-
- m_mesh_ob = BKE_object_copy(bmain, ob);
- m_mesh_ob->runtime.curve_cache = (CurveCache *)MEM_callocN(
- sizeof(CurveCache),
- "CurveCache for AbcMBallWriter");
- /* TODO(Sybren): reimplement metaball writing as subclass of AbcGenericMeshWriter. */
- m_mesh_writer = new AbcMeshWriter(m_mesh_ob, parent, time_sampling, settings);
- m_mesh_writer->setIsAnimated(m_is_animated);
}
AbcMBallWriter::~AbcMBallWriter()
-{
- delete m_mesh_writer;
- BKE_object_free(m_mesh_ob);
-}
+{}
bool AbcMBallWriter::isAnimated() const
{
- MetaBall *mb = static_cast<MetaBall *>(m_object->data);
- if (mb->adt != NULL) return true;
-
- /* Any movement of any object in the parent chain
- * could cause the mball to deform. */
- for (Object *ob = m_object; ob != NULL; ob = ob->parent) {
- if (ob->adt != NULL) return true;
- }
- return false;
+ return true;
}
-void AbcMBallWriter::do_write()
+Mesh *AbcMBallWriter::getEvaluatedMesh(Scene * /*scene_eval*/, Object *ob_eval, bool &r_needsfree)
{
- /* We have already stored a sample for this object. */
- if (!m_first_frame && !m_is_animated)
- return;
+ if (ob_eval->runtime.mesh_eval != NULL) {
+ /* Mesh_eval only exists when generative modifiers are in use. */
+ r_needsfree = false;
+ return ob_eval->runtime.mesh_eval;
+ }
+ r_needsfree = true;
+ /* The approach below is copied from BKE_mesh_new_from_object() */
Mesh *tmpmesh = BKE_mesh_add(m_bmain, ((ID *)m_object->data)->name + 2);
BLI_assert(tmpmesh != NULL);
- m_mesh_ob->data = tmpmesh;
/* BKE_mesh_add gives us a user count we don't need */
id_us_min(&tmpmesh->id);
@@ -100,12 +84,14 @@ void AbcMBallWriter::do_write()
BKE_mesh_from_metaball(&disp, tmpmesh);
BKE_displist_free(&disp);
- BKE_mesh_texspace_copy_from_object(tmpmesh, m_mesh_ob);
+ BKE_mesh_texspace_copy_from_object(tmpmesh, m_object);
- m_mesh_writer->write();
+ return tmpmesh;
+}
- BKE_id_free(m_bmain, tmpmesh);
- m_mesh_ob->data = NULL;
+void AbcMBallWriter::freeEvaluatedMesh(struct Mesh *mesh)
+{
+ BKE_id_free(m_bmain, mesh);
}
bool AbcMBallWriter::isBasisBall(Scene *scene, Object *ob)
diff --git a/source/blender/alembic/intern/abc_mball.h b/source/blender/alembic/intern/abc_mball.h
index 629a584e89e..d2bdb8f297a 100644
--- a/source/blender/alembic/intern/abc_mball.h
+++ b/source/blender/alembic/intern/abc_mball.h
@@ -22,24 +22,21 @@
#define __ABC_MBALL_H__
#include "abc_object.h"
+#include "abc_mesh.h"
-class AbcMeshWriter;
struct EvaluationContext;
struct Main;
struct MetaBall;
struct Object;
/* AbcMBallWriter converts the metaballs to meshes at every frame,
- * and defers to a wrapped AbcMeshWriter to perform the writing
+ * and defers to AbcGenericMeshWriter to perform the writing
* to the Alembic file. Only the basis balls are exported, as this
* results in the entire shape as one mesh. */
-class AbcMBallWriter : public AbcObjectWriter {
- AbcMeshWriter *m_mesh_writer;
- Object *m_mesh_ob;
- bool m_is_animated;
+class AbcMBallWriter : public AbcGenericMeshWriter {
Main *m_bmain;
public:
- AbcMBallWriter(
+ explicit AbcMBallWriter(
Main *bmain,
Object *ob,
AbcTransformWriter *parent,
@@ -50,9 +47,12 @@ public:
static bool isBasisBall(Scene *scene, Object *ob);
+protected:
+ Mesh *getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &r_needsfree) override;
+ void freeEvaluatedMesh(struct Mesh *mesh) override;
+
private:
- virtual void do_write();
- bool isAnimated() const;
+ bool isAnimated() const override;
};
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 2472fe1945f..97cd6ffc0e3 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -387,14 +387,19 @@ void AbcGenericMeshWriter::do_write()
writeMesh(mesh);
}
- if (needsfree) BKE_id_free(NULL, mesh);
+ if (needsfree) freeEvaluatedMesh(mesh);
}
catch (...) {
- if (needsfree) BKE_id_free(NULL, mesh);
+ if (needsfree) freeEvaluatedMesh(mesh);
throw;
}
}
+void AbcGenericMeshWriter::freeEvaluatedMesh(struct Mesh *mesh)
+{
+ BKE_id_free(NULL, mesh);
+}
+
void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh)
{
std::vector<Imath::V3f> points, normals;
diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h
index 938c292b686..35ad0f8b297 100644
--- a/source/blender/alembic/intern/abc_mesh.h
+++ b/source/blender/alembic/intern/abc_mesh.h
@@ -61,6 +61,7 @@ protected:
virtual void do_write();
virtual bool isAnimated() const;
virtual Mesh *getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &r_needsfree) = 0;
+ virtual void freeEvaluatedMesh(struct Mesh *mesh);
Mesh *getFinalMesh(bool &r_needsfree);
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 20a43a821ed..d8bd92121aa 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -290,12 +290,8 @@ Alembic::AbcGeom::IXform AbcObjectReader::xform()
return IXform(abc_parent, Alembic::AbcGeom::kWrapExisting);
}
- /* Should not happen. */
- std::cerr << "AbcObjectReader::xform(): "
- << "unable to find IXform for Alembic object '"
- << m_iobject.getFullName() << "'\n";
- BLI_assert(false);
-
+ /* This can happen in certain cases. For example, MeshLab exports
+ * point clouds without parent XForm. */
return IXform();
}
@@ -304,6 +300,8 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], const float time,
{
IXform ixform = xform();
if (!ixform) {
+ unit_m4(r_mat);
+ is_constant = true;
return;
}
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 8af7fb8b6f6..a4a7256b783 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -86,11 +86,6 @@ std::string get_object_dag_path_name(const Object * const ob, Object *dupli_pare
return name;
}
-bool object_selected(const Base * const ob_base)
-{
- return ob_base->flag & SELECT;
-}
-
Imath::M44d convert_matrix(float mat[4][4])
{
Imath::M44d m;
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index a78a787fa14..d21fe7a78ce 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -52,8 +52,6 @@ std::string get_id_name(const ID * const id);
std::string get_id_name(const Object * const ob);
std::string get_object_dag_path_name(const Object * const ob, Object *dupli_parent);
-bool object_selected(const Base * const ob_base);
-
Imath::M44d convert_matrix(float mat[4][4]);
typedef enum {
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index bf10a9498b5..541db514bb0 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -292,6 +292,8 @@ static void export_endjob(void *customdata)
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
+ DEG_graph_free(data->settings.depsgraph);
+
if (data->was_canceled && BLI_exists(data->filename)) {
BLI_delete(data->filename, false, false);
}
diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt
index d5d062bb826..b03c1a433fb 100644
--- a/source/blender/avi/CMakeLists.txt
+++ b/source/blender/avi/CMakeLists.txt
@@ -46,4 +46,7 @@ set(SRC
intern/avi_rgb32.h
)
-blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index e8a7750c445..25497d1b1c2 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -51,6 +51,9 @@ set(SRC
intern/blf_internal_types.h
)
+set(LIB
+)
+
if(WIN32)
list(APPEND SRC
intern/blf_font_win32_compat.c
@@ -70,4 +73,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 9f81c41bd2d..06904ee36b6 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -74,11 +74,12 @@ static SpinLock ft_lib_mutex;
/* -------------------------------------------------------------------- */
/** \name Glyph Batching
* \{ */
+
/**
* Drawcalls are precious! make them count!
* Since most of the Text elems are not covered by other UI elements, we can
* group some strings together and render them in one drawcall. This behavior
- * is on demand only, between BLF_batch_start() and BLF_batch_end().
+ * is on demand only, between #BLF_batch_draw_begin() and #BLF_batch_draw_end().
*/
static void blf_batch_draw_init(void)
{
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 09d8cbf933c..d9a1064d740 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -184,7 +184,7 @@ void BKE_pchan_bbone_spline_params_get(
struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *r_param);
void BKE_pchan_bbone_spline_setup(
- struct bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV]);
+ struct bPoseChannel *pchan, const bool rest, const bool for_deform, Mat4 *result_array);
void BKE_pchan_bbone_handles_compute(
const BBoneSplineParameters *param,
@@ -192,13 +192,15 @@ void BKE_pchan_bbone_handles_compute(
float h2[3], float *r_roll2,
bool ease, bool offsets);
int BKE_pchan_bbone_spline_compute(
- struct BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]);
+ struct BBoneSplineParameters *param, const bool for_deform, Mat4 *result_array);
void BKE_pchan_bbone_segments_cache_compute(
struct bPoseChannel *pchan);
void BKE_pchan_bbone_segments_cache_copy(
struct bPoseChannel *pchan, struct bPoseChannel *pchan_from);
+void BKE_pchan_bbone_deform_segment_index(const struct bPoseChannel *pchan, float pos, int *r_index, float *r_blend_next);
+
/* like EBONE_VISIBLE */
#define PBONE_VISIBLE(arm, bone) ( \
CHECK_TYPE_INLINE(arm, bArmature *), \
@@ -243,6 +245,8 @@ void BKE_splineik_execute_tree(
struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, struct bPoseChannel *pchan_root, float ctime);
+void BKE_pose_pchan_index_rebuild(struct bPose *pose);
+
void BKE_pose_eval_init(
struct Depsgraph *depsgraph,
struct Scene *scene,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 4c88410134c..7d9fa2d428f 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -20,21 +20,25 @@
* \ingroup bke
*/
-/* these lines are grep'd, watch out for our not-so-awesome regex
- * and keep comment above the defines.
- * Use STRINGIFY() rather than defining with quotes */
+/**
+ * The lines below use regex from scripts to extract their values,
+ * Keep this in mind when modifying this file and keep this comment above the defines.
+ *
+ * \note Use #STRINGIFY() rather than defining with quotes.
+ */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 54
-/* Several breakages with 280, e.g. collections vs layers */
+#define BLENDER_SUBVERSION 57
+/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
-/* used by packaging tools */
-/* can be left blank, otherwise a,b,c... etc with no quotes */
+/** Used by packaging tools. */
+/** Can be left blank, otherwise a,b,c... etc with no quotes. */
#define BLENDER_VERSION_CHAR
-/* alpha/beta/rc/release, docs use this */
+/** alpha/beta/rc/release, docs use this. */
#define BLENDER_VERSION_CYCLE beta
-extern char versionstr[]; /* from blender.c */
+/** Defined in from blender.c */
+extern char versionstr[];
#endif /* __BKE_BLENDER_VERSION_H__ */
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index e94ba27a8ea..a22d30a01fa 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -86,7 +86,6 @@ void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe
/* materials */
void BKE_gpencil_material_index_remove(struct bGPdata *gpd, int index);
void BKE_gpencil_material_remap(struct bGPdata *gpd, const unsigned int *remap, unsigned int remap_len);
-int BKE_gpencil_get_material_index(struct Object *ob, struct Material *ma);
/* statistics functions */
void BKE_gpencil_stats_update(struct bGPdata *gpd);
@@ -131,23 +130,29 @@ struct bGPDlayer *BKE_gpencil_layer_getactive(struct bGPdata *gpd);
void BKE_gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active);
void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
-struct Material *BKE_gpencil_get_material_from_brush(struct Brush *brush);
-void BKE_gpencil_brush_set_material(struct Brush *brush, struct Material *material);
+/* Brush */
+struct Material *BKE_gpencil_brush_material_get(struct Brush *brush);
+void BKE_gpencil_brush_material_set(struct Brush *brush, struct Material *material);
-struct Material *BKE_gpencil_handle_brush_material(struct Main *bmain, struct Object *ob, struct Brush *brush);
-int BKE_gpencil_handle_material(struct Main *bmain, struct Object *ob, struct Material *material);
+/* Object */
+struct Material *BKE_gpencil_object_material_ensure_active(struct Main *bmain, struct Object *ob);
+struct Material *BKE_gpencil_object_material_ensure_from_brush(struct Main *bmain, struct Object *ob, struct Brush *brush);
+int BKE_gpencil_object_material_ensure(struct Main *bmain, struct Object *ob, struct Material *material);
-struct Material *BKE_gpencil_handle_new_material(struct Main *bmain, struct Object *ob, const char *name, int *r_index);
+struct Material *BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index);
-struct Material *BKE_gpencil_get_material_for_brush(struct Object *ob, struct Brush *brush);
-int BKE_gpencil_get_material_index_for_brush(struct Object *ob, struct Brush *brush);
+int BKE_gpencil_object_material_get_index(struct Object *ob, struct Material *ma);
-struct Material *BKE_gpencil_current_input_toolsettings_material(struct Main *bmain, struct Object *ob, struct ToolSettings *ts);
-struct Material *BKE_gpencil_current_input_brush_material(struct Main *bmain, struct Object *ob, struct Brush *brush);
-struct Material *BKE_gpencil_current_input_material(struct Main *bmain, struct Object *ob);
+struct Material *BKE_gpencil_object_material_get_from_brush(struct Object *ob, struct Brush *brush);
+int BKE_gpencil_object_material_get_index_from_brush(struct Object *ob, struct Brush *brush);
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_toolsettings(
+ struct Main *bmain, struct Object *ob, struct ToolSettings *ts);
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_brush(
+ struct Main *bmain, struct Object *ob, struct Brush *brush);
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_material(
+ struct Main *bmain, struct Object *ob);
-struct Material *BKE_gpencil_material_ensure(struct Main *bmain, struct Object *ob);
/* object boundbox */
bool BKE_gpencil_data_minmax(
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 9f522c11733..10f57f88e76 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -409,7 +409,7 @@ const char *modifier_path_relbase_from_global(struct Object *ob);
* If the modifier data is already original, return it as-is. */
struct ModifierData *modifier_get_original(struct ModifierData *md);
struct ModifierData *modifier_get_evaluated(
- struct Depsgraph* depsgraph,
+ struct Depsgraph *depsgraph,
struct Object *object,
struct ModifierData *md);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 4e4883222cc..2ab2bd3fbe6 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -128,6 +128,7 @@ float BKE_scene_frame_get(const struct Scene *scene);
float BKE_scene_frame_get_from_ctime(const struct Scene *scene, const float frame);
void BKE_scene_frame_set(struct Scene *scene, double cfra);
+struct TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(struct Scene *scene, int slot_index);
struct TransformOrientationSlot *BKE_scene_orientation_slot_get(struct Scene *scene, int flag);
void BKE_scene_orientation_slot_set_index(struct TransformOrientationSlot *orient_slot, int orientation);
int BKE_scene_orientation_slot_get_index(const struct TransformOrientationSlot *orient_slot);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 7162d75875d..50aa1c3825e 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -356,6 +356,9 @@ set(SRC
intern/subdiv_inline.h
)
+set(LIB
+)
+
if(WITH_BINRELOC)
list(APPEND INC_SYS
${BINRELOC_INCLUDE_DIRS}
@@ -567,4 +570,4 @@ endif()
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
#endif()
-blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9ba3a23df05..da4fea26e64 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -825,6 +825,8 @@ void BKE_pose_channels_free_ex(bPose *pose, bool do_id_user)
}
BKE_pose_channels_hash_free(pose);
+
+ MEM_SAFE_FREE(pose->chan_array);
}
void BKE_pose_channels_free(bPose *pose)
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 6e0767836d7..1b9e6dcdbc4 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -36,6 +36,7 @@
#include "BLI_ghash.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
+#include "BLI_alloca.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -389,45 +390,60 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
/* ************* B-Bone support ******************* */
-/* data has MAX_BBONE_SUBDIV+1 interpolated points, will become desired amount with equal distances */
-static void equalize_bbone_bezier(float *data, int desired)
+/* Compute a set of bezier parameter values that produce approximately equally spaced points. */
+static void equalize_cubic_bezier(const float control[4][3], int temp_segments, int final_segments, float *r_t_points)
{
- float *fp, totdist, ddist, dist, fac1, fac2;
- float pdist[MAX_BBONE_SUBDIV + 1];
- float temp[MAX_BBONE_SUBDIV + 1][4];
- int a, nr;
+ float (*coords)[3] = BLI_array_alloca(coords, temp_segments + 1);
+ float *pdist = BLI_array_alloca(pdist, temp_segments + 1);
+ /* Compute the first pass of bezier point coordinates. */
+ for (int i = 0; i < 3; i++) {
+ BKE_curve_forward_diff_bezier(
+ control[0][i], control[1][i], control[2][i], control[3][i],
+ &coords[0][i], temp_segments, sizeof(*coords)
+ );
+ }
+
+ /* Calculate the length of the polyline at each point. */
pdist[0] = 0.0f;
- for (a = 0, fp = data; a < MAX_BBONE_SUBDIV; a++, fp += 4) {
- copy_qt_qt(temp[a], fp);
- pdist[a + 1] = pdist[a] + len_v3v3(fp, fp + 4);
- }
- /* do last point */
- copy_qt_qt(temp[a], fp);
- totdist = pdist[a];
-
- /* go over distances and calculate new points */
- ddist = totdist / ((float)desired);
- nr = 1;
- for (a = 1, fp = data + 4; a < desired; a++, fp += 4) {
- dist = ((float)a) * ddist;
-
- /* we're looking for location (distance) 'dist' in the array */
- while ((nr < MAX_BBONE_SUBDIV) && (dist >= pdist[nr]))
+
+ for (int i = 0; i < temp_segments; i++)
+ pdist[i + 1] = pdist[i] + len_v3v3(coords[i], coords[i + 1]);
+
+ /* Go over distances and calculate new parameter values. */
+ float dist_step = pdist[temp_segments] / final_segments;
+
+ r_t_points[0] = 0.0f;
+
+ for (int i = 1, nr = 1; i <= final_segments; i++) {
+ float dist = i * dist_step;
+
+ /* We're looking for location (distance) 'dist' in the array. */
+ while ((nr < temp_segments) && (dist >= pdist[nr]))
nr++;
- fac1 = pdist[nr] - pdist[nr - 1];
- fac2 = pdist[nr] - dist;
- fac1 = fac2 / fac1;
- fac2 = 1.0f - fac1;
+ float fac = (pdist[nr] - dist) / (pdist[nr] - pdist[nr - 1]);
- fp[0] = fac1 * temp[nr - 1][0] + fac2 * temp[nr][0];
- fp[1] = fac1 * temp[nr - 1][1] + fac2 * temp[nr][1];
- fp[2] = fac1 * temp[nr - 1][2] + fac2 * temp[nr][2];
- fp[3] = fac1 * temp[nr - 1][3] + fac2 * temp[nr][3];
+ r_t_points[i] = (nr - fac) / temp_segments;
}
- /* set last point, needed for orientation calculus */
- copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]);
+
+ r_t_points[final_segments] = 1.0f;
+}
+
+/* Evaluate bezier position and tangent at a specific parameter value using the De Casteljau algorithm. */
+static void evaluate_cubic_bezier(const float control[4][3], float t, float r_pos[3], float r_tangent[3])
+{
+ float layer1[3][3];
+ interp_v3_v3v3(layer1[0], control[0], control[1], t);
+ interp_v3_v3v3(layer1[1], control[1], control[2], t);
+ interp_v3_v3v3(layer1[2], control[2], control[3], t);
+
+ float layer2[2][3];
+ interp_v3_v3v3(layer2[0], layer1[0], layer1[1], t);
+ interp_v3_v3v3(layer2[1], layer1[1], layer1[2], t);
+
+ sub_v3_v3v3(r_tangent, layer2[1], layer2[0]);
+ madd_v3_v3v3fl(r_pos, layer2[0], r_tangent, t);
}
/* Get "next" and "prev" bones - these are used for handle calculations. */
@@ -640,13 +656,13 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan, const bool re
/* Fills the array with the desired amount of bone->segments elements.
* This calculation is done within unit bone space. */
-void BKE_pchan_bbone_spline_setup(bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV])
+void BKE_pchan_bbone_spline_setup(bPoseChannel *pchan, const bool rest, const bool for_deform, Mat4 *result_array)
{
BBoneSplineParameters param;
BKE_pchan_bbone_spline_params_get(pchan, rest, &param);
- pchan->bone->segments = BKE_pchan_bbone_spline_compute(&param, result_array);
+ pchan->bone->segments = BKE_pchan_bbone_spline_compute(&param, for_deform, result_array);
}
/* Computes the bezier handle vectors and rolls coming from custom handles. */
@@ -654,6 +670,7 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h
{
float mat3[3][3];
float length = param->length;
+ float epsilon = 1e-5 * length;
if (param->do_scale) {
length *= param->scale[1];
@@ -669,7 +686,9 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h
h1[1] -= length;
}
- normalize_v3(h1);
+ if (normalize_v3(h1) < epsilon)
+ copy_v3_fl3(h1, 0.0f, -1.0f, 0.0f);
+
negate_v3(h1);
if (!param->prev_bbone) {
@@ -693,7 +712,8 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h
h2[1] -= length;
}
- normalize_v3(h2);
+ if (normalize_v3(h2) < epsilon)
+ copy_v3_fl3(h2, 0.0f, 1.0f, 0.0f);
/* Find the next roll to interpolate as well. */
copy_m3_m4(mat3, param->next_mat);
@@ -749,20 +769,55 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h
}
}
+static void make_bbone_spline_matrix(
+ BBoneSplineParameters *param, float scalemats[2][4][4],
+ float pos[3], float axis[3], float roll, float scalefac,
+ float result[4][4]
+) {
+ float mat3[3][3];
+
+ vec_roll_to_mat3(axis, roll, mat3);
+
+ copy_m4_m3(result, mat3);
+ copy_v3_v3(result[3], pos);
+
+ if (param->do_scale) {
+ /* Correct for scaling when this matrix is used in scaled space. */
+ mul_m4_series(result, scalemats[0], result, scalemats[1]);
+ }
+
+ /* BBone scale... */
+ mul_v3_fl(result[0], scalefac);
+ mul_v3_fl(result[2], scalefac);
+}
+
+/* Fade from first to second derivative when the handle is very short. */
+static void ease_handle_axis(const float deriv1[3], const float deriv2[3], float r_axis[3])
+{
+ const float gap = 0.1f;
+
+ copy_v3_v3(r_axis, deriv1);
+
+ float len1 = len_squared_v3(deriv1), len2 = len_squared_v3(deriv2);
+ float ratio = len1 / len2;
+
+ if (ratio < gap * gap) {
+ madd_v3_v3fl(r_axis, deriv2, gap - sqrtf(ratio));
+ }
+}
+
/* Fills the array with the desired amount of bone->segments elements.
* This calculation is done within unit bone space. */
-int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV])
+int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, const bool for_deform, Mat4 *result_array)
{
- float scalemat[4][4], iscalemat[4][4];
- float mat3[3][3];
- float h1[3], roll1, h2[3], roll2;
- float data[MAX_BBONE_SUBDIV + 1][4], *fp;
+ float scalemats[2][4][4];
+ float bezt_controls[4][3];
+ float h1[3], roll1, h2[3], roll2, prev[3], cur[3], axis[3];
float length = param->length;
- int a;
if (param->do_scale) {
- size_to_mat4(scalemat, param->scale);
- invert_m4_m4(iscalemat, scalemat);
+ size_to_mat4(scalemats[1], param->scale);
+ invert_m4_m4(scalemats[0], scalemats[1]);
length *= param->scale[1];
}
@@ -772,48 +827,60 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, Mat4 result_arr
/* Make curve. */
CLAMP_MAX(param->segments, MAX_BBONE_SUBDIV);
- BKE_curve_forward_diff_bezier(0.0f, h1[0], h2[0], 0.0f, data[0], MAX_BBONE_SUBDIV, 4 * sizeof(float));
- BKE_curve_forward_diff_bezier(0.0f, h1[1], length + h2[1], length, data[0] + 1, MAX_BBONE_SUBDIV, 4 * sizeof(float));
- BKE_curve_forward_diff_bezier(0.0f, h1[2], h2[2], 0.0f, data[0] + 2, MAX_BBONE_SUBDIV, 4 * sizeof(float));
- BKE_curve_forward_diff_bezier(roll1, roll1 + 0.390464f * (roll2 - roll1), roll2 - 0.390464f * (roll2 - roll1), roll2, data[0] + 3, MAX_BBONE_SUBDIV, 4 * sizeof(float));
+ copy_v3_fl3(bezt_controls[3], 0.0f, length, 0.0f);
+ add_v3_v3v3(bezt_controls[2], bezt_controls[3], h2);
+ copy_v3_v3(bezt_controls[1], h1);
+ zero_v3(bezt_controls[0]);
- equalize_bbone_bezier(data[0], param->segments); /* note: does stride 4! */
+ float bezt_points[MAX_BBONE_SUBDIV + 1];
- /* Make transformation matrices for the segments for drawing. */
- for (a = 0, fp = data[0]; a < param->segments; a++, fp += 4) {
- sub_v3_v3v3(h1, fp + 4, fp);
- vec_roll_to_mat3(h1, fp[3], mat3); /* fp[3] is roll */
+ equalize_cubic_bezier(bezt_controls, MAX_BBONE_SUBDIV, param->segments, bezt_points);
- copy_m4_m3(result_array[a].mat, mat3);
- copy_v3_v3(result_array[a].mat[3], fp);
+ /* Deformation uses N+1 matrices computed at points between the segments. */
+ if (for_deform) {
+ /* Bezier derivatives. */
+ float bezt_deriv1[3][3], bezt_deriv2[2][3];
- if (param->do_scale) {
- /* Correct for scaling when this matrix is used in scaled space. */
- mul_m4_series(result_array[a].mat, iscalemat, result_array[a].mat, scalemat);
+ for (int i = 0; i < 3; i++) {
+ sub_v3_v3v3(bezt_deriv1[i], bezt_controls[i + 1], bezt_controls[i]);
+ }
+ for (int i = 0; i < 2; i++) {
+ sub_v3_v3v3(bezt_deriv2[i], bezt_deriv1[i + 1], bezt_deriv1[i]);
}
- /* BBone scale... */
- {
- const int num_segments = param->segments;
+ /* End points require special handling to fix zero length handles. */
+ ease_handle_axis(bezt_deriv1[0], bezt_deriv2[0], axis);
+ make_bbone_spline_matrix(param, scalemats, bezt_controls[0], axis, roll1, param->scaleIn, result_array[0].mat);
- const float scaleIn = param->scaleIn;
- const float scaleFactorIn = 1.0f + (scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
+ for (int a = 1; a < param->segments; a++) {
+ evaluate_cubic_bezier(bezt_controls, bezt_points[a], cur, axis);
- const float scaleOut = param->scaleOut;
- const float scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments);
+ float fac = ((float)a) / param->segments;
+ float roll = interpf(roll2, roll1, fac);
+ float scalefac = interpf(param->scaleOut, param->scaleIn, fac);
- const float scalefac = scaleFactorIn * scaleFactorOut;
- float bscalemat[4][4], bscale[3];
+ make_bbone_spline_matrix(param, scalemats, cur, axis, roll, scalefac, result_array[a].mat);
+ }
+
+ negate_v3(bezt_deriv2[1]);
+ ease_handle_axis(bezt_deriv1[2], bezt_deriv2[1], axis);
+ make_bbone_spline_matrix(param, scalemats, bezt_controls[3], axis, roll2, param->scaleOut, result_array[param->segments].mat);
+ }
+ /* Other code (e.g. display) uses matrices for the segments themselves. */
+ else {
+ zero_v3(prev);
+
+ for (int a = 0; a < param->segments; a++) {
+ evaluate_cubic_bezier(bezt_controls, bezt_points[a + 1], cur, axis);
- bscale[0] = scalefac;
- bscale[1] = 1.0f;
- bscale[2] = scalefac;
+ sub_v3_v3v3(axis, cur, prev);
- size_to_mat4(bscalemat, bscale);
+ float fac = (a + 0.5f) / param->segments;
+ float roll = interpf(roll2, roll1, fac);
+ float scalefac = interpf(param->scaleOut, param->scaleIn, fac);
- /* Note: don't multiply by inverse scale mat here, as it causes problems with scaling shearing and breaking segment chains */
- /*mul_m4_series(result_array[a].mat, ibscalemat, result_array[a].mat, bscalemat);*/
- mul_m4_series(result_array[a].mat, result_array[a].mat, bscalemat);
+ make_bbone_spline_matrix(param, scalemats, prev, axis, roll, scalefac, result_array[a].mat);
+ copy_v3_v3(prev, cur);
}
}
@@ -843,10 +910,10 @@ static void allocate_bbone_cache(bPoseChannel *pchan, int segments)
}
runtime->bbone_segments = segments;
- runtime->bbone_rest_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannel_Runtime::bbone_rest_mats");
- runtime->bbone_pose_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannel_Runtime::bbone_pose_mats");
- runtime->bbone_deform_mats = MEM_malloc_arrayN(sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_deform_mats");
- runtime->bbone_dual_quats = MEM_malloc_arrayN(sizeof(DualQuat), (uint)segments, "bPoseChannel_Runtime::bbone_dual_quats");
+ runtime->bbone_rest_mats = MEM_malloc_arrayN(sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_rest_mats");
+ runtime->bbone_pose_mats = MEM_malloc_arrayN(sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_pose_mats");
+ runtime->bbone_deform_mats = MEM_malloc_arrayN(sizeof(Mat4), 2 + (uint)segments, "bPoseChannel_Runtime::bbone_deform_mats");
+ runtime->bbone_dual_quats = MEM_malloc_arrayN(sizeof(DualQuat), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_dual_quats");
}
}
@@ -869,8 +936,8 @@ void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
DualQuat *b_bone_dual_quats = runtime->bbone_dual_quats;
int a;
- BKE_pchan_bbone_spline_setup(pchan, false, b_bone);
- BKE_pchan_bbone_spline_setup(pchan, true, b_bone_rest);
+ BKE_pchan_bbone_spline_setup(pchan, false, true, b_bone);
+ BKE_pchan_bbone_spline_setup(pchan, true, true, b_bone_rest);
/* Compute deform matrices. */
/* first matrix is the inverse arm_mat, to bring points in local bone space
@@ -883,7 +950,7 @@ void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
* - transform with b_bone matrix
* - transform back into global space */
- for (a = 0; a < bone->segments; a++) {
+ for (a = 0; a <= bone->segments; a++) {
float tmat[4][4];
invert_m4_m4(tmat, b_bone_rest[a].mat);
@@ -906,44 +973,83 @@ void BKE_pchan_bbone_segments_cache_copy(bPoseChannel *pchan, bPoseChannel *pcha
else {
allocate_bbone_cache(pchan, segments);
- memcpy(runtime->bbone_rest_mats, runtime_from->bbone_rest_mats, sizeof(Mat4) * segments);
- memcpy(runtime->bbone_pose_mats, runtime_from->bbone_pose_mats, sizeof(Mat4) * segments);
- memcpy(runtime->bbone_deform_mats, runtime_from->bbone_deform_mats, sizeof(Mat4) * (1 + segments));
- memcpy(runtime->bbone_dual_quats, runtime_from->bbone_dual_quats, sizeof(DualQuat) * segments);
+ memcpy(runtime->bbone_rest_mats, runtime_from->bbone_rest_mats, sizeof(Mat4) * (1 + segments));
+ memcpy(runtime->bbone_pose_mats, runtime_from->bbone_pose_mats, sizeof(Mat4) * (1 + segments));
+ memcpy(runtime->bbone_deform_mats, runtime_from->bbone_deform_mats, sizeof(Mat4) * (2 + segments));
+ memcpy(runtime->bbone_dual_quats, runtime_from->bbone_dual_quats, sizeof(DualQuat) * (1 + segments));
}
}
-static void b_bone_deform(const bPoseChannel *pchan, float co[3], DualQuat *dq, float defmat[3][3])
+/** Calculate index and blend factor for the two B-Bone segment nodes affecting the point at 0 <= pos <= 1. */
+void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan, float pos, int *r_index, float *r_blend_next)
{
- Bone *bone = pchan->bone;
- const Mat4 *b_bone = pchan->runtime.bbone_deform_mats;
- const float (*mat)[4] = b_bone[0].mat;
- float segment, y;
- int a;
+ int segments = pchan->bone->segments;
- /* need to transform co back to bonespace, only need y */
- y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
+ CLAMP(pos, 0.0f, 1.0f);
+
+ /* Calculate the indices of the 2 affecting b_bone segments.
+ * Integer part is the first segment's index.
+ * Integer part plus 1 is the second segment's index.
+ * Fractional part is the blend factor. */
+ float pre_blend = pos * (float)segments;
+
+ int index = (int)floorf(pre_blend);
+ float blend = pre_blend - index;
+
+ CLAMP(index, 0, segments);
+ CLAMP(blend, 0.0f, 1.0f);
- /* now calculate which of the b_bones are deforming this */
- segment = bone->length / ((float)bone->segments);
- a = (int)(y / segment);
+ *r_index = index;
+ *r_blend_next = blend;
+}
+
+/* Add the effect of one bone or B-Bone segment to the accumulated result. */
+static void pchan_deform_accumulate(
+ const DualQuat *deform_dq, const float deform_mat[4][4], const float co_in[3], float weight,
+ float co_accum[3], DualQuat *dq_accum, float mat_accum[3][3]
+) {
+ if (weight == 0.0f)
+ return;
- /* note; by clamping it extends deform at endpoints, goes best with
- * straight joints in restpos. */
- CLAMP(a, 0, bone->segments - 1);
+ if (dq_accum) {
+ BLI_assert(!co_accum);
- if (dq) {
- copy_dq_dq(dq, &(pchan->runtime.bbone_dual_quats)[a]);
+ add_weighted_dq_dq(dq_accum, deform_dq, weight);
}
else {
- mul_m4_v3(b_bone[a + 1].mat, co);
+ float tmp[3];
+ mul_v3_m4v3(tmp, deform_mat, co_in);
- if (defmat) {
- copy_m3_m4(defmat, b_bone[a + 1].mat);
+ sub_v3_v3(tmp, co_in);
+ madd_v3_v3fl(co_accum, tmp, weight);
+
+ if (mat_accum) {
+ float tmpmat[3][3];
+ copy_m3_m4(tmpmat, deform_mat);
+
+ madd_m3_m3m3fl(mat_accum, mat_accum, tmpmat, weight);
}
}
}
+static void b_bone_deform(const bPoseChannel *pchan, const float co[3], float weight, float vec[3], DualQuat *dq, float defmat[3][3])
+{
+ const DualQuat *quats = pchan->runtime.bbone_dual_quats;
+ const Mat4 *mats = pchan->runtime.bbone_deform_mats;
+ const float (*mat)[4] = mats[0].mat;
+ float blend, y;
+ int index;
+
+ /* Transform co to bone space and get its y component. */
+ y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
+
+ /* Calculate the indices of the 2 affecting b_bone segments. */
+ BKE_pchan_bbone_deform_segment_index(pchan, y / pchan->bone->length, &index, &blend);
+
+ pchan_deform_accumulate(&quats[index], mats[index + 1].mat, co, weight * (1.0f - blend), vec, dq, defmat);
+ pchan_deform_accumulate(&quats[index + 1], mats[index + 2].mat, co, weight * blend, vec, dq, defmat);
+}
+
/* using vec with dist to bone b1 - b2 */
float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float rad1, float rad2, float rdist)
{
@@ -996,60 +1102,25 @@ float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3
}
}
-static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonemat[3][3], float mat[3][3])
-{
- float wmat[3][3];
-
- if (pchan->bone->segments > 1)
- copy_m3_m3(wmat, bbonemat);
- else
- copy_m3_m4(wmat, pchan->chan_mat);
-
- mul_m3_fl(wmat, weight);
- add_m3_m3m3(mat, mat, wmat);
-}
-
static float dist_bone_deform(bPoseChannel *pchan, const bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq,
float mat[3][3], const float co[3])
{
Bone *bone = pchan->bone;
float fac, contrib = 0.0;
- float cop[3], bbonemat[3][3];
- DualQuat bbonedq;
if (bone == NULL)
return 0.0f;
- copy_v3_v3(cop, co);
-
- fac = distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
+ fac = distfactor_to_bone(co, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
if (fac > 0.0f) {
fac *= bone->weight;
contrib = fac;
if (contrib > 0.0f) {
- if (vec) {
- if (bone->segments > 1 && pchan->runtime.bbone_segments == bone->segments)
- /* applies on cop and bbonemat */
- b_bone_deform(pchan, cop, NULL, (mat) ? bbonemat : NULL);
- else
- mul_m4_v3(pchan->chan_mat, cop);
-
- /* Make this a delta from the base position */
- sub_v3_v3(cop, co);
- madd_v3_v3fl(vec, cop, fac);
-
- if (mat)
- pchan_deform_mat_add(pchan, fac, bbonemat, mat);
- }
- else {
- if (bone->segments > 1 && pchan->runtime.bbone_segments == bone->segments) {
- b_bone_deform(pchan, cop, &bbonedq, NULL);
- add_weighted_dq_dq(dq, &bbonedq, fac);
- }
- else
- add_weighted_dq_dq(dq, pdef_info->dual_quat, fac);
- }
+ if (bone->segments > 1 && pchan->runtime.bbone_segments == bone->segments)
+ b_bone_deform(pchan, co, fac, vec, dq, mat);
+ else
+ pchan_deform_accumulate(pdef_info->dual_quat, pchan->chan_mat, co, fac, vec, dq, mat);
}
}
@@ -1061,36 +1132,14 @@ static void pchan_bone_deform(bPoseChannel *pchan, const bPoseChanDeform *pdef_i
float mat[3][3], const float co[3], float *contrib)
{
Bone *bone = pchan->bone;
- float cop[3], bbonemat[3][3];
- DualQuat bbonedq;
if (!weight)
return;
- copy_v3_v3(cop, co);
-
- if (vec) {
- if (bone->segments > 1 && bone->segments == pchan->runtime.bbone_segments)
- /* applies on cop and bbonemat */
- b_bone_deform(pchan, cop, NULL, (mat) ? bbonemat : NULL);
- else
- mul_m4_v3(pchan->chan_mat, cop);
-
- vec[0] += (cop[0] - co[0]) * weight;
- vec[1] += (cop[1] - co[1]) * weight;
- vec[2] += (cop[2] - co[2]) * weight;
-
- if (mat)
- pchan_deform_mat_add(pchan, weight, bbonemat, mat);
- }
- else {
- if (bone->segments > 1 && bone->segments == pchan->runtime.bbone_segments) {
- b_bone_deform(pchan, cop, &bbonedq, NULL);
- add_weighted_dq_dq(dq, &bbonedq, weight);
- }
- else
- add_weighted_dq_dq(dq, pdef_info->dual_quat, weight);
- }
+ if (bone->segments > 1 && pchan->runtime.bbone_segments == bone->segments)
+ b_bone_deform(pchan, co, weight, vec, dq, mat);
+ else
+ pchan_deform_accumulate(pdef_info->dual_quat, pchan->chan_mat, co, weight, vec, dq, mat);
(*contrib) += weight;
}
@@ -1666,7 +1715,9 @@ void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, Object *ob, b
BKE_armature_mat_pose_to_bone(&work_pchan, inmat, outmat);
}
-/* same as BKE_object_mat3_to_rot() */
+/**
+ * Same as #BKE_object_mat3_to_rot().
+ */
void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat)
{
BLI_ASSERT_UNIT_M3(mat);
@@ -1687,8 +1738,10 @@ void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat
}
}
-/* Apply a 4x4 matrix to the pose bone,
- * similar to BKE_object_apply_mat4() */
+/**
+ * Apply a 4x4 matrix to the pose bone,
+ * similar to #BKE_object_apply_mat4().
+ */
void BKE_pchan_apply_mat4(bPoseChannel *pchan, float mat[4][4], bool use_compat)
{
float rot[3][3];
@@ -1696,9 +1749,11 @@ void BKE_pchan_apply_mat4(bPoseChannel *pchan, float mat[4][4], bool use_compat)
BKE_pchan_mat3_to_rot(pchan, rot, use_compat);
}
-/* Remove rest-position effects from pose-transform for obtaining
+/**
+ * Remove rest-position effects from pose-transform for obtaining
* 'visual' transformation of pose-channel.
- * (used by the Visual-Keyframing stuff) */
+ * (used by the Visual-Keyframing stuff).
+ */
void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4])
{
float imat[4][4];
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 5cd82803fae..6bf120b8f00 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -56,10 +56,10 @@ typedef struct tSplineIK_Tree {
int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */
- bool free_points; /* free the point positions array */
short chainlen; /* number of bones in the chain */
+ float totlength; /* total length of bones in the chain */
- float *points; /* parametric positions for the joints along the curve */
+ const float *points; /* parametric positions for the joints along the curve */
bPoseChannel **chain; /* chain of bones to affect using Spline IK (ordered from the tip) */
bPoseChannel *root; /* bone that is the root node of the chain */
@@ -71,15 +71,14 @@ typedef struct tSplineIK_Tree {
/* ----------- */
/* Tag the bones in the chain formed by the given bone for IK */
-static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip)
+static void splineik_init_tree_from_pchan(Scene *UNUSED(scene), Object *UNUSED(ob), bPoseChannel *pchan_tip)
{
bPoseChannel *pchan, *pchanRoot = NULL;
bPoseChannel *pchanChain[255];
bConstraint *con = NULL;
bSplineIKConstraint *ikData = NULL;
- float boneLengths[255], *jointPoints;
+ float boneLengths[255];
float totLength = 0.0f;
- bool free_joints = 0;
int segcount = 0;
/* find the SplineIK constraint */
@@ -101,31 +100,6 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
if (con == NULL)
return;
- /* make sure that the constraint targets are ok
- * - this is a workaround for a depsgraph bug...
- */
- if (ikData->tar) {
- /* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
- * currently for paths to work it needs to go through the bevlist/displist system (ton)
- */
-
- /* TODO: Make sure this doesn't crash. */
-#if 0
- /* only happens on reload file, but violates depsgraph still... fix! */
- if (ELEM(NULL, ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
- BKE_displist_make_curveTypes(depsgraph, scene, ikData->tar, 0);
-
- /* path building may fail in EditMode after removing verts [#33268]*/
- if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
- /* BLI_assert(cu->path != NULL); */
- return;
- }
- }
-#else
- (void) scene;
-#endif
- }
-
/* find the root bone and the chain of bones from the root to the tip
* NOTE: this assumes that the bones are connected, but that may not be true... */
for (pchan = pchan_tip; pchan && (segcount < ikData->chainlen); pchan = pchan->parent, segcount++) {
@@ -182,41 +156,6 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
/* disallow negative values (happens with float precision) */
CLAMP_MIN(ikData->points[segcount], 0.0f);
- /* apply corrections for sensitivity to scaling on a copy of the bind points,
- * since it's easier to determine the positions of all the joints beforehand this way
- */
- if ((ikData->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) && (totLength != 0.0f)) {
- float splineLen, maxScale;
- int i;
-
- /* make a copy of the points array, that we'll store in the tree
- * - although we could just multiply the points on the fly, this approach means that
- * we can introduce per-segment stretchiness later if it is necessary
- */
- jointPoints = MEM_dupallocN(ikData->points);
- free_joints = 1;
-
- /* get the current length of the curve */
- /* NOTE: this is assumed to be correct even after the curve was resized */
- splineLen = ikData->tar->runtime.curve_cache->path->totdist;
-
- /* calculate the scale factor to multiply all the path values by so that the
- * bone chain retains its current length, such that
- * maxScale * splineLen = totLength
- */
- maxScale = totLength / splineLen;
-
- /* apply scaling correction to all of the temporary points */
- /* TODO: this is really not adequate enough on really short chains */
- for (i = 0; i < segcount; i++)
- jointPoints[i] *= maxScale;
- }
- else {
- /* just use the existing points array */
- jointPoints = ikData->points;
- free_joints = 0;
- }
-
/* make a new Spline-IK chain, and store it in the IK chains */
/* TODO: we should check if there is already an IK chain on this, since that would take precedence... */
{
@@ -225,14 +164,14 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
tree->type = CONSTRAINT_TYPE_SPLINEIK;
tree->chainlen = segcount;
+ tree->totlength = totLength;
/* copy over the array of links to bones in the chain (from tip to root) */
tree->chain = MEM_mallocN(sizeof(bPoseChannel *) * segcount, "SplineIK Chain");
memcpy(tree->chain, pchanChain, sizeof(bPoseChannel *) * segcount);
/* store reference to joint position array */
- tree->points = jointPoints;
- tree->free_points = free_joints;
+ tree->points = ikData->points;
/* store references to different parts of the chain */
tree->root = pchanRoot;
@@ -261,20 +200,69 @@ static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime))
/* ----------- */
-/* Evaluate spline IK for a given bone */
-static void splineik_evaluate_bone(
- struct Depsgraph *depsgraph, tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan,
- int index, float ctime)
+typedef struct tSplineIk_EvalState {
+ float curve_position; /* Current position along the curve. */
+ float curve_scale; /* Global scale to apply to curve positions. */
+ float locrot_offset[4][4]; /* Bone rotation and location offset inherited from parent. */
+} tSplineIk_EvalState;
+
+/* Prepare data to evaluate spline IK. */
+static bool splineik_evaluate_init(tSplineIK_Tree *tree, tSplineIk_EvalState *state)
{
bSplineIKConstraint *ikData = tree->ikData;
- float poseHead[3], poseTail[3], poseMat[4][4];
+
+ /* Make sure that the constraint targets are ok, to avoid crashes
+ * in case of a depsgraph bug or dependency cycle.
+ */
+ if (ikData->tar == NULL) {
+ return false;
+ }
+
+ CurveCache *cache = ikData->tar->runtime.curve_cache;
+
+ if (ELEM(NULL, cache, cache->path, cache->path->data)) {
+ return false;
+ }
+
+ /* Initialize the evaluation state. */
+ state->curve_position = 0.0f;
+ state->curve_scale = 1.0f;
+ unit_m4(state->locrot_offset);
+
+ /* Apply corrections for sensitivity to scaling. */
+ if ((ikData->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) && (tree->totlength != 0.0f)) {
+ /* get the current length of the curve */
+ /* NOTE: this is assumed to be correct even after the curve was resized */
+ float splineLen = cache->path->totdist;
+
+ /* calculate the scale factor to multiply all the path values by so that the
+ * bone chain retains its current length, such that
+ * maxScale * splineLen = totLength
+ */
+ state->curve_scale = tree->totlength / splineLen;
+ }
+
+ return true;
+}
+
+/* Evaluate spline IK for a given bone. */
+static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChannel *pchan, int index, tSplineIk_EvalState *state)
+{
+ bSplineIKConstraint *ikData = tree->ikData;
+ float origHead[3], origTail[3], poseHead[3], poseTail[3], poseMat[4][4];
float splineVec[3], scaleFac, radius = 1.0f;
- /* firstly, calculate the bone matrix the standard way, since this is needed for roll control */
- BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1);
+ mul_v3_m4v3(poseHead, state->locrot_offset, pchan->pose_head);
+ mul_v3_m4v3(poseTail, state->locrot_offset, pchan->pose_tail);
- copy_v3_v3(poseHead, pchan->pose_head);
- copy_v3_v3(poseTail, pchan->pose_tail);
+ copy_v3_v3(origHead, poseHead);
+
+ /* first, adjust the point positions on the curve */
+ float curveLen = tree->points[index] - tree->points[index + 1];
+ float pointStart = state->curve_position;
+ float pointEnd = pointStart + curveLen * state->curve_scale;
+
+ state->curve_position = pointEnd;
/* step 1: determine the positions for the endpoints of the bone */
{
@@ -282,18 +270,18 @@ static void splineik_evaluate_bone(
float tailBlendFac = 1.0f;
/* determine if the bone should still be affected by SplineIK */
- if (tree->points[index + 1] >= 1.0f) {
+ if (pointStart >= 1.0f) {
/* spline doesn't affect the bone anymore, so done... */
pchan->flag |= POSE_DONE;
return;
}
- else if ((tree->points[index] >= 1.0f) && (tree->points[index + 1] < 1.0f)) {
+ else if ((pointEnd >= 1.0f) && (pointStart < 1.0f)) {
/* blending factor depends on the amount of the bone still left on the chain */
- tailBlendFac = (1.0f - tree->points[index + 1]) / (tree->points[index] - tree->points[index + 1]);
+ tailBlendFac = (1.0f - pointStart) / (pointEnd - pointStart);
}
/* tail endpoint */
- if (where_on_path(ikData->tar, tree->points[index], vec, dir, NULL, &rad, NULL)) {
+ if (where_on_path(ikData->tar, pointEnd, vec, dir, NULL, &rad, NULL)) {
/* apply curve's object-mode transforms to the position
* unless the option to allow curve to be positioned elsewhere is activated (i.e. no root)
*/
@@ -309,7 +297,7 @@ static void splineik_evaluate_bone(
}
/* head endpoint */
- if (where_on_path(ikData->tar, tree->points[index + 1], vec, dir, NULL, &rad, NULL)) {
+ if (where_on_path(ikData->tar, pointStart, vec, dir, NULL, &rad, NULL)) {
/* apply curve's object-mode transforms to the position
* unless the option to allow curve to be positioned elsewhere is activated (i.e. no root)
*/
@@ -342,9 +330,7 @@ static void splineik_evaluate_bone(
/* compute the raw rotation matrix from the bone's current matrix by extracting only the
* orientation-relevant axes, and normalizing them
*/
- copy_v3_v3(rmat[0], pchan->pose_mat[0]);
- copy_v3_v3(rmat[1], pchan->pose_mat[1]);
- copy_v3_v3(rmat[2], pchan->pose_mat[2]);
+ mul_m3_m4m4(rmat, state->locrot_offset, pchan->pose_mat);
normalize_m3(rmat);
/* also, normalize the orientation imposed by the bone, now that we've extracted the scale factor */
@@ -375,6 +361,9 @@ static void splineik_evaluate_bone(
mul_m3_m3m3(tmat, dmat, rmat); /* m1, m3, m2 */
normalize_m3(tmat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */
copy_m4_m3(poseMat, tmat);
+
+ /* apply rotation to the accumulated parent transform */
+ mul_m4_m3m4(state->locrot_offset, dmat, state->locrot_offset);
}
/* step 4: set the scaling factors for the axes */
@@ -484,19 +473,18 @@ static void splineik_evaluate_bone(
/* when the 'no-root' option is affected, the chain can retain
* the shape but be moved elsewhere
*/
- copy_v3_v3(poseHead, pchan->pose_head);
+ copy_v3_v3(poseHead, origHead);
}
else if (tree->con->enforce < 1.0f) {
/* when the influence is too low
* - blend the positions for the 'root' bone
* - stick to the parent for any other
*/
- if (pchan->parent) {
- copy_v3_v3(poseHead, pchan->pose_head);
+ if (index < tree->chainlen - 1) {
+ copy_v3_v3(poseHead, origHead);
}
else {
- /* FIXME: this introduces popping artifacts when we reach 0.0 */
- interp_v3_v3v3(poseHead, pchan->pose_head, poseHead, tree->con->enforce);
+ interp_v3_v3v3(poseHead, origHead, poseHead, tree->con->enforce);
}
}
copy_v3_v3(poseMat[3], poseHead);
@@ -505,9 +493,14 @@ static void splineik_evaluate_bone(
copy_m4_m4(pchan->pose_mat, poseMat);
copy_v3_v3(pchan->pose_head, poseHead);
+ mul_v3_mat3_m4v3(origTail, state->locrot_offset, pchan->pose_tail);
+
/* recalculate tail, as it's now outdated after the head gets adjusted above! */
BKE_pose_where_is_bone_tail(pchan);
+ /* update the offset in the accumulated parent transform */
+ sub_v3_v3v3(state->locrot_offset[3], pchan->pose_tail, origTail);
+
/* done! */
pchan->flag |= POSE_DONE;
}
@@ -521,20 +514,28 @@ static void splineik_execute_tree(struct Depsgraph *depsgraph, Scene *scene, Obj
while ((tree = pchan_root->siktree.first) != NULL) {
int i;
- /* walk over each bone in the chain, calculating the effects of spline IK
- * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
- * so that dependencies are correct
- */
+ /* Firstly, calculate the bone matrix the standard way, since this is needed for roll control. */
for (i = tree->chainlen - 1; i >= 0; i--) {
- bPoseChannel *pchan = tree->chain[i];
- splineik_evaluate_bone(depsgraph, tree, scene, ob, pchan, i, ctime);
+ BKE_pose_where_is_bone(depsgraph, scene, ob, tree->chain[i], ctime, 1);
+ }
+
+ /* After that, evaluate the actual Spline IK, unless there are missing dependencies. */
+ tSplineIk_EvalState state;
+
+ if (splineik_evaluate_init(tree, &state)) {
+ /* Walk over each bone in the chain, calculating the effects of spline IK
+ * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
+ * so that dependencies are correct
+ */
+ for (i = tree->chainlen - 1; i >= 0; i--) {
+ bPoseChannel *pchan = tree->chain[i];
+ splineik_evaluate_bone(tree, ob, pchan, i, &state);
+ }
}
/* free the tree info specific to SplineIK trees now */
if (tree->chain)
MEM_freeN(tree->chain);
- if (tree->free_points)
- MEM_freeN(tree->points);
/* free this tree */
BLI_freelinkN(&pchan_root->siktree, tree);
@@ -555,8 +556,9 @@ void BKE_splineik_execute_tree(
/* *************** Depsgraph evaluation callbacks ************ */
-static void pose_pchan_index_create(bPose *pose)
+void BKE_pose_pchan_index_rebuild(bPose *pose)
{
+ MEM_SAFE_FREE(pose->chan_array);
const int num_channels = BLI_listbase_count(&pose->chanbase);
pose->chan_array = MEM_malloc_arrayN(
num_channels, sizeof(bPoseChannel *), "pose->chan_array");
@@ -604,7 +606,8 @@ void BKE_pose_eval_init(struct Depsgraph *depsgraph,
}
}
- pose_pchan_index_create(pose);
+ BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
+
BKE_armature_cached_bbone_deformation_free_data(object);
}
@@ -805,7 +808,6 @@ static void pose_eval_cleanup_common(Object *object)
bPose *pose = object->pose;
BLI_assert(pose != NULL);
BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
- MEM_SAFE_FREE(pose->chan_array);
}
void BKE_pose_eval_done(struct Depsgraph *depsgraph, Object *object)
@@ -838,7 +840,8 @@ void BKE_pose_eval_proxy_init(struct Depsgraph *depsgraph, Object *object)
BLI_assert(ID_IS_LINKED(object) && object->proxy_from != NULL);
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
- pose_pchan_index_create(object->pose);
+ BLI_assert(object->pose->chan_array != NULL || BLI_listbase_is_empty(&object->pose->chanbase));
+
BKE_armature_cached_bbone_deformation_free_data(object);
}
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 336a4739760..eadf190c363 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -804,7 +804,7 @@ static void collection_missing_parents_remove(Collection *collection)
* This is used for library remapping, where these pointers have been set to NULL.
* Otherwise this should never happen.
*
- * \note caller must ensure BKE_main_collection_sync_remap() is called afterwards!
+ * \note caller must ensure #BKE_main_collection_sync_remap() is called afterwards!
*
* \param collection: may be \a NULL, in which case whole \a bmain database of collections is checked.
*/
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 6d7765d4314..59a374d5e88 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -319,8 +319,7 @@ void BKE_constraint_mat_convertspace(
{
/* local + parent to pose */
if (pchan->bone) {
- copy_m4_m4(diff_mat, pchan->bone->arm_mat);
- mul_m4_m4m4(mat, mat, diff_mat);
+ mul_m4_m4m4(mat, pchan->bone->arm_mat, mat);
}
/* use pose-space as stepping stone for other spaces */
@@ -592,58 +591,25 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
Mat4 *bbone = pchan->runtime.bbone_pose_mats;
float tempmat[4][4];
float loc[3], fac;
+ int index;
/* figure out which segment(s) the headtail value falls in */
- fac = (float)pchan->bone->segments * headtail;
-
- if (fac >= pchan->bone->segments - 1) {
- /* special case: end segment doesn't get created properly... */
- float pt[3], sfac;
- int index;
-
- /* bbone points are in bonespace, so need to move to posespace first */
- index = pchan->bone->segments - 1;
- mul_v3_m4v3(pt, pchan->pose_mat, bbone[index].mat[3]);
-
- /* interpolate between last segment point and the endpoint */
- sfac = fac - (float)(pchan->bone->segments - 1); /* fac is just the "leftover" between penultimate and last points */
- interp_v3_v3v3(loc, pt, pchan->pose_tail, sfac);
- }
- else {
- /* get indices for finding interpolating between points along the bbone */
- float pt_a[3], pt_b[3], pt[3];
- int index_a, index_b;
-
- index_a = floorf(fac);
- CLAMP(index_a, 0, MAX_BBONE_SUBDIV - 1);
-
- index_b = ceilf(fac);
- CLAMP(index_b, 0, MAX_BBONE_SUBDIV - 1);
-
- /* interpolate between these points */
- copy_v3_v3(pt_a, bbone[index_a].mat[3]);
- copy_v3_v3(pt_b, bbone[index_b].mat[3]);
-
- interp_v3_v3v3(pt, pt_a, pt_b, fac - floorf(fac));
-
- /* move the point from bone local space to pose space... */
- mul_v3_m4v3(loc, pchan->pose_mat, pt);
- }
+ BKE_pchan_bbone_deform_segment_index(pchan, headtail, &index, &fac);
/* apply full transformation of the segment if requested */
if (full_bbone) {
- int index = floorf(fac);
- CLAMP(index, 0, pchan->bone->segments - 1);
+ interp_m4_m4m4(tempmat, bbone[index].mat, bbone[index + 1].mat, fac);
- mul_m4_m4m4(tempmat, pchan->pose_mat, bbone[index].mat);
+ mul_m4_m4m4(tempmat, pchan->pose_mat, tempmat);
}
+ /* only interpolate location */
else {
+ interp_v3_v3v3(loc, bbone[index].mat[3], bbone[index + 1].mat[3], fac);
+
copy_m4_m4(tempmat, pchan->pose_mat);
+ mul_v3_m4v3(tempmat[3], pchan->pose_mat, loc);
}
- /* use interpolated distance for subtarget */
- copy_v3_v3(tempmat[3], loc);
-
mul_m4_m4m4(mat, ob->obmat, tempmat);
}
else {
@@ -2155,10 +2121,31 @@ static void armdef_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
}
}
+static void armdef_accumulate_matrix(float obmat[4][4], float iobmat[4][4], float basemat[4][4], float bonemat[4][4], float weight, float r_sum_mat[4][4], DualQuat *r_sum_dq)
+{
+ if (weight == 0.0f)
+ return;
+
+ /* Convert the selected matrix into object space. */
+ float mat[4][4];
+ mul_m4_series(mat, obmat, bonemat, iobmat);
+
+ /* Accumulate the transformation. */
+ if (r_sum_dq != NULL) {
+ DualQuat tmpdq;
+
+ mat4_to_dquat(&tmpdq, basemat, mat);
+ add_weighted_dq_dq(r_sum_dq, &tmpdq, weight);
+ }
+ else {
+ madd_m4_m4m4fl(r_sum_mat, r_sum_mat, mat, weight);
+ }
+}
+
/* Compute and accumulate transformation for a single target bone. */
static void armdef_accumulate_bone(bConstraintTarget *ct, bPoseChannel *pchan, const float wco[3], bool force_envelope, float *r_totweight, float r_sum_mat[4][4], DualQuat *r_sum_dq)
{
- float mat[4][4], iobmat[4][4], basemat[4][4], co[3];
+ float iobmat[4][4], basemat[4][4], co[3];
Bone *bone = pchan->bone;
float weight = ct->weight;
@@ -2172,6 +2159,11 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, bPoseChannel *pchan, c
bone->rad_head, bone->rad_tail, bone->dist);
}
+ /* Compute the quaternion base matrix. */
+ if (r_sum_dq != NULL) {
+ mul_m4_series(basemat, ct->tar->obmat, bone->arm_mat, iobmat);
+ }
+
/* Find the correct bone transform matrix in world space. */
if (bone->segments > 1 && bone->segments == pchan->runtime.bbone_segments) {
Mat4 *b_bone_mats = pchan->runtime.bbone_deform_mats;
@@ -2182,34 +2174,21 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, bPoseChannel *pchan, c
* Need to transform co back to bonespace, only need y. */
float y = iamat[0][1] * co[0] + iamat[1][1] * co[1] + iamat[2][1] * co[2] + iamat[3][1];
- float segment = bone->length / ((float)bone->segments);
- int a = (int)(y / segment);
-
- CLAMP(a, 0, bone->segments - 1);
+ /* Blend the matrix. */
+ int index;
+ float blend;
+ BKE_pchan_bbone_deform_segment_index(pchan, y / bone->length, &index, &blend);
- /* Convert the selected matrix into object space. */
- mul_m4_series(mat, ct->tar->obmat, b_bone_mats[a + 1].mat, iobmat);
+ armdef_accumulate_matrix(ct->tar->obmat, iobmat, basemat, b_bone_mats[index + 1].mat, weight * (1.0f - blend), r_sum_mat, r_sum_dq);
+ armdef_accumulate_matrix(ct->tar->obmat, iobmat, basemat, b_bone_mats[index + 2].mat, weight * blend, r_sum_mat, r_sum_dq);
}
else {
/* Simple bone. This requires DEG_OPCODE_BONE_DONE dependency due to chan_mat. */
- mul_m4_series(mat, ct->tar->obmat, pchan->chan_mat, iobmat);
+ armdef_accumulate_matrix(ct->tar->obmat, iobmat, basemat, pchan->chan_mat, weight, r_sum_mat, r_sum_dq);
}
- /* Accumulate the transformation. */
+ /* Accumulate the weight. */
*r_totweight += weight;
-
- if (r_sum_dq != NULL) {
- DualQuat tmpdq;
-
- mul_m4_series(basemat, ct->tar->obmat, bone->arm_mat, iobmat);
-
- mat4_to_dquat(&tmpdq, basemat, mat);
- add_weighted_dq_dq(r_sum_dq, &tmpdq, weight);
- }
- else {
- mul_m4_fl(mat, weight);
- add_m4_m4m4(r_sum_mat, r_sum_mat, mat);
- }
}
static void armdef_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
@@ -4729,15 +4708,18 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_get(bConstraint *con)
/* ---------- Data Management ------- */
-/* helper function for BKE_constraint_free_data() - unlinks references */
+/**
+ * Helper function for #BKE_constraint_free_data() - unlinks references.
+ */
static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData))
{
if (*idpoin && is_reference)
id_us_min(*idpoin);
}
-/* Free data of a specific constraint if it has any info.
- * be sure to run BIK_clear_data() when freeing an IK constraint,
+/**
+ * Free data of a specific constraint if it has any info.
+ * be sure to run #BIK_clear_data() when freeing an IK constraint,
* unless DAG_relations_tag_update is called.
*/
void BKE_constraint_free_data_ex(bConstraint *con, bool do_id_user)
diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c
index 5dd5e014cc8..4aa3b702693 100644
--- a/source/blender/blenkernel/intern/crazyspace.c
+++ b/source/blender/blenkernel/intern/crazyspace.c
@@ -305,12 +305,13 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh(
return numleft;
}
-/* Crazyspace evaluation needs to have an object which has all the fields
+/**
+ * Crazyspace evaluation needs to have an object which has all the fields
* evaluated, but the mesh data being at undeformed state. This way it can
* re-apply modifiers and also have proper pointers to key data blocks.
*
- * Similar to BKE_object_eval_reset(), but does not modify the actual evaluated
- * object. */
+ * Similar to #BKE_object_eval_reset(), but does not modify the actual evaluated object.
+ */
static void crazyspace_init_object_for_eval(
struct Depsgraph *depsgraph,
Object *object,
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 9b184713f0e..c779f05c0b0 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -431,17 +431,6 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
vfd = vfont_get_data(which_vfont(cu, info));
if (!vfd) return;
-#if 0
- if (cu->selend < cu->selstart) {
- if ((charidx >= (cu->selend)) && (charidx <= (cu->selstart - 2)))
- sel = 1;
- }
- else {
- if ((charidx >= (cu->selstart - 1)) && (charidx <= (cu->selend - 1)))
- sel = 1;
- }
-#endif
-
/* make a copy at distance ofsx, ofsy with shear */
shear = cu->shear;
si = sinf(rot);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 2ef8568e308..c204a8128c1 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -985,7 +985,7 @@ void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
BLI_freelinkN(&gpd->layers, gpl);
}
-Material *BKE_gpencil_get_material_from_brush(Brush *brush)
+Material *BKE_gpencil_brush_material_get(Brush *brush)
{
Material *ma = NULL;
@@ -998,7 +998,7 @@ Material *BKE_gpencil_get_material_from_brush(Brush *brush)
return ma;
}
-void BKE_gpencil_brush_set_material(Brush *brush, Material *ma)
+void BKE_gpencil_brush_material_set(Brush *brush, Material *ma)
{
BLI_assert(brush);
BLI_assert(brush->gpencil_settings);
@@ -1014,13 +1014,13 @@ void BKE_gpencil_brush_set_material(Brush *brush, Material *ma)
}
/* Adds the pinned material to the object if necessary. */
-Material *BKE_gpencil_handle_brush_material(Main *bmain, Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
{
if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
- Material *ma = BKE_gpencil_get_material_from_brush(brush);
+ Material *ma = BKE_gpencil_brush_material_get(brush);
/* check if the material is already on object material slots and add it if missing */
- if (ma && BKE_gpencil_get_material_index(ob, ma) < 0) {
+ if (ma && BKE_gpencil_object_material_get_index(ob, ma) < 0) {
BKE_object_material_slot_add(bmain, ob);
assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF);
}
@@ -1034,12 +1034,12 @@ Material *BKE_gpencil_handle_brush_material(Main *bmain, Object *ob, Brush *brus
}
/* Assigns the material to object (if not already present) and returns its index (mat_nr). */
-int BKE_gpencil_handle_material(Main *bmain, Object *ob, Material *material)
+int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *material)
{
if (!material) {
return -1;
}
- int index = BKE_gpencil_get_material_index(ob, material);
+ int index = BKE_gpencil_object_material_get_index(ob, material);
if (index < 0) {
BKE_object_material_slot_add(bmain, ob);
assign_material(bmain, ob, material, ob->totcol, BKE_MAT_ASSIGN_USERPREF);
@@ -1052,7 +1052,7 @@ int BKE_gpencil_handle_material(Main *bmain, Object *ob, Material *material)
*
* \param *r_index: value is set to zero based index of the new material if r_index is not NULL
*/
-Material *BKE_gpencil_handle_new_material(Main *bmain, Object *ob, const char *name, int *r_index)
+Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
{
Material *ma = BKE_material_add_gpencil(bmain, name);
id_us_min(&ma->id); /* no users yet */
@@ -1067,10 +1067,10 @@ Material *BKE_gpencil_handle_new_material(Main *bmain, Object *ob, const char *n
}
/* Returns the material for a brush with respect to its pinned state. */
-Material *BKE_gpencil_get_material_for_brush(Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_get_from_brush(Object *ob, Brush *brush)
{
- if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
- Material *ma = BKE_gpencil_get_material_from_brush(brush);
+ if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
+ Material *ma = BKE_gpencil_brush_material_get(brush);
return ma;
}
else {
@@ -1079,10 +1079,10 @@ Material *BKE_gpencil_get_material_for_brush(Object *ob, Brush *brush)
}
/* Returns the material index for a brush with respect to its pinned state. */
-int BKE_gpencil_get_material_index_for_brush(Object *ob, Brush *brush)
+int BKE_gpencil_object_material_get_index_from_brush(Object *ob, Brush *brush)
{
- if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
- return BKE_gpencil_get_material_index(ob, brush->gpencil_settings->material);
+ if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
+ return BKE_gpencil_object_material_get_index(ob, brush->gpencil_settings->material);
}
else {
return ob->actcol - 1;
@@ -1090,21 +1090,21 @@ int BKE_gpencil_get_material_index_for_brush(Object *ob, Brush *brush)
}
/* Guaranteed to return a material assigned to object. Returns never NULL. */
-Material *BKE_gpencil_current_input_toolsettings_material(Main *bmain, Object *ob, ToolSettings *ts)
+Material *BKE_gpencil_object_material_ensure_from_active_input_toolsettings(Main *bmain, Object *ob, ToolSettings *ts)
{
if (ts && ts->gp_paint && ts->gp_paint->paint.brush) {
- return BKE_gpencil_current_input_brush_material(bmain, ob, ts->gp_paint->paint.brush);
+ return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, ts->gp_paint->paint.brush);
}
else {
- return BKE_gpencil_current_input_brush_material(bmain, ob, NULL);
+ return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, NULL);
}
}
/* Guaranteed to return a material assigned to object. Returns never NULL. */
-Material *BKE_gpencil_current_input_brush_material(Main *bmain, Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_ensure_from_active_input_brush(Main *bmain, Object *ob, Brush *brush)
{
if (brush) {
- Material *ma = BKE_gpencil_handle_brush_material(bmain, ob, brush);
+ Material *ma = BKE_gpencil_object_material_ensure_from_brush(bmain, ob, brush);
if (ma) {
return ma;
}
@@ -1113,21 +1113,21 @@ Material *BKE_gpencil_current_input_brush_material(Main *bmain, Object *ob, Brus
brush->gpencil_settings->flag &= ~GP_BRUSH_MATERIAL_PINNED;
}
}
- return BKE_gpencil_current_input_material(bmain, ob);
+ return BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob);
}
/* Guaranteed to return a material assigned to object. Returns never NULL. Only use this for materials unrelated to user input */
-Material *BKE_gpencil_current_input_material(Main *bmain, Object *ob)
+Material *BKE_gpencil_object_material_ensure_from_active_input_material(Main *bmain, Object *ob)
{
Material *ma = give_current_material(ob, ob->actcol);
if (ma) {
return ma;
}
- return BKE_gpencil_handle_new_material(bmain, ob, "Material", NULL);
+ return BKE_gpencil_object_material_new(bmain, ob, "Material", NULL);
}
/* Get active color, and add all default settings if we don't find anything */
-Material *BKE_gpencil_material_ensure(Main *bmain, Object *ob)
+Material *BKE_gpencil_object_material_ensure_active(Main *bmain, Object *ob)
{
Material *ma = NULL;
@@ -1135,7 +1135,7 @@ Material *BKE_gpencil_material_ensure(Main *bmain, Object *ob)
if (ELEM(NULL, bmain, ob))
return NULL;
- ma = BKE_gpencil_current_input_material(bmain, ob);
+ ma = BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob);
if (ma->gp_style == NULL) {
BKE_material_init_gpencil_settings(ma);
}
@@ -1662,7 +1662,7 @@ void BKE_gpencil_stats_update(bGPdata *gpd)
}
/* get material index (0-based like mat_nr not actcol) */
-int BKE_gpencil_get_material_index(Object *ob, Material *ma)
+int BKE_gpencil_object_material_get_index(Object *ob, Material *ma)
{
short *totcol = give_totcolp(ob);
Material *read_ma = NULL;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index b00e4cbcdd9..0205f275f59 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -4770,8 +4770,9 @@ bool BKE_image_has_loaded_ibuf(Image *image)
return has_loaded_ibuf;
}
-/* References the result, BKE_image_release_ibuf is to be called to de-reference.
- * Use lock=NULL when calling BKE_image_release_ibuf().
+/**
+ * References the result, #BKE_image_release_ibuf is to be called to de-reference.
+ * Use lock=NULL when calling #BKE_image_release_ibuf().
*/
ImBuf *BKE_image_get_ibuf_with_name(Image *image, const char *name)
{
@@ -4797,8 +4798,9 @@ ImBuf *BKE_image_get_ibuf_with_name(Image *image, const char *name)
return ibuf;
}
-/* References the result, BKE_image_release_ibuf is to be called to de-reference.
- * Use lock=NULL when calling BKE_image_release_ibuf().
+/**
+ * References the result, #BKE_image_release_ibuf is to be called to de-reference.
+ * Use lock=NULL when calling #BKE_image_release_ibuf().
*
* TODO(sergey): This is actually "get first entry from the cache", which is
* not so much predictable. But using first loaded image buffer
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index f85964f76bc..de1c3976b7b 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1497,7 +1497,9 @@ KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const bool do_force
if (!do_force && (key->type != KEY_RELATIVE)) {
KeyBlock *it_kb;
for (it_kb = key->block.first; it_kb; it_kb = it_kb->next) {
- if (it_kb->pos == cpos) {
+ /* Use epsilon to avoid floating point precision issues.
+ * 1e-3 because the position is stored as frame * 1e-2. */
+ if (compare_ff(it_kb->pos, cpos, 1e-3f)) {
return kb;
}
}
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 453cbe16de0..b7ae8eea18d 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -581,7 +581,7 @@ static void library_foreach_ID_link(
}
data.cb_flag = data_cb_flag;
- CALLBACK_INVOKE(object->gpd, IDWALK_CB_USER);
+ /* Note that ob->gpd is deprecated, so no need to handle it here. */
CALLBACK_INVOKE(object->instance_collection, IDWALK_CB_USER);
if (object->pd) {
@@ -783,7 +783,7 @@ static void library_foreach_ID_link(
CALLBACK_INVOKE(child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
}
for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
- CALLBACK_INVOKE(parent->collection, IDWALK_CB_NEVER_SELF);
+ CALLBACK_INVOKE(parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
}
break;
}
@@ -1294,7 +1294,7 @@ bool BKE_library_ID_is_indirectly_used(Main *bmain, void *idv)
}
/**
- * Combine \a BKE_library_ID_is_locally_used() and \a BKE_library_ID_is_indirectly_used() in a single call.
+ * Combine #BKE_library_ID_is_locally_used() and #BKE_library_ID_is_indirectly_used() in a single call.
*/
void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *is_used_local, bool *is_used_linked)
{
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 449c2f86b04..74fb31d0121 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -634,6 +634,7 @@ static Mesh *mesh_new_nomain_from_template_ex(
me_dst->totpoly = polys_len;
me_dst->cd_flag = me_src->cd_flag;
+ me_dst->editflag = me_src->editflag;
CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, CD_CALLOC, verts_len);
CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, CD_CALLOC, edges_len);
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 664698afa38..5be4b8524b1 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -869,26 +869,31 @@ Mesh *BKE_mesh_new_from_object(
Object *object_input = ob;
Object *object_eval = DEG_get_evaluated_object(depsgraph, object_input);
- Object object_for_eval = *object_eval;
+ Object object_for_eval;
if (object_eval == object_input) {
/* Evaluated mesh contains all modifiers applied already.
* The other types of object has them applied, but are stored in other
* data structures than a mesh. So need to apply modifiers again on a
* temporary copy before converting result to mesh. */
- if (object_for_eval.type == OB_MESH) {
+ if (object_input->type == OB_MESH) {
effective_apply_modifiers = false;
}
else {
effective_apply_modifiers = true;
}
+ object_for_eval = *object_eval;
}
else {
if (apply_modifiers) {
+ object_for_eval = *object_eval;
if (object_for_eval.runtime.mesh_orig != NULL) {
object_for_eval.data = object_for_eval.runtime.mesh_orig;
}
}
+ else {
+ object_for_eval = *object_input;
+ }
}
const bool cage = !effective_apply_modifiers;
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index a5aa198bc4e..295b65190a8 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -1063,10 +1063,13 @@ void BKE_mesh_strip_loose_faces(Mesh *me)
}
}
-/* Works on both loops and polys! */
-/* Note: It won't try to guess which loops of an invalid poly to remove!
- * this is the work of the caller, to mark those loops...
- * See e.g. BKE_mesh_validate_arrays(). */
+/**
+ * Works on both loops and polys!
+ *
+ * \note It won't try to guess which loops of an invalid poly to remove!
+ * this is the work of the caller, to mark those loops...
+ * See e.g. #BKE_mesh_validate_arrays().
+ */
void BKE_mesh_strip_loose_polysloops(Mesh *me)
{
MPoly *p;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 8f52e579a91..7600c74b777 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -895,7 +895,7 @@ ModifierData *modifier_get_original(ModifierData *md)
}
struct ModifierData *modifier_get_evaluated(
- Depsgraph* depsgraph,
+ Depsgraph *depsgraph,
Object *object,
ModifierData *md)
{
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9985c8026e7..6e9c8ecb480 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1429,11 +1429,11 @@ Object *BKE_object_copy(Main *bmain, const Object *ob)
/** Perform deep-copy of object and its 'children' data-blocks (obdata, materials, actions, etc.).
*
- * \param dupflag Controls which sub-data are also duplicated (see \a eDupli_ID_Flags in \a DNA_userdef_types.h).
+ * \param dupflag Controls which sub-data are also duplicated (see #eDupli_ID_Flags in DNA_userdef_types.h).
*
- * \note This function does not do any remapping to new IDs, caller must do it (\a BKE_libblock_relink_to_newid()).
- * \note Caller MUST free \a newid pointers itself (\a BKE_main_id_clear_newpoins()) and call updates of DEG too
- * (\a DAG_relations_tag_update()).
+ * \note This function does not do any remapping to new IDs, caller must do it (\a #BKE_libblock_relink_to_newid()).
+ * \note Caller MUST free \a newid pointers itself (#BKE_main_id_clear_newpoins()) and call updates of DEG too
+ * (#DAG_relations_tag_update()).
*/
Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
{
@@ -3147,10 +3147,12 @@ void BKE_object_handle_update_ex(Depsgraph *depsgraph,
object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update);
}
-/* WARNING: "scene" here may not be the scene object actually resides in.
+/**
+ * \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 current rigid body world
+ * rigid bodies depend on their world so use #BKE_object_handle_update_ex()
+ * to also pass along the current rigid body world.
*/
void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index c03fffc4098..bcca39cff24 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -66,7 +66,7 @@
*
* Some changes done directly in evaluated object require them to be reset
* before being re-evaluated.
- * For example, we need to call this before BKE_mesh_new_from_object(),
+ * For example, we need to call this before #BKE_mesh_new_from_object(),
* in case we removed/added modifiers in the evaluated object.
*/
void BKE_object_eval_reset(Object *ob_eval)
@@ -244,8 +244,10 @@ void BKE_object_handle_data_update(
BKE_object_eval_boundbox(depsgraph, ob);
}
-/* TODO(sergey): Ensure that bounding box is already calculated, and move this
- * into BKE_object_synchronize_to_original(). */
+/**
+ * TODO(sergey): Ensure that bounding box is already calculated, and move this
+ * into #BKE_object_synchronize_to_original().
+ */
void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
{
if (!DEG_is_active(depsgraph)) {
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 7dc772576c5..09fc7c64d6a 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -516,7 +516,7 @@ static void pbvh_build(PBVH *bvh, BB *cb, BBC *prim_bbc, int totprim)
* Do a full rebuild with on Mesh data structure.
*
* \note Unlike mpoly/mloop/verts, looptri is **totally owned** by PBVH (which means it may rewrite it if needed,
- * see BKE_pbvh_apply_vertCos().
+ * see #BKE_pbvh_apply_vertCos().
*/
void BKE_pbvh_build_mesh(
PBVH *bvh, const MPoly *mpoly, const MLoop *mloop, MVert *verts,
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 644eb704655..361459c7c18 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -651,7 +651,6 @@ void BKE_scene_init(Scene *sce)
sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT;
sce->toolsettings->unwrapper = 1;
sce->toolsettings->select_thresh = 0.01f;
- sce->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
@@ -1347,24 +1346,28 @@ void BKE_scene_frame_set(struct Scene *scene, double cfra)
/** \name Scene Orientation Slots
* \{ */
-TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int flag)
+TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
{
- BLI_assert(flag && !(flag & ~(SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE)));
- int index = SCE_ORIENT_DEFAULT;
- if (flag & SCE_GIZMO_SHOW_TRANSLATE) {
- index = SCE_ORIENT_TRANSLATE;
+ if ((scene->orientation_slots[slot_index].flag & SELECT) == 0) {
+ slot_index = SCE_ORIENT_DEFAULT;
}
- else if (flag & SCE_GIZMO_SHOW_ROTATE) {
- index = SCE_ORIENT_ROTATE;
+ return &scene->orientation_slots[slot_index];
+}
+
+TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(Scene *scene, int flag)
+{
+ BLI_assert(flag && !(flag & ~(V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)));
+ int slot_index = SCE_ORIENT_DEFAULT;
+ if (flag & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) {
+ slot_index = SCE_ORIENT_TRANSLATE;
}
- else if (flag & SCE_GIZMO_SHOW_SCALE) {
- index = SCE_ORIENT_SCALE;
+ else if (flag & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
+ slot_index = SCE_ORIENT_ROTATE;
}
-
- if ((scene->orientation_slots[index].flag & SELECT) == 0) {
- index = SCE_ORIENT_DEFAULT;
+ else if (flag & V3D_GIZMO_SHOW_OBJECT_SCALE) {
+ slot_index = SCE_ORIENT_SCALE;
}
- return &scene->orientation_slots[index];
+ return BKE_scene_orientation_slot_get(scene, slot_index);
}
/**
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 0d8b2381572..2e0d4719339 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -725,8 +725,9 @@ static void add_bp_springlist(BodyPoint *bp, int springID)
}
}
-/* do this once when sb is build
- * it is O(N^2) so scanning for springs every iteration is too expensive
+/**
+ * Do this once when sb is build it is `O(N^2)`
+ * so scanning for springs every iteration is too expensive.
*/
static void build_bps_springlist(Object *ob)
{
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c
index 5e7f2421428..6a0dbefd340 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -266,12 +266,13 @@ static StabContext *initialize_stabilization_working_context(MovieClip *clip)
return ctx;
}
-/* Discard all private working data attached to this call context.
- * NOTE: We allocate the record for the per track baseline contribution
- * locally for each call context (i.e. call to
- * BKE_tracking_stabilization_data_get()
- * Thus it is correct to discard all allocations found within the
- * corresponding _local_ GHash
+/**
+ * Discard all private working data attached to this call context.
+ *
+ * \note We allocate the record for the per track baseline contribution
+ * locally for each call context (i.e. call to #BKE_tracking_stabilization_data_get)
+ * Thus it is correct to discard all allocations found within the
+ * corresponding _local_ GHash.
*/
static void discard_stabilization_working_context(StabContext *ctx)
{
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 8e35b197e14..0b65597665d 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -59,6 +59,9 @@ void swap_m4m4(float A[4][4], float B[4][4]);
void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]);
void add_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]);
+void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], const float f);
+void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], const float f);
+
void sub_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]);
void sub_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]);
@@ -66,7 +69,9 @@ void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]);
void mul_m4_m3m4(float R[4][4], const float A[3][3], const float B[4][4]);
void mul_m4_m4m3(float R[4][4], const float A[4][4], const float B[3][3]);
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]);
-void mul_m3_m3m4(float R[3][3], const float A[4][4], const float B[3][3]);
+void mul_m3_m3m4(float R[3][3], const float A[3][3], const float B[4][4]);
+void mul_m3_m4m3(float R[3][3], const float A[4][4], const float B[3][3]);
+void mul_m3_m4m4(float R[3][3], const float A[4][4], const float B[4][4]);
/* special matrix multiplies
* uniq: R <-- AB, R is neither A nor B
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 831626b164b..09844d75c93 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -32,6 +32,7 @@ extern "C" {
#endif
#include "BLI_compiler_attrs.h"
+#include "BLI_utildefines_variadic.h"
char *BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
@@ -117,6 +118,53 @@ int BLI_string_find_split_words(
len += BLI_snprintf_rlen(dst + len, ARRAY_SIZE(dst) - len, format, __VA_ARGS__)
/** \} */
+/* -------------------------------------------------------------------- */
+/** \name Equal to Any Element (STR_ELEM) Macro
+ *
+ * Follows #ELEM macro convention.
+ * \{ */
+
+/* STR_ELEM#(v, ...): is the first arg equal any others? */
+/* Internal helpers. */
+#define _VA_STR_ELEM2(v, a) \
+ (strcmp(v, a) == 0)
+#define _VA_STR_ELEM3(v, a, b) \
+ (_VA_STR_ELEM2(v, a) || ((v) == (b)))
+#define _VA_STR_ELEM4(v, a, b, c) \
+ (_VA_STR_ELEM3(v, a, b) || ((v) == (c)))
+#define _VA_STR_ELEM5(v, a, b, c, d) \
+ (_VA_STR_ELEM4(v, a, b, c) || ((v) == (d)))
+#define _VA_STR_ELEM6(v, a, b, c, d, e) \
+ (_VA_STR_ELEM5(v, a, b, c, d) || ((v) == (e)))
+#define _VA_STR_ELEM7(v, a, b, c, d, e, f) \
+ (_VA_STR_ELEM6(v, a, b, c, d, e) || ((v) == (f)))
+#define _VA_STR_ELEM8(v, a, b, c, d, e, f, g) \
+ (_VA_STR_ELEM7(v, a, b, c, d, e, f) || ((v) == (g)))
+#define _VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) \
+ (_VA_STR_ELEM8(v, a, b, c, d, e, f, g) || ((v) == (h)))
+#define _VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) \
+ (_VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) || ((v) == (i)))
+#define _VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) \
+ (_VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) || ((v) == (j)))
+#define _VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) \
+ (_VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || ((v) == (k)))
+#define _VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) \
+ (_VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || ((v) == (l)))
+#define _VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) \
+ (_VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || ((v) == (m)))
+#define _VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
+ (_VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || ((v) == (n)))
+#define _VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \
+ (_VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || ((v) == (o)))
+#define _VA_STR_ELEM17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
+ (_VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || ((v) == (p)))
+
+/* reusable STR_ELEM macro */
+#define STR_ELEM(...) VA_NARGS_CALL_OVERLOAD(_VA_STR_ELEM, __VA_ARGS__)
+
+/** \} */
+
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 79cde43d399..33ddf9367f4 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -250,6 +250,9 @@ set(SRC
BLI_timeit.hpp
)
+set(LIB
+)
+
if(WITH_MEM_VALGRIND)
add_definitions(-DWITH_MEM_VALGRIND)
endif()
@@ -271,4 +274,4 @@ set_source_files_properties(
PROPERTIES HEADER_FILE_ONLY TRUE
)
-blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index af3a7a4f68a..ae1c6e0ba0b 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -1045,7 +1045,7 @@ void BLI_ghash_flag_clear(GHash *gh, uint flag)
/**
* Create a new GHashIterator. The hash table must not be mutated
* while the iterator is in use, and the iterator will step exactly
- * BLI_ghash_len(gh) times before becoming done.
+ * #BLI_ghash_len(gh) times before becoming done.
*
* \param gh: The GHash to iterate over.
* \return Pointer to a new DynStr.
@@ -1060,7 +1060,7 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh)
/**
* Init an already allocated GHashIterator. The hash table must not
* be mutated while the iterator is in use, and the iterator will
- * step exactly BLI_ghash_len(gh) times before becoming done.
+ * step exactly #BLI_ghash_len(gh) times before becoming done.
*
* \param ghi: The GHashIterator to initialize.
* \param gh: The GHash to iterate over.
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 5acc84da288..24e3f22172e 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -371,7 +371,7 @@ void *BLI_mempool_calloc(BLI_mempool *pool)
/**
* Free an element from the mempool.
*
- * \note doesnt protect against double frees, don't be stupid!
+ * \note doesn't protect against double frees, take care!
*/
void BLI_mempool_free(BLI_mempool *pool, void *addr)
{
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 55c9a189a20..564090f734e 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -314,7 +314,7 @@ void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_
* Return value for given edge (\a v0, \a v1), or NULL if
* if key does not exist in hash. (If need exists
* to differentiate between key-value being NULL and
- * lack of key then see BLI_edgehash_lookup_p().
+ * lack of key then see #BLI_edgehash_lookup_p().
*/
void *BLI_edgehash_lookup(EdgeHash *eh, uint v0, uint v1)
{
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 8e6de3ab141..e34f9d0ab10 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -61,7 +61,7 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
}
/**
- * moves the entire contents of \a src at the begining of \a dst.
+ * moves the entire contents of \a src at the beginning of \a dst.
*/
void BLI_movelisttolist_reverse(ListBase *dst, ListBase *src)
{
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 68c80beb005..3da69e92227 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -316,8 +316,32 @@ void mul_m4_m4m3(float m1[4][4], const float m3_[4][4], const float m2_[3][3])
m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
}
+/* m1 = m2 * m3, ignore the elements on the 4th row/column of m2 */
+void mul_m3_m3m4(float m1[3][3], const float m3_[3][3], const float m2_[4][4])
+{
+ float m2[4][4], m3[3][3];
+
+ /* copy so it works when m1 is the same pointer as m2 or m3 */
+ /* TODO: avoid copying when matrices are different */
+ copy_m4_m4(m2, m2_);
+ copy_m3_m3(m3, m3_);
+
+ /* m1[i][j] = m2[i][k] * m3[k][j] */
+ m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+ m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+ m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
+
+ m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+ m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+ m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
+
+ m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+ m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+ m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
+}
+
/* m1 = m2 * m3, ignore the elements on the 4th row/column of m3 */
-void mul_m3_m3m4(float m1[3][3], const float m3_[4][4], const float m2_[3][3])
+void mul_m3_m4m3(float m1[3][3], const float m3_[4][4], const float m2_[3][3])
{
float m2[3][3], m3[4][4];
@@ -360,6 +384,18 @@ void mul_m4_m3m4(float m1[4][4], const float m3_[3][3], const float m2_[4][4])
m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
}
+void mul_m3_m4m4(float m1[3][3], const float m3[4][4], const float m2[4][4])
+{
+ m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+ m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+ m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
+ m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+ m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+ m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
+ m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+ m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+ m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
+}
/** \name Macro helpers for: mul_m3_series
* \{ */
@@ -813,6 +849,28 @@ void add_m4_m4m4(float m1[4][4], const float m2[4][4], const float m3[4][4])
}
}
+void madd_m3_m3m3fl(float m1[3][3], const float m2[3][3], const float m3[3][3], const float f)
+{
+ int i, j;
+
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 3; j++) {
+ m1[i][j] = m2[i][j] + m3[i][j] * f;
+ }
+ }
+}
+
+void madd_m4_m4m4fl(float m1[4][4], const float m2[4][4], const float m3[4][4], const float f)
+{
+ int i, j;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ m1[i][j] = m2[i][j] + m3[i][j] * f;
+ }
+ }
+}
+
void sub_m3_m3m3(float m1[3][3], const float m2[3][3], const float m3[3][3])
{
int i, j;
@@ -1811,7 +1869,7 @@ void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4]
*
* \note This code is about five times slower as the 'naive' interpolation done by #blend_m3_m3m3
* (it typically remains below 2 usec on an average i74700, while #blend_m3_m3m3 remains below 0.4 usec).
- * However, it gives expected results even with non-uniformaly scaled matrices, see T46418 for an example.
+ * However, it gives expected results even with non-uniformly scaled matrices, see T46418 for an example.
*
* Based on "Matrix Animation and Polar Decomposition", by Ken Shoemake & Tom Duff
*
@@ -2533,20 +2591,20 @@ void invert_m4_m4_safe(float Ainv[4][4], const float A[4][4])
}
/**
- * SpaceTransform struct encapsulates all needed data to convert between two coordinate spaces
+ * #SpaceTransform struct encapsulates all needed data to convert between two coordinate spaces
* (where conversion can be represented by a matrix multiplication).
*
* A SpaceTransform is initialized using:
- * BLI_SPACE_TRANSFORM_SETUP(&data, ob1, ob2)
+ * - #BLI_SPACE_TRANSFORM_SETUP(&data, ob1, ob2)
*
* After that the following calls can be used:
- * BLI_space_transform_apply(&data, co); // converts a coordinate in ob1 space to the corresponding ob2 space
- * BLI_space_transform_invert(&data, co); // converts a coordinate in ob2 space to the corresponding ob1 space
+ * - #BLI_space_transform_apply(&data, co); // converts a coordinate in ob1 space to the corresponding ob2 space.
+ * - #BLI_space_transform_invert(&data, co); // converts a coordinate in ob2 space to the corresponding ob1 space.
*
- * Same concept as BLI_space_transform_apply and BLI_space_transform_invert, but no is normalized after conversion
+ * Same concept as #BLI_space_transform_apply and #BLI_space_transform_invert, but no is normalized after conversion
* (and not translated at all!):
- * BLI_space_transform_apply_normal(&data, no);
- * BLI_space_transform_invert_normal(&data, no);
+ * - #BLI_space_transform_apply_normal(&data, no);
+ * - #BLI_space_transform_invert_normal(&data, no);
*/
/**
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 0bd09f0c268..dc5ee984c25 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1626,11 +1626,13 @@ bool BLI_ensure_filename(char *filepath, size_t maxlen, const char *filename)
return false;
}
-/* Converts "/foo/bar.txt" to "/foo/" and "bar.txt"
- * - wont change 'string'
- * - wont create any directories
- * - dosnt use CWD, or deal with relative paths.
- * - Only fill's in *dir and *file when they are non NULL
+/**
+ * Converts `/foo/bar.txt` to "/foo/" and `bar.txt`
+ *
+ * - Wont change \a string.
+ * - Wont create any directories.
+ * - Doesn't use CWD, or deal with relative paths.
+ * - Only fill's in \a dir and \a file when they are non NULL.
* */
void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen)
{
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index df2e50233d1..0758af03193 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -839,7 +839,7 @@ void BLI_threaded_malloc_begin(void)
unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
- /* There is a little chance that two threads will meed to acces to a
+ /* There is a little chance that two threads will need to access to a
* scheduler which was not yet created from main thread. which could
* cause scheduler created multiple times.
*/
@@ -874,10 +874,10 @@ static bool check_is_threadripper2_alike_topology(void)
return false;
}
if (strstr(cpu_brand, "Threadripper")) {
- /* NOTE: We consinder all Threadrippers having similar topology to
+ /* NOTE: We consider all Thread-rippers having similar topology to
* the second one. This is because we are trying to utilize NUMA node
* 0 as much as possible. This node does exist on earlier versions of
- * threadripper and setting affinity to it should not have negative
+ * thread-ripper and setting affinity to it should not have negative
* effect.
* This allows us to avoid per-model check, making the code more
* reliable for the CPUs which are not yet released.
@@ -893,7 +893,7 @@ static bool check_is_threadripper2_alike_topology(void)
* up their DR slots, making it only two dies connected to a DDR slot
* with actual memory in it. */
if (strstr(cpu_brand, "EPYC")) {
- /* NOTE: Similarly to Threadripper we do not do model check. */
+ /* NOTE: Similarly to Thread-ripper we do not do model check. */
is_threadripper2 = true;
}
MEM_freeN(cpu_brand);
@@ -913,7 +913,7 @@ static void threadripper_put_process_on_fast_node(void)
* However, if scene fits into memory adjacent to a single die we don't
* want OS to re-schedule the process to another die since that will make
* it further away from memory allocated for .blend file. */
- /* NOTE: Even if NUMA is avasilable in the API but is disabled in BIOS on
+ /* NOTE: Even if NUMA is available in the API but is disabled in BIOS on
* this workstation we still process here. If NUMA is disabled it will be a
* single node, so our action is no-visible-changes, but allows to keep
* things simple and unified. */
@@ -942,7 +942,7 @@ static void threadripper_put_thread_on_fast_node(void)
void BLI_thread_put_process_on_fast_node(void)
{
/* Disabled for now since this causes only 16 threads to be used on a
- * threadripper for computations like sculpting and fluid sim. The problem
+ * thread-ripper for computations like sculpting and fluid sim. The problem
* is that all threads created as children from this thread will inherit
* the NUMA node and so will end up on the same node. This can be fixed
* case-by-case by assigning the NUMA node for every child thread, however
diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c
index b302eaea9de..9c1a51f9be7 100644
--- a/source/blender/blenlib/intern/winstuff_dir.c
+++ b/source/blender/blenlib/intern/winstuff_dir.c
@@ -54,9 +54,10 @@ struct __dirstream {
struct dirent direntry;
};
-/* Note: MinGW (FREE_WINDOWS) has opendir() and _wopendir(), and only the
- * latter accepts a path name of wchar_t type. Rather than messing up with
- * extra #ifdef's here and there, Blender's own implementations of opendir()
+/**
+ * \note MinGW (FREE_WINDOWS) has #opendir() and #_wopendir(), and only the
+ * latter accepts a path name of #wchar_t type. Rather than messing up with
+ * extra #ifdef's here and there, Blender's own implementations of #opendir()
* and related functions are used to properly support paths with non-ASCII
* characters. (kjym3)
*/
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index b9bec1b97b3..26d1ee14856 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -67,6 +67,9 @@ set(SRC
intern/readfile.h
)
+set(LIB
+)
+
if(WITH_BUILDINFO)
add_definitions(-DWITH_BUILDINFO)
endif()
@@ -92,7 +95,7 @@ if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
endif()
-blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# needed so writefile.c can use dna_type_offsets.h
add_dependencies(bf_blenloader bf_dna)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6c4049ec295..2543271e691 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1628,7 +1628,7 @@ bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, cha
*
* \param filepath: The path of the file to extract thumbnail from.
* \return The raw thumbnail
- * (MEM-allocated, as stored in file, use BKE_main_thumbnail_to_imbuf() to convert it to ImBuf image).
+ * (MEM-allocated, as stored in file, use #BKE_main_thumbnail_to_imbuf() to convert it to ImBuf image).
*/
BlendThumbnail *BLO_thumbnail_from_file(const char *filepath)
{
@@ -7170,7 +7170,7 @@ static void direct_link_area(FileData *fd, ScrArea *area)
direct_link_gpencil(fd, v3d->gpd);
}
v3d->localvd = newdataadr(fd, v3d->localvd);
- v3d->properties_storage = NULL;
+ v3d->runtime.properties_storage = NULL;
/* render can be quite heavy, set to solid on load */
if (v3d->shading.type == OB_RENDER) {
@@ -8171,7 +8171,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
/* Now, since Blender always expect **latest** Main pointer from fd->mainlist to be the active library
* Main pointer, where to add all non-library data-blocks found in file next, we have to switch that
* 'dupli' found Main to latest position in the list!
- * Otherwise, you get weird disappearing linked data on a rather unconsistant basis.
+ * Otherwise, you get weird disappearing linked data on a rather inconsistent basis.
* See also T53977 for reproducible case. */
BLI_remlink(fd->mainlist, newmain);
BLI_addtail(fd->mainlist, newmain);
@@ -8930,7 +8930,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const int ta
/* In undo case, most libs and linked data should be kept as is from previous state (see BLO_read_from_memfile).
* However, some needed by the snapshot being read may have been removed in previous one, and would go missing.
- * This leads e.g. to desappearing objects in some undo/redo case, see T34446.
+ * This leads e.g. to disappearing objects in some undo/redo case, see T34446.
* That means we have to carefully check whether current lib or libdata already exits in old main, if it does
* we merely copy it over into new main area, otherwise we have to do a full read of that bhead... */
if (fd->memfile && ELEM(bhead->code, ID_LI, ID_LINK_PLACEHOLDER)) {
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 25ada2fd13e..ce2345b44db 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -564,6 +564,36 @@ static void do_version_collection_propagate_lib_to_children(Collection *collecti
}
}
+/** convert old annotations colors */
+static void do_versions_fix_annotations(bGPdata *gpd)
+{
+ for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
+ for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
+ /* fix layers */
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* unlock/unhide layer */
+ gpl->flag &= ~GP_LAYER_LOCKED;
+ gpl->flag &= ~GP_LAYER_HIDE;
+ /* set opacity to 1 */
+ gpl->opacity = 1.0f;
+ /* disable tint */
+ gpl->tintcolor[3] = 0.0f;
+
+ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ if ((gps->colorname[0] != '\0') &&
+ (STREQ(gps->colorname, palcolor->info)))
+ {
+ /* copy color settings */
+ copy_v4_v4(gpl->color, palcolor->color);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
void do_versions_after_linking_280(Main *bmain)
{
bool use_collection_compat_28 = true;
@@ -657,6 +687,30 @@ void do_versions_after_linking_280(Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *space = sa->spacedata.first; space; space = space->next) {
+ if (space->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)space;
+ if ((sima) && (sima->gpd)) {
+ sima->gpd->flag |= GP_DATA_ANNOTATIONS;
+ do_versions_fix_annotations(sima->gpd);
+ }
+ }
+ if (space->spacetype == SPACE_CLIP) {
+ SpaceClip *spclip = (SpaceClip *)space;
+ MovieClip *clip = spclip->clip;
+ if ((clip) && (clip->gpd)) {
+ clip->gpd->flag |= GP_DATA_ANNOTATIONS;
+ do_versions_fix_annotations(clip->gpd);
+ }
+ }
+ }
+ }
+ }
+ }
+
/* New workspace design */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
do_version_workspaces_after_lib_link(bmain);
@@ -1776,12 +1830,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
- if (scene->toolsettings->gizmo_flag == 0) {
- scene->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
- }
- }
-
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
@@ -2995,15 +3043,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- {
- /* Versioning code until next subversion bump goes here. */
-
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 55)) {
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_TEXT) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
ARegion *ar = MEM_callocN(sizeof(ARegion), "footer for text");
+
+ /* Remove multiple footers that were added by mistake. */
+ ARegion *ar_footer, *ar_next;
+ for (ar_footer = regionbase->first; ar_footer; ar_footer = ar_next) {
+ ar_next = ar_footer->next;
+ if (ar_footer->regiontype == RGN_TYPE_FOOTER) {
+ BLI_freelinkN(regionbase, ar_footer);
+ }
+ }
+
+ /* Add footer. */
ARegion *ar_header = NULL;
for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
@@ -3022,4 +3079,40 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 56)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->gizmo_show_armature = V3D_GIZMO_SHOW_ARMATURE_BBONE | V3D_GIZMO_SHOW_ARMATURE_ROLL;
+ v3d->gizmo_show_empty = V3D_GIZMO_SHOW_EMPTY_IMAGE | V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD;
+ v3d->gizmo_show_light = V3D_GIZMO_SHOW_LIGHT_SIZE | V3D_GIZMO_SHOW_LIGHT_LOOK_AT;
+ v3d->gizmo_show_camera = V3D_GIZMO_SHOW_CAMERA_LENS | V3D_GIZMO_SHOW_CAMERA_DOF_DIST;
+ }
+ }
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 57)) {
+ /* Enable Show Interpolation in dopesheet by default. */
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_ACTION) {
+ SpaceAction *saction = (SpaceAction *)sl;
+ if ((saction->flag & SACTION_SHOW_EXTREMES) == 0) {
+ saction->flag |= SACTION_SHOW_INTERPOLATION;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ {
+ /* Versioning code until next subversion bump goes here. */
+ }
}
diff --git a/source/blender/blentranslation/CMakeLists.txt b/source/blender/blentranslation/CMakeLists.txt
index fa3f8c47bee..2a397af051d 100644
--- a/source/blender/blentranslation/CMakeLists.txt
+++ b/source/blender/blentranslation/CMakeLists.txt
@@ -39,6 +39,9 @@ set(SRC
BLT_translation.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -56,7 +59,7 @@ if(WIN32)
endif()
endif()
-blender_add_lib(bf_blentranslation "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_blentranslation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_INTERNATIONAL)
add_subdirectory(msgfmt)
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 631886ac86e..be6c819bc1f 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -163,6 +163,9 @@ set(SRC
bmesh_tools.h
)
+set(LIB
+)
+
if(MSVC AND NOT MSVC_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX /wd4101")
endif()
@@ -182,4 +185,4 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp
index afc37191e2e..7e504a0e745 100644
--- a/source/blender/collada/BCAnimationSampler.cpp
+++ b/source/blender/collada/BCAnimationSampler.cpp
@@ -395,9 +395,9 @@ void BCAnimationSampler::generate_transforms(Object *ob, Bone *bone, BCAnimation
}
/**
- * Collect all keyframes from all animation curves related to the object
- * The bc_get... functions check for NULL and correct object type
- * The add_keyframes_from() function checks for NULL
+ * Collect all keyframes from all animation curves related to the object.
+ * The bc_get... functions check for NULL and correct object type.
+ * The #add_keyframes_from() function checks for NULL.
*/
void BCAnimationSampler::initialize_keyframes(BCFrameSet &frameset, Object *ob)
{
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 41178b542eb..7a02068f42d 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -125,6 +125,9 @@ set(SRC
collada_utils.h
)
+set(LIB
+)
+
if(WITH_BUILDINFO)
add_definitions(-DWITH_BUILDINFO)
endif()
@@ -138,4 +141,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
-blender_add_lib(bf_collada "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_collada "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 306c06c4576..67e7afefcd3 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -539,6 +539,9 @@ set(SRC
operations/COM_MaskOperation.h
)
+set(LIB
+)
+
list(APPEND INC
${CMAKE_CURRENT_BINARY_DIR}/operations
)
@@ -552,4 +555,4 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 18674a85654..5c8432e1043 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -110,6 +110,9 @@ set(SRC
intern/depsgraph_update.h
)
+set(LIB
+)
+
if(WITH_BOOST)
list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
@@ -117,4 +120,4 @@ if(WITH_BOOST)
add_definitions(-DHAVE_BOOST_FUNCTION_BINDINGS)
endif()
-blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index 35652ebb53e..9fd4a8dc802 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -172,7 +172,8 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
BUILD,
"\nStarting IK Build: pchan = %s, target = (%s, %s), "
"segcount = %d\n",
- pchan->name, data->tar->id.name, data->subtarget, data->rootbone);
+ pchan->name, data->tar ? data->tar->id.name : "NULL",
+ data->subtarget, data->rootbone);
bPoseChannel *parchan = pchan;
/* Exclude tip from chain if needed. */
if (!(data->flag & CONSTRAINT_IK_TIP)) {
@@ -260,8 +261,11 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
RELATION_FLAG_GODMODE);
/* Attach path dependency to solver. */
if (data->tar != NULL) {
- ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY);
- add_relation(target_key, init_ik_key, "Curve.Path -> Spline IK");
+ ComponentKey target_geometry_key(&data->tar->id, NodeType::GEOMETRY);
+ add_relation(target_geometry_key, solver_key, "Curve.Path -> Spline IK");
+ ComponentKey target_transform_key(&data->tar->id, NodeType::TRANSFORM);
+ add_relation(target_transform_key, solver_key, "Curve.Transform -> Spline IK");
+ add_special_eval_flag(&data->tar->id, DAG_EVAL_NEED_CURVE_PATH);
}
pchan->flag |= POSE_DONE;
OperationKey final_transforms_key(
@@ -269,41 +273,27 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
add_relation(solver_key, final_transforms_key, "Spline IK Result");
root_map->add_bone(pchan->name, rootchan->name);
/* Walk to the chain's root/ */
- int segcount = 0;
+ int segcount = 1;
for (bPoseChannel *parchan = pchan->parent;
- parchan != NULL;
- parchan = parchan->parent)
+ parchan != NULL && segcount < data->chainlen;
+ parchan = parchan->parent, segcount++)
{
/* Make Spline IK solver dependent on this bone's result, since it can
* only run after the standard results of the bone are know. Validate
* links step on the bone will ensure that users of this bone only grab
* the result with IK solver results. */
- if (parchan != pchan) {
- OperationKey parent_key(&object->id,
- NodeType::BONE,
- parchan->name,
- OperationCode::BONE_READY);
- add_relation(parent_key, solver_key, "Spline IK Solver Update");
- OperationKey bone_done_key(&object->id,
- NodeType::BONE,
- parchan->name,
- OperationCode::BONE_DONE);
- add_relation(solver_key, bone_done_key, "IK Chain Result");
- }
+ OperationKey parent_key(&object->id,
+ NodeType::BONE,
+ parchan->name,
+ OperationCode::BONE_READY);
+ add_relation(parent_key, solver_key, "Spline IK Solver Update");
+ OperationKey bone_done_key(&object->id,
+ NodeType::BONE,
+ parchan->name,
+ OperationCode::BONE_DONE);
+ add_relation(solver_key, bone_done_key, "Spline IK Solver Result");
parchan->flag |= POSE_DONE;
- OperationKey final_transforms_key(&object->id,
- NodeType::BONE,
- parchan->name,
- OperationCode::BONE_DONE);
- add_relation(
- solver_key, final_transforms_key, "Spline IK Solver Result");
root_map->add_bone(parchan->name, rootchan->name);
- /* TODO(sergey): This is an arbitrary value, which was just following
- * old code convention. */
- segcount++;
- if ((segcount == data->chainlen) || (segcount > 255)) {
- break;
- }
}
OperationKey pose_done_key(
&object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index f6887af63f2..daa599b6972 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -472,8 +472,8 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
{
for (DEG::IDNode *id_node : graph->id_nodes) {
if (!id_node->visible_components_mask) {
- /* ID has no components which affects anything visible. no meed
- * bother with it to tag or anything. */
+ /* ID has no components which affects anything visible.
+ * No need bother with it to tag or anything. */
continue;
}
if (id_node->visible_components_mask ==
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 0d60defa9b6..387253ab3fe 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -697,6 +697,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
update_pose_orig_pointers(object_orig->pose,
object_cow->pose);
}
+ BKE_pose_pchan_index_rebuild(object_cow->pose);
}
update_particles_after_copy(object_orig, object_cow);
update_modifiers_orig_pointers(object_orig, object_cow);
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 3ac606fc48f..fe9b3d1f629 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -151,6 +151,9 @@ set(SRC
engines/workbench/workbench_private.h
)
+set(LIB
+)
+
data_to_c_simple(engines/eevee/shaders/ambient_occlusion_lib.glsl SRC)
data_to_c_simple(engines/eevee/shaders/default_frag.glsl SRC)
data_to_c_simple(engines/eevee/shaders/default_world_frag.glsl SRC)
@@ -355,4 +358,4 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 32ec54b1ca6..94e0231c5fe 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1551,7 +1551,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
*/
bool use_volume_material = (gpumat_array[0] && GPU_material_use_domain_volume(gpumat_array[0]));
- if (DRW_state_is_image_render() || ob->dt >= OB_SOLID) {
+ if ((ob->dt >= OB_SOLID) || DRW_state_is_image_render()) {
/* Get per-material split surface */
char *auto_layer_names;
int *auto_layer_is_srgb;
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index cf3025302ef..972ada22b50 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -31,6 +31,7 @@
#include "BKE_library.h"
#include "BKE_gpencil.h"
+#include "BKE_object.h"
#include "gpencil_engine.h"
@@ -38,7 +39,33 @@
#include "DEG_depsgraph.h"
- /* add a gpencil object to cache to defer drawing */
+/* verify if exist a non instanced version of the object */
+static bool gpencil_has_noninstanced_object(Object *ob_instance)
+{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const ViewLayer *view_layer = draw_ctx->view_layer;
+ Object *ob = NULL;
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ ob = base->object;
+ if (ob->type != OB_GPENCIL) {
+ continue;
+ }
+ /* object must be visible (invisible objects don't create VBO data) */
+ if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
+ continue;
+ }
+ /* is not duplicated and the name is equals */
+ if ((ob->base_flag & BASE_FROM_DUPLI) == 0) {
+ if (STREQ(ob->id.name, ob_instance->id.name)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/* add a gpencil object to cache to defer drawing */
tGPencilObjectCache *gpencil_object_cache_add(
tGPencilObjectCache *cache_array, Object *ob,
int *gp_cache_size, int *gp_cache_used)
@@ -76,7 +103,18 @@ tGPencilObjectCache *gpencil_object_cache_add(
cache_elem->idx = *gp_cache_used;
/* object is duplicated (particle) */
- cache_elem->is_dup_ob = ob->base_flag & BASE_FROM_DUPLI;
+ if (ob->base_flag & BASE_FROM_DUPLI) {
+ /* Check if the original object is not in the viewlayer
+ * and cannot be managed as dupli. This is slower, but required to keep
+ * the particle drawing FPS and display instanced objects in scene
+ * without the original object */
+ bool has_original = gpencil_has_noninstanced_object(ob);
+ cache_elem->is_dup_ob = (has_original) ? ob->base_flag & BASE_FROM_DUPLI : false;
+ }
+ else {
+ cache_elem->is_dup_ob = false;
+ }
+
cache_elem->scale = mat4_to_scale(ob->obmat);
/* save FXs */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 475a083ac97..6aefd2a69c5 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1355,7 +1355,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
float obscale = mat4_to_scale(ob->obmat);
/* use the brush material */
- Material *ma = BKE_gpencil_get_material_for_brush(ob, brush);
+ Material *ma = BKE_gpencil_object_material_get_from_brush(ob, brush);
if (ma != NULL) {
gp_style = ma->gp_style;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index c5546a55dda..d1a8f40a428 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -316,7 +316,7 @@ void GPENCIL_cache_init(void *vedata)
if (obact && (obact->type == OB_GPENCIL) && (obact->data)) {
obact_gpd = (bGPdata *)obact->data;
/* use the brush material */
- Material *ma = BKE_gpencil_get_material_for_brush(obact, brush);
+ Material *ma = BKE_gpencil_object_material_get_from_brush(obact, brush);
if (ma != NULL) {
gp_style = ma->gp_style;
}
@@ -405,7 +405,7 @@ void GPENCIL_cache_init(void *vedata)
/* xray mode */
if (v3d) {
- stl->storage->is_xray = (v3d->shading.flag & V3D_XRAY_FLAG(v3d)) ? 1 : 0;
+ stl->storage->is_xray = XRAY_ACTIVE(v3d);
}
else {
stl->storage->is_xray = 0;
@@ -620,7 +620,8 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
/* enable instance loop */
if (!stl->g_data->do_instances) {
- stl->g_data->do_instances = ob->base_flag & BASE_FROM_DUPLI;
+ tGPencilObjectCache *cache_ob = &stl->g_data->gp_object_cache[stl->g_data->gp_cache_used - 1];
+ stl->g_data->do_instances = cache_ob->is_dup_ob;
}
/* load drawing data */
@@ -642,7 +643,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
if ((draw_ctx->obact == ob) &&
- ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar)))
+ ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar)))
{
DRW_gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob);
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
index 1ebb6797f63..aa38ff26a62 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
@@ -84,6 +84,9 @@ void main(void)
if (sp2.x < -area.x || sp2.x > area.x) return;
if (sp2.y < -area.y || sp2.y > area.y) return;
+ /* culling behind camera */
+ if (P1.w < 0 || P2.w < 0) return;
+
/* determine the direction of each of the 3 segments (previous, current, next) */
vec2 v0 = normalize(sp1 - sp0);
vec2 v1 = normalize(sp2 - sp1);
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index f75d385714f..482d7178cb7 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -897,7 +897,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
return;
}
- if (!DRW_state_is_image_render() && ob->dt < OB_SOLID) {
+ if ((ob->dt < OB_SOLID) && !DRW_state_is_image_render()) {
return;
}
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 45f1c632a05..fe8a341bf3e 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -38,6 +38,7 @@
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
+#include "ED_view3d.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
@@ -307,11 +308,12 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
workbench_private_data_get_light_direction(wpd, light_direction);
if (!e_data.checker_depth_sh) {
- workbench_forward_outline_shaders_ensure(wpd, draw_ctx->sh_cfg);
-
e_data.checker_depth_sh = DRW_shader_create_fullscreen(
datatoc_workbench_checkerboard_depth_frag_glsl, NULL);
}
+
+ workbench_forward_outline_shaders_ensure(wpd, draw_ctx->sh_cfg);
+
workbench_volume_engine_init();
workbench_fxaa_engine_init();
workbench_taa_engine_init(vedata);
@@ -381,7 +383,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
/* TODO(campbell): displays but masks geometry,
* only use with wire or solid-without-xray for now. */
- if (((wpd->shading.type != OB_WIRE && XRAY_FLAG(wpd) == 0)) &&
+ if ((wpd->shading.type != OB_WIRE && !XRAY_FLAG_ENABLED(wpd)) &&
(draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb))
{
psl->background_pass = DRW_pass_create(
@@ -407,7 +409,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
noise_offset = fmodf(noise_offset + 1.0f / 8.0f, 1.0f);
}
- if (wpd->shading.flag & XRAY_FLAG(wpd)) {
+ if (XRAY_FLAG_ENABLED(wpd)) {
blend_threshold = 1.0f - XRAY_ALPHA(wpd) * 0.9f;
}
diff --git a/source/blender/draw/engines/workbench/workbench_render.c b/source/blender/draw/engines/workbench/workbench_render.c
index c551a369b58..663727285a1 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -28,6 +28,8 @@
#include "DRW_render.h"
+#include "ED_view3d.h"
+
#include "GPU_shader.h"
#include "DEG_depsgraph.h"
@@ -135,7 +137,7 @@ void workbench_render(WORKBENCH_Data *data, RenderEngine *engine, RenderLayer *r
return;
}
- const bool deferred = (scene->display.shading.flag & XRAY_FLAG(&scene->display)) == 0;
+ const bool deferred = !XRAY_FLAG_ENABLED(&scene->display);
if (deferred) {
/* Init engine. */
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 3d4618021e8..ce75cc0f05d 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -598,8 +598,4 @@ typedef struct DRWContextState {
const DRWContextState *DRW_context_state_get(void);
-#define XRAY_ALPHA(v3d) (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha)
-#define XRAY_FLAG(v3d) (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
-#define XRAY_ENABLED(v3d) ((((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0) && (XRAY_ALPHA(v3d) < 1.0f))
-
#endif /* __DRW_RENDER_H__ */
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 76a48260fc2..06013bad7c0 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -1079,7 +1079,7 @@ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_S
param.curveOutX = ebone->curveOutX;
param.curveOutY = ebone->curveOutY;
- ebone->segments = BKE_pchan_bbone_spline_compute(&param, (Mat4 *)result_array);
+ ebone->segments = BKE_pchan_bbone_spline_compute(&param, false, (Mat4 *)result_array);
}
static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pchan)
@@ -1118,12 +1118,7 @@ static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pc
if (pchan) {
Mat4 *bbones_mat = (Mat4 *)pchan->draw_data->bbone_matrix;
if (bbone_segments > 1) {
- if (bbone_segments == pchan->runtime.bbone_segments) {
- memcpy(bbones_mat, pchan->runtime.bbone_pose_mats, sizeof(Mat4) * bbone_segments);
- }
- else {
- BKE_pchan_bbone_spline_setup(pchan, false, bbones_mat);
- }
+ BKE_pchan_bbone_spline_setup(pchan, false, false, bbones_mat);
for (int i = bbone_segments; i--; bbones_mat++) {
mul_m4_m4m4(bbones_mat->mat, bbones_mat->mat, s);
@@ -1246,8 +1241,8 @@ static void draw_points(
Bone *bone = pchan->bone;
if (is_envelope_draw) {
drw_shgroup_bone_envelope(
- pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root,
- &bone->rad_head, &envelope_ignore, sh_cfg);
+ pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root,
+ &bone->rad_head, &envelope_ignore, sh_cfg);
}
else {
drw_shgroup_bone_point(pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root, sh_cfg);
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 0256564ffb5..717fd69149c 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3808,10 +3808,11 @@ void drw_batch_cache_generate_requested(Object *ob)
const enum eContextObjectMode mode = CTX_data_mode_enum_ex(
draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
+
const bool use_hide = (
(ob->type == OB_MESH) &&
((is_paint_mode && (ob == draw_ctx->obact) &&
- (BKE_paint_select_face_test(ob) || BKE_paint_select_vert_test(ob))) ||
+ DRW_object_use_hide_faces(ob)) ||
((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
struct Mesh *mesh_eval = ob->runtime.mesh_eval;
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c
index 29fc5478072..9dbf8af0372 100644
--- a/source/blender/draw/intern/draw_cache_impl_displist.c
+++ b/source/blender/draw/intern/draw_cache_impl_displist.c
@@ -598,9 +598,9 @@ static void set_edge_adjacency_lines_indices(EdgeHash *eh, GPUIndexBufBuilder *e
static void set_edges_adjacency_lines_indices(void *thunk, uint v1, uint v2, uint v3)
{
void **packed = (void **)thunk;
- GPUIndexBufBuilder *elb = (GPUIndexBufBuilder*)packed[0];
+ GPUIndexBufBuilder *elb = (GPUIndexBufBuilder *)packed[0];
EdgeHash *eh = (EdgeHash *)packed[1];
- bool *r_is_manifold = (bool*)packed[2];
+ bool *r_is_manifold = (bool *)packed[2];
set_edge_adjacency_lines_indices(eh, elb, r_is_manifold, v1, v2, v3);
set_edge_adjacency_lines_indices(eh, elb, r_is_manifold, v2, v3, v1);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 5643d23c7cd..e35a191cad5 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -982,11 +982,13 @@ static MeshRenderData *mesh_render_data_create_ex(
CustomData_free_layers(cd_ldata, CD_MLOOPTANGENT, rdata->loop_len);
if (rdata->cd.layers.uv_len != 0) {
+ int act_uv = rdata->cd.layers.uv_active;
for (int i_src = 0, i_dst = 0; i_src < cd_layers_src.uv_len; i_src++, i_dst++) {
if ((cd_used->uv & (1 << i_src)) == 0) {
+ /* This is a non-used UV slot. Skip. */
i_dst--;
if (rdata->cd.layers.uv_active >= i_src) {
- rdata->cd.layers.uv_active--;
+ act_uv--;
}
}
else {
@@ -1002,6 +1004,10 @@ static MeshRenderData *mesh_render_data_create_ex(
BLI_snprintf(rdata->cd.uuid.auto_mix[i_dst], sizeof(*rdata->cd.uuid.auto_mix), "a%u", hash);
}
}
+ if (rdata->cd.layers.uv_active != -1) {
+ /* Actual active UV slot inside uv layers used for shading. */
+ rdata->cd.layers.uv_active = act_uv;
+ }
}
if (rdata->cd.layers.tangent_len != 0) {
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index cde7b283976..699ac8d5b0b 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -200,7 +200,7 @@ bool DRW_object_is_flat_normal(const Object *ob)
bool DRW_object_use_hide_faces(const struct Object *ob)
{
if (ob->type == OB_MESH) {
- const Mesh *me = DEG_get_original_object((Object *)ob)->data;
+ const Mesh *me = ob->data;
switch (ob->mode) {
case OB_MODE_TEXTURE_PAINT:
@@ -1581,9 +1581,7 @@ void DRW_draw_render_loop_ex(
if (DST.draw_ctx.evil_C) {
/* needed so gizmo isn't obscured */
- if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
- ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0))
- {
+ if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
glDisable(GL_DEPTH_TEST);
DRW_draw_gizmo_3d();
}
@@ -1601,7 +1599,7 @@ void DRW_draw_render_loop_ex(
GPU_depth_test(true);
}
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) {
+ if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
/* Draw 2D after region info so we can draw on top of the camera passepartout overlay.
* 'DRW_draw_region_info' sets the projection in pixel-space. */
GPU_depth_test(false);
diff --git a/source/blender/draw/modes/edit_armature_mode.c b/source/blender/draw/modes/edit_armature_mode.c
index 68f091da797..e2af2f10779 100644
--- a/source/blender/draw/modes/edit_armature_mode.c
+++ b/source/blender/draw/modes/edit_armature_mode.c
@@ -26,6 +26,8 @@
#include "DNA_armature_types.h"
#include "DNA_view3d_types.h"
+#include "ED_view3d.h"
+
#include "draw_common.h"
#include "draw_mode_engines.h"
@@ -112,8 +114,7 @@ static void EDIT_ARMATURE_cache_populate(void *vedata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
int ghost = (ob->dtx & OB_DRAWXRAY) ? 1 : 0;
- bool transp = (stl->g_data->transparent_bones || (ob->dt <= OB_WIRE)) ||
- (draw_ctx->v3d->shading.flag & XRAY_FLAG(draw_ctx->v3d)) != 0;
+ bool transp = (stl->g_data->transparent_bones || (ob->dt <= OB_WIRE)) || XRAY_FLAG_ENABLED(draw_ctx->v3d);
DRWArmaturePasses passes = {
.bone_solid = (transp) ? psl->bone_transp[ghost] : psl->bone_solid[ghost],
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index 71c759d47a5..dedf7eac00a 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -43,6 +43,8 @@
#include "BLI_dynstr.h"
#include "BLI_string_utils.h"
+#include "ED_view3d.h"
+
extern char datatoc_paint_weight_vert_glsl[];
extern char datatoc_paint_weight_frag_glsl[];
@@ -385,7 +387,7 @@ static void EDIT_MESH_cache_init(void *vedata)
stl->g_data->do_faces = true;
stl->g_data->do_edges = true;
- stl->g_data->do_zbufclip = ((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0;
+ stl->g_data->do_zbufclip = XRAY_FLAG_ENABLED(v3d);
stl->g_data->data_mask[0] = 0xFF; /* Face Flag */
stl->g_data->data_mask[1] = 0xFF; /* Edge Flag */
@@ -740,7 +742,7 @@ static void EDIT_MESH_draw_scene(void *vedata)
DRW_draw_pass(psl->normals);
DRW_draw_pass(psl->edit_face_overlay);
- if (v3d->shading.type == OB_SOLID && (v3d->shading.flag & XRAY_FLAG(v3d)) == 0 &&
+ if (v3d->shading.type == OB_SOLID && !XRAY_FLAG_ENABLED(v3d) &&
stl->g_data->ghost_ob == 1 && stl->g_data->edit_ob == 1)
{
/* In the case of single ghost object edit (common case for retopology):
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 563d1267885..7b6519a6863 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1011,8 +1011,7 @@ static void OBJECT_cache_init(void *vedata)
}
g_data = stl->g_data;
- g_data->xray_enabled = XRAY_ENABLED(draw_ctx->v3d) &&
- (draw_ctx->v3d->shading.type < OB_MATERIAL);
+ g_data->xray_enabled = XRAY_ACTIVE(draw_ctx->v3d);
g_data->xray_enabled_and_not_wire = g_data->xray_enabled && draw_ctx->v3d->shading.type > OB_WIRE;
{
@@ -1841,8 +1840,7 @@ static void camera_view3d_reconstruction(
BLI_assert(BLI_listbase_is_empty(&sgl->camera_path));
const bool is_solid_bundle = (v3d->bundle_drawtype == OB_EMPTY_SPHERE) &&
- ((v3d->shading.type != OB_SOLID) ||
- ((v3d->shading.flag & XRAY_FLAG(v3d)) == 0));
+ ((v3d->shading.type != OB_SOLID) || !XRAY_FLAG_ENABLED(v3d));
MovieTracking *tracking = &clip->tracking;
/* Index must start in 1, to mimic BKE_tracking_track_get_indexed. */
@@ -2988,7 +2986,11 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
(draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0) &&
((DRW_object_is_renderable(ob) && (ob->dt > OB_WIRE)) || (ob->dt == OB_WIRE)));
const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
- const bool hide_object_extra = (v3d->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) != 0;
+ const bool hide_object_extra = (
+ (v3d->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) != 0 &&
+ /* Show if this is the camera we're looking through
+ * since it's useful for moving the camera. */
+ (((rv3d->persp == RV3D_CAMOB) && ((ID *)v3d->camera == ob->id.orig_id)) == 0));
if (do_outlines) {
if (!BKE_object_is_in_editmode(ob) &&
@@ -3152,8 +3154,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
bArmature *arm = ob->data;
if (arm->edbo == NULL) {
if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) {
- bool is_wire = (v3d->shading.type == OB_WIRE) || (ob->dt <= OB_WIRE) ||
- (v3d->shading.flag & XRAY_FLAG(v3d)) != 0;
+ bool is_wire = (v3d->shading.type == OB_WIRE) || (ob->dt <= OB_WIRE) || XRAY_FLAG_ENABLED(v3d);
DRWArmaturePasses passes = {
.bone_solid = (is_wire) ? NULL : sgl->bone_solid,
.bone_outline = sgl->bone_outline,
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index 52e8f73f971..f2cafd51666 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -34,6 +34,8 @@
#include "GPU_shader.h"
#include "DRW_render.h"
+#include "ED_view3d.h"
+
#include "draw_mode_engines.h"
#ifdef __APPLE__
@@ -421,7 +423,7 @@ static void overlay_cache_finish(void *vedata)
View3D *v3d = ctx->v3d;
/* only in solid mode */
- if (v3d->shading.type == OB_SOLID && (v3d->shading.flag & XRAY_FLAG(v3d)) == 0) {
+ if (v3d->shading.type == OB_SOLID && !XRAY_FLAG_ENABLED(v3d)) {
if (stl->g_data->ghost_stencil_test) {
DRW_pass_state_add(psl->face_wireframe_pass, DRW_STATE_STENCIL_EQUAL);
}
diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c
index c4050bf3f1a..c445335b587 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -27,6 +27,8 @@
#include "DRW_engine.h"
#include "DRW_render.h"
+#include "ED_view3d.h"
+
/* If builtin shaders are needed */
#include "GPU_shader.h"
@@ -34,11 +36,13 @@
#include "draw_mode_engines.h"
/* *********** LISTS *********** */
-/* All lists are per viewport specific datas.
+/**
+ * All lists are per viewport specific datas.
* They are all free when viewport changes engines
- * or is free itself. Use POSE_engine_init() to
- * initialize most of them and POSE_cache_init()
- * for POSE_PassList */
+ * or is free itself. Use #POSE_engine_init() to
+ * initialize most of them and #POSE_cache_init()
+ * for #POSE_PassList
+ */
typedef struct POSE_PassList {
struct DRWPass *bone_solid[2];
@@ -198,8 +202,7 @@ static void POSE_cache_populate(void *vedata, Object *ob)
}
if (DRW_pose_mode_armature(ob, draw_ctx->obact)) {
int ghost = (ob->dtx & OB_DRAWXRAY) ? 1 : 0;
- bool transp = (ppd->transparent_bones || (ob->dt <= OB_WIRE)) ||
- (draw_ctx->v3d->shading.flag & XRAY_FLAG(draw_ctx->v3d)) != 0;
+ bool transp = (ppd->transparent_bones || (ob->dt <= OB_WIRE)) || XRAY_FLAG_ENABLED(draw_ctx->v3d);
DRWArmaturePasses passes = {
.bone_solid = (transp) ? psl->bone_transp[ghost] : psl->bone_solid[ghost],
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 933b4815175..14936e5bc2a 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -53,6 +53,9 @@ set(SRC
anim_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -63,4 +66,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 618ac8f6f13..1bddc6268b5 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -734,7 +734,7 @@ static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
- return SELECT;
+ return BASE_SELECTED;
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = 1;
@@ -766,7 +766,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings se
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
- return GET_ACF_FLAG_PTR(ob->flag, type);
+ return GET_ACF_FLAG_PTR(base->flag, type);
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index af1fd0e31c4..4661d19378a 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -38,6 +38,8 @@ extern ListBase builtin_keyingsets;
*/
void ANIM_OT_keyframe_insert(struct wmOperatorType *ot);
void ANIM_OT_keyframe_delete(struct wmOperatorType *ot);
+void ANIM_OT_keyframe_insert_by_name(struct wmOperatorType *ot);
+void ANIM_OT_keyframe_delete_by_name(struct wmOperatorType *ot);
/* Main Keyframe Management operators:
* These handle keyframes management from various spaces. They will handle the menus
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index b4e60d29a40..2287f2e0347 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -505,6 +505,8 @@ void ED_operatortypes_anim(void)
WM_operatortype_append(ANIM_OT_keyframe_insert_button);
WM_operatortype_append(ANIM_OT_keyframe_delete_button);
WM_operatortype_append(ANIM_OT_keyframe_clear_button);
+ WM_operatortype_append(ANIM_OT_keyframe_insert_by_name);
+ WM_operatortype_append(ANIM_OT_keyframe_delete_by_name);
WM_operatortype_append(ANIM_OT_driver_button_add);
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index d186a0bb757..c9e672a111d 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -64,9 +64,10 @@
/* **************************************************** */
-/* Only delete the nominated keyframe from provided F-Curve.
+/**
+ * Only delete the nominated keyframe from provided F-Curve.
* Not recommended to be used many times successively. For that
- * there is delete_fcurve_keys().
+ * there is #delete_fcurve_keys().
*/
void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
{
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 4cea8ddbf74..bc630040fdd 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -80,6 +80,8 @@
#include "anim_intern.h"
+static KeyingSet *keyingset_get_from_op_with_error(wmOperator *op, PropertyRNA *prop, Scene *scene);
+
/* ************************************************** */
/* Keyframing Setting Wrangling */
@@ -447,13 +449,13 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
}
/**
- * This function is a wrapper for insert_bezt_fcurve_internal(), and should be used when
+ * This function is a wrapper for #insert_bezt_fcurve(), and should be used when
* adding a new keyframe to a curve, when the keyframe doesn't exist anywhere else yet.
* It returns the index at which the keyframe was added.
*
- * \param keyframe_type: The type of keyframe (eBezTriple_KeyframeType)
+ * \param keyframe_type: The type of keyframe (#eBezTriple_KeyframeType).
* \param flag: Optional flags (eInsertKeyFlags) for controlling how keys get added
- * and/or whether updates get done
+ * and/or whether updates get done.
*/
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
{
@@ -1587,26 +1589,12 @@ static int insert_key_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
bool ob_edit_mode = false;
- KeyingSet *ks = NULL;
- int type = RNA_enum_get(op->ptr, "type");
+
float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
- /* type is the Keying Set the user specified to use when calling the operator:
- * - type == 0: use scene's active Keying Set
- * - type > 0: use a user-defined Keying Set from the active scene
- * - type < 0: use a builtin Keying Set
- */
- if (type == 0)
- type = scene->active_keyingset;
- if (type > 0)
- ks = BLI_findlink(&scene->keyingsets, type - 1);
- else
- ks = BLI_findlink(&builtin_keyingsets, -type - 1);
-
- /* report failures */
+ KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene);
if (ks == NULL) {
- BKE_report(op->reports, RPT_ERROR, "No active keying set");
return OPERATOR_CANCELLED;
}
@@ -1677,6 +1665,36 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
+/* Clone of 'ANIM_OT_keyframe_insert' which uses a name for the keying set instead of an enum. */
+void ANIM_OT_keyframe_insert_by_name(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Insert Keyframe (by name)";
+ ot->idname = "ANIM_OT_keyframe_insert_by_name";
+ ot->description = "Alternate access to 'Insert Keyframe' for keymaps to use";
+
+ /* callbacks */
+ ot->exec = insert_key_exec;
+ ot->poll = modify_key_op_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* keyingset to use (idname) */
+ prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, "", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop = prop;
+
+ /* confirm whether a keyframe was added by showing a popup
+ * - by default, this is enabled, since this operator is assumed to be called independently
+ */
+ prop = RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert",
+ "Show a popup when the keyframes get successfully added");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+}
+
/* Insert Key Operator (With Menu) ------------------------ */
/* This operator checks if a menu should be shown for choosing the KeyingSet to use,
* then calls the menu if necessary before
@@ -1752,22 +1770,36 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
static int delete_key_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- KeyingSet *ks = NULL;
- int type = RNA_enum_get(op->ptr, "type");
float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
- /* type is the Keying Set the user specified to use when calling the operator:
- * - type == 0: use scene's active Keying Set
- * - type > 0: use a user-defined Keying Set from the active scene
- * - type < 0: use a builtin Keying Set
- */
- if (type == 0)
- type = scene->active_keyingset;
- if (type > 0)
- ks = BLI_findlink(&scene->keyingsets, type - 1);
- else
- ks = BLI_findlink(&builtin_keyingsets, -type - 1);
+ KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene);
+ if (ks == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ const int prop_type = RNA_property_type(op->type->prop);
+ if (prop_type == PROP_ENUM) {
+ int type = RNA_property_enum_get(op->ptr, op->type->prop);
+ ks = ANIM_keyingset_get_from_enum_type(scene, type);
+ if (ks == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active keying set");
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else if (prop_type == PROP_STRING) {
+ char type_id[MAX_ID_NAME - 2];
+ RNA_property_string_get(op->ptr, op->type->prop, type_id);
+ ks = ANIM_keyingset_get_from_idname(scene, type_id);
+
+ if (ks == NULL) {
+ BKE_reportf(op->reports, RPT_ERROR, "No active keying set '%s' not found", type_id);
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else {
+ BLI_assert(0);
+ }
/* report failure */
if (ks == NULL) {
@@ -1828,6 +1860,34 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
"Show a popup when the keyframes get successfully removed");
}
+void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Delete Keying-Set Keyframe (by name)";
+ ot->idname = "ANIM_OT_keyframe_delete_by_name";
+ ot->description = "Alternate access to 'Delete Keyframe' for keymaps to use";
+
+ /* callbacks */
+ ot->exec = delete_key_exec;
+ ot->poll = modify_key_op_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* keyingset to use (idname) */
+ prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, "", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop = prop;
+
+ /* confirm whether a keyframe was added by showing a popup
+ * - by default, this is enabled, since this operator is assumed to be called independently
+ */
+ RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Delete",
+ "Show a popup when the keyframes get successfully removed");
+}
+
/* Delete Key Operator ------------------------ */
/* NOTE: Although this version is simpler than the more generic version for KeyingSets,
* it is more useful for animators working in the 3D view.
@@ -2597,3 +2657,36 @@ bool ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *
return false;
}
}
+
+/* -------------------------------------------------------------------- */
+/** \name Internal Utilities
+ * \{ */
+
+/** Use for insert/delete key-frame. */
+static KeyingSet *keyingset_get_from_op_with_error(wmOperator *op, PropertyRNA *prop, Scene *scene)
+{
+ KeyingSet *ks = NULL;
+ const int prop_type = RNA_property_type(prop);
+ if (prop_type == PROP_ENUM) {
+ int type = RNA_property_enum_get(op->ptr, prop);
+ ks = ANIM_keyingset_get_from_enum_type(scene, type);
+ if (ks == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active keying set");
+ }
+ }
+ else if (prop_type == PROP_STRING) {
+ char type_id[MAX_ID_NAME - 2];
+ RNA_property_string_get(op->ptr, prop, type_id);
+ ks = ANIM_keyingset_get_from_idname(scene, type_id);
+
+ if (ks == NULL) {
+ BKE_reportf(op->reports, RPT_ERROR, "Keying set '%s' not found", type_id);
+ }
+ }
+ else {
+ BLI_assert(0);
+ }
+ return ks;
+}
+
+/** \} */
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d532e22e7f7..654543c9d5d 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -784,6 +784,40 @@ const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNU
return item;
}
+/**
+ * Get the keying set from enum values generated in #ANIM_keying_sets_enum_itemf.
+ *
+ * Type is the Keying Set the user specified to use when calling the operator:
+ * - type == 0: use scene's active Keying Set
+ * - type > 0: use a user-defined Keying Set from the active scene
+ * - type < 0: use a builtin Keying Set
+ */
+KeyingSet *ANIM_keyingset_get_from_enum_type(Scene *scene, int type)
+{
+ KeyingSet *ks = NULL;
+
+ if (type == 0) {
+ type = scene->active_keyingset;
+ }
+
+ if (type > 0) {
+ ks = BLI_findlink(&scene->keyingsets, type - 1);
+ }
+ else {
+ ks = BLI_findlink(&builtin_keyingsets, -type - 1);
+ }
+ return ks;
+}
+
+KeyingSet *ANIM_keyingset_get_from_idname(Scene *scene, const char *idname)
+{
+ KeyingSet *ks = BLI_findstring(&scene->keyingsets, idname, offsetof(KeyingSet, idname));
+ if (ks == NULL) {
+ ks = BLI_findstring(&builtin_keyingsets, idname, offsetof(KeyingSet, idname));
+ }
+ return ks;
+}
+
/* ******************************************* */
/* KEYFRAME MODIFICATION */
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 0dd213d3bef..d63c53a6a09 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -58,10 +58,13 @@ set(SRC
meshlaplacian.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 6e93ecc484d..4aab80bcbdd 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -419,7 +419,7 @@ static EditBone *get_nearest_editbonepoint(
if (use_cycle) {
static int last_mval[2] = {-100, -100};
- if (vc->v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(vc->v3d)) {
do_nearest = true;
if (len_manhattan_v2v2_int(vc->mval, last_mval) <= WM_EVENT_CURSOR_MOTION_THRESHOLD) {
do_nearest = false;
@@ -428,7 +428,7 @@ static EditBone *get_nearest_editbonepoint(
copy_v2_v2_int(last_mval, vc->mval);
}
else {
- if (vc->v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(vc->v3d)) {
do_nearest = true;
}
}
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 5608479905a..5aec55bd1ed 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -318,7 +318,7 @@ static void add_verts_to_dgroups(
if ((par->pose) && (pchan = BKE_pose_channel_find_name(par->pose, bone->name))) {
if (bone->segments > 1) {
segments = bone->segments;
- BKE_pchan_bbone_spline_setup(pchan, true, bbone_array);
+ BKE_pchan_bbone_spline_setup(pchan, true, false, bbone_array);
bbone = bbone_array;
}
}
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 6b09912064e..465209eb9c5 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -547,13 +547,16 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, struct Bone *actBone)
return active;
}
-/* This function:
- * - sets local head/tail rest locations using parent bone's arm_mat.
- * - calls BKE_armature_where_is_bone() which uses parent's transform (arm_mat) to define this bone's transform.
- * - fixes (converts) EditBone roll into Bone roll.
- * - calls again BKE_armature_where_is_bone(), since roll fiddling may have changed things for our bone...
- * Note that order is crucial here, we can only handle child if all its parents in chain have already been handled
- * (this is ensured by recursive process). */
+/**
+ * This function:
+ * - Sets local head/tail rest locations using parent bone's arm_mat.
+ * - Calls #BKE_armature_where_is_bone() which uses parent's transform (arm_mat) to define this bone's transform.
+ * - Fixes (converts) EditBone roll into Bone roll.
+ * - Calls again #BKE_armature_where_is_bone(), since roll fiddling may have changed things for our bone...
+ *
+ * \note The order is crucial here, we can only handle child
+ * if all its parents in chain have already been handled (this is ensured by recursive process).
+ */
static void armature_finalize_restpose(ListBase *bonelist, ListBase *editbonelist)
{
Bone *curBone;
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 7ba6db92a47..41df3086fa8 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1118,7 +1118,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
else
RNA_int_set(op->ptr, "pose_index", -2); /* -2 means don't apply any pose */
- /* old optimize trick... this enforces to bypass the depgraph
+ /* old optimize trick... this enforces to bypass the depsgraph
* - note: code copied from transform_generics.c -> recalcData()
*/
// FIXME: shouldn't this use the builtin stuff?
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 8b0bfadcbe7..e6ed26bdf71 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -295,7 +295,7 @@ static void pose_slide_refresh(bContext *C, tPoseSlideOp *pso)
/**
* Although this lookup is not ideal, we won't be dealing with a lot of objects at a given time.
- * But if it comes to that we can instead store prev/next frme in the #tPChanFCurveLink.
+ * But if it comes to that we can instead store prev/next frame in the #tPChanFCurveLink.
*/
static bool pose_frame_range_from_object_get(tPoseSlideOp *pso, Object *ob, float *prevFrameF, float *nextFrameF)
{
@@ -704,7 +704,7 @@ static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
pose_slide_refresh(C, pso);
}
-/* perform autokeyframing after changes were made + confirmed */
+/* perform auto-key-framing after changes were made + confirmed */
static void pose_slide_autoKeyframe(bContext *C, tPoseSlideOp *pso)
{
/* wrapper around the generic call */
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index 75a3f13ee84..25ddcee52cf 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -277,7 +277,7 @@ void poseAnim_mapping_reset(ListBase *pfLinks)
}
}
-/* perform autokeyframing after changes were made + confirmed */
+/* perform auto-key-framing after changes were made + confirmed */
void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, ListBase *pfLinks, float cframe)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -303,7 +303,7 @@ void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, ListBase *pfLinks,
return;
}
- /* insert keyframes as necessary if autokeyframing */
+ /* Insert keyframes as necessary if auto-key-framing. */
KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
ListBase dsources = {NULL, NULL};
tPChanFCurveLink *pfl;
diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt
index 9d1b463ec42..726a744dd95 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -48,10 +48,13 @@ set(SRC
curve_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 10729ecaa5e..4aaf0dc2a2f 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2697,7 +2697,7 @@ static void smooth_single_bezt(
}
/**
- * Same as smooth_single_bezt(), keep in sync
+ * Same as #smooth_single_bezt(), keep in sync.
*/
static void smooth_single_bp(
BPoint *bp,
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 876af10f884..04bd067b146 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -28,6 +28,9 @@ set(SRC
)
+set(LIB
+)
+
# Order matches "UI_icons.h", final name will be formatted: "icons{size}_{name}.dat"
set(ICON_NAMES
question
@@ -764,7 +767,7 @@ if(WITH_BLENDER)
# blender UI only
# blends
- data_to_c_simple(../../../../release/datafiles/preview_cycles.blend SRC)
+ data_to_c_simple(../../../../release/datafiles/preview.blend SRC)
data_to_c_simple(../../../../release/datafiles/preview_grease_pencil.blend SRC)
# images
@@ -845,4 +848,4 @@ endif()
unset(ICON_NAMES)
-blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/gizmo_library/CMakeLists.txt b/source/blender/editors/gizmo_library/CMakeLists.txt
index 0e7b2a8be0f..0d2d9446889 100644
--- a/source/blender/editors/gizmo_library/CMakeLists.txt
+++ b/source/blender/editors/gizmo_library/CMakeLists.txt
@@ -58,6 +58,9 @@ set(SRC
gizmo_types/value2d_gizmo.c
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_gizmo_library "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_gizmo_library "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index f31e53d2a1f..3e3aa13f184 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -369,7 +369,7 @@ static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel)
const bool is_prop_valid = WM_gizmo_target_property_is_valid(gz_prop);
if (!cancel) {
- /* Assign incase applying the opetration needs an updated offset
+ /* Assign incase applying the operation needs an updated offset
* editmesh bisect needs this. */
if (is_prop_valid) {
const int transform_flag = RNA_enum_get(arrow->gizmo.ptr, "transform");
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 977b7c7a0a5..9579f7db196 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -472,7 +472,7 @@ static int gizmo_cage3d_modal(
return OPERATOR_RUNNING_MODAL;
}
/* For transform logic to be manageable we operate in -0.5..0.5 2D space,
- * no matter the size of the rectangle, mouse coorts are scaled to unit space.
+ * no matter the size of the rectangle, mouse coords are scaled to unit space.
* The mouse coords have been projected into the matrix so we don't need to worry about axis alignment.
*
* - The cursor offset are multiplied by 'dims'.
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index a12dca3ad16..53b527dd1f7 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -50,8 +50,8 @@ set(SRC
gpencil_fill.c
gpencil_interpolate.c
gpencil_merge.c
- gpencil_old.c
gpencil_ops.c
+ gpencil_ops_versioning.c
gpencil_paint.c
gpencil_primitive.c
gpencil_select.c
@@ -61,10 +61,13 @@ set(SRC
gpencil_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 43e2b5bd3bf..2a7f9a715ad 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -1036,9 +1036,8 @@ void ED_annotation_draw_2dimage(const bContext *C)
}
if (ED_screen_animation_playing(wm)) {
- /* don't show onionskins during animation playback/scrub (i.e. it obscures the poses)
- * OpenGL Renders (i.e. final output), or depth buffer (i.e. not real strokes)
- */
+ /* Don't show onion-skins during animation playback/scrub (i.e. it obscures the poses)
+ * OpenGL Renders (i.e. final output), or depth buffer (i.e. not real strokes). */
dflag |= GP_DRAWDATA_NO_ONIONS;
}
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index b9b0c8fe788..5152bcb0a90 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1423,34 +1423,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
break;
}
case SPACE_NODE:
- {
- p->gpd->runtime.sbuffer_sflag |= GP_STROKE_2DSPACE;
- break;
- }
case SPACE_SEQ:
- {
- p->gpd->runtime.sbuffer_sflag |= GP_STROKE_2DSPACE;
- break;
- }
case SPACE_IMAGE:
- {
- SpaceImage *sima = (SpaceImage *)p->sa->spacedata.first;
-
- /* only set these flags if the image editor doesn't have an image active,
- * otherwise user will be confused by strokes not appearing after they're drawn
- *
- * Admittedly, this is a bit hacky, but it works much nicer from an ergonomic standpoint!
- */
- if (ELEM(NULL, sima, sima->image)) {
- /* make strokes be drawn in screen space */
- p->gpd->runtime.sbuffer_sflag &= ~GP_STROKE_2DSPACE;
- *(p->align_flag) &= ~GP_PROJECT_VIEWSPACE;
- }
- else {
- p->gpd->runtime.sbuffer_sflag |= GP_STROKE_2DSPACE;
- }
- break;
- }
case SPACE_CLIP:
{
p->gpd->runtime.sbuffer_sflag |= GP_STROKE_2DSPACE;
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index cd28043a6fe..de6ecfefb2f 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -63,7 +63,7 @@ static int gpencil_monkey_color(
int idx;
/* create a new one */
- ma = BKE_gpencil_handle_new_material(bmain, ob, pct->name, &idx);
+ ma = BKE_gpencil_object_material_new(bmain, ob, pct->name, &idx);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index c56cb94c58d..1107819a09a 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -63,7 +63,7 @@ static int gp_stroke_material(
int idx;
/* create a new one */
- ma = BKE_gpencil_handle_new_material(bmain, ob, pct->name, &idx);
+ ma = BKE_gpencil_object_material_new(bmain, ob, pct->name, &idx);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c
index a482eb837e7..8fff6b207ba 100644
--- a/source/blender/editors/gpencil/gpencil_armature.c
+++ b/source/blender/editors/gpencil/gpencil_armature.c
@@ -314,7 +314,7 @@ static void gpencil_add_verts_to_dgroups(
{
if (bone->segments > 1) {
segments = bone->segments;
- BKE_pchan_bbone_spline_setup(pchan, true, bbone_array);
+ BKE_pchan_bbone_spline_setup(pchan, true, false, bbone_array);
bbone = bbone_array;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 6b646566996..e7e6d7a5f7f 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -811,7 +811,7 @@ static bool gp_brush_randomize_apply(
/* Jitter is applied perpendicular to the mouse movement vector
* - We compute all effects in screenspace (since it's easier)
* and then project these to get the points/distances in
- * viewspace as needed
+ * view-space as needed.
*/
float mvec[2], svec[2];
@@ -1029,8 +1029,8 @@ static void gp_brush_clone_init(bContext *C, tGP_BrushEditData *gso)
data->new_strokes = MEM_callocN(sizeof(bGPDstroke *) * data->totitems, "cloned strokes ptr array");
}
- /* Init colormap for mapping between the pasted stroke's source colour(names)
- * and the final colours that will be used here instead...
+ /* Init colormap for mapping between the pasted stroke's source color (names)
+ * and the final colours that will be used here instead.
*/
data->new_colors = gp_copybuf_validate_colormap(C);
}
@@ -1101,7 +1101,7 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
/* Fix color references */
Material *ma = BLI_ghash_lookup(data->new_colors, &new_stroke->mat_nr);
- gps->mat_nr = BKE_gpencil_get_material_index(ob, ma);
+ gps->mat_nr = BKE_gpencil_object_material_get_index(ob, ma);
if (!ma || gps->mat_nr) {
gps->mat_nr = 0;
}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index e3d57149d0f..710e8a9bc1c 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -521,7 +521,7 @@ static int gp_layer_duplicate_object_exec(bContext *C, wmOperator *op)
* otherwise add the slot with the material
*/
Material *ma_src = give_current_material(ob_src, gps_src->mat_nr + 1);
- int idx = BKE_gpencil_handle_material(bmain, ob_dst, ma_src);
+ int idx = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma_src);
/* reasign the stroke material to the right slot in destination object */
gps_dst->mat_nr = idx;
@@ -1379,7 +1379,7 @@ static int gp_stroke_change_color_exec(bContext *C, wmOperator *op)
}
}
/* try to find slot */
- int idx = BKE_gpencil_get_material_index(ob, ma);
+ int idx = BKE_gpencil_object_material_get_index(ob, ma);
if (idx < 0) {
return OPERATOR_CANCELLED;
}
@@ -2054,7 +2054,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob_src, i + 1);
- BKE_gpencil_handle_material(bmain, ob_dst, tmp_ma);
+ BKE_gpencil_object_material_ensure(bmain, ob_dst, tmp_ma);
}
/* duplicate bGPDlayers */
@@ -2089,7 +2089,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
/* reasign material. Look old material and try to find in dst */
ma_src = give_current_material(ob_src, gps->mat_nr + 1);
- gps->mat_nr = BKE_gpencil_handle_material(bmain, ob_dst, ma_src);
+ gps->mat_nr = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma_src);
bGPDspoint *pt;
int i;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 99d37f87da7..e1eaedd435c 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1080,7 +1080,7 @@ GHash *gp_copybuf_validate_colormap(bContext *C)
char *ma_name = BLI_ghashIterator_getValue(&gh_iter);
Material *ma = BLI_ghash_lookup(name_to_ma, ma_name);
- BKE_gpencil_handle_material(bmain, ob, ma);
+ BKE_gpencil_object_material_ensure(bmain, ob, ma);
/* Store this mapping (for use later when pasting) */
if (!BLI_ghash_haskey(new_colors, POINTER_FROM_INT(*key))) {
@@ -1334,7 +1334,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
/* Remap material */
Material *ma = BLI_ghash_lookup(new_colors, POINTER_FROM_INT(new_stroke->mat_nr));
- new_stroke->mat_nr = BKE_gpencil_get_material_index(ob, ma);
+ new_stroke->mat_nr = BKE_gpencil_object_material_get_index(ob, ma);
BLI_assert(new_stroke->mat_nr >= 0); /* have to add the material first */
}
}
@@ -3957,7 +3957,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
/* add duplicate materials */
ma = give_current_material(ob, gps->mat_nr + 1); /* XXX same material can be in multiple slots */
- idx = BKE_gpencil_handle_material(bmain, ob_dst, ma);
+ idx = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma);
/* selected points mode */
if (mode == GP_SEPARATE_POINT) {
@@ -4029,7 +4029,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
continue;
}
ma = give_current_material(ob, gps->mat_nr + 1);
- gps->mat_nr = BKE_gpencil_handle_material(bmain, ob_dst, ma);
+ gps->mat_nr = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma);
}
}
}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 5922872070d..e13dfb38c7d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1017,7 +1017,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
gps->flag |= GP_STROKE_CYCLIC;
gps->flag |= GP_STROKE_3DSPACE;
- gps->mat_nr = BKE_gpencil_handle_material(tgpf->bmain, tgpf->ob, tgpf->mat);
+ gps->mat_nr = BKE_gpencil_object_material_ensure(tgpf->bmain, tgpf->ob, tgpf->mat);
/* allocate memory for storage points */
gps->totpoints = tgpf->sbuffer_size;
@@ -1222,7 +1222,7 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
int totcol = tgpf->ob->totcol;
/* get color info */
- Material *ma = BKE_gpencil_current_input_brush_material(bmain, tgpf->ob, brush);
+ Material *ma = BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, tgpf->ob, brush);
tgpf->mat = ma;
diff --git a/source/blender/editors/gpencil/gpencil_old.c b/source/blender/editors/gpencil/gpencil_ops_versioning.c
index 47654b69da4..9fdb5a9b174 100644
--- a/source/blender/editors/gpencil/gpencil_old.c
+++ b/source/blender/editors/gpencil/gpencil_ops_versioning.c
@@ -48,6 +48,9 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "ED_object.h"
#include "ED_gpencil.h"
@@ -94,25 +97,26 @@ static bool gpencil_convert_old_files_poll(bContext *C)
return (int) (scene->gpd != NULL);
}
-static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
+static int gpencil_convert_old_files_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
+ const bool is_annotation = RNA_boolean_get(op->ptr, "annotation");
+ bGPdata *gpd = scene->gpd;
/* Convert grease pencil scene datablock to GP object */
- if ((scene->gpd) && (view_layer != NULL)) {
+ if ((!is_annotation) && (view_layer != NULL)) {
Object *ob;
ob = BKE_object_add_for_data(bmain, view_layer, OB_GPENCIL, "GP_Scene", &scene->gpd->id, false);
zero_v3(ob->loc);
/* convert grease pencil palettes (version >= 2.78) to materials and weights */
- bGPdata *gpd = scene->gpd;
for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
/* create material slot */
- Material *ma = BKE_gpencil_handle_new_material(bmain, ob, palcolor->info, NULL);
+ Material *ma = BKE_gpencil_object_material_new(bmain, ob, palcolor->info, NULL);
/* copy color settings */
MaterialGPencilStyle *gp_style = ma->gp_style;
@@ -161,35 +165,32 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
scene->gpd = NULL;
}
-#if 0 /* GPXX */
- /* Handle object-linked grease pencil datablocks */
- for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->gpd) {
- if (ob->type == OB_GPENCIL) {
- /* GP Object - remap the links */
- ob->data = ob->gpd;
- ob->gpd = NULL;
- }
- else if (ob->type == OB_EMPTY) {
- /* Empty with GP data - This should be able to be converted
- * to a GP object with little data loss
- */
- ob->data = ob->gpd;
- ob->gpd = NULL;
- ob->type = OB_GPENCIL;
- }
- else {
- /* FIXME: What to do in this case?
- *
- * We cannot create new objects for these, as we don't have a scene & scene layer
- * to put them into from here...
- */
- printf("WARNING: Old Grease Pencil data ('%s') still exists on Object '%s'\n",
- ob->gpd->id.name + 2, ob->id.name + 2);
+ if (is_annotation) {
+ for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
+ for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
+ /* fix layers */
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* unlock/unhide layer */
+ gpl->flag &= ~GP_LAYER_LOCKED;
+ gpl->flag &= ~GP_LAYER_HIDE;
+ /* set opacity to 1 */
+ gpl->opacity = 1.0f;
+ /* disable tint */
+ gpl->tintcolor[3] = 0.0f;
+ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ if ((gps->colorname[0] != '\0') &&
+ (STREQ(gps->colorname, palcolor->info)))
+ {
+ /* copy color settings */
+ copy_v4_v4(gpl->color, palcolor->color);
+ }
+ }
+ }
+ }
}
}
}
-#endif
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -200,9 +201,9 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
void GPENCIL_OT_convert_old_files(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Convert 2.7 Grease Pencil File";
+ ot->name = "Convert Grease Pencil";
ot->idname = "GPENCIL_OT_convert_old_files";
- ot->description = "Convert 2.7x grease pencil files to 2.8";
+ ot->description = "Convert 2.7x grease pencil files to 2.80";
/* callbacks */
ot->exec = gpencil_convert_old_files_exec;
@@ -210,4 +211,7 @@ void GPENCIL_OT_convert_old_files(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ ot->prop = RNA_def_boolean(ot->srna, "annotation", 0, "Annotation", "Convert to Annotations");
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d544bd8f9b6..daea24ecaa3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1223,7 +1223,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
}
/* Save material index */
- gps->mat_nr = BKE_gpencil_get_material_index_for_brush(p->ob, p->brush);
+ gps->mat_nr = BKE_gpencil_object_material_get_index_from_brush(p->ob, p->brush);
/* calculate UVs along the stroke */
ED_gpencil_calc_stroke_uv(obact, gps);
@@ -1832,7 +1832,7 @@ static void gp_init_colors(tGPsdata *p)
MaterialGPencilStyle *gp_style = NULL;
/* use brush material */
- p->material = BKE_gpencil_current_input_brush_material(p->bmain, p->ob, brush);
+ p->material = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
/* assign color information to temp tGPsdata */
gp_style = p->material->gp_style;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index f6571773706..f92398520fa 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -140,7 +140,7 @@ static void gp_init_colors(tGPDprimitive *p)
MaterialGPencilStyle *gp_style = NULL;
/* use brush material */
- p->mat = BKE_gpencil_current_input_brush_material(p->bmain, p->ob, brush);
+ p->mat = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
/* assign color information to temp data */
gp_style = p->mat->gp_style;
@@ -331,7 +331,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
gps->flag |= GP_STROKE_3DSPACE;
- gps->mat_nr = BKE_gpencil_get_material_index(tgpi->ob, tgpi->mat);
+ gps->mat_nr = BKE_gpencil_object_material_get_index(tgpi->ob, tgpi->mat);
/* allocate memory for storage points, but keep empty */
gps->totpoints = 0;
@@ -1111,7 +1111,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
tgpi->gpd->runtime.tot_cp_points = 0;
/* getcolor info */
- tgpi->mat = BKE_gpencil_current_input_toolsettings_material(bmain, tgpi->ob, ts);
+ tgpi->mat = BKE_gpencil_object_material_ensure_from_active_input_toolsettings(bmain, tgpi->ob, ts);
/* set parameters */
tgpi->type = RNA_enum_get(op->ptr, "type");
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 6601bfe9d2f..f582b52713d 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -216,7 +216,7 @@ bGPdata *ED_gpencil_data_get_active_direct(ID *screen_id, ScrArea *sa, Scene *sc
/**
* Get the active Grease Pencil datablock
* \note This is the original (bmain) copy of the datablock, stored in files.
- * Do not use for reading evaluated copies of GP Objects data
+ * Do not use for reading evaluated copies of GP Objects data
*/
bGPdata *ED_gpencil_data_get_active(const bContext *C)
{
@@ -228,9 +228,9 @@ bGPdata *ED_gpencil_data_get_active(const bContext *C)
* Get the evaluated copy of the active Grease Pencil datablock (where applicable)
* - For the 3D View (i.e. "GP Objects"), this gives the evaluated copy of the GP datablock
* (i.e. a copy of the active GP datablock for the active object, where modifiers have been
- * applied). This is needed to correctly work with "Copy-on-Write"
+ * applied). This is needed to correctly work with "Copy-on-Write".
* - For all other editors (i.e. "GP Annotations"), this just gives the active datablock
- * like for ED_gpencil_data_get_active()
+ * like for #ED_gpencil_data_get_active()
*/
bGPdata *ED_gpencil_data_get_active_evaluated(const bContext *C)
{
@@ -640,13 +640,13 @@ void gp_point_to_xy(
/**
* Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D)
*
- * Just like gp_point_to_xy(), except the resulting coordinates are floats not ints.
+ * Just like #gp_point_to_xy(), except the resulting coordinates are floats not ints.
* Use this version to solve "stair-step" artifacts which may arise when roundtripping the calculations.
*
- * \param r_x: [out] The screen-space x-coordinate of the point
- * \param r_y: [out] The screen-space y-coordinate of the point
+ * \param r_x: [out] The screen-space x-coordinate of the point.
+ * \param r_y: [out] The screen-space y-coordinate of the point.
*
- * \warning This assumes that the caller has already checked whether the stroke in question can be drawn
+ * \warning This assumes that the caller has already checked whether the stroke in question can be drawn.
*/
void gp_point_to_xy_fl(
const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt,
@@ -808,9 +808,9 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, Scene *scene, const float
* Convert tGPspoint (temporary 2D/screenspace point data used by GP modal operators)
* to 3D coordinates.
*
- * \param point2D: The screenspace 2D point data to convert
- * \param depth: Depth array (via ED_view3d_autodist_depth())
- * \param[out] r_out: The resulting 2D point data
+ * \param point2D: The screenspace 2D point data to convert.
+ * \param depth: Depth array (via #ED_view3d_autodist_depth()).
+ * \param[out] r_out: The resulting 2D point data.
*/
void gp_stroke_convertcoords_tpoint(
Scene *scene, ARegion *ar,
@@ -992,7 +992,7 @@ void ED_gp_project_stroke_to_plane(
/**
* Reproject given point to a plane locked to axis to avoid stroke offset
- * \param[in, out] pt : Point to affect
+ * \param[in,out] pt: Point to affect
*/
void ED_gp_project_point_to_plane(
const Scene *scene, const Object *ob,
@@ -1332,7 +1332,7 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob)
}
/* ensure a color exists and is assigned to object */
- BKE_gpencil_current_input_toolsettings_material(bmain, ob, ts);
+ BKE_gpencil_object_material_ensure_from_active_input_toolsettings(bmain, ob, ts);
/* ensure multiframe falloff curve */
if (ts->gp_sculpt.cur_falloff == NULL) {
@@ -1701,7 +1701,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
}
/* get current drawing color */
- ma = BKE_gpencil_get_material_for_brush(ob, brush);
+ ma = BKE_gpencil_object_material_get_from_brush(ob, brush);
if (ma) {
gp_style = ma->gp_style;
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index fa082e71bf6..43d7117a1b2 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -29,8 +29,8 @@
extern int datatoc_startup_blend_size;
extern char datatoc_startup_blend[];
-extern int datatoc_preview_cycles_blend_size;
-extern char datatoc_preview_cycles_blend[];
+extern int datatoc_preview_blend_size;
+extern char datatoc_preview_blend[];
extern int datatoc_preview_grease_pencil_blend_size;
extern char datatoc_preview_grease_pencil_blend[];
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 78a9f13e64f..5191978c529 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -229,6 +229,10 @@ struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const c
/* Dynamically populate an enum of Keying Sets */
const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
+/* Use to get the keying set from the int value used by enums. */
+KeyingSet *ANIM_keyingset_get_from_enum_type(struct Scene *scene, int type);
+KeyingSet *ANIM_keyingset_get_from_idname(struct Scene *scene, const char *idname);
+
/* Check if KeyingSet can be used in the current context */
bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
@@ -373,11 +377,12 @@ bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter);
*/
bool fcurve_is_changed(struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float frame);
-/* Main Keyframe Checking API call:
+/**
+ * Main Keyframe Checking API call:
* Checks whether a keyframe exists for the given ID-block one the given frame.
* - It is recommended to call this method over the other keyframe-checkers directly,
* in case some detail of the implementation changes...
- * - frame: the value of this is quite often result of BKE_scene_frame_get()
+ * - frame: the value of this is quite often result of #BKE_scene_frame_get()
*/
bool id_frame_has_keyframe(struct ID *id, float frame, short filter);
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index 5f90996988a..d4cb2110c2c 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -72,15 +72,18 @@ enum {
struct UnitSettings;
-/*********************** NumInput ********************************/
-
-/* There are important things to note here for code using numinput:
- * * Values passed to applyNumInput() should be valid and are stored as default ones (val_org), if it is not EDITED.
- * * bool returned by applyNumInput should be used to decide whether to apply numinput-specific post-process to data.
- * * *Once applyNumInput has been called*, hasNumInput returns a valid value to decide whether to use numinput
- * as drawstr source or not (i.e. to call outputNumInput).
+/* -------------------------------------------------------------------- */
+/** \name NumInput
+ * \{ */
+
+/**
+ * There are important things to note here for code using numinput:
+ * - Values passed to #applyNumInput() should be valid and are stored as default ones (val_org), if it is not EDITED.
+ * - bool returned by #applyNumInput should be used to decide whether to apply numinput-specific post-process to data.
+ * - Once #applyNumInput has been called, #hasNumInput returns a valid value to decide whether to use numinput
+ * as drawstr source or not (i.e. to call #outputNumInput).
*
- * Those two steps have to be separated (so do not use a common call to hasNumInput() to do both in the same time!).
+ * Those two steps have to be separated (so do not use a common call to #hasNumInput() to do both in the same time!).
*/
void initNumInput(NumInput *n);
@@ -94,4 +97,6 @@ bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event
bool user_string_to_number(bContext *C, const char *str, const struct UnitSettings *unit, int type, double *r_value);
+/** \} */
+
#endif /* __ED_NUMINPUT_H__ */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 1bd8782bb12..18573e92926 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -82,6 +82,7 @@ enum TfmMode {
TFM_SEQ_SLIDE,
TFM_BONE_ENVELOPE_DIST,
TFM_NORMAL_ROTATION,
+ TFM_GPENCIL_OPACITY,
};
/* TRANSFORM CONTEXTS */
@@ -154,7 +155,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags);
/* transform gizmos */
-void TRANSFORM_GGT_gizmo(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_xform_gizmo(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_xform_gizmo_context(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_xform_cage(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_xform_shear(struct wmGizmoGroupType *gzgt);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 2a115f49c31..4c03be3bd5a 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -556,8 +556,11 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx,
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
-#define V3D_XRAY_FLAG(v3d) (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
-#define V3D_IS_ZBUF(v3d) (((v3d)->shading.flag & V3D_XRAY_FLAG(v3d)) == 0)
+#define XRAY_ALPHA(v3d) (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha)
+#define XRAY_FLAG(v3d) (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
+#define XRAY_FLAG_ENABLED(v3d) (((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0)
+#define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f))
+#define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < OB_MATERIAL))
/* view3d_draw_legacy.c */
/* Try avoid using these more move out of legacy. */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 9f189b63ad5..4a3e0983989 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -172,21 +172,21 @@ enum {
/* but->flag - general state flags. */
enum {
- /** warning, the first 6 flags are internal. */
+ /** Warning, the first 6 flags are internal. */
UI_BUT_ICON_SUBMENU = 1 << 6,
UI_BUT_ICON_PREVIEW = 1 << 7,
UI_BUT_NODE_LINK = 1 << 8,
UI_BUT_NODE_ACTIVE = 1 << 9,
UI_BUT_DRAG_LOCK = 1 << 10,
- /** grayed out and uneditable */
+ /** Grayed out and un-editable. */
UI_BUT_DISABLED = 1 << 11,
UI_BUT_ANIMATED = 1 << 13,
UI_BUT_ANIMATED_KEY = 1 << 14,
UI_BUT_DRIVEN = 1 << 15,
UI_BUT_REDALERT = 1 << 16,
- /** grayed out but still editable */
+ /** Grayed out but still editable. */
UI_BUT_INACTIVE = 1 << 17,
UI_BUT_LAST_ACTIVE = 1 << 18,
UI_BUT_UNDO = 1 << 19,
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index 1ecd9e64924..78b0202dc22 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -79,6 +79,9 @@ set(SRC
interface_regions_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -103,4 +106,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index 8e7dc792da6..9e1563e6511 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -260,7 +260,7 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
* Here, BUT 3 RIGHT side would not get 'dragged' to align with BUT 1 RIGHT side, since BUT 3 has not RIGHT neighbor.
* So, this function, when called with BUT 1, will 'walk' the whole column in \a side_s1 direction (TOP or DOWN when
* called for RIGHT side), and force buttons like BUT 3 to align as needed, if BUT 1 and BUT 3 were detected as needing
- * top-right corner stitching in \a block_align_proximity_compute() step.
+ * top-right corner stitching in #block_align_proximity_compute() step.
*
* \note To avoid doing this twice, some stitching flags are cleared to break the 'stitching connection'
* between neighbors.
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 7ca6db2ca21..7396b5406ed 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -182,7 +182,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
}
/* Prefer popover from header to be positioned into the editor. */
else if (sa && ar) {
- if (ar->regiontype == RGN_TYPE_HEADER){
+ if (ar->regiontype == RGN_TYPE_HEADER) {
if (ED_area_header_alignment(sa) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 0bb1497a74e..897a07708d0 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -713,8 +713,10 @@ static void template_ID(
but = uiDefIconBut(
block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0,
- TIP_("Direct linked library data-block, click to make local, "
- "Shift + Click to create a static override"));
+ BKE_override_static_is_enabled() ?
+ TIP_("Direct linked library data-block, click to make local, "
+ "Shift + Click to create a static override") :
+ TIP_("Direct linked library data-block, click to make local"));
if (disabled) {
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
@@ -2213,7 +2215,7 @@ void uiTemplatePreview(
if (!ui_preview) {
ui_preview = MEM_callocN(sizeof(uiPreview), "uiPreview");
BLI_strncpy(ui_preview->preview_id, preview_id, sizeof(ui_preview->preview_id));
- ui_preview->height = (short)(UI_UNIT_Y * 5.6f);
+ ui_preview->height = (short)(UI_UNIT_Y * 7.6f);
BLI_addtail(&ar->ui_previews, ui_preview);
}
@@ -2255,6 +2257,8 @@ void uiTemplatePreview(
col = uiLayoutColumn(row, true);
uiLayoutSetScaleX(col, 1.5);
uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE);
+ uiItemS(col);
+ uiItemR(col, &material_ptr, "use_preview_world", 0, "", ICON_WORLD);
}
if (pr_texture) {
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 65abac968e3..915793445db 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -209,7 +209,7 @@ eAutoPropButsReturn uiDefAutoButsRNA(
col = uiLayoutColumn(split, false);
}
- /* may meed to add more cases here.
+ /* May need to add more cases here.
* don't override enum flag names */
/* name is shown above, empty name for button below */
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 2235e94180d..1aa6de534c4 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -46,6 +46,9 @@ set(SRC
io_ops.h
)
+set(LIB
+)
+
if(WITH_OPENCOLLADA)
add_definitions(-DWITH_COLLADA)
endif()
@@ -62,4 +65,4 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_io "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_io "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/lattice/CMakeLists.txt b/source/blender/editors/lattice/CMakeLists.txt
index f14de01c102..5a231837d0b 100644
--- a/source/blender/editors/lattice/CMakeLists.txt
+++ b/source/blender/editors/lattice/CMakeLists.txt
@@ -41,4 +41,7 @@ set(SRC
lattice_intern.h
)
-blender_add_lib(bf_editor_lattice "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_editor_lattice "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c
index 0d57b94a493..edb79797c2a 100644
--- a/source/blender/editors/lattice/editlattice_tools.c
+++ b/source/blender/editors/lattice/editlattice_tools.c
@@ -133,9 +133,9 @@ typedef enum eLattice_FlipAxes {
} eLattice_FlipAxes;
/**
- * Flip midpoint value so that relative distances between midpoint and neighbor-pair is maintained
- * ! Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes)
- * - Helper for lattice_flip_exec()
+ * Flip midpoint value so that relative distances between midpoint and neighbor-pair is maintained.
+ * Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes).
+ * - Helper for #lattice_flip_exec()
*/
static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
{
@@ -151,8 +151,8 @@ static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid
}
/**
- * Swap pairs of lattice points along a specified axis
- * - Helper for lattice_flip_exec()
+ * Swap pairs of lattice points along a specified axis.
+ * - Helper for #lattice_flip_exec()
*/
static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
{
diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt
index 63f8dc78d13..a8ed6812897 100644
--- a/source/blender/editors/mask/CMakeLists.txt
+++ b/source/blender/editors/mask/CMakeLists.txt
@@ -47,6 +47,9 @@ set(SRC
mask_intern.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index bc8761f24c0..41e247b8d77 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -72,6 +72,9 @@ set(SRC
mesh_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -86,4 +89,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index 9884ded4f0a..1ff7d835aad 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -241,7 +241,7 @@ static void gizmo_mesh_spin_init_draw_prepare(
{
Scene *scene = CTX_data_scene(C);
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_ORIENT_ROTATE);
switch (orient_slot->type) {
case V3D_ORIENT_VIEW:
{
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index 19831e8f380..7decd5f4b2f 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -91,9 +91,7 @@ static bool edbm_preselect_or_active(
BMElem **r_ele)
{
ARegion *ar = CTX_wm_region(C);
- const bool show_gizmo = !(
- (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
+ const bool show_gizmo = !((v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
wmGizmoMap *gzmap = show_gizmo ? ar->gizmo_map : NULL;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") : NULL;
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 1855eeab944..8b75b511319 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -215,7 +215,7 @@ bool EDBM_backbuf_border_init(
{
uint *buf, *dr, buf_len;
- if (vc->obedit == NULL || !V3D_IS_ZBUF(vc->v3d)) {
+ if (vc->obedit == NULL || XRAY_FLAG_ENABLED(vc->v3d)) {
return false;
}
@@ -292,7 +292,7 @@ bool EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
return false;
}
}
- else if (!V3D_IS_ZBUF(vc->v3d)) {
+ else if (XRAY_FLAG_ENABLED(vc->v3d)) {
return false;
}
@@ -342,7 +342,7 @@ bool EDBM_backbuf_circle_init(
return false;
}
}
- else if (!V3D_IS_ZBUF(vc->v3d)) {
+ else if (XRAY_FLAG_ENABLED(vc->v3d)) {
return false;
}
@@ -454,8 +454,8 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, const float
*
* \param r_dist: (in/out), minimal distance to the nearest and at the end, actual distance
* \param use_select_bias:
- * - When true, selected vertice are given a 5 pixel bias to make them further than unselect verts.
- * - When false, unselected vertice are given the bias.
+ * - When true, selected vertices are given a 5 pixel bias to make them further than unselect verts.
+ * - When false, unselected vertices are given the bias.
* \param use_cycle: Cycle over elements within #FIND_NEAR_CYCLE_THRESHOLD_MIN in order of index.
*/
BMVert *EDBM_vert_find_nearest_ex(
@@ -464,7 +464,7 @@ BMVert *EDBM_vert_find_nearest_ex(
{
BMesh *bm = vc->em->bm;
- if (V3D_IS_ZBUF(vc->v3d)) {
+ if (!XRAY_FLAG_ENABLED(vc->v3d)) {
uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
unsigned int index;
BMVert *eve;
@@ -655,7 +655,7 @@ BMEdge *EDBM_edge_find_nearest_ex(
{
BMesh *bm = vc->em->bm;
- if (V3D_IS_ZBUF(vc->v3d)) {
+ if (!XRAY_FLAG_ENABLED(vc->v3d)) {
uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
unsigned int index;
BMEdge *eed;
@@ -825,7 +825,7 @@ BMFace *EDBM_face_find_nearest_ex(
{
BMesh *bm = vc->em->bm;
- if (V3D_IS_ZBUF(vc->v3d)) {
+ if (!XRAY_FLAG_ENABLED(vc->v3d)) {
float dist_test = 0.0f;
unsigned int index;
BMFace *efa;
@@ -1757,7 +1757,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
if (select) {
if (em->selectmode & SCE_SELECT_VERTEX) {
/* Find nearest vert from mouse
- * (initialize to large values incase only one vertex can be projected) */
+ * (initialize to large values in case only one vertex can be projected) */
float v1_co[2], v2_co[2];
float length_1 = FLT_MAX;
float length_2 = FLT_MAX;
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index c9365e8d0fd..67e455375df 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -1150,7 +1150,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
continue;
}
- /* We map back the names of the vertex groups to their corresponsing indices
+ /* We map back the names of the vertex groups to their corresponding indices
* for this object. This is fast, and keep the logic for each vertex very simple. */
GSetIterator gs_iter;
GSET_ITER(gs_iter, gset) {
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 5d653ffe00b..9fb200951ca 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -4943,7 +4943,7 @@ static int edbm_decimate_exec(bContext *C, wmOperator *op)
}
else {
/**
- * Calculate a new ratio based on faces that could be remoevd during decimation.
+ * Calculate a new ratio based on faces that could be removed during decimation.
* needed so 0..1 has a meaningful range when operating on the selection.
*
* This doesn't have to be totally accurate,
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 3a4f9d461ec..f86a2388f87 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -919,8 +919,10 @@ UvElement *BM_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l)
/** \name Data Layer Checks
* \{ */
-/* last_sel, use em->act_face otherwise get the last selected face in the editselections
- * at the moment, last_sel is mainly useful for making sure the space image dosnt flicker */
+/**
+ * last_sel, use em->act_face otherwise get the last selected face in the editselections
+ * at the moment, last_sel is mainly useful for making sure the space image doesn't flicker.
+ */
BMFace *EDBM_uv_active_face_get(BMEditMesh *em, const bool sloppy, const bool selected)
{
BMFace *efa = NULL;
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index a1859bf70b0..8bfe51d09fa 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -267,15 +267,15 @@ void ED_mesh_mirrtopo_init(
}
if ((tot_unique <= tot_unique_prev) && (tot_unique_edges <= tot_unique_edges_prev)) {
- /* Finish searching for unique values when 1 loop dosnt give a
- * higher number of unique values compared to the previous loop */
+ /* Finish searching for unique values when 1 loop dosn't give a
+ * higher number of unique values compared to the previous loop. */
break;
}
else {
tot_unique_prev = tot_unique;
tot_unique_edges_prev = tot_unique_edges;
}
- /* Copy the hash calculated this iter, so we can use them next time */
+ /* Copy the hash calculated this iteration, so we can use them next time */
memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert);
topo_pass++;
diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt
index a0d6fb928ff..11547a0af6f 100644
--- a/source/blender/editors/metaball/CMakeLists.txt
+++ b/source/blender/editors/metaball/CMakeLists.txt
@@ -40,4 +40,7 @@ set(SRC
mball_intern.h
)
-blender_add_lib(bf_editor_metaball "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_editor_metaball "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index f15427e61ac..7a5eee4bfbb 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -68,6 +68,9 @@ set(SRC
object_intern.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
if(WITH_PYTHON)
@@ -78,4 +81,4 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index d069772a0ce..6d3cca5477e 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -151,7 +151,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
EDBM_mesh_normals_update(em);
BKE_editmesh_tessface_calc(em);
- /* Make sure the evaluated mesh is updates.
+ /* Make sure the evaluated mesh is updated.
*
* Most reliable way is to update the tagged objects, which will ensure
* proper copy-on-write update, but also will make sure all dependent
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index c0e022df629..cd8b7d082ef 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -247,7 +247,7 @@ bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, co
* For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true.
* This finds the unselected mirror deform verts and copies the weights to them from the selected.
*
- * \note \a dvert_array has mirrored weights filled in, incase cleanup operations are needed on both.
+ * \note \a dvert_array has mirrored weights filled in, in case cleanup operations are needed on both.
*/
void ED_vgroup_parray_mirror_sync(
Object *ob,
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 88d6f1b015c..1b42c3f2669 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -51,6 +51,9 @@ set(SRC
physics_intern.h
)
+set(LIB
+)
+
if(WITH_MOD_FLUID)
add_definitions(-DWITH_MOD_FLUID)
endif()
@@ -68,4 +71,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 112d453c44a..bd78677bdb6 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -446,7 +446,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
ED_view3d_viewcontext_init(C, &data->vc);
- if (V3D_IS_ZBUF(data->vc.v3d)) {
+ if (!XRAY_ENABLED(data->vc.v3d)) {
if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
@@ -503,7 +503,7 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
float depth;
/* nothing to do */
- if (!V3D_IS_ZBUF(v3d))
+ if (XRAY_ENABLED(v3d))
return true;
/* used to calculate here but all callers have the screen_co already, so pass as arg */
@@ -3965,7 +3965,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
}
BLI_assert(mesh);
- /* Calculate positions of new particles to add, based on brush interseciton
+ /* Calculate positions of new particles to add, based on brush intersection
* with object. New particle data is assigned to a corresponding to check
* index element of add_pars array. This means, that add_pars is a sparse
* array.
@@ -3993,7 +3993,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
BLI_task_parallel_range(0, number, &iter_data, brush_add_count_iter, &settings);
/* Convert add_parse to a dense array, where all new particles are in the
- * beginnign of the array.
+ * beginning of the array.
*/
n = iter_data.num_added;
for (int current_iter = 0, new_index = 0; current_iter < number; current_iter++) {
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index c65cada1cc0..dee56d7f2fa 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -50,6 +50,9 @@ set(SRC
render_intern.h
)
+set(LIB
+)
+
if(WITH_HEADLESS)
add_definitions(-DWITH_HEADLESS)
endif()
@@ -67,4 +70,4 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_render "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_render "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 0b0acbffec9..77b24a1b4d9 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -189,7 +189,7 @@ typedef struct IconPreview {
/* *************************** Preview for buttons *********************** */
-static Main *G_pr_main_cycles = NULL;
+static Main *G_pr_main = NULL;
static Main *G_pr_main_grease_pencil = NULL;
#ifndef WITH_HEADLESS
@@ -218,19 +218,13 @@ void ED_preview_ensure_dbase(void)
static bool base_initialized = false;
BLI_assert(BLI_thread_is_main());
if (!base_initialized) {
- G_pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size);
+ G_pr_main = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size);
G_pr_main_grease_pencil = load_main_from_memory(datatoc_preview_grease_pencil_blend, datatoc_preview_grease_pencil_blend_size);
base_initialized = true;
}
#endif
}
-static bool check_engine_supports_textures(Scene *scene)
-{
- RenderEngineType *type = RE_engines_find(scene->r.engine);
- return (type->flag & RE_USE_TEXTURE_PREVIEW) != 0;
-}
-
static bool check_engine_supports_preview(Scene *scene)
{
RenderEngineType *type = RE_engines_find(scene->r.engine);
@@ -239,8 +233,8 @@ static bool check_engine_supports_preview(Scene *scene)
void ED_preview_free_dbase(void)
{
- if (G_pr_main_cycles)
- BKE_main_free(G_pr_main_cycles);
+ if (G_pr_main)
+ BKE_main_free(G_pr_main);
if (G_pr_main_grease_pencil)
BKE_main_free(G_pr_main_grease_pencil);
@@ -262,14 +256,16 @@ static const char *preview_collection_name(const char pr_type)
return "Sphere";
case MA_CUBE:
return "Cube";
- case MA_MONKEY:
- return "Monkey";
+ case MA_SHADERBALL:
+ return "Shader Ball";
+ case MA_CLOTH:
+ return "Cloth";
+ case MA_FLUID:
+ return "Fluid";
case MA_SPHERE_A:
- return "World Sphere";
- case MA_TEXTURE:
- return "Texture";
+ return "World Shader Ball";
case MA_LAMP:
- return "Light";
+ return "Lamp";
case MA_SKY:
return "Sky";
case MA_HAIR:
@@ -282,8 +278,9 @@ static const char *preview_collection_name(const char pr_type)
}
}
-static void set_preview_collection(Scene *scene, ViewLayer *view_layer, char pr_type)
+static void set_preview_visibility(Scene *scene, ViewLayer *view_layer, char pr_type, int pr_method)
{
+ /* Set appropriate layer as visibile. */
LayerCollection *lc = view_layer->layer_collections.first;
const char *collection_name = preview_collection_name(pr_type);
@@ -296,6 +293,18 @@ static void set_preview_collection(Scene *scene, ViewLayer *view_layer, char pr_
}
}
+ /* Hide floor for icon renders. */
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (STREQ(base->object->id.name + 2, "Floor")) {
+ if (pr_method == PR_ICON_RENDER) {
+ base->object->restrictflag |= OB_RESTRICT_RENDER;
+ }
+ else {
+ base->object->restrictflag &= ~OB_RESTRICT_RENDER;
+ }
+ }
+ }
+
BKE_layer_collection_sync(scene, view_layer);
}
@@ -389,11 +398,8 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
sce->r.cfra = scene->r.cfra;
- if (id_type == ID_TE && !check_engine_supports_textures(scene)) {
- /* Force blender internal for texture icons and nodes render,
- * seems commonly used render engines does not support
- * such kind of rendering.
- */
+ if (id_type == ID_TE) {
+ /* Texture is not actually rendered with engine, just set dummy value. */
BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine));
}
else {
@@ -410,8 +416,8 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
sp->id_copy = NULL;
BLI_addtail(&pr_main->materials, mat);
- /* use current scene world to light sphere */
- if (mat->pr_type == MA_SPHERE_A && sp->pr_method == PR_BUTS_RENDER) {
+ /* Use current scene world for lighting. */
+ if (mat->pr_flag == MA_PREVIEW_WORLD && sp->pr_method == PR_BUTS_RENDER) {
/* Use current scene world to light sphere. */
sce->world = preview_get_localized_world(sp, scene->world);
}
@@ -419,17 +425,14 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
/* Use a default world color. Using the current
* scene world can be slow if it has big textures. */
sce->world->use_nodes = false;
- sce->world->horr = 0.5f;
- sce->world->horg = 0.5f;
- sce->world->horb = 0.5f;
+ sce->world->horr = 0.05f;
+ sce->world->horg = 0.05f;
+ sce->world->horb = 0.05f;
}
- if (sp->pr_method == PR_ICON_RENDER) {
- set_preview_collection(sce, view_layer, MA_SPHERE_A);
- }
- else {
- set_preview_collection(sce, view_layer, mat->pr_type);
+ set_preview_visibility(sce, view_layer, mat->pr_type, sp->pr_method);
+ if (sp->pr_method != PR_ICON_RENDER) {
if (mat->nodetree && sp->pr_method == PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
BKE_node_preview_init_tree(mat->nodetree, sp->sizex, sp->sizey, true);
@@ -470,7 +473,6 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
sp->id_copy = NULL;
BLI_addtail(&pr_main->textures, tex);
}
- set_preview_collection(sce, view_layer, MA_TEXTURE);
if (tex && tex->nodetree && sp->pr_method == PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
@@ -490,7 +492,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_addtail(&pr_main->lights, la);
}
- set_preview_collection(sce, view_layer, MA_LAMP);
+ set_preview_visibility(sce, view_layer, MA_LAMP, sp->pr_method);
if (sce->world) {
/* Only use lighting from the light. */
@@ -524,7 +526,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_addtail(&pr_main->worlds, wrld);
}
- set_preview_collection(sce, view_layer, MA_SKY);
+ set_preview_visibility(sce, view_layer, MA_SKY, sp->pr_method);
sce->world = wrld;
if (wrld && wrld->nodetree && sp->pr_method == PR_NODE_RENDER) {
@@ -1178,7 +1180,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
}
if ((ma == NULL) || (ma->gp_style == NULL)) {
- sp->pr_main = G_pr_main_cycles;
+ sp->pr_main = G_pr_main;
}
else {
sp->pr_main = G_pr_main_grease_pencil;
@@ -1359,7 +1361,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
}
if ((ma == NULL) || (ma->gp_style == NULL)) {
- sp->pr_main = G_pr_main_cycles;
+ sp->pr_main = G_pr_main;
}
else {
sp->pr_main = G_pr_main_grease_pencil;
diff --git a/source/blender/editors/scene/CMakeLists.txt b/source/blender/editors/scene/CMakeLists.txt
index 7f496cad060..0768e0ee571 100644
--- a/source/blender/editors/scene/CMakeLists.txt
+++ b/source/blender/editors/scene/CMakeLists.txt
@@ -34,8 +34,11 @@ set(SRC
scene_edit.c
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_scene "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_scene "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 810adba3288..a4a0b873c92 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -54,10 +54,13 @@ set(SRC
screen_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 0150127d6fb..e01f6e04086 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -446,7 +446,7 @@ void ED_area_do_msg_notify_tag_refresh(
/**
* Although there's no general support for minimizing areas, the status-bar can
* be snapped to be only a few pixels high. A few pixels rather than 0 so it
- * can be un-minimized again. We consider it pseudo-minimalized and don't draw
+ * can be un-minimized again. We consider it pseudo-minimized and don't draw
* it then.
*/
static bool area_is_pseudo_minimized(const ScrArea *area)
@@ -1913,7 +1913,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
/* Sync header alignment. */
if (sync_header_alignment) {
/* Spaces with footer. */
- if (st->spaceid == SPACE_TEXT){
+ if (st->spaceid == SPACE_TEXT) {
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_HEADER) {
ar->alignment = header_alignment;
@@ -2573,7 +2573,7 @@ int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback)
int ED_area_footer_alignment(const ScrArea *area)
{
return ED_area_footer_alignment_or_fallback(
- area, (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM);
+ area, (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM);
}
/**
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 230d6179871..1606a159e38 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -286,6 +286,13 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
immAttr2f(texco, (float)(0 + offset_left) / tex_w, (float)(subpart_h - offset_top) / tex_h);
immVertex2f(pos, rast_x + (float)offset_left * xzoom, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY);
immEnd();
+
+ /* NOTE: Weirdly enough this is only required on macOS. Without this there is some sort of
+ * bleeding of data is happening from tiles which are drawn later on.
+ * This doesn't seem to be too slow, but still would be nice to have fast and nice solution. */
+#ifdef __APPLE__
+ GPU_flush();
+#endif
}
}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 41ce5455c3b..031eee3c9a4 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1263,8 +1263,10 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
for (ar = newa->regionbase.first; ar; ar = ar->next) {
ar->flagfullscreen = ar->flag;
- if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_HEADER, RGN_TYPE_FOOTER,
- RGN_TYPE_TOOLS, RGN_TYPE_NAV_BAR, RGN_TYPE_EXECUTE)) {
+ if (ELEM(ar->regiontype,
+ RGN_TYPE_UI, RGN_TYPE_HEADER, RGN_TYPE_FOOTER,
+ RGN_TYPE_TOOLS, RGN_TYPE_NAV_BAR, RGN_TYPE_EXECUTE))
+ {
ar->flag |= RGN_FLAG_HIDDEN;
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 09ca0476b10..f475a87df59 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -618,7 +618,7 @@ static ARegion *screen_find_region_type(bContext *C, int type)
*
* functions:
*
- * apply() set actionzone event
+ * apply() set action-zone event
*
* exit() free customdata
*
@@ -826,7 +826,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
return az;
}
-/* Finds an actionzone by position in entire screen so azones can overlap */
+/* Finds an action-zone by position in entire screen so azones can overlap. */
static AZone *screen_actionzone_find_xy(bScreen *sc, const int xy[2])
{
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
@@ -904,7 +904,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL))
return OPERATOR_PASS_THROUGH;
- /* ok we do the actionzone */
+ /* ok we do the action-zone */
sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
sad->sa1 = screen_actionzone_area(sc, az);
sad->az = az;
@@ -1054,7 +1054,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
*
* functions:
*
- * init() set custom data for operator, based on actionzone event custom data
+ * init() set custom data for operator, based on action-zone event custom data
*
* cancel() cancel the operator
*
@@ -1062,7 +1062,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
*
* callbacks:
*
- * invoke() gets called on shift+lmb drag in actionzone
+ * invoke() gets called on shift+lmb drag in action-zone
* call init(), add handler
*
* modal() accept modal events while doing it
@@ -2280,7 +2280,6 @@ typedef struct RegionMoveData {
static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
{
- ARegion *ar;
int dist;
/* regions in regions. */
@@ -2288,11 +2287,11 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
const int align = scalear->alignment & RGN_ALIGN_ENUM_MASK;
if (ELEM(align, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
- ar = scalear->prev;
+ ARegion *ar = scalear->prev;
dist = ar->winy + scalear->winy - U.pixelsize;
}
- else if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
- ar = scalear->prev;
+ else /* if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) */ {
+ ARegion *ar = scalear->prev;
dist = ar->winx + scalear->winx - U.pixelsize;
}
}
@@ -2306,7 +2305,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
/* subtractwidth of regions on opposite side
* prevents dragging regions into other opposite regions */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar == scalear)
continue;
@@ -3811,8 +3810,8 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN
(sa->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
"SCREEN_OT_header_toggle_menus");
- /* file browser should be fullscreen all the time, topbar should
- * never be. But other regions can be maximized/restored... */
+ /* File browser should be fullscreen all the time, top-bar should
+ * never be. But other regions can be maximized/restored. */
if (!ELEM(sa->spacetype, SPACE_FILE, SPACE_TOPBAR)) {
uiItemS(layout);
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 704de3f7f9d..d772a1a0541 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -64,10 +64,13 @@ set(SRC
sculpt_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 863afcf70aa..4d1dd7eb1d6 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -796,8 +796,8 @@ static void paint_draw_alpha_overlay(
UnifiedPaintSettings *ups, Brush *brush,
ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{
- /* color means that primary brush texture is colured and
- * secondary is used for alpha/mask control */
+ /* Color means that primary brush texture is colored and
+ * secondary is used for alpha/mask control. */
bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 5e3d01d7f6a..0fdd3043d0c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -83,9 +83,9 @@
#include "paint_intern.h"
-/* this is a static resource for non-globality,
- * Maybe it should be exposed as part of the
- * paint operation, but for now just give a public interface */
+/* This is a static resource for non-global access.
+ * Maybe it should be exposed as part of the paint operation, but for now just give a public interface.
+ */
static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
ImagePaintPartialRedraw *get_imapaintpartial(void)
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 1691b70a271..45ae3e9dc11 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -924,8 +924,8 @@ static bool project_bucket_point_occluded(
return false;
}
-/* basic line intersection, could move to math_geom.c, 2 points with a horiz line
- * 1 for an intersection, 2 if the first point is aligned, 3 if the second point is aligned */
+/* Basic line intersection, could move to math_geom.c, 2 points with a horizontal line
+ * 1 for an intersection, 2 if the first point is aligned, 3 if the second point is aligned. */
#define ISECT_TRUE 1
#define ISECT_TRUE_P1 2
#define ISECT_TRUE_P2 3
@@ -1747,7 +1747,7 @@ static float project_paint_uvpixel_mask(
} /* otherwise no mask normal is needed, were within the limit */
}
- /* This only works when the opacity dosnt change while painting, stylus pressure messes with this
+ /* This only works when the opacity doesn't change while painting, stylus pressure messes with this
* so don't use it. */
// if (ps->is_airbrush == 0) mask *= BKE_brush_alpha_get(ps->brush);
@@ -2443,8 +2443,8 @@ static void project_bucket_clip_face(
*tot = 3;
return;
}
- /* handle pathological case here,
- * no need for further intersections below since tringle area is almost zero */
+ /* Handle pathological case here,
+ * no need for further intersections below since triangle area is almost zero. */
if (collinear) {
int flag;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index ca12854aa7d..85bdba683cd 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1887,7 +1887,7 @@ static void do_wpaint_brush_draw_task_cb_ex(
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* Note: grids are 1:1 with corners (aka loops).
- * For multires, take the vert whose loop cooresponds to the current grid.
+ * For multires, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
@@ -2675,7 +2675,7 @@ static void do_vpaint_brush_draw_task_cb_ex(
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* Note: Grids are 1:1 with corners (aka loops).
- * For grid based pbvh, take the vert whose loop cooresponds to the current grid.
+ * For grid based pbvh, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
@@ -2769,7 +2769,7 @@ static void do_vpaint_brush_blur_task_cb_ex(
{
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- /* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
+ /* For grid based pbvh, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
@@ -2888,7 +2888,7 @@ static void do_vpaint_brush_smear_task_cb_ex(
{
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- /* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
+ /* For grid based pbvh, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index a371d8ec93c..cd366ecff3b 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -224,8 +224,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
vgroup_weight = BKE_defvert_multipaint_collective_weight(
&me->dvert[v_idx_best], defbase_tot, defbase_sel, defbase_tot_sel, ts->auto_normalize);
- /* if autonormalize is enabled, but weights are not normalized,
- * the value can exceed 1 */
+ /* If auto-normalize is enabled, but weights are not normalized,
+ * the value can exceed 1. */
CLAMP(vgroup_weight, 0.0f, 1.0f);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 24edd9bec86..ad2cfb5f9fc 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1599,7 +1599,7 @@ static void bmesh_neighbor_average(float avg[3], BMVert *v)
}
/* For bmesh: average only the four most aligned (parallel and perpendicular) edges
- * relative to a direction. Naturally converges to a quad-like tesselation. */
+ * relative to a direction. Naturally converges to a quad-like tessellation. */
static void bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v)
{
/* Logic for 3 or more is identical. */
diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt
index 67ec2359c5e..41650f07101 100644
--- a/source/blender/editors/sound/CMakeLists.txt
+++ b/source/blender/editors/sound/CMakeLists.txt
@@ -35,6 +35,9 @@ set(SRC
sound_intern.h
)
+set(LIB
+)
+
if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
@@ -51,4 +54,4 @@ if(WITH_CODEC_SNDFILE)
add_definitions(-DWITH_SNDFILE)
endif()
-blender_add_lib(bf_editor_sound "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_sound "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index 92cf40248ff..aff4e75abb7 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -44,6 +44,9 @@ set(SRC
action_intern.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 8cfb77e58d7..0db1fd6eec3 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -164,7 +164,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
bDopeSheet *ads = &saction->ads;
AnimData *adt = NULL;
- float act_start, act_end, y;
+ float y;
unsigned char col1[4], col2[4];
unsigned char col1a[4], col2a[4];
@@ -183,16 +183,6 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELOB, col1b);
UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
- /* set view-mapping rect (only used for x-axis), for NLA-scaling mapping with less calculation */
-
- /* if in NLA there's a strip active, map the view */
- if (ac->datatype == ANIMCONT_ACTION) {
- /* adt = ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */
-
- /* start and end of action itself */
- calc_action_range(ac->data, &act_start, &act_end, 0);
- }
-
/* build list of channels to draw */
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -286,9 +276,6 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* draw region twice: firstly backdrop, then the current range */
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
-
- if (ac->datatype == ANIMCONT_ACTION)
- immRectf(pos, act_start, (float)y - ACHANNEL_HEIGHT_HALF(ac), act_end, (float)y + ACHANNEL_HEIGHT_HALF(ac));
}
else if (ac->datatype == ANIMCONT_GPENCIL) {
unsigned char *color;
@@ -348,6 +335,12 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
*/
y = (float)(-ACHANNEL_HEIGHT(ac));
+ int action_flag = saction->flag;
+
+ if (saction->mode == SACTCONT_TIMELINE) {
+ action_flag &= ~(SACTION_SHOW_INTERPOLATION | SACTION_SHOW_EXTREMES);
+ }
+
for (ale = anim_data.first; ale; ale = ale->next) {
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
@@ -363,28 +356,28 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* draw 'keyframes' for each specific datatype */
switch (ale->datatype) {
case ALE_ALL:
- draw_summary_channel(v2d, ale->data, y, ac->yscale_fac, saction->flag);
+ draw_summary_channel(v2d, ale->data, y, ac->yscale_fac, action_flag);
break;
case ALE_SCE:
- draw_scene_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
+ draw_scene_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, action_flag);
break;
case ALE_OB:
- draw_object_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
+ draw_object_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, action_flag);
break;
case ALE_ACT:
- draw_action_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
+ draw_action_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, action_flag);
break;
case ALE_GROUP:
- draw_agroup_channel(v2d, adt, ale->data, y, ac->yscale_fac, saction->flag);
+ draw_agroup_channel(v2d, adt, ale->data, y, ac->yscale_fac, action_flag);
break;
case ALE_FCURVE:
- draw_fcurve_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
+ draw_fcurve_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, action_flag);
break;
case ALE_GPFRAME:
- draw_gpl_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
+ draw_gpl_channel(v2d, ads, ale->data, y, ac->yscale_fac, action_flag);
break;
case ALE_MASKLAY:
- draw_masklay_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
+ draw_masklay_channel(v2d, ads, ale->data, y, ac->yscale_fac, action_flag);
break;
}
}
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 3dffa6afb55..f2550550bc1 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -95,6 +95,7 @@ static SpaceLink *action_new(const ScrArea *sa, const Scene *scene)
saction->autosnap = SACTSNAP_FRAME;
saction->mode = SACTCONT_DOPESHEET;
saction->mode_prev = SACTCONT_DOPESHEET;
+ saction->flag = SACTION_SHOW_INTERPOLATION;
saction->ads.filterflag |= ADS_FILTER_SUMMARY;
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index 34436ae9b4d..8f744269de8 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -34,4 +34,7 @@ set(SRC
spacetypes.c
)
-blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 90919fa793d..5ec2041c1dc 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -41,6 +41,9 @@ set(SRC
buttons_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -51,4 +54,4 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index a40a1bf6d25..d770a85709a 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -63,10 +63,13 @@ set(SRC
tracking_ops_intern.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 79a159bac2e..7cfc5257792 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -578,7 +578,7 @@ void ED_clip_point_stable_pos(SpaceClip *sc, ARegion *ar, float x, float y, floa
}
/**
- * \brief the reverse of ED_clip_point_stable_pos(), gets the marker region coords.
+ * \brief the reverse of #ED_clip_point_stable_pos(), gets the marker region coords.
* better name here? view_to_track / track_to_view or so?
*/
void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2])
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index bed1b7dce96..d68e7745bdf 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -40,10 +40,13 @@ set(SRC
console_intern.h
)
+set(LIB
+)
+
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 07ba1cc7a64..a92ed62cae2 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -52,6 +52,9 @@ set(SRC
fsmenu.h
)
+set(LIB
+)
+
if(WITH_HEADLESS)
add_definitions(-DWITH_HEADLESS)
endif()
@@ -94,4 +97,4 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_editor_space_file "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_file "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 5195fa818d6..3ab08b5ac71 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -240,14 +240,21 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
if (params->display == FILE_DEFAULTDISPLAY) {
- if (U.uiflag & USER_SHOW_THUMBNAILS) {
- if (params->filter & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT))
- params->display = FILE_IMGDISPLAY;
- else
+ if(params->display_previous == FILE_DEFAULTDISPLAY){
+ if (U.uiflag & USER_SHOW_THUMBNAILS) {
+ if (params->filter & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT)) {
+ params->display = FILE_IMGDISPLAY;
+ }
+ else {
+ params->display = FILE_SHORTDISPLAY;
+ }
+ }
+ else {
params->display = FILE_SHORTDISPLAY;
+ }
}
else {
- params->display = FILE_SHORTDISPLAY;
+ params->display = params->display_previous;
}
}
@@ -265,6 +272,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->flag |= FILE_HIDE_DOT;
params->flag &= ~FILE_DIRSEL_ONLY;
params->display = FILE_SHORTDISPLAY;
+ params->display_previous = FILE_DEFAULTDISPLAY;
params->sort = FILE_SORT_ALPHA;
params->filter = 0;
params->filter_glob[0] = '\0';
@@ -554,7 +562,6 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
(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;
if (layout->rows > 0)
@@ -566,6 +573,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->width = sfile->layout->columns * (layout->tile_w + 2 * layout->tile_border_x) + layout->tile_border_x * 2;
layout->flag = FILE_LAYOUT_HOR;
}
+ params->display_previous = params->display;
layout->dirty = false;
}
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 20e2ebc0936..53c228cd9c9 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -45,6 +45,9 @@ set(SRC
graph_intern.h
)
+set(LIB
+)
+
if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
@@ -59,4 +62,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 77abfebc662..99ede338dee 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -47,6 +47,9 @@ set(SRC
image_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -73,4 +76,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index f54e4921e6b..665d130e072 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -49,10 +49,13 @@ set(SRC
textview.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index eb0d92e2e69..35c29ad4492 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -45,10 +45,13 @@ set(SRC
nla_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 049342b0244..b06b7120faf 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -360,7 +360,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
row = uiLayoutRow(layout, true);
uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE);
- /* blend in/out + autoblending
+ /* Blend in/out + auto-blending:
* - blend in/out can only be set when autoblending is off
*/
column = uiLayoutColumn(layout, true);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index a92a2ec66ca..1d21619fbd1 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -1269,8 +1269,8 @@ static void nlaedit_split_strip_actclip(Main *bmain, AnimData *adt, NlaTrack *nl
nstrip = BKE_nlastrip_copy(bmain, strip, true, 0);
BLI_insertlinkafter(&nlt->strips, strip, nstrip);
- /* set the endpoint of the first strip and the start of the new strip
- * to the splitframe values calculated above
+ /* Set the endpoint of the first strip and the start of the new strip
+ * to the split-frame values calculated above.
*/
strip->end = splitframe;
nstrip->start = splitframe;
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 0950e738e3e..2c1ec0cc834 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -57,6 +57,9 @@ set(SRC
node_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
@@ -67,4 +70,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 55a3da6f77c..afb0c833aa8 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -1543,7 +1543,7 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
/* check if the node rect intersetcts the line from this point to next one */
if (BLI_rctf_isect_segment(&select->totr, coord_array[i], coord_array[i + 1])) {
/* store the shortest distance to the upper left edge
- * of all intersetctions found so far */
+ * of all intersections found so far */
const float node_xy[] = {select->totr.xmin, select->totr.ymax};
/* to be precise coord_array should be clipped by select->totr,
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 207a5c194bd..ae2d52533fe 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -49,10 +49,13 @@ set(SRC
outliner_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index d6344eb9005..600f6b1fbe9 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1750,7 +1750,7 @@ static void outliner_draw_tree_element(
}
else if (te->idcode == ID_OB) {
Object *ob = (Object *)tselem->id;
- Base *base = (Base *)te->directdata;
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
if (ob == obact || is_selected) {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 72e9236636e..a4e512d6846 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -331,8 +331,6 @@ static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te,
outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
}
- outliner_add_element(soops, &te->subtree, ob->gpd, te, 0, 0);
-
outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
if (ob->pose) {
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 5d950a3558d..19b3e42b37a 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -39,6 +39,9 @@ set(SRC
script_intern.h
)
+set(LIB
+)
+
if(WITH_PYTHON)
list(APPEND INC
../../python
@@ -48,4 +51,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 7d76fa1af5c..bf70473610d 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -50,6 +50,9 @@ set(SRC
sequencer_intern.h
)
+set(LIB
+)
+
if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
@@ -64,4 +67,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index b7d3bec326a..9e5a2624226 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2455,7 +2455,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
Sequence *seq_next;
/* remove seq so overlap tests don't conflict,
- * see seq_free_sequence below for the real free'ing */
+ * see seq_free_sequence below for the real freeing. */
BLI_remlink(ed->seqbasep, seq);
/* if (seq->ipo) id_us_min(&seq->ipo->id); */
/* XXX, remove fcurve and assign to split image strips */
@@ -2584,8 +2584,8 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
BKE_sequence_calc(scene, seq);
}
- /* 2.73+, keeping endpoings is important!
- * moving them around means you can't usefully use metas in a complex edit */
+ /* 2.73+, keeping endpoints is important!
+ * moving them around means you can't usefully use metas in a complex edit. */
#if 1
BKE_sequence_tx_set_final_left(ms->parseq, ms->disp_range[0]);
BKE_sequence_tx_set_final_right(ms->parseq, ms->disp_range[1]);
@@ -3354,7 +3354,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
}
/* Replace datablock pointers with copies, to keep things working in case
- * datablocks get deleted or another .blend file is openeded. */
+ * datablocks get deleted or another .blend file is opened. */
BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt
index 8440d410c31..3b1372b419e 100644
--- a/source/blender/editors/space_statusbar/CMakeLists.txt
+++ b/source/blender/editors/space_statusbar/CMakeLists.txt
@@ -37,6 +37,9 @@ set(SRC
space_statusbar.c
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_statusbar "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_statusbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index 378f2e5d84f..b542732fc54 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -51,6 +51,9 @@ set(SRC
text_intern.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
if(WITH_PYTHON)
@@ -64,4 +67,4 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_space_text "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_text "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 87bbefdd365..1b49e637350 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -154,14 +154,19 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
/************************** draw text *****************************/
-/* Notes on word-wrap
+/**
+ * Notes on word-wrap
* --
- * All word-wrap functions follow the algorithm below to maintain consistency.
- * line The line to wrap (tabs converted to spaces)
- * view_width The maximum number of characters displayable in the region
- * This equals region_width/font_width for the region
- * wrap_chars Characters that allow wrapping. This equals [' ', '\t', '-']
+ * All word-wrap functions follow the algorithm below to maintain consistency:
+ * - line:
+ * The line to wrap (tabs converted to spaces)
+ * - view_width:
+ * The maximum number of characters displayable in the region
+ * This equals region_width/font_width for the region
+ * - wrap_chars:
+ * Characters that allow wrapping. This equals [' ', '\t', '-']
*
+ * \code{.py}
* def wrap(line, view_width, wrap_chars):
* draw_start = 0
* draw_end = view_width
@@ -175,6 +180,7 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
* draw_end = pos+1
* pos += 1
* print line[draw_start:]
+ * \encode
*/
int wrap_width(const SpaceText *st, ARegion *ar)
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index 7118b8b748a..4b25c5d39a7 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -30,9 +30,10 @@
/* *** Lua Keywords (for format_line) *** */
-/* Checks the specified source string for a Lua keyword (minus boolean & 'nil').
+/**
+ * Checks the specified source string for a Lua keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
- * followed by a non-identifier (see text_check_identifier(char)) or null char.
+ * followed by a non-identifier (see #text_check_identifier(char)) or null char.
*
* If a keyword is found, the length of the matching word is returned.
* Otherwise, -1 is returned.
@@ -40,7 +41,6 @@
* See:
* http://www.lua.org/manual/5.1/manual.html#2.1
*/
-
static int txtfmt_lua_find_keyword(const char *string)
{
int i, len;
@@ -71,9 +71,10 @@ static int txtfmt_lua_find_keyword(const char *string)
return i;
}
-/* Checks the specified source string for a Lua special name/function. This
+/**
+ * Checks the specified source string for a Lua special name/function. This
* name must start at the beginning of the source string and must be followed
- * by a non-identifier (see text_check_identifier(char)) or null character.
+ * by a non-identifier (see *text_check_identifier(char)) or null character.
*
* If a special name is found, the length of the matching name is returned.
* Otherwise, -1 is returned.
@@ -81,7 +82,6 @@ static int txtfmt_lua_find_keyword(const char *string)
* See:
* http://www.lua.org/manual/5.1/manual.html#5.1
*/
-
static int txtfmt_lua_find_specialvar(const char *string)
{
int i, len;
diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c
index da10c8626b5..2435d2f21da 100644
--- a/source/blender/editors/space_text/text_format_pov.c
+++ b/source/blender/editors/space_text/text_format_pov.c
@@ -30,9 +30,10 @@
/* *** POV Keywords (for format_line) *** */
-/* Checks the specified source string for a POV keyword (minus boolean & 'nil').
+/**
+ * Checks the specified source string for a POV keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
- * followed by a non-identifier (see text_check_identifier(char)) or null char.
+ * followed by a non-identifier (see #text_check_identifier(char)) or null char.
*
* If a keyword is found, the length of the matching word is returned.
* Otherwise, -1 is returned.
@@ -40,7 +41,6 @@
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
-
static int txtfmt_pov_find_keyword(const char *string)
{
int i, len;
@@ -467,9 +467,10 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
}
-/* Checks the specified source string for a POV modifiers. This
+/**
+ * Checks the specified source string for a POV modifiers. This
* name must start at the beginning of the source string and must be followed
- * by a non-identifier (see text_check_identifier(char)) or null character.
+ * by a non-identifier (see #text_check_identifier(char)) or null character.
*
* If a special name is found, the length of the matching name is returned.
* Otherwise, -1 is returned.
@@ -477,7 +478,6 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
-
static int txtfmt_pov_find_specialvar(const char *string)
{
int i, len;
diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c
index e41fd94ef49..da69a35f0b0 100644
--- a/source/blender/editors/space_text/text_format_pov_ini.c
+++ b/source/blender/editors/space_text/text_format_pov_ini.c
@@ -30,9 +30,10 @@
/* *** POV INI Keywords (for format_line) *** */
-/* Checks the specified source string for a POV INI keyword (minus boolean & 'nil').
+/**
+ * Checks the specified source string for a POV INI keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
- * followed by a non-identifier (see text_check_identifier(char)) or null char.
+ * followed by a non-identifier (see #text_check_identifier(char)) or null char.
*
* If a keyword is found, the length of the matching word is returned.
* Otherwise, -1 is returned.
@@ -40,7 +41,6 @@
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
-
static int txtfmt_ini_find_keyword(const char *string)
{
int i, len;
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c
index 85c3c4220c0..87b3835ce1e 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -30,9 +30,10 @@
/* *** Local Functions (for format_line) *** */
-/* Checks the specified source string for a Python built-in function name. This
+/**
+ * Checks the specified source string for a Python built-in function name. This
* name must start at the beginning of the source string and must be followed by
- * a non-identifier (see text_check_identifier(char)) or null character.
+ * a non-identifier (see #text_check_identifier(char)) or null character.
*
* If a built-in function is found, the length of the matching name is returned.
* Otherwise, -1 is returned.
@@ -40,7 +41,6 @@
* See:
* http://docs.python.org/py3k/reference/lexical_analysis.html#keywords
*/
-
static int txtfmt_py_find_builtinfunc(const char *string)
{
int i, len;
diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt
index 418a0eb3ad8..15352044d4a 100644
--- a/source/blender/editors/space_topbar/CMakeLists.txt
+++ b/source/blender/editors/space_topbar/CMakeLists.txt
@@ -37,6 +37,9 @@ set(SRC
space_topbar.c
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_space_topbar "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_topbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt
index ec0c76c3d5b..d26766358ca 100644
--- a/source/blender/editors/space_userpref/CMakeLists.txt
+++ b/source/blender/editors/space_userpref/CMakeLists.txt
@@ -36,4 +36,7 @@ set(SRC
userpref_intern.h
)
-blender_add_lib(bf_editor_space_userpref "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_editor_space_userpref "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 83e65246797..e3f5245fc59 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -72,6 +72,9 @@ set(SRC
view3d_intern.h
)
+set(LIB
+)
+
if(WITH_PYTHON)
blender_include_dirs(../../python)
add_definitions(-DWITH_PYTHON)
@@ -91,4 +94,4 @@ if(WITH_MOD_SMOKE)
add_definitions(-DWITH_SMOKE)
endif()
-blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index d46c7a292cb..42860b62ae5 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -415,8 +415,8 @@ static void view3d_free(SpaceLink *sl)
MEM_freeN(vd->localvd);
}
- if (vd->properties_storage) {
- MEM_freeN(vd->properties_storage);
+ if (vd->runtime.properties_storage) {
+ MEM_freeN(vd->runtime.properties_storage);
}
if (vd->fx_settings.ssao) {
@@ -443,7 +443,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
if (v3dn->localvd) {
v3dn->localvd = NULL;
- v3dn->properties_storage = NULL;
+ v3dn->runtime.properties_storage = NULL;
}
if (v3dn->shading.type == OB_RENDER) {
@@ -452,7 +452,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
/* copy or clear inside new stuff */
- v3dn->properties_storage = NULL;
+ v3dn->runtime.properties_storage = NULL;
if (v3dn->fx_settings.dof) {
v3dn->fx_settings.dof = MEM_dupallocN(v3do->fx_settings.dof);
}
@@ -697,6 +697,7 @@ static void view3d_widgets(void)
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(
&(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW});
+ WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_xform_gizmo_context);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_spot);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_area);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_target);
@@ -706,7 +707,7 @@ static void view3d_widgets(void)
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_empty_image);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_armature_spline);
- WM_gizmogrouptype_append(TRANSFORM_GGT_gizmo);
+ WM_gizmogrouptype_append(VIEW3D_GGT_xform_gizmo);
WM_gizmogrouptype_append(VIEW3D_GGT_xform_cage);
WM_gizmogrouptype_append(VIEW3D_GGT_xform_shear);
WM_gizmogrouptype_append(VIEW3D_GGT_xform_extrude);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 3baf297e580..ca30e3d3b01 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -196,10 +196,10 @@ static void apply_scale_factor_clamp(float *val, const int tot, const float ve_m
static TransformProperties *v3d_transform_props_ensure(View3D *v3d)
{
- if (v3d->properties_storage == NULL) {
- v3d->properties_storage = MEM_callocN(sizeof(TransformProperties), "TransformProperties");
+ if (v3d->runtime.properties_storage == NULL) {
+ v3d->runtime.properties_storage = MEM_callocN(sizeof(TransformProperties), "TransformProperties");
}
- return v3d->properties_storage;
+ return v3d->runtime.properties_storage;
}
/* is used for both read and write... */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 522d081fdd6..3399bda1cfa 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1324,7 +1324,6 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
BLF_batch_draw_begin();
if ((U.uiflag & USER_SHOW_GIZMO_AXIS) ||
- (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
/* No need to display gizmo and this info. */
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 454315afa57..f7fcd5cb11f 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -81,6 +81,7 @@
#include "ED_space_api.h"
#include "ED_screen_types.h"
#include "ED_transform.h"
+#include "ED_view3d.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -174,12 +175,12 @@ static void validate_object_select_id(
/* do nothing */
}
else if ((obact_eval && (obact_eval->mode & OB_MODE_PARTICLE_EDIT)) &&
- V3D_IS_ZBUF(v3d))
+ !XRAY_ENABLED(v3d))
{
/* do nothing */
}
else if ((obedit && (obedit->mode & OB_MODE_EDIT)) &&
- V3D_IS_ZBUF(v3d))
+ !XRAY_FLAG_ENABLED(v3d))
{
/* do nothing */
}
@@ -654,7 +655,7 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
float zoomx = (x2 - x1) / ibuf->x;
float zoomy = (y2 - y1) / ibuf->y;
- /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
+ /* For some reason; zoom-levels down refuses to use GL_ALPHA_SCALE. */
if (zoomx < 1.0f || zoomy < 1.0f) {
float tzoom = min_ff(zoomx, zoomy);
int mip = 0;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 19008ebd122..e74703baf2d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4003,6 +4003,13 @@ void VIEW3D_OT_view_camera(wmOperatorType *ot)
* Rotate (orbit) in incremental steps. For interactive orbit see #VIEW3D_OT_rotate.
* \{ */
+enum {
+ V3D_VIEW_STEPLEFT = 1,
+ V3D_VIEW_STEPRIGHT,
+ V3D_VIEW_STEPDOWN,
+ V3D_VIEW_STEPUP,
+};
+
static const EnumPropertyItem prop_view_orbit_items[] = {
{V3D_VIEW_STEPLEFT, "ORBITLEFT", 0, "Orbit Left", "Orbit the view around to the Left"},
{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"},
@@ -4366,6 +4373,13 @@ void VIEW3D_OT_view_roll(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
+enum {
+ V3D_VIEW_PANLEFT = 1,
+ V3D_VIEW_PANRIGHT,
+ V3D_VIEW_PANDOWN,
+ V3D_VIEW_PANUP,
+};
+
static const EnumPropertyItem prop_view_pan_items[] = {
{V3D_VIEW_PANLEFT, "PANLEFT", 0, "Pan Left", "Pan the view to the Left"},
{V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"},
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
index a2b93dcd309..64617b03c5e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
@@ -125,9 +125,7 @@ static void gizmo_bbone_offset_set(
static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index 2aa10dc3040..590597145a0 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -61,8 +61,11 @@ struct CameraWidgetGroup {
static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_LENS) == 0 &&
+ (v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_DOF_DIST) == 0)
{
return false;
}
@@ -135,6 +138,7 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
}
struct CameraWidgetGroup *cagzgroup = gzgroup->customdata;
+ View3D *v3d = CTX_wm_view3d(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Camera *ca = ob->data;
@@ -145,7 +149,9 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
negate_v3_v3(dir, ob->obmat[2]);
- if (ca->flag & CAM_SHOWLIMITS) {
+ if ((ca->flag & CAM_SHOWLIMITS) &&
+ (v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_DOF_DIST))
+ {
WM_gizmo_set_matrix_location(cagzgroup->dop_dist, ob->obmat[3]);
WM_gizmo_set_matrix_rotation_from_yz_axis(cagzgroup->dop_dist, ob->obmat[1], dir);
WM_gizmo_set_scale(cagzgroup->dop_dist, ca->drawsize);
@@ -234,6 +240,11 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
WM_gizmo_target_property_def_rna_ptr(widget, gz_prop_type, &camera_ptr, prop, -1);
}
+ /* This could be handled more elegently (split into two gizmo groups). */
+ if ((v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_LENS) == 0) {
+ WM_gizmo_set_flag(cagzgroup->focal_len, WM_GIZMO_HIDDEN, true);
+ WM_gizmo_set_flag(cagzgroup->ortho_scale, WM_GIZMO_HIDDEN, true);
+ }
}
static void WIDGETGROUP_camera_message_subscribe(
@@ -374,9 +385,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN
}
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index 7d6ec3b782f..8e78fe8a18e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -106,9 +106,10 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_IMAGE) == 0) {
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
index 750a8101a15..34cf38b3466 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
@@ -49,9 +49,10 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD) == 0) {
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c
index 90f1b60e21a..5fd5336f4ca 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_light.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c
@@ -51,9 +51,10 @@
static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_SIZE) == 0) {
return false;
}
@@ -161,7 +162,10 @@ static void gizmo_area_light_prop_matrix_set(
static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_SIZE) == 0) {
return false;
}
@@ -244,7 +248,10 @@ void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_LOOK_AT) == 0) {
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index acf6aa7e188..a6fd195b04d 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -121,13 +121,11 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
{
View3D *v3d = CTX_wm_view3d(C);
if (((U.uiflag & USER_SHOW_GIZMO_AXIS) == 0) ||
- (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{
return false;
}
return true;
-
}
static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 09757e13297..f8f92d8bef8 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -1042,9 +1042,7 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ar->regiondata;
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
return OPERATOR_CANCELLED;
}
@@ -1107,9 +1105,7 @@ static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
- (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
- {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 0054680281b..daa1cd38164 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -79,10 +79,12 @@ typedef struct foreachScreenFace_userData {
} foreachScreenFace_userData;
-/* Note! - foreach funcs should be called while drawing or directly after
- * if not, ED_view3d_init_mats_rv3d() can be used for selection tools
+/**
+ * \note foreach funcs should be called while drawing or directly after
+ * if not, #ED_view3d_init_mats_rv3d() can be used for selection tools
* but would not give correct results with dupli's for eg. which don't
- * use the object matrix in the usual way */
+ * use the object matrix in the usual way.
+ */
/* ------------------------------------------------------------------------ */
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 760cbb3f3ef..e5f8ac147de 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -582,7 +582,7 @@ bool ED_view3d_win_to_3d_on_plane_int(
/**
* Calculate a 3d difference vector from 2d window offset.
- * note that ED_view3d_calc_zfac() must be called first to determine
+ * note that #ED_view3d_calc_zfac() must be called first to determine
* the depth used to calculate the delta.
* \param ar: The region (used for the window width and height).
* \param mval: The area relative 2d difference (such as event->mval[0] - other_x).
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index ea44f19c4fe..3ff6a7146c6 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -943,7 +943,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
}
static bool do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, const eSelectOp sel_op)
{
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
rcti rect;
@@ -1472,7 +1472,7 @@ static int mixed_bones_object_selectbuffer_extended(
/* define if we use solid nearest select or not */
if (use_cycle) {
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
do_nearest = true;
if (len_manhattan_v2v2_int(mval, last_mval) <= WM_EVENT_CURSOR_MOTION_THRESHOLD) {
do_nearest = false;
@@ -1481,7 +1481,7 @@ static int mixed_bones_object_selectbuffer_extended(
copy_v2_v2_int(last_mval, mval);
}
else {
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
do_nearest = true;
}
}
@@ -1630,7 +1630,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
ED_view3d_viewcontext_init(C, &vc);
- const bool do_nearest = (vc.v3d->shading.type > OB_WIRE);
+ const bool do_nearest = !XRAY_ACTIVE(vc.v3d);
const int hits = mixed_bones_object_selectbuffer(
&vc, buffer, mval, VIEW3D_SELECT_FILTER_NOP, do_nearest);
@@ -1996,7 +1996,7 @@ static bool ed_wpaint_vertex_select_pick(
bool extend, bool deselect, bool toggle, Object *obact)
{
View3D *v3d = CTX_wm_view3d(C);
- const bool use_zbuf = V3D_IS_ZBUF(v3d);
+ const bool use_zbuf = !XRAY_ENABLED(v3d);
Mesh *me = obact->data; /* already checked for NULL */
uint index = 0;
@@ -2246,7 +2246,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
static bool do_paintvert_box_select(
ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
{
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Mesh *me;
MVert *mvert;
unsigned int *rt;
@@ -3096,7 +3096,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
static bool paint_vertsel_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 21716f28b85..4e5dddf4742 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1049,7 +1049,7 @@ int view3d_opengl_select(
* the object & bone view locking takes 'rect' into account, see: T51629. */
ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect);
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(true);
}
@@ -1058,7 +1058,7 @@ int view3d_opengl_select(
}
/* If in xray mode, we select the wires in priority. */
- if ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) && use_nearest) {
+ if (XRAY_ACTIVE(v3d) && use_nearest) {
/* We need to call "GPU_select_*" API's inside DRW_draw_select_loop
* because the OpenGL context created & destroyed inside this function. */
struct DrawSelectLoopUserData drw_select_loop_user_data = {
@@ -1092,7 +1092,8 @@ int view3d_opengl_select(
.rect = &rect,
.gpu_select_mode = gpu_select_mode,
};
- draw_surface = (v3d->shading.type > OB_WIRE) || ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) == 0);
+ /* If are not in wireframe mode, we need to use the mesh surfaces to check for hits */
+ draw_surface = (v3d->shading.type > OB_WIRE) || !XRAY_ENABLED(v3d);
DRW_draw_select_loop(
depsgraph, ar, v3d,
use_obedit_skip, draw_surface, use_nearest, &rect,
@@ -1104,7 +1105,7 @@ int view3d_opengl_select(
G.f &= ~G_FLAG_PICKSEL;
ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(false);
}
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 088128ba152..7d3690df826 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -54,10 +54,13 @@ set(SRC
transform.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index e785268b80a..4135a1b320d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -205,6 +205,9 @@ static void applyAlign(TransInfo *t, const int mval[2]);
static void initSeqSlide(TransInfo *t);
static void applySeqSlide(TransInfo *t, const int mval[2]);
+
+static void initGPOpacity(TransInfo *t);
+static void applyGPOpacity(TransInfo *t, const int mval[2]);
/* end transform callbacks */
@@ -2035,7 +2038,7 @@ static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
ViewLayer *view_layer = t->view_layer;
Object *ob = OBACT(view_layer);
- /* draw autokeyframing hint in the corner
+ /* draw auto-key-framing hint in the corner
* - only draw if enabled (advanced users may be distracted/annoyed),
* for objects that will be autokeyframed (no point otherwise),
* AND only for the active region (as showing all is too overwhelming)
@@ -2613,6 +2616,9 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
case TFM_NORMAL_ROTATION:
initNormalRotation(t);
break;
+ case TFM_GPENCIL_OPACITY:
+ initGPOpacity(t);
+ break;
}
if (t->state == TRANS_CANCEL) {
@@ -5525,6 +5531,84 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
}
/** \} */
+/* -------------------------------------------------------------------- */
+/* Transform (GPencil Opacity) */
+
+/** \name Transform GPencil Strokes Opacity
+ * \{ */
+
+static void initGPOpacity(TransInfo *t)
+{
+ t->mode = TFM_GPENCIL_OPACITY;
+ t->transform = applyGPOpacity;
+
+ initMouseInputMode(t, &t->mouse, INPUT_SPRING);
+
+ t->idx_max = 0;
+ t->num.idx_max = 0;
+ t->snap[0] = 0.0f;
+ t->snap[1] = 0.1f;
+ t->snap[2] = t->snap[1] * 0.1f;
+
+ copy_v3_fl(t->num.val_inc, t->snap[1]);
+ t->num.unit_sys = t->scene->unit.system;
+ t->num.unit_type[0] = B_UNIT_NONE;
+
+ t->flag |= T_NO_ZERO;
+#ifdef USE_NUM_NO_ZERO
+ t->num.val_flag[0] |= NUM_NO_ZERO;
+#endif
+
+ t->flag |= T_NO_CONSTRAINT;
+}
+
+static void applyGPOpacity(TransInfo *t, const int UNUSED(mval[2]))
+{
+ float ratio;
+ int i;
+ char str[UI_MAX_DRAW_STR];
+
+ ratio = t->values[0];
+
+ snapGridIncrement(t, &ratio);
+
+ applyNumInput(&t->num, &ratio);
+
+ t->values[0] = ratio;
+
+ /* header print for NumInput */
+ if (hasNumInput(&t->num)) {
+ char c[NUM_STR_REP_LEN];
+
+ outputNumInput(&(t->num), c, &t->scene->unit);
+ BLI_snprintf(str, sizeof(str), IFACE_("Opacity: %s"), c);
+ }
+ else {
+ BLI_snprintf(str, sizeof(str), IFACE_("Opacity: %3f"), ratio);
+ }
+
+ FOREACH_TRANS_DATA_CONTAINER(t, tc) {
+ TransData *td = tc->data;
+ for (i = 0; i < tc->data_len; i++, td++) {
+ if (td->flag & TD_NOACTION)
+ break;
+
+ if (td->flag & TD_SKIP)
+ continue;
+
+ if (td->val) {
+ *td->val = td->ival * ratio;
+ /* apply PET */
+ *td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival);
+ CLAMP(*td->val, 0.0f, 1.0f);
+ }
+ }
+ }
+
+ ED_area_status_text(t->sa, str);
+}
+/** \} */
+
/* -------------------------------------------------------------------- */
/* Transform (Push/Pull) */
@@ -7094,7 +7178,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
if (t->spacetype == SPACE_VIEW3D) {
v3d = t->sa ? t->sa->spacedata.first : NULL;
rv3d = t->ar ? t->ar->regiondata : NULL;
- use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && v3d->shading.type > OB_WIRE);
+ use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && !XRAY_ENABLED(v3d));
}
calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, true);
@@ -7289,7 +7373,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t
if (t->spacetype == SPACE_VIEW3D) {
v3d = t->sa ? t->sa->spacedata.first : NULL;
rv3d = t->ar ? t->ar->regiondata : NULL;
- use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && v3d->shading.type > OB_WIRE);
+ use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && !XRAY_ENABLED(v3d));
}
calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, false);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 4bed5a3f05c..2e8a921c7d8 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -1005,7 +1005,7 @@ static void setNearestAxis3d(TransInfo *t)
mvec[1] = (float)(t->mval[1] - t->con.imval[1]);
mvec[2] = 0.0f;
- /* we need to correct axis length for the current zoomlevel of view,
+ /* We need to correct axis length for the current zoom-level of view,
* this to prevent projected values to be clipped behind the camera
* and to overflow the short integers.
* The formula used is a bit stupid, just a simplification of the subtraction
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 0fc36858e13..a3ee7dd5635 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2292,7 +2292,7 @@ static bool bmesh_test_dist_add(
}
/**
- * \param mtx: Measure disatnce in this space.
+ * \param mtx: Measure distance in this space.
* \param dists: Store the closest connected distance to selected vertices.
* \param index: Optionally store the original index we're measuring the distance to (can be NULL).
*/
@@ -5806,17 +5806,17 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
if (t->mode == TFM_DUMMY)
skip_invert = true;
- /* NOTE: This is not really following copy-on-write design and we shoud not
+ /* NOTE: This is not really following copy-on-write design and we should not
* be re-evaluating the evaluated object. But as the comment above mentioned
* this is part of a hack.
- * More proper solution would be to make a shallwe copy of the object and
+ * More proper solution would be to make a shallow copy of the object and
* evaluate that, and access matrix of that evaluated copy of the object.
* Might be more tricky than it sounds, if some logic later on accesses the
* object matrix via td->ob->obmat. */
Object *object_eval = DEG_get_evaluated_object(t->depsgraph, ob);
if (skip_invert == false && constinv == false) {
object_eval->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc checks this */
- /* It is possiblre to have transform data initialization prior to a
+ /* It is possible to have transform data initialization prior to a
* complete dependency graph evaluated. Happens, for example, when
* changing transformation mode. */
BKE_object_tfm_copy(object_eval, ob);
@@ -5829,7 +5829,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
/* Copy newly evaluated fields to the original object, similar to how
* active dependency graph will do it. */
copy_m4_m4(ob->obmat, object_eval->obmat);
- /* Only copy negative scale flag, this is the only flag which is modifed by
+ /* Only copy negative scale flag, this is the only flag which is modified by
* the BKE_object_where_is_calc(). The rest of the flags we need to keep,
* otherwise we might loose dupli flags (see T61787). */
ob->transflag &= ~OB_NEG_SCALE;
@@ -6465,8 +6465,8 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t)
TransData *td;
int i;
- /* rather then adjusting the selection (which the user would notice)
- * tag all mirrored verts, then automerge those */
+ /* Rather then adjusting the selection (which the user would notice)
+ * tag all mirrored verts, then auto-merge those. */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false);
for (i = 0, td = tc->data; i < tc->data_len; i++, td++) {
@@ -6528,8 +6528,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
EdgeSlideData *sld = tc->custom.mode.data;
- /* free temporary faces to avoid automerging and deleting
- * during cleanup - psy-fi */
+ /* Free temporary faces to avoid auto-merging and deleting
+ * during cleanup - psy-fi. */
freeEdgeSlideTempFaces(sld);
}
}
@@ -8357,8 +8357,8 @@ static void createTransGPencil(bContext *C, TransInfo *t)
curvemapping_initialize(ts->gp_sculpt.cur_falloff);
}
- /* First Pass: Count the number of datapoints required for the strokes,
- * (and additional info about the configuration - e.g. 2D/3D?)
+ /* First Pass: Count the number of data-points required for the strokes,
+ * (and additional info about the configuration - e.g. 2D/3D?).
*/
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */
@@ -8567,8 +8567,14 @@ static void createTransGPencil(bContext *C, TransInfo *t)
* but never for scale or mirror
*/
if ((t->mode != TFM_RESIZE) && (t->mode != TFM_MIRROR)) {
- td->val = &pt->pressure;
- td->ival = pt->pressure;
+ if (t->mode != TFM_GPENCIL_OPACITY) {
+ td->val = &pt->pressure;
+ td->ival = pt->pressure;
+ }
+ else {
+ td->val = &pt->strength;
+ td->ival = pt->strength;
+ }
}
/* screenspace needs special matrices... */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 93bfb7261a8..0f7992e0b4a 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -945,7 +945,7 @@ static void recalcData_objects(TransInfo *t)
/* if animtimer is running, and the object already has animation data,
* check if the auto-record feature means that we should record 'samples'
- * (i.e. uneditable animation values)
+ * (i.e. un-editable animation values)
*
* context is needed for keying set poll() functions.
*/
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index d1e91cd2a73..77480e1a8ce 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -40,6 +40,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_string.h"
#include "BKE_action.h"
#include "BKE_context.h"
@@ -273,9 +274,9 @@ static bool gizmo_is_axis_visible(
}
}
- if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & SCE_GIZMO_SHOW_TRANSLATE)) ||
- (axis_type == MAN_AXES_ROTATE && !(twtype & SCE_GIZMO_SHOW_ROTATE)) ||
- (axis_type == MAN_AXES_SCALE && !(twtype & SCE_GIZMO_SHOW_SCALE)))
+ if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE)) ||
+ (axis_type == MAN_AXES_ROTATE && !(twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE)) ||
+ (axis_type == MAN_AXES_SCALE && !(twtype & V3D_GIZMO_SHOW_OBJECT_SCALE)))
{
return false;
}
@@ -305,34 +306,34 @@ static bool gizmo_is_axis_visible(
case MAN_AXIS_SCALE_Z:
return (rv3d->twdrawflag & MAN_SCALE_Z);
case MAN_AXIS_SCALE_C:
- return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & SCE_GIZMO_SHOW_TRANSLATE) == 0);
+ return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0);
case MAN_AXIS_TRANS_XY:
return (rv3d->twdrawflag & MAN_TRANS_X &&
rv3d->twdrawflag & MAN_TRANS_Y &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_TRANS_YZ:
return (rv3d->twdrawflag & MAN_TRANS_Y &&
rv3d->twdrawflag & MAN_TRANS_Z &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_TRANS_ZX:
return (rv3d->twdrawflag & MAN_TRANS_Z &&
rv3d->twdrawflag & MAN_TRANS_X &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_XY:
return (rv3d->twdrawflag & MAN_SCALE_X &&
rv3d->twdrawflag & MAN_SCALE_Y &&
- (twtype & SCE_GIZMO_SHOW_TRANSLATE) == 0 &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_YZ:
return (rv3d->twdrawflag & MAN_SCALE_Y &&
rv3d->twdrawflag & MAN_SCALE_Z &&
- (twtype & SCE_GIZMO_SHOW_TRANSLATE) == 0 &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_ZX:
return (rv3d->twdrawflag & MAN_SCALE_Z &&
rv3d->twdrawflag & MAN_SCALE_X &&
- (twtype & SCE_GIZMO_SHOW_TRANSLATE) == 0 &&
- (twtype & SCE_GIZMO_SHOW_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
}
return false;
}
@@ -1184,15 +1185,15 @@ static void gizmo_line_range(const int twtype, const short axis_type, float *r_s
switch (axis_type) {
case MAN_AXES_TRANSLATE:
- if (twtype & SCE_GIZMO_SHOW_SCALE) {
+ if (twtype & V3D_GIZMO_SHOW_OBJECT_SCALE) {
*r_start = *r_len - ofs + 0.075f;
}
- if (twtype & SCE_GIZMO_SHOW_ROTATE) {
+ if (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
*r_len += ofs;
}
break;
case MAN_AXES_SCALE:
- if (twtype & (SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE)) {
+ if (twtype & (V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE)) {
*r_len -= ofs + 0.025f;
}
break;
@@ -1203,7 +1204,7 @@ static void gizmo_line_range(const int twtype, const short axis_type, float *r_s
static void gizmo_xform_message_subscribe(
wmGizmoGroup *gzgroup, struct wmMsgBus *mbus,
- Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn)
+ Scene *scene, bScreen *screen, ScrArea *sa, ARegion *ar, const void *type_fn)
{
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
@@ -1213,18 +1214,18 @@ static void gizmo_xform_message_subscribe(
};
int orient_flag = 0;
- if (type_fn == TRANSFORM_GGT_gizmo) {
+ if (type_fn == VIEW3D_GGT_xform_gizmo) {
GizmoGroup *ggd = gzgroup->customdata;
orient_flag = ggd->twtype_init;
}
else if (type_fn == VIEW3D_GGT_xform_cage) {
- orient_flag = SCE_GIZMO_SHOW_SCALE;
+ orient_flag = V3D_GIZMO_SHOW_OBJECT_SCALE;
/* pass */
}
else if (type_fn == VIEW3D_GGT_xform_shear) {
- orient_flag = SCE_GIZMO_SHOW_ROTATE;
+ orient_flag = V3D_GIZMO_SHOW_OBJECT_ROTATE;
}
- TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, orient_flag);
+ TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, orient_flag);
PointerRNA orient_ref_ptr;
RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
const ToolSettings *ts = scene->toolsettings;
@@ -1267,18 +1268,35 @@ static void gizmo_xform_message_subscribe(
PointerRNA toolsettings_ptr;
RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
- if (type_fn == TRANSFORM_GGT_gizmo) {
- GizmoGroup *ggd = gzgroup->customdata;
+ if (type_fn == VIEW3D_GGT_xform_gizmo) {
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
- extern PropertyRNA rna_ToolSettings_use_gizmo_mode;
const PropertyRNA *props[] = {
&rna_ToolSettings_transform_pivot_point,
- ggd->use_twtype_refresh ? &rna_ToolSettings_use_gizmo_mode : NULL,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
WM_msg_subscribe_rna(mbus, &toolsettings_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
}
}
+
+ PointerRNA view3d_ptr;
+ RNA_pointer_create(&screen->id, &RNA_SpaceView3D, sa->spacedata.first, &view3d_ptr);
+
+ if (type_fn == VIEW3D_GGT_xform_gizmo) {
+ GizmoGroup *ggd = gzgroup->customdata;
+ if (ggd->use_twtype_refresh) {
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_translate;
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_rotate;
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_scale;
+ const PropertyRNA *props[] = {
+ &rna_SpaceView3D_show_gizmo_object_translate,
+ &rna_SpaceView3D_show_gizmo_object_rotate,
+ &rna_SpaceView3D_show_gizmo_object_scale,
+ };
+ for (int i = 0; i < ARRAY_SIZE(props); i++) {
+ WM_msg_subscribe_rna(mbus, &view3d_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
+ }
+ }
+ }
else if (type_fn == VIEW3D_GGT_xform_cage) {
/* pass */
}
@@ -1513,7 +1531,7 @@ static void gizmogroup_init_properties_from_twtype(wmGizmoGroup *gzgroup)
case MAN_AXIS_SCALE_Z:
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
int draw_options = 0;
- if ((ggd->twtype & (SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE)) == 0) {
+ if ((ggd->twtype & (V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)) == 0) {
draw_options |= ED_GIZMO_ARROW_DRAW_FLAG_STEM;
}
RNA_enum_set(axis->ptr, "draw_options", draw_options);
@@ -1616,23 +1634,23 @@ static void WIDGETGROUP_gizmo_setup(const bContext *C, wmGizmoGroup *gzgroup)
gzgroup->customdata = ggd;
{
- ggd->twtype = 0;
ScrArea *sa = CTX_wm_area(C);
const bToolRef *tref = sa->runtime.tool;
- if (tref == NULL || STREQ(tref->idname, "builtin.transform")) {
- /* Setup all gizmos, they can be toggled via 'ToolSettings.gizmo_flag' */
- ggd->twtype = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
- ggd->use_twtype_refresh = true;
+ ggd->twtype = 0;
+ if (tref && STREQ(tref->idname, "builtin.move")) {
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_TRANSLATE;
}
- else if (STREQ(tref->idname, "builtin.move")) {
- ggd->twtype |= SCE_GIZMO_SHOW_TRANSLATE;
+ else if (tref && STREQ(tref->idname, "builtin.rotate")) {
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_ROTATE;
}
- else if (STREQ(tref->idname, "builtin.rotate")) {
- ggd->twtype |= SCE_GIZMO_SHOW_ROTATE;
+ else if (tref && STREQ(tref->idname, "builtin.scale")) {
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_SCALE;
}
- else if (STREQ(tref->idname, "builtin.scale")) {
- ggd->twtype |= SCE_GIZMO_SHOW_SCALE;
+ else {
+ /* Setup all gizmos, they can be toggled via 'ToolSettings.gizmo_flag' */
+ ggd->twtype = V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE;
+ ggd->use_twtype_refresh = true;
}
BLI_assert(ggd->twtype != 0);
ggd->twtype_init = ggd->twtype;
@@ -1646,19 +1664,21 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
GizmoGroup *ggd = gzgroup->customdata;
Scene *scene = CTX_data_scene(C);
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = sa->spacedata.first;
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
struct TransformBounds tbounds;
if (ggd->use_twtype_refresh) {
- ggd->twtype = scene->toolsettings->gizmo_flag & ggd->twtype_init;
+ ggd->twtype = v3d->gizmo_show_object & ggd->twtype_init;
if (ggd->twtype != ggd->twtype_prev) {
ggd->twtype_prev = ggd->twtype;
gizmogroup_init_properties_from_twtype(gzgroup);
}
}
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, ggd->twtype_init);
/* skip, we don't draw anything anyway */
if ((ggd->all_hidden =
@@ -1700,7 +1720,7 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup)
RNA_float_set(axis->ptr, "length", len);
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
- if (ggd->twtype & SCE_GIZMO_SHOW_ROTATE) {
+ if (ggd->twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
/* Avoid rotate and translate arrows overlap. */
start_co[2] += 0.215f;
}
@@ -1738,7 +1758,7 @@ static void WIDGETGROUP_gizmo_message_subscribe(
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
- gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, TRANSFORM_GGT_gizmo);
+ gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_gizmo);
}
static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
@@ -1796,7 +1816,7 @@ static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgr
if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
{
Scene *scene = CTX_data_scene(C);
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, ggd->twtype_init);
switch (orient_slot->type) {
case V3D_ORIENT_VIEW:
{
@@ -1822,7 +1842,7 @@ static void WIDGETGROUP_gizmo_invoke_prepare(
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA *ptr = &gzop->ptr;
PropertyRNA *prop_orient_type = RNA_struct_find_property(ptr, "orient_type");
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, ggd->twtype_init);
if (orient_slot == &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
RNA_property_unset(ptr, prop_orient_type);
}
@@ -1871,46 +1891,95 @@ static void WIDGETGROUP_gizmo_invoke_prepare(
}
}
-static bool WIDGETGROUP_gizmo_poll(const struct bContext *C, struct wmGizmoGroupType *gzgt)
+static bool WIDGETGROUP_gizmo_poll_generic(View3D *v3d)
+{
+ if (v3d->gizmo_flag & V3D_GIZMO_HIDE) {
+ return false;
+ }
+ if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) {
+ return false;
+ }
+ return true;
+}
+
+static bool WIDGETGROUP_gizmo_poll_context(const struct bContext *C, struct wmGizmoGroupType *UNUSED(gzgt))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = sa->spacedata.first;
+ if (!WIDGETGROUP_gizmo_poll_generic(v3d)) {
+ return false;
+ }
+
+ const bToolRef *tref = sa->runtime.tool;
+ if (v3d->gizmo_flag & V3D_GIZMO_HIDE_CONTEXT) {
+ return false;
+ }
+ if ((v3d->gizmo_show_object & (V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)) == 0) {
+ return false;
+ }
+
+ /* Don't show if the tool has a gizmo. */
+ if (tref && tref->runtime && tref->runtime->gizmo_group[0]) {
+ return false;
+ }
+ return true;
+}
+
+static bool WIDGETGROUP_gizmo_poll_tool(const struct bContext *C, struct wmGizmoGroupType *gzgt)
{
if (!ED_gizmo_poll_or_unlink_delayed_from_tool(C, gzgt)) {
return false;
}
- View3D *v3d = CTX_wm_view3d(C);
- if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
+
+ return true;
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = sa->spacedata.first;
+ if (!WIDGETGROUP_gizmo_poll_generic(v3d)) {
return false;
}
- if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) {
+
+ if (v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) {
return false;
}
+
return true;
}
-void TRANSFORM_GGT_gizmo(wmGizmoGroupType *gzgt)
+/* Expose as multiple gizmos so tools use one, persistant context another.
+ * Needed because they use different options which isn't so simple to dynamically update. */
+
+void VIEW3D_GGT_xform_gizmo(wmGizmoGroupType *gzgt)
{
gzgt->name = "Transform Gizmo";
- gzgt->idname = "TRANSFORM_GGT_gizmo";
+ gzgt->idname = "VIEW3D_GGT_xform_gizmo";
- gzgt->flag |= WM_GIZMOGROUPTYPE_3D;
+ gzgt->flag = WM_GIZMOGROUPTYPE_3D;
gzgt->gzmap_params.spaceid = SPACE_VIEW3D;
gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW;
- gzgt->poll = WIDGETGROUP_gizmo_poll;
+ gzgt->poll = WIDGETGROUP_gizmo_poll_tool;
gzgt->setup = WIDGETGROUP_gizmo_setup;
gzgt->refresh = WIDGETGROUP_gizmo_refresh;
gzgt->message_subscribe = WIDGETGROUP_gizmo_message_subscribe;
gzgt->draw_prepare = WIDGETGROUP_gizmo_draw_prepare;
gzgt->invoke_prepare = WIDGETGROUP_gizmo_invoke_prepare;
+}
- static const EnumPropertyItem rna_enum_gizmo_items[] = {
- {SCE_GIZMO_SHOW_TRANSLATE, "TRANSLATE", 0, "Move", ""},
- {SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
- {SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
- {0, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL},
- };
- RNA_def_enum(gzgt->srna, "drag_action", rna_enum_gizmo_items, SCE_GIZMO_SHOW_TRANSLATE, "Drag Action", "");
+/** Only poll, flag & gzmap_params differ. */
+void VIEW3D_GGT_xform_gizmo_context(wmGizmoGroupType *gzgt)
+{
+ gzgt->name = "Transform Gizmo Context";
+ gzgt->idname = "VIEW3D_GGT_xform_gizmo_context";
+
+ gzgt->flag = WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_PERSISTENT;
+
+ gzgt->poll = WIDGETGROUP_gizmo_poll_context;
+ gzgt->setup = WIDGETGROUP_gizmo_setup;
+ gzgt->refresh = WIDGETGROUP_gizmo_refresh;
+ gzgt->message_subscribe = WIDGETGROUP_gizmo_message_subscribe;
+ gzgt->draw_prepare = WIDGETGROUP_gizmo_draw_prepare;
+ gzgt->invoke_prepare = WIDGETGROUP_gizmo_invoke_prepare;
}
/** \} */
@@ -1997,7 +2066,7 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr
struct TransformBounds tbounds;
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_SCALE);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_ORIENT_SCALE);
if ((ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams) {
@@ -2079,7 +2148,7 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup
RegionView3D *rv3d = CTX_wm_region_view3d(C);
{
Scene *scene = CTX_data_scene(C);
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_SCALE);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_ORIENT_SCALE);
switch (orient_slot->type) {
case V3D_ORIENT_VIEW:
{
@@ -2177,7 +2246,7 @@ static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzg
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
struct TransformBounds tbounds;
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_ORIENT_ROTATE);
if (ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams) {
@@ -2240,7 +2309,7 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
{
Scene *scene = CTX_data_scene(C);
/* Shear is like rotate, use the rotate setting. */
- const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_ORIENT_ROTATE);
switch (orient_slot->type) {
case V3D_ORIENT_VIEW:
{
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 648e616a27c..7140938c99a 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -155,6 +155,7 @@ const EnumPropertyItem rna_enum_transform_mode_types[] =
{TFM_ALIGN, "ALIGN", 0, "Align", ""},
{TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
{TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
+ {TFM_GPENCIL_OPACITY, "GPENCIL_OPACITY", 0, "GPencil_Opacity", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -1148,58 +1149,6 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
P_GPENCIL_EDIT | P_CENTER);
}
-static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
-{
- bToolRef *tref = WM_toolsystem_ref_from_context(C);
- if (tref) {
- ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
- wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "TRANSFORM_GGT_gizmo") : NULL;
- if (gzgroup != NULL) {
- PointerRNA gzg_ptr;
- WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup->type, &gzg_ptr);
- const int drag_action = RNA_enum_get(&gzg_ptr, "drag_action");
- const char *op_id = NULL;
- switch (drag_action) {
- case SCE_GIZMO_SHOW_TRANSLATE:
- op_id = "TRANSFORM_OT_translate";
- break;
- case SCE_GIZMO_SHOW_ROTATE:
- op_id = "TRANSFORM_OT_rotate";
- break;
- case SCE_GIZMO_SHOW_SCALE:
- op_id = "TRANSFORM_OT_resize";
- break;
- default:
- break;
- }
- if (op_id) {
- wmOperatorType *ot = WM_operatortype_find(op_id, true);
- PointerRNA op_ptr;
- WM_operator_properties_create_ptr(&op_ptr, ot);
- RNA_boolean_set(&op_ptr, "release_confirm", true);
- WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr);
- WM_operator_properties_free(&op_ptr);
- return OPERATOR_FINISHED;
- }
- }
- }
- return OPERATOR_PASS_THROUGH;
-}
-
-/* Use with 'TRANSFORM_GGT_gizmo'. */
-static void TRANSFORM_OT_from_gizmo(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Transform From Gizmo";
- ot->description = "Transform selected items by mode type";
- ot->idname = "TRANSFORM_OT_from_gizmo";
- ot->flag = 0;
-
- /* api callbacks */
- ot->invoke = transform_from_gizmo_invoke;
-}
-
void transform_operatortypes(void)
{
TransformModeItem *tmode;
@@ -1213,8 +1162,6 @@ void transform_operatortypes(void)
WM_operatortype_append(TRANSFORM_OT_select_orientation);
WM_operatortype_append(TRANSFORM_OT_create_orientation);
WM_operatortype_append(TRANSFORM_OT_delete_orientation);
-
- WM_operatortype_append(TRANSFORM_OT_from_gizmo);
}
void ED_keymap_transform(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index ea3657b8729..f2692f57a35 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -673,21 +673,22 @@ static bool raycastObj(
{
bool retval = false;
- if (use_occlusion_test) {
- if (use_obedit && sctx->use_v3d &&
- !V3D_IS_ZBUF(sctx->v3d_data.v3d))
- {
- /* Use of occlude geometry in editing mode disabled. */
- return false;
- }
- }
-
switch (ob->type) {
case OB_MESH:
{
- if (ob->dt == OB_BOUNDBOX || ob->dt == OB_WIRE) {
- /* Do not hit objects that are in wire or bounding box display mode */
- return false;
+ if (use_occlusion_test) {
+ if (use_obedit && sctx->use_v3d &&
+ XRAY_ENABLED(sctx->v3d_data.v3d))
+ {
+ /* Use of occlude geometry in editing mode disabled. */
+ return false;
+ }
+
+ if (ELEM(ob->dt, OB_BOUNDBOX, OB_WIRE)) {
+ /* Do not hit objects that are in wire or bounding box
+ * display mode. */
+ return false;
+ }
}
Mesh *me = ob->data;
@@ -2540,8 +2541,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
const RegionView3D *rv3d = ar->regiondata;
bool use_occlusion_test =
- params->use_occlusion_test &&
- !(sctx->v3d_data.v3d->shading.flag & V3D_XRAY_FLAG(sctx->v3d_data.v3d));
+ params->use_occlusion_test && !XRAY_ENABLED(sctx->v3d_data.v3d);
if (snap_to_flag & SCE_SNAP_MODE_FACE || use_occlusion_test) {
float ray_start[3], ray_normal[3];
diff --git a/source/blender/editors/undo/CMakeLists.txt b/source/blender/editors/undo/CMakeLists.txt
index 6ccba01c465..3a6aded0c08 100644
--- a/source/blender/editors/undo/CMakeLists.txt
+++ b/source/blender/editors/undo/CMakeLists.txt
@@ -36,8 +36,11 @@ set(SRC
undo_intern.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-blender_add_lib(bf_editor_undo "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_undo "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 55298e5c4ab..728dacc1649 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -99,6 +99,9 @@ set(SRC
../include/UI_view2d.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
@@ -112,4 +115,4 @@ if(WITH_PYTHON)
)
endif()
-blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index c54c3851ee7..45cd9b09de3 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -47,10 +47,13 @@ set(SRC
uvedit_parametrizer.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index a4247ec370d..1bcf60077ff 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -2827,10 +2827,12 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot)
/** \name Select Split Operator
* \{ */
-/* note: this is based on similar use case to MESH_OT_split(), which has a similar effect
+/**
+ * \note This is based on similar use case to #MESH_OT_split(), which has a similar effect
* but in this case they are not joined to begin with (only having the behavior of being joined)
- * so its best to call this uv_select_split() instead of just split(), but assigned to the same key
- * as MESH_OT_split - Campbell */
+ * so its best to call this #uv_select_split() instead of just split(), but assigned to the same key
+ * as #MESH_OT_split - Campbell.
+ */
static int uv_select_split_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index edab13d4286..9dfeb065902 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -547,6 +547,9 @@ set(SRC
intern/winged_edge/WingedEdgeBuilder.h
)
+set(LIB
+)
+
set(INC
.
../blenkernel
@@ -581,4 +584,4 @@ if(WIN32)
)
endif()
-blender_add_lib(bf_freestyle "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_freestyle "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt b/source/blender/gpencil_modifiers/CMakeLists.txt
index e1aad91050a..f7cfe073d4a 100644
--- a/source/blender/gpencil_modifiers/CMakeLists.txt
+++ b/source/blender/gpencil_modifiers/CMakeLists.txt
@@ -63,10 +63,13 @@ set(SRC
MOD_gpencil_modifiertypes.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_gpencil_modifiers "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_gpencil_modifiers "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index cc6d316bd3a..c66580cd5d4 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -188,7 +188,7 @@ void gpencil_apply_modifier_material(
DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
}
/* reasign color index */
- int idx = BKE_gpencil_get_material_index(ob, newmat);
+ int idx = BKE_gpencil_object_material_get_index(ob, newmat);
gps->mat_nr = idx - 1;
}
else {
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index b76edf4068a..430eefe6fc7 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -123,6 +123,9 @@ set(SRC
intern/gpu_vertex_format_private.h
)
+set(LIB
+)
+
data_to_c_simple(shaders/gpu_shader_depth_only_frag.glsl SRC)
data_to_c_simple(shaders/gpu_shader_uniform_color_frag.glsl SRC)
data_to_c_simple(shaders/gpu_shader_checker_frag.glsl SRC)
@@ -255,4 +258,4 @@ if(WITH_IMAGE_DDS)
add_definitions(-DWITH_DDS)
endif()
-blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index e822c33ab4a..77573b80a1b 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -96,7 +96,7 @@ void GPU_framebuffer_texture_detach_slot(
* })
* \encode
*
- * \note Unspecified attachements (i.e: those beyond the last
+ * \note Unspecified attachments (i.e: those beyond the last
* GPU_ATTACHMENT_* in GPU_framebuffer_ensure_config list) are left unchanged.
*
* \note Make sure that the dimensions of your textures matches
diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h
index 57912c01991..b7d2901daeb 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -124,8 +124,10 @@ void immUniformColor3ubv(const unsigned char rgb[3]);
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a);
void immUniformColor4ubv(const unsigned char rgba[4]);
-/* Extend immBindProgram to use Blender’s library of built-in shader programs.
- * Use immUnbindProgram() when done. */
+/**
+ * Extend #immBindProgram to use Blender’s library of built-in shader programs.
+ * Use #immUnbindProgram() when done.
+ */
void immBindBuiltinProgram(eGPUBuiltinShader shader_id);
/* Extend immUniformColor to take Blender's themes */
diff --git a/source/blender/gpu/GPU_legacy_stubs.h b/source/blender/gpu/GPU_legacy_stubs.h
index b290e4b093c..9d45c051f39 100644
--- a/source/blender/gpu/GPU_legacy_stubs.h
+++ b/source/blender/gpu/GPU_legacy_stubs.h
@@ -40,7 +40,7 @@
#include "BLI_utildefines.h"
/**
- * Empty function, use for breakpoint when a depreacated
+ * Empty function, use for breakpoint when a deprecated
* OpenGL function is called.
*/
static void gl_deprecated(void)
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 0b69b0c6cd8..552ae8f4cd7 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1349,7 +1349,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType
name = outnode->name;
input = outnode->inputs.first;
- if ((STREQ(name, "set_value") || STREQ(name, "set_rgb") || STREQ(name, "set_rgba")) &&
+ if ((STR_ELEM(name, "set_value", "set_rgb", "set_rgba")) &&
(input->type == type))
{
input = MEM_dupallocN(outnode->inputs.first);
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 6d546c1b5c5..53a69b0b9d7 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -144,7 +144,7 @@ void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4])
* Pack color into 3 bytes
*
* This define converts a numerical value to the equivalent 24-bit
- * color, while not being endian-sensitive. On little-endians, this
+ * color, while not being endian-sensitive. On little-endian, this
* is the same as doing a 'naive' indexing, on big-endian, it is not!
*
* \note BGR format (i.e. 0xBBGGRR)...
diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.c b/source/blender/gpu/intern/gpu_uniformbuffer.c
index 47539724a26..a5559b2558a 100644
--- a/source/blender/gpu/intern/gpu_uniformbuffer.c
+++ b/source/blender/gpu/intern/gpu_uniformbuffer.c
@@ -107,7 +107,7 @@ GPUUniformBuffer *GPU_uniformbuffer_create(int size, const void *data, char err_
* Create dynamic UBO from parameters
* Return NULL if failed to create or if \param inputs: is empty.
*
- * \param inputs: ListBase of BLI_genericNodeN(GPUInput)
+ * \param inputs: ListBase of #BLI_genericNodeN(#GPUInput).
*/
GPUUniformBuffer *GPU_uniformbuffer_dynamic_create(ListBase *inputs, char err_out[256])
{
diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index 648486072f0..9bbc3a62b99 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -39,6 +39,9 @@ set(SRC
intern/ikplugin_api.h
)
+set(LIB
+)
+
if(WITH_IK_SOLVER)
add_definitions(-DWITH_IK_SOLVER)
list(APPEND INC
@@ -64,4 +67,4 @@ if(WITH_IK_ITASC)
)
endif()
-blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index dd020ffe1f2..87002e5efc0 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -83,6 +83,9 @@ set(SRC
../../../intern/ffmpeg/ffmpeg_compat.h
)
+set(LIB
+)
+
if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
else()
@@ -172,4 +175,4 @@ set_source_files_properties(
PROPERTIES HEADER_FILE_ONLY TRUE
)
-blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt
index 2a592aba860..2f6ca2793e3 100644
--- a/source/blender/imbuf/intern/cineon/CMakeLists.txt
+++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt
@@ -45,8 +45,11 @@ set(SRC
logmemfile.c
)
+set(LIB
+)
+
if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
-blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index 6728dbc758d..c68608f4cff 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -54,8 +54,11 @@ set(SRC
dds_api.cpp
)
+set(LIB
+)
+
if(WITH_IMAGE_DDS)
add_definitions(-DWITH_DDS)
endif()
-blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/imbuf/intern/oiio/CMakeLists.txt b/source/blender/imbuf/intern/oiio/CMakeLists.txt
index 73438436abc..3311d3fd9b4 100644
--- a/source/blender/imbuf/intern/oiio/CMakeLists.txt
+++ b/source/blender/imbuf/intern/oiio/CMakeLists.txt
@@ -39,6 +39,9 @@ set(SRC
openimageio_api.cpp
)
+set(LIB
+)
+
if(WITH_OPENIMAGEIO)
list(APPEND INC_SYS
${OPENIMAGEIO_INCLUDE_DIRS}
@@ -52,4 +55,4 @@ if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
-blender_add_lib(bf_imbuf_openimageio "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_imbuf_openimageio "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index 18f68d5b365..c9ede9ff07f 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -40,6 +40,9 @@ set(SRC
openexr_api.cpp
)
+set(LIB
+)
+
if(WITH_IMAGE_OPENEXR)
list(APPEND INC_SYS
${OPENEXR_INCLUDE_DIRS}
@@ -47,4 +50,4 @@ if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
-blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index f17b93fed62..b6fed5fd941 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -1109,7 +1109,7 @@ typedef enum eAnimData_Flag {
/* Base Struct for Anim ------------------------------------- */
/**
- * Used for BKE_animdata_from_id()
+ * Used for #BKE_animdata_from_id()
* All ID-datablocks which have their own 'local' AnimData
* should have the same arrangement in their structs.
*/
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 718ca4f3b7d..3db8bf92f56 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -147,11 +147,14 @@ typedef struct Material {
float gloss_mir DNA_DEPRECATED;
float roughness;
float metallic;
- char _pad0[2];
- /** For buttons and render. */
- char pr_type, use_nodes;
+ /** Nodes */
+ char use_nodes;
+
+ /** Preview render. */
+ char pr_type;
short pr_texture;
+ short pr_flag;
/** Index for render passes. */
short index;
@@ -279,13 +282,18 @@ typedef struct Material {
#define MA_FLAT 0
#define MA_SPHERE 1
#define MA_CUBE 2
-#define MA_MONKEY 3
-#define MA_SPHERE_A 4
+#define MA_SHADERBALL 3
+#define MA_SPHERE_A 4 /* Used for icon renders only. */
#define MA_TEXTURE 5
#define MA_LAMP 6
#define MA_SKY 7
#define MA_HAIR 10
#define MA_ATMOS 11
+#define MA_CLOTH 12
+#define MA_FLUID 13
+
+/* pr_flag */
+#define MA_PREVIEW_WORLD (1 << 0)
/* blend_method */
enum {
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h
index 4b276a0aa85..edd5d305683 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -185,11 +185,12 @@ typedef struct EffectorWeights {
/* EffectorWeights->flag */
#define EFF_WEIGHT_DO_HAIR 1
-/* Point cache file data types:
- * - used as (1 << flag) so poke jahka if you reach the limit of 15
- * - to add new data types update:
- * - BKE_ptcache_data_size()
- * - ptcache_file_init_pointers()
+/**
+ * Point cache file data types:
+ * - Used as `(1 << flag)` so poke jahka if you reach the limit of 15.
+ * - To add new data types update:
+ * - #BKE_ptcache_data_size()
+ * - #ptcache_file_pointers_init()
*/
#define BPHYS_DATA_INDEX 0
#define BPHYS_DATA_LOCATION 1
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 9f2118d9cc0..c8684f42963 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -202,7 +202,7 @@ typedef struct Object {
void *data;
/** Grease Pencil data. */
- struct bGPdata *gpd;
+ struct bGPdata *gpd DNA_DEPRECATED; // XXX deprecated... replaced by gpencil object, keep for readfile
/** Settings for visualization of object-transform animation. */
bAnimVizSettings avs;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 75dda608975..49ebc9b9bac 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1466,8 +1466,7 @@ typedef struct ToolSettings {
char edge_mode;
char edge_mode_live_unwrap;
- /* SCE_GIZMO_SHOW_* */
- char gizmo_flag;
+ char _pad1[1];
/* Transform */
char transform_pivot_point;
@@ -2272,13 +2271,6 @@ enum {
#define EDGE_MODE_TAG_BEVEL 4
#define EDGE_MODE_TAG_FREESTYLE 5
-/* ToolSettings.gizmo_flag */
-enum {
- SCE_GIZMO_SHOW_TRANSLATE = (1 << 0),
- SCE_GIZMO_SHOW_ROTATE = (1 << 1),
- SCE_GIZMO_SHOW_SCALE = (1 << 2),
-};
-
/* ToolSettings.gpencil_flags */
typedef enum eGPencil_Flags {
/* When creating new frames, the last frame gets used as the basis for the new one */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 21e945a084a..2b1a6adb344 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -669,7 +669,9 @@ typedef struct FileSelectParams {
short sort;
/** Display mode flag. */
short display;
+ short display_previous;
/** Filter when (flags & FILE_FILTER) is true. */
+ char _pad2[2];
int filter;
/** Max number of levels in dirtree to show at once, 0 to disable recursion. */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 075ea50c13b..53519de42a4 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -144,7 +144,7 @@ typedef struct View3DCursor {
char _pad[6];
} View3DCursor;
-/* 3D Viewport Shading settings */
+/** 3D Viewport Shading settings. */
typedef struct View3DShading {
/** Shading type (VIEW3D_SHADE_SOLID, ..). */
char type;
@@ -188,42 +188,47 @@ typedef struct View3DShading {
} View3DShading;
-/* 3D Viewport Overlay settings */
+/** 3D Viewport Overlay settings. */
typedef struct View3DOverlay {
int flag;
- /* Edit mode settings */
+ /** Edit mode settings. */
int edit_flag;
float normals_length;
float backwire_opacity;
- /* Paint mode settings */
+ /** Paint mode settings. */
int paint_flag;
- /* Weight paint mode settings */
+ /** Weight paint mode settings. */
int wpaint_flag;
char _pad2[4];
- /* Alpha for texture, weight, vertex paint overlay */
+ /** Alpha for texture, weight, vertex paint overlay. */
float texture_paint_mode_opacity;
float vertex_paint_mode_opacity;
float weight_paint_mode_opacity;
- /* Armature edit/pose mode settings */
+ /** Armature edit/pose mode settings. */
int _pad3;
float xray_alpha_bone;
- /* Other settings */
+ /** Other settings. */
float wireframe_threshold;
- /* grease pencil settings */
+ /** Grease pencil settings. */
float gpencil_paper_opacity;
float gpencil_grid_opacity;
float gpencil_fade_layer;
} View3DOverlay;
-/* 3D ViewPort Struct */
+typedef struct View3D_Runtime {
+ /** Nkey panel stores stuff here. */
+ void *properties_storage;
+} View3D_Runtime;
+
+/** 3D ViewPort Struct. */
typedef struct View3D {
struct SpaceLink *next, *prev;
/** Storage of regions for inactive spaces. */
@@ -240,7 +245,10 @@ typedef struct View3D {
float bundle_size;
/** Display style for bundle. */
char bundle_drawtype;
- char _pad3[2];
+
+ char drawtype DNA_DEPRECATED;
+
+ char _pad3[1];
/** Multiview current eye - for internal use. */
char multiview_eye;
@@ -261,7 +269,7 @@ typedef struct View3D {
char ob_centre_bone[64];
unsigned short local_view_uuid;
- short _pad6;
+ char _pad6[2];
int layact DNA_DEPRECATED;
/** Optional bool for 3d cursor to define center. */
@@ -275,34 +283,36 @@ typedef struct View3D {
float clip_start, clip_end;
float ofs[3] DNA_DEPRECATED;
- char _pad[4];
+ char _pad[1];
+
+ /** Transform gizmo info. */
+ /** #V3D_GIZMO_SHOW_* */
+ char gizmo_flag;
+
+ char gizmo_show_object;
+ char gizmo_show_armature;
+ char gizmo_show_empty;
+ char gizmo_show_light;
+ char gizmo_show_camera;
- /** Icon id. */
- short matcap_icon;
+ char gridflag;
short gridlines;
/** Number of subdivisions in the grid between each highlighted grid line. */
short gridsubdiv;
- char gridflag;
- /** Transform gizmo info. */
- char gizmo_flag;
-
- /* actually only used to define the opacity of the grease pencil vertex in edit mode */
+ /** Actually only used to define the opacity of the grease pencil vertex in edit mode. */
float vertex_opacity;
/* note, 'fx_settings.dof' is currently _not_ allocated,
* instead set (temporarily) from camera */
struct GPUFXSettings fx_settings;
- /** Nkey panel stores stuff here (runtime only!). */
- void *properties_storage;
-
/* XXX deprecated? */
/** Grease-Pencil Data (annotation layers). */
struct bGPdata *gpd DNA_DEPRECATED;
- /* Stereoscopy settings */
+ /** Stereoscopy settings. */
short stereo3d_flag;
char stereo3d_camera;
char _pad4;
@@ -310,21 +320,21 @@ typedef struct View3D {
float stereo3d_volume_alpha;
float stereo3d_convergence_alpha;
- /* Display settings */
- short drawtype DNA_DEPRECATED;
- char _pad5[6];
-
+ /** Display settings. */
View3DShading shading;
View3DOverlay overlay;
+
+ /** Runtime evaluation data (keep last). */
+ View3D_Runtime runtime;
} View3D;
-/* View3D->stereo_flag (short) */
+/** #View3D.stereo3d_flag */
#define V3D_S3D_DISPCAMERAS (1 << 0)
#define V3D_S3D_DISPPLANE (1 << 1)
#define V3D_S3D_DISPVOLUME (1 << 2)
-/* View3D->flag (short) */
+/** #View3D.flag */
#define V3D_FLAG_UNUSED_0 (1 << 0) /* cleared */
#define V3D_FLAG_UNUSED_1 (1 << 1) /* cleared */
#define V3D_HIDE_HELPLINES (1 << 2)
@@ -336,12 +346,12 @@ typedef struct View3D {
#define V3D_GLOBAL_STATS (1 << 13)
#define V3D_DRAW_CENTERS (1 << 15)
-/* RegionView3d->persp */
+/** #RegionView3D.persp */
#define RV3D_ORTHO 0
#define RV3D_PERSP 1
#define RV3D_CAMOB 2
-/* RegionView3d->rflag */
+/** #RegionView3D.rflag */
#define RV3D_CLIPPING (1 << 2)
#define RV3D_NAVIGATING (1 << 3)
#define RV3D_GPULIGHT_UPDATE (1 << 4)
@@ -352,14 +362,14 @@ typedef struct View3D {
*/
#define RV3D_ZOFFSET_DISABLED 64
-/* RegionView3d->viewlock */
+/** #RegionView3D.viewlock */
#define RV3D_LOCKED (1 << 0)
#define RV3D_BOXVIEW (1 << 1)
#define RV3D_BOXCLIP (1 << 2)
-/* RegionView3d->viewlock_quad */
+/** #RegionView3D.viewlock_quad */
#define RV3D_VIEWLOCK_INIT (1 << 7)
-/* RegionView3d->view */
+/** #RegionView3D.view */
#define RV3D_VIEW_USER 0
#define RV3D_VIEW_FRONT 1
#define RV3D_VIEW_BACK 2
@@ -372,7 +382,7 @@ typedef struct View3D {
#define RV3D_VIEW_IS_AXIS(view) \
(((view) >= RV3D_VIEW_FRONT) && ((view) <= RV3D_VIEW_BOTTOM))
-/* View3d->flag2 (int) */
+/** #View3D.flag2 (int) */
#define V3D_HIDE_OVERLAYS (1 << 2)
#define V3D_FLAG2_UNUSED_3 (1 << 3) /* cleared */
#define V3D_SHOW_ANNOTATION (1 << 4)
@@ -388,7 +398,7 @@ typedef struct View3D {
#define V3D_FLAG2_UNUSED_14 (1 << 14) /* cleared */
#define V3D_FLAG2_UNUSED_15 (1 << 15) /* cleared */
-/* View3d->gp_flag (short) */
+/** #View3D.gp_flag (short) */
#define V3D_GP_SHOW_PAPER (1 << 0) /* Activate paper to cover all viewport */
#define V3D_GP_SHOW_GRID (1 << 1) /* Activate paper grid */
#define V3D_GP_SHOW_EDIT_LINES (1 << 2)
@@ -396,14 +406,14 @@ typedef struct View3D {
#define V3D_GP_SHOW_ONION_SKIN (1 << 4) /* main switch at view level */
#define V3D_GP_FADE_NOACTIVE_LAYERS (1 << 5) /* fade layers not active */
-/* View3DShading->light */
+/** #View3DShading.light */
enum {
V3D_LIGHTING_FLAT = 0,
V3D_LIGHTING_STUDIO = 1,
V3D_LIGHTING_MATCAP = 2,
};
-/* View3DShading->flag */
+/** #View3DShading.flag */
enum {
V3D_SHADING_OBJECT_OUTLINE = (1 << 0),
V3D_SHADING_XRAY = (1 << 1),
@@ -419,7 +429,7 @@ enum {
V3D_SHADING_DEPTH_OF_FIELD = (1 << 11),
};
-/* View3DShading->color_type */
+/** #View3DShading.color_type */
enum {
V3D_SHADING_MATERIAL_COLOR = 0,
V3D_SHADING_RANDOM_COLOR = 1,
@@ -428,21 +438,21 @@ enum {
V3D_SHADING_OBJECT_COLOR = 4,
};
-/* View3DShading->background_type */
+/** #View3DShading.background_type */
enum {
V3D_SHADING_BACKGROUND_THEME = 0,
V3D_SHADING_BACKGROUND_WORLD = 1,
V3D_SHADING_BACKGROUND_VIEWPORT = 2,
};
-/* View3DShading->cavity_type */
+/** #View3DShading.cavity_type */
enum {
V3D_SHADING_CAVITY_SSAO = 0,
V3D_SHADING_CAVITY_CURVATURE = 1,
V3D_SHADING_CAVITY_BOTH = 2,
};
-/* View3DOverlay->flag */
+/** #View3DOverlay.flag */
enum {
V3D_OVERLAY_FACE_ORIENTATION = (1 << 0),
V3D_OVERLAY_HIDE_CURSOR = (1 << 1),
@@ -457,7 +467,7 @@ enum {
V3D_OVERLAY_HIDE_OBJECT_ORIGINS = (1 << 10),
};
-/* View3DOverlay->edit_flag */
+/** #View3DOverlay.edit_flag */
enum {
V3D_OVERLAY_EDIT_VERT_NORMALS = (1 << 0),
V3D_OVERLAY_EDIT_LOOP_NORMALS = (1 << 1),
@@ -490,17 +500,17 @@ enum {
V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21),
};
-/* View3DOverlay->paint_flag */
+/** #View3DOverlay.paint_flag */
enum {
V3D_OVERLAY_PAINT_WIRE = (1 << 0),
};
-/* View3DOverlay->wpaint_flag */
+/** #View3DOverlay.wpaint_flag */
enum {
V3D_OVERLAY_WPAINT_CONTOURS = (1 << 0),
};
-/* View3D->around */
+/** #View3D.around */
enum {
/* center of the bounding box */
V3D_AROUND_CENTER_BOUNDS = 0,
@@ -514,17 +524,7 @@ enum {
V3D_AROUND_ACTIVE = 4,
};
-/*View3D types (only used in tools, not actually saved)*/
-#define V3D_VIEW_STEPLEFT 1
-#define V3D_VIEW_STEPRIGHT 2
-#define V3D_VIEW_STEPDOWN 3
-#define V3D_VIEW_STEPUP 4
-#define V3D_VIEW_PANLEFT 5
-#define V3D_VIEW_PANRIGHT 6
-#define V3D_VIEW_PANDOWN 7
-#define V3D_VIEW_PANUP 8
-
-/* View3d->gridflag */
+/** #View3d.gridflag */
#define V3D_SHOW_FLOOR (1 << 0)
#define V3D_SHOW_X (1 << 1)
#define V3D_SHOW_Y (1 << 2)
@@ -543,7 +543,7 @@ enum {
V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
};
-/* View3d.mpr_flag (also) */
+/** #View3d.gizmo_flag */
enum {
/** All gizmos. */
V3D_GIZMO_HIDE = (1 << 0),
@@ -552,10 +552,41 @@ enum {
V3D_GIZMO_HIDE_TOOL = (1 << 3),
};
+/** #View3d.gizmo_show_object */
+enum {
+ V3D_GIZMO_SHOW_OBJECT_TRANSLATE = (1 << 0),
+ V3D_GIZMO_SHOW_OBJECT_ROTATE = (1 << 1),
+ V3D_GIZMO_SHOW_OBJECT_SCALE = (1 << 2),
+};
+/** #View3d.gizmo_show_armature */
+enum {
+ /** Currently unused (WIP gizmo). */
+ V3D_GIZMO_SHOW_ARMATURE_BBONE = (1 << 0),
+ /** Not yet implemented. */
+ V3D_GIZMO_SHOW_ARMATURE_ROLL = (1 << 1),
+};
+/** #View3d.gizmo_show_empty */
+enum {
+ V3D_GIZMO_SHOW_EMPTY_IMAGE = (1 << 0),
+ V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD = (1 << 1),
+};
+/** #View3d.gizmo_show_light */
+enum {
+ /** Use for both spot & area size. */
+ V3D_GIZMO_SHOW_LIGHT_SIZE = (1 << 0),
+ V3D_GIZMO_SHOW_LIGHT_LOOK_AT = (1 << 1),
+};
+/** #View3d.gizmo_show_camera */
+enum {
+ /** Also used for ortho size. */
+ V3D_GIZMO_SHOW_CAMERA_LENS = (1 << 0),
+ V3D_GIZMO_SHOW_CAMERA_DOF_DIST = (1 << 2),
+};
+
#define RV3D_CAMZOOM_MIN -30
#define RV3D_CAMZOOM_MAX 600
-/* #BKE_screen_view3d_zoom_to_fac() values above */
+/** #BKE_screen_view3d_zoom_to_fac() values above */
#define RV3D_CAMZOOM_MIN_FACTOR 0.1657359312880714853f
#define RV3D_CAMZOOM_MAX_FACTOR 44.9852813742385702928f
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index 09f95d50f17..94caab26e29 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -85,8 +85,8 @@ set(INC_SYS
)
set(SRC
- dna_utils.c
dna_genfile.c
+ dna_utils.c
${CMAKE_CURRENT_BINARY_DIR}/dna.c
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
${SRC_DNA_INC}
@@ -94,14 +94,17 @@ set(SRC
dna_utils.h
)
+set(LIB
+)
+
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/dna.c
- ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
+ ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
PROPERTIES GENERATED TRUE
)
-blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# -----------------------------------------------------------------------------
@@ -125,4 +128,7 @@ set(SRC
../../blenlib/intern/listbase.c
)
-blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 38e1d0986fd..863aebd86e8 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -38,6 +38,7 @@
#include "BLI_utildefines.h"
#include "BLI_endian_switch.h"
#include "BLI_memarena.h"
+#include "BLI_string.h"
#ifdef WITH_DNA_GHASH
# include "BLI_ghash.h"
@@ -718,17 +719,17 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
*/
static eSDNA_Type sdna_type_nr(const char *dna_type)
{
- if ((strcmp(dna_type, "char") == 0) || (strcmp(dna_type, "const char") == 0)) { return SDNA_TYPE_CHAR; }
- else if ((strcmp(dna_type, "uchar") == 0) || (strcmp(dna_type, "unsigned char") == 0)) { return SDNA_TYPE_UCHAR; }
- else if ( strcmp(dna_type, "short") == 0) { return SDNA_TYPE_SHORT; }
- else if ((strcmp(dna_type, "ushort") == 0) || (strcmp(dna_type, "unsigned short") == 0)) { return SDNA_TYPE_USHORT; }
- else if ( strcmp(dna_type, "int") == 0) { return SDNA_TYPE_INT; }
- else if ( strcmp(dna_type, "float") == 0) { return SDNA_TYPE_FLOAT; }
- else if ( strcmp(dna_type, "double") == 0) { return SDNA_TYPE_DOUBLE; }
- else if ( strcmp(dna_type, "int64_t") == 0) { return SDNA_TYPE_INT64; }
- else if ( strcmp(dna_type, "uint64_t") == 0) { return SDNA_TYPE_UINT64; }
+ if (STR_ELEM(dna_type, "char", "const char")) { return SDNA_TYPE_CHAR; }
+ else if (STR_ELEM(dna_type, "uchar", "unsigned char")) { return SDNA_TYPE_UCHAR; }
+ else if (STR_ELEM(dna_type, "short")) { return SDNA_TYPE_SHORT; }
+ else if (STR_ELEM(dna_type, "ushort", "unsigned short")) { return SDNA_TYPE_USHORT; }
+ else if (STR_ELEM(dna_type, "int")) { return SDNA_TYPE_INT; }
+ else if (STR_ELEM(dna_type, "float")) { return SDNA_TYPE_FLOAT; }
+ else if (STR_ELEM(dna_type, "double")) { return SDNA_TYPE_DOUBLE; }
+ else if (STR_ELEM(dna_type, "int64_t")) { return SDNA_TYPE_INT64; }
+ else if (STR_ELEM(dna_type, "uint64_t")) { return SDNA_TYPE_UINT64; }
/* invalid! */
- else { return -1; }
+ else { return -1; }
}
/**
@@ -921,7 +922,7 @@ static bool elem_exists(
*
* Passing olddata=NULL doesn't work reliably for existence checks; it will
* return NULL both when the field is found at offset 0 and when it is not
- * found at all. For field existence checks, use elem_exists() instead.
+ * found at all. For field existence checks, use #elem_exists() instead.
*
* \param sdna: Old SDNA
* \param type: Current field type name
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 601eef1372e..cc5abadd0e8 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -466,7 +466,7 @@ static int add_name(const char *str)
/*
* Put )(void) at the end? Maybe )(). Should check this with
* old sdna. Actually, sometimes )(), sometimes )(void...)
- * Alas.. such is the nature of braindamage :(
+ * Alas.. such is the nature of brain-damage :(
*
* Sorted it out: always do )(), except for headdraw and
* windraw, part of ScrArea. This is important, because some
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 4aee3458a92..8521e06c328 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -372,6 +372,9 @@ set(SRC
rna_mesh_utils.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 1d391988cbd..b1c5ef66958 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -2063,7 +2063,7 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
}
/** \note Does not take into account editable status, this has to be checked separately
- * (using RNA_property_edtiable_flag() usually). */
+ * (using #RNA_property_editable_flag() usually). */
bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
{
if (prop->magic == RNA_MAGIC) {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index a5f43a580c5..ce5b18331c6 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -713,10 +713,10 @@ static void rna_BrushGpencilSettings_use_material_pin_update(bContext *C, Pointe
if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
Material *material = give_current_material(ob, ob->actcol);
- BKE_gpencil_brush_set_material(brush, material);
+ BKE_gpencil_brush_material_set(brush, material);
}
else {
- BKE_gpencil_brush_set_material(brush, NULL);
+ BKE_gpencil_brush_material_set(brush, NULL);
}
/* number of material users changed */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 4c6c7740ff8..bd7f75f86b5 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -115,8 +115,8 @@ static const EnumPropertyItem target_space_pchan_items[] = {
"The transformation of the target is only evaluated in the Pose Space, "
"the target armature object transformation is ignored"},
{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The transformation of the target bone is evaluated relative its local "
- "coordinate system, with the parent transformation added"},
+ "The transformation of the target bone is evaluated relative to its rest pose "
+ "local coordinate system, thus including the parent-induced transformation"},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
"The transformation of the target is evaluated relative to its local "
"coordinate system"},
@@ -129,8 +129,8 @@ static const EnumPropertyItem owner_space_pchan_items[] = {
{CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
"The constraint is applied in Pose Space, the object transformation is ignored"},
{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The constraint is applied relative to the local coordinate system of the object, "
- "with the parent transformation added"},
+ "The constraint is applied relative to the rest pose local coordinate system "
+ "of the bone, thus including the parent-induced transformation"},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
"The constraint is applied relative to the local coordinate system of the object"},
{0, NULL, 0, NULL, NULL},
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 5445db78582..8e5f486fea1 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -658,9 +658,10 @@ void RNA_def_material(BlenderRNA *brna)
{MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
{MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
{MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
- {MA_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Monkey"},
{MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"},
- {MA_SPHERE_A, "SPHERE_A", ICON_MAT_SPHERE_SKY, "World Sphere", "Large sphere with sky"},
+ {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader Ball"},
+ {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
+ {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
{0, NULL, 0, NULL, NULL},
};
@@ -731,7 +732,12 @@ void RNA_def_material(BlenderRNA *brna)
prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "pr_type");
RNA_def_property_enum_items(prop, preview_type_items);
- RNA_def_property_ui_text(prop, "Preview render type", "Type of preview render");
+ RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
+ RNA_def_property_update(prop, 0, "rna_Material_update_previews");
+
+ prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pr_flag", MA_PREVIEW_WORLD);
+ RNA_def_property_ui_text(prop, "Preview World", "Use the current world background to light the preview render");
RNA_def_property_update(prop, 0, "rna_Material_update_previews");
prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 2d0afcd66f1..c8feff4c0e8 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2699,17 +2699,6 @@ static void rna_def_object(BlenderRNA *brna)
"Make the object draw in front of others");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
- /* Grease Pencil */
-#if 1 /* FIXME: Remove this code when all Open-Movie assets have been fixed */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_obdata_poll"); /* XXX */
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block (deprecated)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-#endif
-
/* pose */
prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "poselib");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 5e90f1feddf..68b8d1b2a5f 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -49,7 +49,7 @@ static const EnumPropertyItem space_items[] = {
{CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
"The pose space of a bone (its armature's object space)"},
{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The local space of a bone's parent bone"},
+ "The rest pose local space of a bone (thus matrix includes parent transforms)"},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
"The local space of an object/bone"},
{0, NULL, 0, NULL, NULL},
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index 2658cd552bc..4366b18c049 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -63,7 +63,7 @@ static void rna_PoseBone_bbone_segment_matrix(bPoseChannel *pchan, ReportList *r
BKE_reportf(reports, RPT_ERROR, "Bone '%s' has out of date B-Bone segment data!", pchan->name);
return;
}
- if (index < 0 || index >= pchan->runtime.bbone_segments) {
+ if (index < 0 || index > pchan->runtime.bbone_segments) {
BKE_reportf(reports, RPT_ERROR, "Invalid index %d for B-Bone segments of '%s'!", index, pchan->name);
return;
}
@@ -115,13 +115,13 @@ void RNA_api_pose_channel(StructRNA *srna)
/* B-Bone segment matrices */
func = RNA_def_function(srna, "bbone_segment_matrix", "rna_PoseBone_bbone_segment_matrix");
- RNA_def_function_ui_description(func, "Retrieve the matrix of the B-Bone segment if available");
+ RNA_def_function_ui_description(func, "Retrieve the matrix of the joint between B-Bone segments if available");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(parm, "", "The resulting matrix in bone local space");
RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment", 0, 10000);
+ parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment endpoint", 0, 10000);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose matrix");
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 660e2a76511..46eb0a8d7bc 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -744,10 +744,6 @@ static void rna_def_render_engine(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- prop = RNA_def_property(srna, "bl_use_texture_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_TEXTURE_PREVIEW);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 28ee85373bd..a46be8522dd 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -417,13 +417,6 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
-static const EnumPropertyItem rna_enum_gizmo_items[] = {
- {SCE_GIZMO_SHOW_TRANSLATE, "TRANSLATE", 0, "Move", ""},
- {SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
- {SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
/* interpolation */
@@ -581,20 +574,12 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
}
}
-static void rna_ToolSettings_gizmo_flag_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
-{
- ToolSettings *ts = scene->toolsettings;
- if ((ts->gizmo_flag & (SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE)) == 0) {
- ts->gizmo_flag |= SCE_GIZMO_SHOW_TRANSLATE;
- }
-}
static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
}
-
/* Read-only Iterator of all the scene objects. */
static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -2678,13 +2663,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
"Scale is affected by snapping settings");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
- prop = RNA_def_property(srna, "use_gizmo_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gizmo_flag");
- RNA_def_property_enum_items(prop, rna_enum_gizmo_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Gizmo Mode", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ToolSettings_gizmo_flag_update");
-
/* Grease Pencil */
prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 97b997c4604..fda1d71d9db 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -663,8 +663,9 @@ static void rna_3DViewShading_type_update(Main *bmain, Scene *scene, PointerRNA
View3DShading *shading = ptr->data;
if (shading->type == OB_MATERIAL ||
- (shading->type == OB_RENDER && (strcmp(scene->r.engine, RE_engine_id_BLENDER_EEVEE) == 0 ||
- strcmp(scene->r.engine, RE_engine_id_CYCLES)))) {
+ (shading->type == OB_RENDER &&
+ STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE, RE_engine_id_CYCLES)))
+ {
/* When switching from workbench to render or material mode the geometry of any
* active sculpt session needs to be recalculated. */
for (Object *ob = bmain->objects.first; ob ; ob = ob->id.next) {
@@ -1330,10 +1331,6 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
}
- if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT);
- }
-
if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) {
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER);
}
@@ -1342,6 +1339,18 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SHADERFX);
}
+ if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
+ }
+
+ if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
+ }
+
+ if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT);
+ }
+
if (sbuts->pathflag & (1 << BCONTEXT_DATA)) {
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA);
(item + totitem - 1)->icon = sbuts->dataicon;
@@ -1359,16 +1368,12 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL);
}
- if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
- }
-
- if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
+ if (totitem) {
+ RNA_enum_item_add_separator(&item, &totitem);
}
- if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
+ if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
}
RNA_enum_item_end(&item, &totitem);
@@ -3197,6 +3202,59 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ /* Per object type gizmo display flags. */
+
+ prop = RNA_def_property(srna, "show_gizmo_object_translate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_TRANSLATE);
+ RNA_def_property_ui_text(prop, "Show Object Location", "Gizmo to adjust location");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_rotate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_ROTATE);
+ RNA_def_property_ui_text(prop, "Show Object Rotation", "Gizmo to adjust rotation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_SCALE);
+ RNA_def_property_ui_text(prop, "Show Object Scale", "Gizmo to adjust scale");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Empty Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_empty_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_IMAGE);
+ RNA_def_property_ui_text(prop, "Show Empty Image", "Gizmo to adjust image size and position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_empty_force_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD);
+ RNA_def_property_ui_text(prop, "Show Empty Force Field", "Gizmo to adjust the force field");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Light Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_light_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_SIZE);
+ RNA_def_property_ui_text(prop, "Show Light Size", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_light_look_at", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_LOOK_AT);
+ RNA_def_property_ui_text(prop, "Show Light Look-At", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Camera Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_camera_lens", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_LENS);
+ RNA_def_property_ui_text(prop, "Show Camera Lens", "Gizmo to adjust camera lens & ortho size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_camera_dof_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_DOF_DIST);
+ RNA_def_property_ui_text(
+ prop, "Show Camera Focus Distance", "Gizmo to adjust camera focus distance "
+ "(depends on limits display)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+
prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);
RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_use_local_camera_set");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index a2de1712960..da41134f4ab 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4056,7 +4056,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
};
static const EnumPropertyItem material_link_items[] = {
- {0, "OBDATA", 0, "ObData", "Toggle whether the material is linked to object data or the object block"},
+ {0, "OBDATA", 0, "Object Data", "Toggle whether the material is linked to object data or the object block"},
{USER_MAT_ON_OB, "OBJECT", 0, "Object",
"Toggle whether the material is linked to object data or the object block"},
{0, NULL, 0, NULL, NULL},
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index e9b596c3890..8f87388f76a 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -111,6 +111,9 @@ set(SRC
intern/MOD_weightvg_util.h
)
+set(LIB
+)
+
if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
list(APPEND INC
@@ -144,4 +147,4 @@ endif()
# So we can have special tricks in modifier system.
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index cc2bfbadf80..f58c43cf44f 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -258,6 +258,9 @@ set(SRC
intern/node_util.h
)
+set(LIB
+)
+
if(WITH_PYTHON)
list(APPEND INC
../python
@@ -289,4 +292,4 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index a2978970951..1c3b792f20b 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -28,225 +28,224 @@
/* 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( Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" );
-DefNode( Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" );
-DefNode( Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" );
-DefNode( Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" );
-DefNode( Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" );
+DefNode(Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" )
+DefNode(Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" )
+DefNode(Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" )
+DefNode(Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" )
+DefNode(Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" )
-DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" );
-DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" );
-DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" );
-DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" );
-DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" );
-DefNode( ShaderNode, SH_NODE_SHADERTORGB, 0, "SHADERTORGB", ShaderToRGB, "Shader to RGB", "" );
-DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" );
-DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" );
-DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" );
-DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" );
-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 Value", "" );
-DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" );
-DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" );
-DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" );
-DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" );
+DefNode(ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
+DefNode(ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
+DefNode(ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" )
+DefNode(ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
+DefNode(ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
+DefNode(ShaderNode, SH_NODE_SHADERTORGB, 0, "SHADERTORGB", ShaderToRGB, "Shader to RGB", "" )
+DefNode(ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
+DefNode(ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
+DefNode(ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
+DefNode(ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
+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 Value", "" )
+DefNode(ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
+DefNode(ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
+DefNode(ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" )
+DefNode(ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
-DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" );
-DefNode( ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, "EEVEE_SPECULAR", EeveeSpecular, "Specular", "" );
-DefNode( ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, "OUTPUT_LIGHT", OutputLight, "Light Output", "" );
-DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" );
-DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" );
-DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" );
-DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" );
-DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" );
-DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" );
-DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" );
-DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"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, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "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_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" );
-DefNode( ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", "");
-DefNode( ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering","");
-DefNode( ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" );
-DefNode( ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" );
-DefNode( ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" );
-DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" );
-DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" );
-DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" );
-DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" );
-DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" );
-DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" );
-DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" );
-DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" );
-DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" );
-DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" );
-DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" );
-DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" );
-DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" );
-DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" );
-DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" );
-DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" );
-DefNode( ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" );
-DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" );
-DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" );
-DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" );
-DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" );
-DefNode( ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" );
-DefNode( ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" );
-DefNode( ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" );
-DefNode( ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" );
-DefNode( ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" );
-DefNode( ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" );
-DefNode( ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" );
-DefNode( ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" );
+DefNode(ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" )
+DefNode(ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, "EEVEE_SPECULAR", EeveeSpecular, "Specular", "" )
+DefNode(ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, "OUTPUT_LIGHT", OutputLight, "Light Output", "" )
+DefNode(ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" )
+DefNode(ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" )
+DefNode(ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" )
+DefNode(ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" )
+DefNode(ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" )
+DefNode(ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" )
+DefNode(ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" )
+DefNode(ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"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, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "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_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" )
+DefNode(ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", "")
+DefNode(ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering","")
+DefNode(ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" )
+DefNode(ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" )
+DefNode(ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" )
+DefNode(ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" )
+DefNode(ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" )
+DefNode(ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" )
+DefNode(ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" )
+DefNode(ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" )
+DefNode(ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" )
+DefNode(ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" )
+DefNode(ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" )
+DefNode(ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" )
+DefNode(ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" )
+DefNode(ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" )
+DefNode(ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" )
+DefNode(ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" )
+DefNode(ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" )
+DefNode(ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" )
+DefNode(ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" )
+DefNode(ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" )
+DefNode(ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" )
+DefNode(ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" )
+DefNode(ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" )
+DefNode(ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" )
+DefNode(ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" )
+DefNode(ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" )
+DefNode(ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" )
+DefNode(ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" )
+DefNode(ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" )
+DefNode(ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" )
+DefNode(ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" )
+DefNode(ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" )
-DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" );
-DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" );
-DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" );
-DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" );
-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 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", "" );
-DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" );
-DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" );
-DefNode( CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" );
-DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" );
-DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" );
-DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" );
-DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" );
-DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" );
-DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "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, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" );
+DefNode(CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" )
+DefNode(CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
+DefNode(CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
+DefNode(CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" )
+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 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", "" )
+DefNode(CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" )
+DefNode(CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" )
+DefNode(CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" )
+DefNode(CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" )
+DefNode(CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" )
+DefNode(CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" )
+DefNode(CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" )
+DefNode(CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" )
+DefNode(CompositorNode, CMP_NODE_HUE_SAT, 0, "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, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" )
/* NB: OutputFile node has special rna setup function called in rna_nodetree.c */
-DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "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", "" );
-DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" );
-DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" );
-DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" );
-DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" );
-DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" );
-DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" );
-DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" );
-DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" );
-DefNode( CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" );
-DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" );
-DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" );
-DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" );
-DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" );
-DefNode( CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" );
-DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" );
-DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" );
-DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" );
-DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" );
-DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" );
-DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" );
-DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" );
-DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" );
-DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" );
-DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" );
-DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" );
-DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" );
-DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" );
-DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" );
-DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" );
-DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" );
-DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" );
-DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" );
-DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" );
-DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" );
-DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" );
-DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" );
-DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" );
-DefNode( CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" );
-DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" );
-DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" );
-DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" );
-DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" );
-DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" );
-DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" );
-DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" );
-DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" );
-DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" );
-DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" );
-DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" );
-DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" );
-DefNode( CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" );
-DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" );
-DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" );
-DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" );
-DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" );
-DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" );
-DefNode( CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" );
-DefNode( CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" );
-DefNode( CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" );
-DefNode( CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" );
-DefNode( CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" );
+DefNode(CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "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", "" )
+DefNode(CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" )
+DefNode(CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
+DefNode(CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
+DefNode(CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" )
+DefNode(CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" )
+DefNode(CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" )
+DefNode(CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" )
+DefNode(CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" )
+DefNode(CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" )
+DefNode(CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" )
+DefNode(CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" )
+DefNode(CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" )
+DefNode(CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" )
+DefNode(CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" )
+DefNode(CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" )
+DefNode(CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" )
+DefNode(CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" )
+DefNode(CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" )
+DefNode(CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" )
+DefNode(CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" )
+DefNode(CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" )
+DefNode(CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" )
+DefNode(CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" )
+DefNode(CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
+DefNode(CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" )
+DefNode(CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" )
+DefNode(CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
+DefNode(CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" )
+DefNode(CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )
+DefNode(CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" )
+DefNode(CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" )
+DefNode(CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" )
+DefNode(CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" )
+DefNode(CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" )
+DefNode(CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" )
+DefNode(CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" )
+DefNode(CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" )
+DefNode(CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" )
+DefNode(CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" )
+DefNode(CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" )
+DefNode(CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" )
+DefNode(CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" )
+DefNode(CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" )
+DefNode(CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" )
+DefNode(CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" )
+DefNode(CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" )
+DefNode(CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" )
+DefNode(CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" )
+DefNode(CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" )
+DefNode(CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" )
+DefNode(CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" )
+DefNode(CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" )
+DefNode(CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" )
+DefNode(CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" )
+DefNode(CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" )
+DefNode(CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" )
+DefNode(CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" )
+DefNode(CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" )
+DefNode(CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" )
+DefNode(CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" )
+DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" )
-DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" );
-DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" );
-DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" );
-DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" );
-DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" );
-DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" );
-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 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", "" );
-DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" );
-DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" );
-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, "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", "" );
-DefNode( TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" );
+DefNode(TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
+DefNode(TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
+DefNode(TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
+DefNode(TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" )
+DefNode(TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" )
+DefNode(TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
+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 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", "" )
+DefNode(TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
+DefNode(TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
+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, "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", "" )
+DefNode(TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" )
/* procedural textures */
-DefNode( TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" );
-DefNode( TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" );
-
+DefNode(TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" )
+DefNode(TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" )
/* undefine macros */
#undef DefNode
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index a98872ea43b..4bd9b5e5db7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -44,7 +44,7 @@ static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node)
/* Only show X/Y scale factor inputs for modes using them! */
for (sock = node->inputs.first; sock; sock = sock->next) {
- if (STREQ(sock->name, "X") || STREQ(sock->name, "Y")) {
+ if (STR_ELEM(sock->name, "X", "Y")) {
if (use_xy_scale) {
sock->flag &= ~SOCK_UNAVAIL;
}
diff --git a/source/blender/physics/CMakeLists.txt b/source/blender/physics/CMakeLists.txt
index 800cc6bbdc3..0a991bf2929 100644
--- a/source/blender/physics/CMakeLists.txt
+++ b/source/blender/physics/CMakeLists.txt
@@ -45,4 +45,7 @@ set(SRC
BPH_mass_spring.h
)
-blender_add_lib(bf_physics "${SRC}" "${INC}" "${INC_SYS}")
+set(LIB
+)
+
+blender_add_lib(bf_physics "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index cc8caca9588..83f586c4078 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -493,18 +493,6 @@ BLI_INLINE void madd_m3_m3fl(float r[3][3], float m[3][3], float f)
r[2][2] += m[2][2] * f;
}
-BLI_INLINE void madd_m3_m3m3fl(float r[3][3], float a[3][3], float b[3][3], float f)
-{
- r[0][0] = a[0][0] + b[0][0] * f;
- r[0][1] = a[0][1] + b[0][1] * f;
- r[0][2] = a[0][2] + b[0][2] * f;
- r[1][0] = a[1][0] + b[1][0] * f;
- r[1][1] = a[1][1] + b[1][1] * f;
- r[1][2] = a[1][2] + b[1][2] * f;
- r[2][0] = a[2][0] + b[2][0] * f;
- r[2][1] = a[2][1] + b[2][1] * f;
- r[2][2] = a[2][2] + b[2][2] * f;
-}
/////////////////////////////////////////////////////////////////
///////////////////////////
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index c9524634f7e..8e92b43eb46 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -51,8 +51,11 @@ set(SRC
bmesh_py_utils.h
)
+set(LIB
+)
+
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
-blender_add_lib(bf_python_bmesh "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_python_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index c7b361247ef..3ebd90e5b42 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -50,6 +50,9 @@ set(SRC
python_utildefines.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/python/gpu/CMakeLists.txt b/source/blender/python/gpu/CMakeLists.txt
index 3c3a9b7e577..aeef81c5fd7 100644
--- a/source/blender/python/gpu/CMakeLists.txt
+++ b/source/blender/python/gpu/CMakeLists.txt
@@ -54,6 +54,9 @@ set(SRC
gpu_py_vertex_format.h
)
+set(LIB
+)
+
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_python_gpu "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_python_gpu "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 89e5e368ced..d517d6a9529 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -117,6 +117,9 @@ set(SRC
../BPY_extern_clog.h
)
+set(LIB
+)
+
# only to check if buildinfo is available
if(WITH_BUILDINFO)
add_definitions(-DBUILD_DATE)
@@ -298,4 +301,4 @@ endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f695464ec42..d9052aafae8 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -4136,7 +4136,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
else if (name[0] == '_') { /* rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups */
/* annoying exception, maybe we need to have different types for this... */
- if ((STREQ(name, "__getitem__") || STREQ(name, "__setitem__")) && !RNA_struct_idprops_check(self->ptr.type)) {
+ if (STR_ELEM(name, "__getitem__", "__setitem__") && !RNA_struct_idprops_check(self->ptr.type)) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type");
ret = NULL;
}
diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt
index 4a8d69f72fd..b973875977a 100644
--- a/source/blender/python/mathutils/CMakeLists.txt
+++ b/source/blender/python/mathutils/CMakeLists.txt
@@ -55,5 +55,8 @@ set(SRC
mathutils_noise.h
)
+set(LIB
+)
+
-blender_add_lib(bf_python_mathutils "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_python_mathutils "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index fc2c0b324a9..96c8b9c860b 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -69,6 +69,9 @@ set(SRC
intern/include/zbuf.h
)
+set(LIB
+)
+
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
list(APPEND INC
@@ -103,4 +106,4 @@ if(APPLE)
endif()
endif()
-blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 780894f419d..d22ab6d782d 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -58,7 +58,6 @@ struct bNodeTree;
#define RE_USE_SHADING_NODES 16
#define RE_USE_EXCLUDE_LAYERS 32
#define RE_USE_SAVE_BUFFERS 64
-#define RE_USE_TEXTURE_PREVIEW 128
#define RE_USE_SHADING_NODES_CUSTOM 256
#define RE_USE_SPHERICAL_STEREO 512
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index 632c501c54c..8a8e4bbbb2a 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -802,11 +802,14 @@ static void free_normal_data(void *bake_data)
MEM_freeN(normal_data);
}
-/* MultiresBake callback for normals' baking
- * general idea:
- * - find coord and normal of point with specified UV in hi-res mesh
- * - multiply it by tangmat
- * - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */
+/**
+ * MultiresBake callback for normals' baking.
+ *
+ * General idea:
+ * - Find coord and normal of point with specified UV in hi-res mesh.
+ * - Multiply it by tangmat.
+ * - Vector in color space would be `norm(vec) / 2 + (0.5, 0.5, 0.5)`.
+ */
static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void *UNUSED(thread_data),
void *bake_data, ImBuf *ibuf, const int tri_index, const int lvl,
const float st[2], float tangmat[3][3], const int x, const int y)
diff --git a/source/blender/shader_fx/CMakeLists.txt b/source/blender/shader_fx/CMakeLists.txt
index ddd21449d40..e8f2a038dce 100644
--- a/source/blender/shader_fx/CMakeLists.txt
+++ b/source/blender/shader_fx/CMakeLists.txt
@@ -57,10 +57,13 @@ set(SRC
FX_shader_types.h
)
+set(LIB
+)
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
add_definitions(${GL_DEFINITIONS})
-blender_add_lib(bf_shader_fx "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_shader_fx "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 10f79691924..3f4f18005ef 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -106,6 +106,9 @@ set(SRC
message_bus/wm_message_bus.h
)
+set(LIB
+)
+
if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
@@ -166,4 +169,4 @@ if(WITH_COMPOSITOR)
add_definitions(-DWITH_COMPOSITOR)
endif()
-blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index 7346fa31300..1a4141c0178 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -644,10 +644,12 @@ void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
{
const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
- if (gzt)
+ if (gzt) {
WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)gzt);
- else
+ }
+ else {
RNA_pointer_create(NULL, &RNA_GizmoProperties, NULL, ptr);
+ }
}
/* similar to the function above except its uses ID properties
@@ -674,10 +676,12 @@ void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
{
switch (RNA_property_type(prop)) {
case PROP_ENUM:
- if (no_context)
+ if (no_context) {
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- else
+ }
+ else {
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
+ }
break;
case PROP_POINTER:
{
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 42dd5e8f293..ae264480751 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -145,18 +145,18 @@ int WM_gizmo_cmp_temp_fl(const void *gz_a_ptr, const void *gz_b_ptr)
{
const wmGizmo *gz_a = gz_a_ptr;
const wmGizmo *gz_b = gz_b_ptr;
- if (gz_a->temp.f < gz_b->temp.f) return -1;
- else if (gz_a->temp.f > gz_b->temp.f) return 1;
- else return 0;
+ if (gz_a->temp.f < gz_b->temp.f) { return -1; }
+ else if (gz_a->temp.f > gz_b->temp.f) { return 1; }
+ else { return 0; }
}
int WM_gizmo_cmp_temp_fl_reverse(const void *gz_a_ptr, const void *gz_b_ptr)
{
const wmGizmo *gz_a = gz_a_ptr;
const wmGizmo *gz_b = gz_b_ptr;
- if (gz_a->temp.f < gz_b->temp.f) return 1;
- else if (gz_a->temp.f > gz_b->temp.f) return -1;
- else return 0;
+ if (gz_a->temp.f < gz_b->temp.f) { return 1; }
+ else if (gz_a->temp.f > gz_b->temp.f) { return -1; }
+ else { return 0; }
}
wmGizmo *wm_gizmogroup_find_intersected_gizmo(
@@ -636,8 +636,9 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
keymap = WM_modalkeymap_get(keyconf, name);
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items)
+ if (keymap && keymap->modal_items) {
return NULL;
+ }
keymap = WM_modalkeymap_add(keyconf, name, modal_items);
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index df9f38824b0..112943a7dba 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -345,8 +345,9 @@ static void gizmomap_prepare_drawing(
wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos,
const eWM_GizmoFlagMapDrawStep drawstep)
{
- if (!gzmap || BLI_listbase_is_empty(&gzmap->groups))
+ if (!gzmap || BLI_listbase_is_empty(&gzmap->groups)) {
return;
+ }
gzmap->is_init = false;
@@ -844,8 +845,9 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
break;
}
- if (changed)
+ if (changed) {
WM_event_add_mousemove(C);
+ }
return changed;
}
@@ -874,12 +876,15 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
else {
ARegion *ar;
CTX_wm_area_set(C, sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next)
- if (ar == handler->context.region)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar == handler->context.region) {
break;
+ }
+ }
/* XXX no warning print here, after full-area and back regions are remade */
- if (ar)
+ if (ar) {
CTX_wm_region_set(C, ar);
+ }
}
}
}
@@ -1198,11 +1203,13 @@ void WM_gizmoconfig_update_tag_remove(
*/
void WM_gizmoconfig_update(struct Main *bmain)
{
- if (G.background)
+ if (G.background) {
return;
+ }
- if (wm_gzmap_type_update_flag == 0)
+ if (wm_gzmap_type_update_flag == 0) {
return;
+ }
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 2c6dcd56471..a05dce9d59a 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -219,9 +219,11 @@ void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot)
void WM_keyconfig_reload(bContext *C)
{
if (CTX_py_init_get(C) && !G.background) {
+#ifdef WITH_PYTHON
BPY_execute_string(
C, (const char *[]){"bpy", NULL},
"bpy.utils.keyconfig_init()");
+#endif
}
}
@@ -354,8 +356,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
wmOperator *op;
wmKeyConfig *keyconf;
- if (wm->autosavetimer)
+ if (wm->autosavetimer) {
wm_autosave_timer_ended(wm);
+ }
while ((win = BLI_pophead(&wm->windows))) {
/* prevent draw clear to use screen */
@@ -388,7 +391,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
wm->undo_stack = NULL;
}
- if (C && CTX_wm_manager(C) == wm) CTX_wm_manager_set(C, NULL);
+ if (C && CTX_wm_manager(C) == wm) {
+ CTX_wm_manager_set(C, NULL);
+ }
}
void wm_close_and_free_all(bContext *C, ListBase *wmlist)
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index de293373870..a04b3d1c843 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -114,19 +114,22 @@ void WM_cursor_set(wmWindow *win, int curs)
#ifdef _WIN32
/* the default win32 cross cursor is barely visible,
* only 1 pixel thick, use another one instead */
- if (curs == CURSOR_EDIT)
+ if (curs == CURSOR_EDIT) {
curs = BC_CROSSCURSOR;
+ }
#else
/* in case of large cursor, also use custom cursor because
* large cursors don't work for system cursors */
- if (U.curssize && curs == CURSOR_EDIT)
+ if (U.curssize && curs == CURSOR_EDIT) {
curs = BC_CROSSCURSOR;
+ }
#endif
GHOST_SetCursorVisibility(win->ghostwin, 1);
- if (curs == CURSOR_STD && win->modalcursor)
+ if (curs == CURSOR_STD && win->modalcursor) {
curs = win->modalcursor;
+ }
win->cursor = curs;
@@ -135,7 +138,9 @@ void WM_cursor_set(wmWindow *win, int curs)
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
}
else {
- if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) return;
+ if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) {
+ return;
+ }
if (curs == SYSCURSOR) { /* System default Cursor */
GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
@@ -168,8 +173,9 @@ bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const AReg
void WM_cursor_modal_set(wmWindow *win, int val)
{
- if (win->lastcursor == 0)
+ if (win->lastcursor == 0) {
win->lastcursor = win->cursor;
+ }
win->modalcursor = val;
WM_cursor_set(win, val);
}
@@ -177,8 +183,9 @@ void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
{
win->modalcursor = 0;
- if (win->lastcursor)
+ if (win->lastcursor) {
WM_cursor_set(win, win->lastcursor);
+ }
win->lastcursor = 0;
}
@@ -304,8 +311,9 @@ void WM_cursor_time(wmWindow *win, int nr)
unsigned char bitmap[16][2] = {{0}};
int i, idx;
- if (win->lastcursor == 0)
+ if (win->lastcursor == 0) {
win->lastcursor = win->cursor;
+ }
memset(&mask, 0xFF, sizeof(mask));
@@ -315,8 +323,9 @@ void WM_cursor_time(wmWindow *win, int nr)
int x = idx % 2;
int y = idx / 2;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 8; i++) {
bitmap[i + y * 8][x] = digit[i];
+ }
nr /= 10;
}
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 11e803c4b82..92ce9957351 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -76,10 +76,13 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
{
wmDropBoxMap *dm;
- for (dm = dropboxes.first; dm; dm = dm->next)
- if (dm->spaceid == spaceid && dm->regionid == regionid)
- if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
+ for (dm = dropboxes.first; dm; dm = dm->next) {
+ if (dm->spaceid == spaceid && dm->regionid == regionid) {
+ if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME)) {
return &dm->dropboxes;
+ }
+ }
+ }
dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
@@ -222,13 +225,19 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
const char *name;
name = dropbox_active(C, &win->handlers, drag, event);
- if (name) return name;
+ if (name) {
+ return name;
+ }
name = dropbox_active(C, &sa->handlers, drag, event);
- if (name) return name;
+ if (name) {
+ return name;
+ }
name = dropbox_active(C, &ar->handlers, drag, event);
- if (name) return name;
+ if (name) {
+ return name;
+ }
return NULL;
}
@@ -241,8 +250,9 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e
const int winsize_y = WM_window_pixels_y(win);
/* for multiwin drags, we only do this if mouse inside */
- if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y)
+ if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y) {
return;
+ }
drag->opname[0] = 0;
@@ -361,14 +371,18 @@ static const char *wm_drag_name(wmDrag *drag)
static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
{
- if (rect->xmin > x1)
+ if (rect->xmin > x1) {
rect->xmin = x1;
- if (rect->xmax < x2)
+ }
+ if (rect->xmax < x2) {
rect->xmax = x2;
- if (rect->ymin > y1)
+ }
+ if (rect->ymin > y1) {
rect->ymin = y1;
- if (rect->ymax < y2)
+ }
+ if (rect->ymax < y2) {
rect->ymax = y2;
+ }
}
/* called in wm_draw.c */
@@ -400,8 +414,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
x = cursorx - drag->sx / 2;
y = cursory - drag->sy / 2;
- if (rect)
+ if (rect) {
drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
+ }
else {
float col[4] = {1.0f, 1.0f, 1.0f, 0.65f}; /* this blends texture */
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
@@ -413,10 +428,12 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
x = cursorx - 2 * padding;
y = cursory - 2 * UI_DPI_FAC;
- if (rect)
+ if (rect) {
drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
- else
+ }
+ else {
UI_icon_draw_aspect(x, y, drag->icon, 1.0f / UI_DPI_FAC, 0.8, text_col);
+ }
}
/* item name */
@@ -442,10 +459,12 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
if (drag->imb) {
x = cursorx - drag->sx / 2;
- if (cursory + drag->sy / 2 + padding + iconsize < winsize_y)
+ if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) {
y = cursory + drag->sy / 2 + padding;
- else
+ }
+ else {
y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize;
+ }
}
else {
x = cursorx - 2 * padding;
@@ -462,8 +481,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
}
- else
+ else {
wm_drop_operator_draw(drag->opname, x, y);
+ }
}
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 4f299201bdf..08ece1fd5c5 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -189,8 +189,9 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt
static void wm_area_mark_invalid_backbuf(ScrArea *sa)
{
- if (sa->spacetype == SPACE_VIEW3D)
+ if (sa->spacetype == SPACE_VIEW3D) {
((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
+ }
}
static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *depsgraph,
@@ -207,10 +208,12 @@ static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *
rcti border_rect;
/* do partial redraw when possible */
- if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect))
+ if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect)) {
ED_region_tag_redraw_partial(ar, &border_rect);
- else
+ }
+ else {
ED_region_tag_redraw(ar);
+ }
engine->flag &= ~RE_ENGINE_DO_DRAW;
}
@@ -702,8 +705,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
}
/* always draw, not only when screen tagged */
- if (win->gesture.first)
+ if (win->gesture.first) {
wm_gesture_draw(win);
+ }
/* needs pixel coords in screen */
if (wm->drags.first) {
@@ -798,32 +802,40 @@ static bool wm_draw_update_test_window(wmWindow *win)
screen->do_draw_paintcursor = true;
ar->do_draw_overlay = false;
}
- if (ar->visible && ar->do_draw)
+ if (ar->visible && ar->do_draw) {
do_draw = true;
+ }
}
ED_screen_areas_iter(win, screen, sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
wm_region_test_render_do_draw(scene, depsgraph, sa, ar);
- if (ar->visible && ar->do_draw)
+ if (ar->visible && ar->do_draw) {
do_draw = true;
+ }
}
}
- if (do_draw)
+ if (do_draw) {
return true;
+ }
- if (screen->do_refresh)
+ if (screen->do_refresh) {
return true;
- if (screen->do_draw)
+ }
+ if (screen->do_draw) {
return true;
- if (screen->do_draw_gesture)
+ }
+ if (screen->do_draw_gesture) {
return true;
- if (screen->do_draw_paintcursor)
+ }
+ if (screen->do_draw_paintcursor) {
return true;
- if (screen->do_draw_drag)
+ }
+ if (screen->do_draw_drag) {
return true;
+ }
return false;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 940e7fa8e96..5d22eb79601 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -185,9 +185,11 @@ static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, v
{
wmNotifier *note;
- for (note = wm->queue.first; note; note = note->next)
- if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference)
+ for (note = wm->queue.first; note; note = note->next) {
+ if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference) {
return 1;
+ }
+ }
return 0;
}
@@ -198,8 +200,9 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note;
- if (wm_test_duplicate_notifier(wm, type, reference))
+ if (wm_test_duplicate_notifier(wm, type, reference)) {
return;
+ }
note = MEM_callocN(sizeof(wmNotifier), "notifier");
@@ -222,8 +225,9 @@ void WM_main_add_notifier(unsigned int type, void *reference)
wmWindowManager *wm = bmain->wm.first;
wmNotifier *note;
- if (!wm || wm_test_duplicate_notifier(wm, type, reference))
+ if (!wm || wm_test_duplicate_notifier(wm, type, reference)) {
return;
+ }
note = MEM_callocN(sizeof(wmNotifier), "notifier");
@@ -376,8 +380,9 @@ void wm_event_do_notifiers(bContext *C)
wmNotifier *note, *next;
wmWindow *win;
- if (wm == NULL)
+ if (wm == NULL) {
return;
+ }
BLI_timer_execute();
@@ -398,8 +403,9 @@ void wm_event_do_notifiers(bContext *C)
wm->file_saved = 1;
wm_window_title(wm, win);
}
- else if (note->data == ND_DATACHANGED)
+ else if (note->data == ND_DATACHANGED) {
wm_window_title(wm, win);
+ }
}
if (note->window == win) {
if (note->category == NC_SCREEN) {
@@ -409,15 +415,17 @@ void wm_event_do_notifiers(bContext *C)
UI_popup_handlers_remove_all(C, &win->modalhandlers);
WM_window_set_active_workspace(C, win, ref_ws);
- if (G.debug & G_DEBUG_EVENTS)
+ if (G.debug & G_DEBUG_EVENTS) {
printf("%s: Workspace set %p\n", __func__, note->reference);
+ }
}
else if (note->data == ND_WORKSPACE_DELETE) {
WorkSpace *workspace = note->reference;
ED_workspace_delete(workspace, CTX_data_main(C), C, wm); // XXX hrms, think this over!
- if (G.debug & G_DEBUG_EVENTS)
+ if (G.debug & G_DEBUG_EVENTS) {
printf("%s: Workspace delete %p\n", __func__, workspace);
+ }
}
else if (note->data == ND_LAYOUTBROWSE) {
bScreen *ref_screen = BKE_workspace_layout_screen_get(note->reference);
@@ -427,16 +435,18 @@ void wm_event_do_notifiers(bContext *C)
ED_screen_change(C, ref_screen); /* XXX hrms, think this over! */
- if (G.debug & G_DEBUG_EVENTS)
+ if (G.debug & G_DEBUG_EVENTS) {
printf("%s: screen set %p\n", __func__, note->reference);
+ }
}
else if (note->data == ND_LAYOUTDELETE) {
WorkSpace *workspace = WM_window_get_active_workspace(win);
WorkSpaceLayout *layout = note->reference;
ED_workspace_layout_delete(workspace, layout, C); // XXX hrms, think this over!
- if (G.debug & G_DEBUG_EVENTS)
+ if (G.debug & G_DEBUG_EVENTS) {
printf("%s: screen delete %p\n", __func__, note->reference);
+ }
}
}
}
@@ -445,8 +455,9 @@ void wm_event_do_notifiers(bContext *C)
(note->window == NULL && (note->reference == NULL || note->reference == scene)))
{
if (note->category == NC_SCENE) {
- if (note->data == ND_FRAME)
+ if (note->data == ND_FRAME) {
do_anim = true;
+ }
}
}
if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_WM)) {
@@ -565,10 +576,12 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler_UI *handler, const wmE
/* UI is quite aggressive with swallowing events, like scrollwheel */
/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
if (do_wheel_ui == false) {
- if (is_wheel)
+ if (is_wheel) {
return WM_HANDLER_CONTINUE;
- else if (wm_event_always_pass(event) == 0)
+ }
+ else if (wm_event_always_pass(event) == 0) {
do_wheel_ui = true;
+ }
}
/* we set context to where ui handler came from */
@@ -597,12 +610,14 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler_UI *handler, const wmE
CTX_wm_menu_set(C, NULL);
}
- if (retval == WM_UI_HANDLER_BREAK)
+ if (retval == WM_UI_HANDLER_BREAK) {
return WM_HANDLER_BREAK;
+ }
/* event not handled in UI, if wheel then we temporarily disable it */
- if (is_wheel)
+ if (is_wheel) {
do_wheel_ui = false;
+ }
return WM_HANDLER_CONTINUE;
}
@@ -612,8 +627,9 @@ static void wm_handler_ui_cancel(bContext *C)
wmWindow *win = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
- if (!ar)
+ if (!ar) {
return;
+ }
LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &ar->handlers) {
if (handler_base->type == WM_HANDLER_TYPE_UI) {
@@ -636,15 +652,18 @@ bool WM_operator_poll(bContext *C, wmOperatorType *ot)
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
wmOperatorType *ot_macro = WM_operatortype_find(otmacro->idname, 0);
- if (0 == WM_operator_poll(C, ot_macro))
+ if (0 == WM_operator_poll(C, ot_macro)) {
return 0;
+ }
}
/* python needs operator type, so we added exception for it */
- if (ot->pyop_poll)
+ if (ot->pyop_poll) {
return ot->pyop_poll(C, ot);
- else if (ot->poll)
+ }
+ else if (ot->poll) {
return ot->poll(C);
+ }
return 1;
}
@@ -836,8 +855,9 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
- if (win_prev == NULL)
+ if (win_prev == NULL) {
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+ }
UI_popup_menu_reports(C, op->reports);
@@ -959,11 +979,13 @@ static int wm_operator_exec(
CTX_wm_operator_poll_msg_set(C, NULL);
- if (op == NULL || op->type == NULL)
+ if (op == NULL || op->type == NULL) {
return retval;
+ }
- if (0 == WM_operator_poll(C, op->type))
+ if (0 == WM_operator_poll(C, op->type)) {
return retval;
+ }
if (op->type->exec) {
if (op->type->flag & OPTYPE_UNDO) {
@@ -987,8 +1009,9 @@ static int wm_operator_exec(
/* XXX Disabled the repeat check to address part 2 of #31840.
* Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason
* why this was needed, but worth to note it in case something turns bad. (mont29) */
- if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */)
+ if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */) {
wm_operator_reports(C, op, retval, false);
+ }
if (retval & OPERATOR_FINISHED) {
wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0);
@@ -1009,8 +1032,9 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
{
int retval = OPERATOR_CANCELLED;
- if (op == NULL || op->type == NULL || op->type->exec == NULL)
+ if (op == NULL || op->type == NULL || op->type->exec == NULL) {
return retval;
+ }
retval = op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
@@ -1060,7 +1084,7 @@ int WM_operator_repeat_interactive(bContext *C, wmOperator *op)
* \return true if #WM_operator_repeat can run
* simple check for now but may become more involved.
* To be sure the operator can run call `WM_operator_poll(C, op->type)` also, since this call
- * checks if WM_operator_repeat() can run at all, not that it WILL run at any time.
+ * checks if #WM_operator_repeat() can run at all, not that it WILL run at any time.
*/
bool WM_operator_repeat_check(const bContext *UNUSED(C), wmOperator *op)
{
@@ -1146,8 +1170,9 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
RNA_STRUCT_BEGIN (properties, prop)
{
- if (otmacro == NULL)
+ if (otmacro == NULL) {
break;
+ }
/* skip invalid properties */
if (STREQ(RNA_property_identifier(prop), otmacro->idname)) {
@@ -1175,8 +1200,9 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
}
}
- if (root)
+ if (root) {
motherop = NULL;
+ }
}
WM_operator_properties_sanitize(op->ptr, 0);
@@ -1311,8 +1337,9 @@ static int wm_operator_invoke(
int retval = OPERATOR_PASS_THROUGH;
/* this is done because complicated setup is done to call this function that is better not duplicated */
- if (poll_only)
+ if (poll_only) {
return WM_operator_poll(C, ot);
+ }
if (WM_operator_poll(C, ot)) {
wmWindowManager *wm = CTX_wm_manager(C);
@@ -1337,24 +1364,28 @@ static int wm_operator_invoke(
if (op->type->invoke && event) {
wm_region_mouse_co(C, event);
- if (op->type->flag & OPTYPE_UNDO)
+ if (op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
+ }
retval = op->type->invoke(C, op, event);
OPERATOR_RETVAL_CHECK(retval);
- if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
wm->op_undo_depth--;
+ }
}
else if (op->type->exec) {
- if (op->type->flag & OPTYPE_UNDO)
+ if (op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
+ }
retval = op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
- if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
wm->op_undo_depth--;
+ }
}
else {
/* debug, important to leave a while, should never happen */
@@ -1543,8 +1574,9 @@ static int wm_operator_call_internal(
ar1 = BKE_area_find_region_type(area, type);
}
- if (ar1)
+ if (ar1) {
CTX_wm_region_set(C, ar1);
+ }
}
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
@@ -1659,11 +1691,15 @@ int WM_operator_call_py(
* we could have some more obvious way of doing this like passing a flag.
*/
wmWindowManager *wm = CTX_wm_manager(C);
- if (!is_undo && wm) wm->op_undo_depth++;
+ if (!is_undo && wm) {
+ wm->op_undo_depth++;
+ }
retval = wm_operator_call_internal(C, ot, properties, reports, context, false, NULL);
- if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
+ if (!is_undo && wm && (wm == CTX_wm_manager(C))) {
+ wm->op_undo_depth--;
+ }
return retval;
}
@@ -1684,8 +1720,9 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const
bScreen *screen = CTX_wm_screen(C);
if (screen && handler->op) {
- if (handler->context.area == NULL)
+ if (handler->context.area == NULL) {
CTX_wm_area_set(C, NULL);
+ }
else {
ScrArea *sa = NULL;
@@ -1727,8 +1764,9 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const
}
/* XXX no warning print here, after full-area and back regions are remade */
- if (ar)
+ if (ar) {
CTX_wm_region_set(C, ar);
+ }
}
}
}
@@ -1948,8 +1986,9 @@ static wmKeyMapItem *wm_eventmatch_modal_keymap_items(const wmKeyMap *keymap, wm
static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *event, bool *dbl_click_disabled)
{
/* support for modal keymap in macros */
- if (op->opm)
+ if (op->opm) {
op = op->opm;
+ }
if (op->type->modalkeymap) {
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
@@ -2014,8 +2053,9 @@ static void wm_event_modalmap_end(wmEvent *event, bool dbl_click_disabled)
event->val = event->prevval;
event->prevval = 0;
}
- else if (dbl_click_disabled)
+ else if (dbl_click_disabled) {
event->val = KM_DBL_CLICK;
+ }
}
@@ -2050,8 +2090,9 @@ static int wm_handler_operator_call(
wm_region_mouse_co(C, event);
wm_event_modalkeymap(C, op, event, &dbl_click_disabled);
- if (ot->flag & OPTYPE_UNDO)
+ if (ot->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
+ }
/* warning, after this call all context data and 'event' may be freed. see check below */
retval = ot->modal(C, op, event);
@@ -2064,8 +2105,9 @@ static int wm_handler_operator_call(
wm_event_modalmap_end(event, dbl_click_disabled);
- if (ot->flag & OPTYPE_UNDO)
+ if (ot->flag & OPTYPE_UNDO) {
wm->op_undo_depth--;
+ }
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
wm_operator_reports(C, op, retval, false);
@@ -2176,15 +2218,18 @@ static int wm_handler_operator_call(
/* Finished and pass through flag as handled */
/* Finished and pass through flag as handled */
- if (retval == (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH))
+ if (retval == (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH)) {
return WM_HANDLER_HANDLED;
+ }
/* Modal unhandled, break */
- if (retval == (OPERATOR_PASS_THROUGH | OPERATOR_RUNNING_MODAL))
+ if (retval == (OPERATOR_PASS_THROUGH | OPERATOR_RUNNING_MODAL)) {
return (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
+ }
- if (retval & OPERATOR_PASS_THROUGH)
+ if (retval & OPERATOR_PASS_THROUGH) {
return WM_HANDLER_CONTINUE;
+ }
return WM_HANDLER_BREAK;
}
@@ -2269,21 +2314,25 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
if (val == EVT_FILESELECT_EXEC) {
int retval;
- if (handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
+ }
retval = handler->op->type->exec(C, handler->op);
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
- if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+ if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
wm->op_undo_depth--;
+ }
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0) {
- if (handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO) {
ED_undo_push_op(C, handler->op);
- else if (handler->op->type->flag & OPTYPE_UNDO_GROUPED)
+ }
+ else if (handler->op->type->flag & OPTYPE_UNDO_GROUPED) {
ED_undo_grouped_push_op(C, handler->op);
+ }
}
if (handler->op->reports->list.first) {
@@ -2295,8 +2344,9 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
- if (win_prev == NULL)
+ if (win_prev == NULL) {
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+ }
BKE_report_print_level_set(handler->op->reports, RPT_WARNING);
UI_popup_menu_reports(C, handler->op->reports);
@@ -2326,13 +2376,15 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
}
else {
if (handler->op->type->cancel) {
- if (handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
+ }
handler->op->type->cancel(C, handler->op);
- if (handler->op->type->flag & OPTYPE_UNDO)
+ if (handler->op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth--;
+ }
}
WM_operator_free(handler->op);
@@ -2355,10 +2407,12 @@ static int wm_handler_fileselect_call(
{
int action = WM_HANDLER_CONTINUE;
- if (event->type != EVT_FILESELECT)
+ if (event->type != EVT_FILESELECT) {
return action;
- if (handler->op != (wmOperator *)event->customdata)
+ }
+ if (handler->op != (wmOperator *)event->customdata) {
return action;
+ }
return wm_handler_fileselect_do(C, handlers, handler, event->val);
}
@@ -2370,20 +2424,26 @@ static bool handler_boundbox_test(wmEventHandler *handler, const wmEvent *event)
rcti rect = *handler->bblocal;
BLI_rcti_translate(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
- if (BLI_rcti_isect_pt_v(&rect, &event->x))
+ if (BLI_rcti_isect_pt_v(&rect, &event->x)) {
return 1;
- else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(&rect, &event->prevx))
+ }
+ else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(&rect, &event->prevx)) {
return 1;
- else
+ }
+ else {
return 0;
+ }
}
else {
- if (BLI_rcti_isect_pt_v(handler->bbwin, &event->x))
+ if (BLI_rcti_isect_pt_v(handler->bbwin, &event->x)) {
return 1;
- else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(handler->bbwin, &event->prevx))
+ }
+ else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(handler->bbwin, &event->prevx)) {
return 1;
- else
+ }
+ else {
return 0;
+ }
}
}
return 1;
@@ -2525,8 +2585,9 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
event->custom = 0;
/* XXX fileread case */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return action;
+ }
/* escape from drag loop, got freed */
break;
@@ -2682,10 +2743,12 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
if (action & WM_HANDLER_BREAK) {
- if (always_pass)
+ if (always_pass) {
action &= ~WM_HANDLER_BREAK;
- else
+ }
+ else {
break;
+ }
}
}
@@ -2706,8 +2769,9 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
}
- if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL))
+ if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL)) {
wm_cursor_arrow_move(CTX_wm_window(C), event);
+ }
#undef PRINT
@@ -2720,8 +2784,9 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
int action = wm_handlers_do_intern(C, event, handlers);
/* fileread case */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return action;
+ }
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
@@ -2839,10 +2904,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
static int wm_event_inside_i(wmEvent *event, rcti *rect)
{
- if (wm_event_always_pass(event))
+ if (wm_event_always_pass(event)) {
return 1;
- if (BLI_rcti_isect_pt_v(rect, &event->x))
+ }
+ if (BLI_rcti_isect_pt_v(rect, &event->x)) {
return 1;
+ }
return 0;
}
@@ -2853,8 +2920,9 @@ static ScrArea *area_event_inside(bContext *C, const int xy[2])
if (screen) {
ED_screen_areas_iter(win, screen, sa) {
- if (BLI_rcti_isect_pt_v(&sa->totrct, xy))
+ if (BLI_rcti_isect_pt_v(&sa->totrct, xy)) {
return sa;
+ }
}
}
return NULL;
@@ -2866,10 +2934,13 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
ScrArea *area = CTX_wm_area(C);
ARegion *ar;
- if (screen && area)
- for (ar = area->regionbase.first; ar; ar = ar->next)
- if (BLI_rcti_isect_pt_v(&ar->winrct, xy))
+ if (screen && area) {
+ for (ar = area->regionbase.first; ar; ar = ar->next) {
+ if (BLI_rcti_isect_pt_v(&ar->winrct, xy)) {
return ar;
+ }
+ }
+ }
return NULL;
}
@@ -2894,8 +2965,9 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event)
if (wm->paintcursors.first) {
ARegion *ar = CTX_wm_region(C);
- if (ar)
+ if (ar) {
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
+ }
/* if previous position was not in current region, we have to set a temp new context */
if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) {
@@ -2933,8 +3005,9 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
/* create customdata, first free existing */
if (event->customdata) {
- if (event->customdatafree)
+ if (event->customdatafree) {
MEM_freeN(event->customdata);
+ }
}
event->custom = EVT_DATA_DRAGDROP;
@@ -2986,8 +3059,9 @@ void wm_event_do_handlers(bContext *C)
BLI_assert(WM_window_get_active_screen(win));
BLI_assert(WM_window_get_active_workspace(win));
- if (screen == NULL)
+ if (screen == NULL) {
wm_event_free_all(win);
+ }
else {
Scene *scene = WM_window_get_active_scene(win);
@@ -3071,8 +3145,9 @@ void wm_event_do_handlers(bContext *C)
action |= wm_handlers_do(C, event, &win->modalhandlers);
/* fileread case */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return;
+ }
/* check for a tooltip */
if (screen == WM_window_get_active_screen(win)) {
@@ -3141,11 +3216,13 @@ void wm_event_do_handlers(bContext *C)
action |= wm_handlers_do(C, event, &ar->handlers);
/* fileread case (python), [#29489] */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return;
+ }
- if (action & WM_HANDLER_BREAK)
+ if (action & WM_HANDLER_BREAK) {
break;
+ }
}
}
}
@@ -3172,8 +3249,9 @@ void wm_event_do_handlers(bContext *C)
action |= wm_handlers_do(C, event, &win->handlers);
/* fileread case */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return;
+ }
}
}
@@ -3652,8 +3730,9 @@ bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
* some items (i.e. markers) being tweaked may end up getting
* dropped all over
*/
- if (event->val != KM_RELEASE)
+ if (event->val != KM_RELEASE) {
return 1;
+ }
}
return 0;
@@ -3935,8 +4014,9 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
{
int mx = event->x, my = event->y;
- if (wm->windows.first == wm->windows.last)
+ if (wm->windows.first == wm->windows.last) {
return NULL;
+ }
/* in order to use window size and mouse position (pixels), we have to use a WM function */
@@ -4004,8 +4084,9 @@ static wmEvent *wm_event_add_mousemove(wmWindow *win, const wmEvent *event)
/* some painting operators want accurate mouse events, they can
* handle in between mouse move moves, others can happily ignore
* them for better performance */
- if (event_last && event_last->type == MOUSEMOVE)
+ if (event_last && event_last->type == MOUSEMOVE) {
event_last->type = INBETWEEN_MOUSEMOVE;
+ }
wmEvent *event_new = wm_event_add(win, event);
if (event_last == NULL) {
@@ -4110,20 +4191,27 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* get value and type from ghost */
event.val = (type == GHOST_kEventButtonDown) ? KM_PRESS : KM_RELEASE;
- if (bd->button == GHOST_kButtonMaskLeft)
+ if (bd->button == GHOST_kButtonMaskLeft) {
event.type = LEFTMOUSE;
- else if (bd->button == GHOST_kButtonMaskRight)
+ }
+ else if (bd->button == GHOST_kButtonMaskRight) {
event.type = RIGHTMOUSE;
- else if (bd->button == GHOST_kButtonMaskButton4)
+ }
+ else if (bd->button == GHOST_kButtonMaskButton4) {
event.type = BUTTON4MOUSE;
- else if (bd->button == GHOST_kButtonMaskButton5)
+ }
+ else if (bd->button == GHOST_kButtonMaskButton5) {
event.type = BUTTON5MOUSE;
- else if (bd->button == GHOST_kButtonMaskButton6)
+ }
+ else if (bd->button == GHOST_kButtonMaskButton6) {
event.type = BUTTON6MOUSE;
- else if (bd->button == GHOST_kButtonMaskButton7)
+ }
+ else if (bd->button == GHOST_kButtonMaskButton7) {
event.type = BUTTON7MOUSE;
- else
+ }
+ else {
event.type = MIDDLEMOUSE;
+ }
wm_eventemulation(&event, false);
@@ -4206,10 +4294,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.utf8_buf[0] = '\0';
}
else {
- if (event.ascii < 32 && event.ascii > 0)
+ if (event.ascii < 32 && event.ascii > 0) {
event.ascii = '\0';
- if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0)
+ }
+ if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0) {
event.utf8_buf[0] = '\0';
+ }
}
if (event.utf8_buf[0]) {
@@ -4226,39 +4316,58 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
case LEFTSHIFTKEY:
case RIGHTSHIFTKEY:
if (event.val == KM_PRESS) {
- if (evt->ctrl || evt->alt || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
- else keymodifier = KM_MOD_FIRST;
+ if (evt->ctrl || evt->alt || evt->oskey) {
+ keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
+ }
+ else {
+ keymodifier = KM_MOD_FIRST;
+ }
}
event.shift = evt->shift = keymodifier;
break;
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
if (event.val == KM_PRESS) {
- if (evt->shift || evt->alt || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
- else keymodifier = KM_MOD_FIRST;
+ if (evt->shift || evt->alt || evt->oskey) {
+ keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
+ }
+ else {
+ keymodifier = KM_MOD_FIRST;
+ }
}
event.ctrl = evt->ctrl = keymodifier;
break;
case LEFTALTKEY:
case RIGHTALTKEY:
if (event.val == KM_PRESS) {
- if (evt->ctrl || evt->shift || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
- else keymodifier = KM_MOD_FIRST;
+ if (evt->ctrl || evt->shift || evt->oskey) {
+ keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
+ }
+ else {
+ keymodifier = KM_MOD_FIRST;
+ }
}
event.alt = evt->alt = keymodifier;
break;
case OSKEY:
if (event.val == KM_PRESS) {
- if (evt->ctrl || evt->alt || evt->shift) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
- else keymodifier = KM_MOD_FIRST;
+ if (evt->ctrl || evt->alt || evt->shift) {
+ keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
+ }
+ else {
+ keymodifier = KM_MOD_FIRST;
+ }
}
event.oskey = evt->oskey = keymodifier;
break;
default:
- if (event.val == KM_PRESS && event.keymodifier == 0)
- evt->keymodifier = event.type; /* only set in eventstate, for next event */
- else if (event.val == KM_RELEASE && event.keymodifier == event.type)
+ if (event.val == KM_PRESS && event.keymodifier == 0) {
+ /* Only set in eventstate, for next event. */
+ evt->keymodifier = event.type;
+ }
+ else if (event.val == KM_RELEASE && event.keymodifier == event.type) {
event.keymodifier = evt->keymodifier = 0;
+ }
break;
}
@@ -4271,8 +4380,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* this case happens on holding a key pressed, it should not generate
* press events events with the same key as modifier */
- if (event.keymodifier == event.type)
+ if (event.keymodifier == event.type) {
event.keymodifier = 0;
+ }
/* this case happens with an external numpad, and also when using 'dead keys' (to compose complex latin
* characters e.g.), it's not really clear why.
@@ -4308,10 +4418,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
{
GHOST_TEventWheelData *wheelData = customdata;
- if (wheelData->z > 0)
+ if (wheelData->z > 0) {
event.type = WHEELUPMOUSE;
- else
+ }
+ else {
event.type = WHEELDOWNMOUSE;
+ }
event.val = KM_PRESS;
wm_event_add(win, &event);
@@ -4488,8 +4600,9 @@ float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
int erasor = 0;
float pressure = 1;
- if (tilt)
+ if (tilt) {
zero_v2(tilt);
+ }
if (event->tablet_data) {
const wmTabletData *wmtab = event->tablet_data;
@@ -4504,8 +4617,9 @@ float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
}
}
- if (pen_flip)
+ if (pen_flip) {
(*pen_flip) = erasor;
+ }
return pressure;
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 0b990be3eec..abea0571a2c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -194,8 +194,11 @@ static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm
wm->windrawable = win;
}
- if (!G.background) /* file loading in background mode still calls this */
- GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
+ /* File loading in background mode still calls this. */
+ if (!G.background) {
+ /* Pointer back. */
+ GHOST_SetWindowUserData(win->ghostwin, win);
+ }
oldwin->ghostwin = NULL;
oldwin->gpuctx = NULL;
@@ -405,7 +408,11 @@ static int wm_read_exotic(const char *name)
retval = BKE_READ_EXOTIC_OK_BLEND;
}
else {
-#if 0 /* historic stuff - no longer used */
+ /* We may want to support loading other file formats
+ * from their header bytes or file extension.
+ * This used to be supported in the code below and may be added
+ * back at some point. */
+#if 0
WM_cursor_wait(true);
if (is_foo_format(name)) {
@@ -892,8 +899,9 @@ void wm_homefile_read(
NULL) != BKE_BLENDFILE_READ_FAIL;
}
if (BLI_listbase_is_empty(&U.themes)) {
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\nNote: No (valid) '%s' found, fall back to built-in default.\n\n", filepath_startup);
+ }
success = false;
}
if (success) {
@@ -1024,7 +1032,9 @@ void wm_history_file_read(void)
int num;
const char * const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
- if (!cfgdir) return;
+ if (!cfgdir) {
+ return;
+ }
BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
@@ -1078,8 +1088,9 @@ static void wm_history_file_write(void)
/* will be NULL in background mode */
user_config_dir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL);
- if (!user_config_dir)
+ if (!user_config_dir) {
return;
+ }
BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE);
@@ -1157,8 +1168,9 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
}
/* scene can be NULL if running a script at startup and calling the save operator */
- if (G.background || scene == NULL)
+ if (G.background || scene == NULL) {
return NULL;
+ }
if ((scene->camera == NULL) && (screen != NULL)) {
sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0);
@@ -1389,8 +1401,9 @@ void WM_autosave_init(wmWindowManager *wm)
{
wm_autosave_timer_ended(wm);
- if (U.flag & USER_AUTOSAVE)
+ if (U.flag & USER_AUTOSAVE) {
wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
+ }
}
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
@@ -1457,8 +1470,12 @@ void wm_autosave_delete(void)
BLI_make_file_string("/", str, BKE_tempdir_base(), BLENDER_QUIT_FILE);
/* if global undo; remove tempsave, otherwise rename */
- if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, false, false);
- else BLI_rename(filename, str);
+ if (U.uiflag & USER_GLOBALUNDO) {
+ BLI_delete(filename, false, false);
+ }
+ else {
+ BLI_rename(filename, str);
+ }
}
}
@@ -1543,8 +1560,9 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op)
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
/* check current window and close it if temp */
- if (win && WM_window_is_temp_screen(win))
+ if (win && WM_window_is_temp_screen(win)) {
wm_window_close(C, wm, win);
+ }
/* update keymaps in user preferences */
WM_keyconfig_update(wm);
@@ -1913,15 +1931,19 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
wm_open_init_load_ui(op, false);
wm_open_init_use_scripts(op, false);
- if (RNA_boolean_get(op->ptr, "load_ui"))
+ if (RNA_boolean_get(op->ptr, "load_ui")) {
G.fileflags &= ~G_FILE_NO_UI;
- else
+ }
+ else {
G.fileflags |= G_FILE_NO_UI;
+ }
- if (RNA_boolean_get(op->ptr, "use_scripts"))
+ if (RNA_boolean_get(op->ptr, "use_scripts")) {
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
- else
+ }
+ else {
G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
+ }
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
@@ -1948,7 +1970,9 @@ static bool wm_open_mainfile_check(bContext *UNUSED(C), wmOperator *op)
/* get the dir */
lslash = (char *)BLI_last_slash(path);
- if (lslash) *(lslash + 1) = '\0';
+ if (lslash) {
+ *(lslash + 1) = '\0';
+ }
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) {
if (BKE_autoexec_match(path) == true) {
@@ -2021,10 +2045,12 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
wm_open_init_use_scripts(op, false);
- if (RNA_boolean_get(op->ptr, "use_scripts"))
+ if (RNA_boolean_get(op->ptr, "use_scripts")) {
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
- else
+ }
+ else {
G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
+ }
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
@@ -2310,8 +2336,9 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
int ret;
/* cancel if no active window */
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return OPERATOR_CANCELLED;
+ }
save_set_compress(op);
save_set_filepath(C, op);
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 3b27d2199b6..56dfe4a327d 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -85,8 +85,9 @@ static bool wm_link_append_poll(bContext *C)
* but which totally confuses edit mode (i.e. it becoming not so obvious
* 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))
+ if (CTX_data_edit_object(C)) {
return 0;
+ }
return 1;
}
@@ -117,16 +118,21 @@ static short wm_link_append_flag(wmOperator *op)
PropertyRNA *prop;
short flag = 0;
- if (RNA_boolean_get(op->ptr, "autoselect"))
+ if (RNA_boolean_get(op->ptr, "autoselect")) {
flag |= FILE_AUTOSELECT;
- if (RNA_boolean_get(op->ptr, "active_collection"))
+ }
+ if (RNA_boolean_get(op->ptr, "active_collection")) {
flag |= FILE_ACTIVE_COLLECTION;
- if ((prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop))
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop)) {
flag |= FILE_RELPATH;
- if (RNA_boolean_get(op->ptr, "link"))
+ }
+ if (RNA_boolean_get(op->ptr, "link")) {
flag |= FILE_LINK;
- if (RNA_boolean_get(op->ptr, "instance_collections"))
+ }
+ if (RNA_boolean_get(op->ptr, "instance_collections")) {
flag |= FILE_GROUP_INSTANCE;
+ }
return flag;
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 013ee029200..7e95f36b2db 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -98,8 +98,9 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
{
wmWindow *win = CTX_wm_window(C);
- if (win->tweak == gesture)
+ if (win->tweak == gesture) {
win->tweak = NULL;
+ }
BLI_remlink(&win->gesture, gesture);
MEM_freeN(gesture->customdata);
if (gesture->userdata && gesture->userdata_free) {
@@ -112,8 +113,9 @@ void WM_gestures_remove(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- while (win->gesture.first)
+ while (win->gesture.first) {
WM_gesture_end(C, win->gesture.first);
+ }
}
bool WM_gesture_is_modal_first(const wmGesture *gesture)
@@ -136,13 +138,27 @@ int wm_gesture_evaluate(wmGesture *gesture)
int theta = round_fl_to_int(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI);
int val = EVT_GESTURE_W;
- if (theta == 0) val = EVT_GESTURE_E;
- else if (theta == 1) val = EVT_GESTURE_NE;
- else if (theta == 2) val = EVT_GESTURE_N;
- else if (theta == 3) val = EVT_GESTURE_NW;
- else if (theta == -1) val = EVT_GESTURE_SE;
- else if (theta == -2) val = EVT_GESTURE_S;
- else if (theta == -3) val = EVT_GESTURE_SW;
+ if (theta == 0) {
+ val = EVT_GESTURE_E;
+ }
+ else if (theta == 1) {
+ val = EVT_GESTURE_NE;
+ }
+ else if (theta == 2) {
+ val = EVT_GESTURE_N;
+ }
+ else if (theta == 3) {
+ val = EVT_GESTURE_NW;
+ }
+ else if (theta == -1) {
+ val = EVT_GESTURE_SE;
+ }
+ else if (theta == -2) {
+ val = EVT_GESTURE_S;
+ }
+ else if (theta == -3) {
+ val = EVT_GESTURE_SW;
+ }
#if 0
/* debug */
@@ -424,12 +440,14 @@ void wm_gesture_draw(wmWindow *win)
/* all in subwindow space */
wmViewport(&gt->winrct);
- if (gt->type == WM_GESTURE_RECT)
+ if (gt->type == WM_GESTURE_RECT) {
wm_gesture_draw_rect(gt);
+ }
// else if (gt->type == WM_GESTURE_TWEAK)
// wm_gesture_draw_line(gt);
- else if (gt->type == WM_GESTURE_CIRCLE)
+ else if (gt->type == WM_GESTURE_CIRCLE) {
wm_gesture_draw_circle(gt);
+ }
else if (gt->type == WM_GESTURE_CROSS_RECT) {
if (gt->is_active) {
wm_gesture_draw_rect(gt);
@@ -438,12 +456,15 @@ void wm_gesture_draw(wmWindow *win)
wm_gesture_draw_cross(win, gt);
}
}
- else if (gt->type == WM_GESTURE_LINES)
+ else if (gt->type == WM_GESTURE_LINES) {
wm_gesture_draw_lasso(gt, false);
- else if (gt->type == WM_GESTURE_LASSO)
+ }
+ else if (gt->type == WM_GESTURE_LASSO) {
wm_gesture_draw_lasso(gt, true);
- else if (gt->type == WM_GESTURE_STRAIGHTLINE)
+ }
+ else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
wm_gesture_draw_line(gt);
+ }
}
}
@@ -451,6 +472,7 @@ void wm_gesture_tag_redraw(bContext *C)
{
bScreen *screen = CTX_wm_screen(C);
- if (screen)
+ if (screen) {
screen->do_draw_gesture = true;
+ }
}
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index 030cf15adfb..98e17f77a17 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -136,9 +136,9 @@ static bool gesture_box_apply_rect(wmOperator *op)
wmGesture *gesture = op->customdata;
rcti *rect = gesture->customdata;
- if (rect->xmin == rect->xmax || rect->ymin == rect->ymax)
+ if (rect->xmin == rect->xmax || rect->ymin == rect->ymax) {
return 0;
-
+ }
/* operator arguments and storage. */
RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax));
@@ -353,11 +353,15 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->val) {
case GESTURE_MODAL_CIRCLE_SIZE:
fac = 0.3f * (event->y - event->prevy);
- if (fac > 0)
+ if (fac > 0) {
rect->xmax += ceil(fac);
- else
+ }
+ else {
rect->xmax += floor(fac);
- if (rect->xmax < 1) rect->xmax = 1;
+ }
+ if (rect->xmax < 1) {
+ rect->xmax = 1;
+ }
is_circle_size = true;
break;
case GESTURE_MODAL_CIRCLE_ADD:
@@ -366,7 +370,9 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
break;
case GESTURE_MODAL_CIRCLE_SUB:
rect->xmax -= 2 + rect->xmax / 10;
- if (rect->xmax < 1) rect->xmax = 1;
+ if (rect->xmax < 1) {
+ rect->xmax = 1;
+ }
is_circle_size = true;
break;
case GESTURE_MODAL_SELECT:
@@ -478,12 +484,15 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
/* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */
tevent.x = rect->xmin + gesture->winrct.xmin;
tevent.y = rect->ymin + gesture->winrct.ymin;
- if (gesture->event_type == LEFTMOUSE)
+ if (gesture->event_type == LEFTMOUSE) {
tevent.type = EVT_TWEAK_L;
- else if (gesture->event_type == RIGHTMOUSE)
+ }
+ else if (gesture->event_type == RIGHTMOUSE) {
tevent.type = EVT_TWEAK_R;
- else
+ }
+ else {
tevent.type = EVT_TWEAK_M;
+ }
tevent.val = val;
/* mouse coords! */
@@ -535,8 +544,9 @@ void wm_tweakevent_test(bContext *C, const wmEvent *event, int action)
if ((action & WM_HANDLER_BREAK)) {
WM_gesture_end(C, win->tweak);
}
- else
+ else {
gesture_tweak_modal(C, event);
+ }
}
}
@@ -764,8 +774,9 @@ static bool gesture_straightline_apply(bContext *C, wmOperator *op)
wmGesture *gesture = op->customdata;
rcti *rect = gesture->customdata;
- if (rect->xmin == rect->xmax && rect->ymin == rect->ymax)
+ if (rect->xmin == rect->xmax && rect->ymin == rect->ymax) {
return 0;
+ }
/* operator arguments and storage. */
RNA_int_set(op->ptr, "xstart", rect->xmin);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 136d4e00d91..f39cb7d7cb2 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -292,8 +292,9 @@ void WM_init(bContext *C, int argc, const char **argv)
(void)argv; /* unused */
#endif
- if (!G.background && !wm_start_with_console)
+ if (!G.background && !wm_start_with_console) {
GHOST_toggleConsole(3);
+ }
clear_matcopybuf();
ED_render_clear_mtex_copybuf();
@@ -362,8 +363,9 @@ static void free_openrecent(void)
{
struct RecentFile *recent;
- for (recent = G.recent_files.first; recent; recent = recent->next)
+ for (recent = G.recent_files.first; recent; recent = recent->next) {
MEM_freeN(recent->filepath);
+ }
BLI_freelistN(&(G.recent_files));
}
@@ -401,7 +403,7 @@ static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata)
}
/**
- * Cause a delayed WM_exit() call to avoid leaking memory when trying to exit from within operators.
+ * Cause a delayed #WM_exit() call to avoid leaking memory when trying to exit from within operators.
*/
void wm_exit_schedule_delayed(const bContext *C)
{
@@ -490,8 +492,10 @@ void WM_exit_ext(bContext *C, const bool do_python)
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
- if (C && wm)
- wm_free_reports(C); /* before BKE_blender_free! - since the ListBases get freed there */
+ if (C && wm) {
+ /* Before BKE_blender_free! - since the ListBases get freed there. */
+ wm_free_reports(C);
+ }
BKE_sequencer_free_clipboard(); /* sequencer.c */
BKE_tracking_clipboard_free();
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 3d70fd03845..a1ebc29802f 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -146,19 +146,25 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
wmJob *wm_job;
if (owner && job_type) {
- for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
- if (wm_job->owner == owner && wm_job->job_type == job_type)
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->owner == owner && wm_job->job_type == job_type) {
return wm_job;
+ }
+ }
}
else if (owner) {
- for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
- if (wm_job->owner == owner)
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->owner == owner) {
return wm_job;
+ }
+ }
}
else if (job_type) {
- for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
- if (wm_job->job_type == job_type)
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->job_type == job_type) {
return wm_job;
+ }
+ }
}
return NULL;
@@ -220,8 +226,9 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
- if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
+ if (wm_job && wm_job->flag & WM_JOB_PROGRESS) {
return wm_job->progress;
+ }
return 0.0;
}
@@ -246,14 +253,16 @@ static void wm_jobs_update_progress_bars(wmWindowManager *wm)
wmWindow *win;
float progress = total_progress / (float)jobs_progress;
- for (win = wm->windows.first; win; win = win->next)
+ for (win = wm->windows.first; win; win = win->next) {
WM_progress_set(win, progress);
+ }
}
else {
wmWindow *win;
- for (win = wm->windows.first; win; win = win->next)
+ for (win = wm->windows.first; win; win = win->next) {
WM_progress_clear(win);
+ }
}
}
@@ -263,8 +272,9 @@ double WM_jobs_starttime(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
- if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
+ if (wm_job && wm_job->flag & WM_JOB_PROGRESS) {
return wm_job->start_time;
+ }
return 0;
}
@@ -273,8 +283,9 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
- if (wm_job)
+ if (wm_job) {
return wm_job->name;
+ }
return NULL;
}
@@ -283,8 +294,9 @@ void *WM_jobs_customdata(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
- if (wm_job)
+ if (wm_job) {
return WM_jobs_customdata_get(wm_job);
+ }
return NULL;
}
@@ -293,8 +305,9 @@ void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type)
{
wmJob *wm_job = wm_job_find(wm, NULL, job_type);
- if (wm_job)
+ if (wm_job) {
return WM_jobs_customdata_get(wm_job);
+ }
return NULL;
}
@@ -323,8 +336,9 @@ void *WM_jobs_customdata_get(wmJob *wm_job)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void *))
{
/* pending job? just free */
- if (wm_job->customdata)
+ if (wm_job->customdata) {
wm_job->free(wm_job->customdata);
+ }
wm_job->customdata = customdata;
wm_job->free = free;
@@ -385,14 +399,18 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
}
/* if new job is not render, then check for same startjob */
- if (0 == (test->flag & WM_JOB_EXCL_RENDER))
- if (wm_job->startjob != test->startjob)
+ if (0 == (test->flag & WM_JOB_EXCL_RENDER)) {
+ if (wm_job->startjob != test->startjob) {
continue;
+ }
+ }
/* if new job is render, any render job should be stopped */
- if (test->flag & WM_JOB_EXCL_RENDER)
- if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER))
+ if (test->flag & WM_JOB_EXCL_RENDER) {
+ if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER)) {
continue;
+ }
+ }
suspend = true;
@@ -434,8 +452,9 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
wm_job->customdata = NULL;
wm_job->running = true;
- if (wm_job->initjob)
+ if (wm_job->initjob) {
wm_job->initjob(wm_job->run_customdata);
+ }
wm_job->stop = false;
wm_job->ready = false;
@@ -448,8 +467,9 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
}
/* restarted job has timer already */
- if (wm_job->wt == NULL)
+ if (wm_job->wt == NULL) {
wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
+ }
wm_job->start_time = PIL_check_seconds_timer();
}
@@ -480,16 +500,20 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
- if (wm_job->endjob)
+ if (wm_job->endjob) {
wm_job->endjob(wm_job->run_customdata);
+ }
}
- if (wm_job->wt)
+ if (wm_job->wt) {
WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
- if (wm_job->customdata)
+ }
+ if (wm_job->customdata) {
wm_job->free(wm_job->customdata);
- if (wm_job->run_customdata)
+ }
+ if (wm_job->run_customdata) {
wm_job->run_free(wm_job->run_customdata);
+ }
/* remove wm_job */
wm_job_free(wm, wm_job);
@@ -505,8 +529,9 @@ void WM_jobs_kill_all(wmWindowManager *wm)
{
wmJob *wm_job;
- while ((wm_job = wm->jobs.first))
+ while ((wm_job = wm->jobs.first)) {
wm_jobs_kill_job(wm, wm_job);
+ }
}
@@ -518,8 +543,9 @@ void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
next_job = wm_job->next;
- if (wm_job->owner != owner)
+ if (wm_job->owner != owner) {
wm_jobs_kill_job(wm, wm_job);
+ }
}
}
@@ -531,9 +557,11 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
next_job = wm_job->next;
- if (!owner || wm_job->owner == owner)
- if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type)
+ if (!owner || wm_job->owner == owner) {
+ if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type) {
wm_jobs_kill_job(wm, wm_job);
+ }
+ }
}
}
@@ -601,19 +629,23 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
/* always call note and update when ready */
if (wm_job->do_update || wm_job->ready) {
- if (wm_job->update)
+ if (wm_job->update) {
wm_job->update(wm_job->run_customdata);
- if (wm_job->note)
+ }
+ if (wm_job->note) {
WM_event_add_notifier(C, wm_job->note, NULL);
+ }
- if (wm_job->flag & WM_JOB_PROGRESS)
+ if (wm_job->flag & WM_JOB_PROGRESS) {
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
+ }
wm_job->do_update = false;
}
if (wm_job->ready) {
- if (wm_job->endjob)
+ if (wm_job->endjob) {
wm_job->endjob(wm_job->run_customdata);
+ }
/* free own data */
wm_job->run_free(wm_job->run_customdata);
@@ -634,8 +666,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
- if (wm_job->endnote)
+ if (wm_job->endnote) {
WM_event_add_notifier(C, wm_job->endnote, NULL);
+ }
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 16e4913a206..ba9accb5dee 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -152,10 +152,12 @@ static void wm_keyconfig_properties_update_ot(ListBase *km_lb)
}
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
- if (kmdi->add_item)
+ if (kmdi->add_item) {
wm_keymap_item_properties_update_ot(kmdi->add_item);
- if (kmdi->remove_item)
+ }
+ if (kmdi->remove_item) {
wm_keymap_item_properties_update_ot(kmdi->remove_item);
+ }
}
}
}
@@ -232,10 +234,12 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
kmdin->next = kmdin->prev = NULL;
- if (kmdi->add_item)
+ if (kmdi->add_item) {
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
- if (kmdi->remove_item)
+ }
+ if (kmdi->remove_item) {
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
+ }
return kmdin;
}
@@ -331,8 +335,9 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
/* first try from preset */
keyconf = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
- if (keyconf)
+ if (keyconf) {
return keyconf;
+ }
/* otherwise use default */
return wm->defaultconf;
@@ -401,11 +406,13 @@ void WM_keymap_clear(wmKeyMap *keymap)
wmKeyMapItem *kmi;
wmKeyMapDiffItem *kmdi;
- for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next)
+ for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next) {
wm_keymap_diff_item_free(kmdi);
+ }
- for (kmi = keymap->items.first; kmi; kmi = kmi->next)
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
wm_keymap_item_free(kmi);
+ }
BLI_freelistN(&keymap->diff_items);
BLI_freelistN(&keymap->items);
@@ -437,6 +444,12 @@ bool WM_keymap_poll(bContext *C, wmKeyMap *keymap)
}
}
+ if (UNLIKELY(BLI_listbase_is_empty(&keymap->items))) {
+ /* Empty key-maps may be missing more there may be a typo in the name.
+ * Warn early to avoid loosing time investigating each case. */
+ CLOG_WARN(WM_LOG_KEYMAPS, "empty keymap '%s'", keymap->idname);
+ }
+
if (keymap->poll != NULL) {
return keymap->poll(C);
}
@@ -476,9 +489,11 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
{
wmKeyMapItem *kmi;
- for (kmi = keymap->items.first; kmi; kmi = kmi->next)
- if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME))
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME)) {
break;
+ }
+ }
if (kmi == NULL) {
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
@@ -563,9 +578,11 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
{
wmKeyMapItem *kmi;
- for (kmi = km->items.first; kmi; kmi = kmi->next)
- if (wm_keymap_item_equals(kmi, needle))
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
+ if (wm_keymap_item_equals(kmi, needle)) {
return kmi;
+ }
+ }
return NULL;
}
@@ -574,9 +591,11 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
{
wmKeyMapItem *kmi;
- for (kmi = km->items.first; kmi; kmi = kmi->next)
- if (wm_keymap_item_equals_result(kmi, needle))
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
+ if (wm_keymap_item_equals_result(kmi, needle)) {
return kmi;
+ }
+ }
return NULL;
}
@@ -607,8 +626,9 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
if (to_kmi) {
orig_kmi = WM_keymap_item_find_id(orig_km, kmi->id);
- if (!orig_kmi && addon_km)
+ if (!orig_kmi && addon_km) {
orig_kmi = wm_keymap_find_item_equals(addon_km, kmi);
+ }
if (orig_kmi) {
orig_kmi->flag &= ~KMI_EXPANDED;
@@ -637,8 +657,9 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
kmi_remove = NULL;
if (kmdi->remove_item) {
kmi_remove = wm_keymap_find_item_equals(km, kmdi->remove_item);
- if (!kmi_remove)
+ if (!kmi_remove) {
kmi_remove = wm_keymap_find_item_equals_result(km, kmdi->remove_item);
+ }
}
/* add item */
@@ -711,32 +732,39 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
/* try to find corresponding id's for items */
for (kmi = km->items.first; kmi; kmi = kmi->next) {
orig_kmi = wm_keymap_find_item_equals(defaultmap, kmi);
- if (!orig_kmi)
+ if (!orig_kmi) {
orig_kmi = wm_keymap_find_item_equals_result(defaultmap, kmi);
+ }
- if (orig_kmi)
+ if (orig_kmi) {
kmi->id = orig_kmi->id;
- else
+ }
+ else {
kmi->id = -(km->kmi_id++);
+ }
}
km->flag |= KEYMAP_UPDATE; /* update again to create diff */
}
- else
+ else {
km = wm_keymap_copy(defaultmap);
+ }
/* add addon keymap items */
- if (addonmap)
+ if (addonmap) {
wm_keymap_addon_add(km, addonmap);
+ }
/* tag as being user edited */
- if (usermap)
+ if (usermap) {
km->flag |= KEYMAP_USER_MODIFIED;
+ }
km->flag |= KEYMAP_USER | expanded;
/* apply user changes of diff keymap */
- if (usermap && (usermap->flag & KEYMAP_DIFF))
+ if (usermap && (usermap->flag & KEYMAP_DIFF)) {
wm_keymap_patch(km, usermap);
+ }
/* add to list */
BLI_addtail(lb, km);
@@ -766,8 +794,9 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
/* create diff keymap */
diffmap = wm_keymap_new(km->idname, km->spaceid, km->regionid);
diffmap->flag |= KEYMAP_DIFF;
- if (defaultmap->flag & KEYMAP_MODAL)
+ if (defaultmap->flag & KEYMAP_MODAL) {
diffmap->flag |= KEYMAP_MODAL;
+ }
wm_keymap_diff(diffmap, defaultmap, km, origmap, addonmap);
/* add to list if not empty */
@@ -796,10 +825,13 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
{
wmKeyMap *km;
- for (km = lb->first; km; km = km->next)
- if (km->spaceid == spaceid && km->regionid == regionid)
- if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
+ for (km = lb->first; km; km = km->next) {
+ if (km->spaceid == spaceid && km->regionid == regionid) {
+ if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
return km;
+ }
+ }
+ }
return NULL;
}
@@ -808,10 +840,13 @@ wmKeyMap *WM_keymap_list_find_spaceid_or_empty(ListBase *lb, const char *idname,
{
wmKeyMap *km;
- for (km = lb->first; km; km = km->next)
- if (ELEM(km->spaceid, spaceid, SPACE_EMPTY) && km->regionid == regionid)
- if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
+ for (km = lb->first; km; km = km->next) {
+ if (ELEM(km->spaceid, spaceid, SPACE_EMPTY) && km->regionid == regionid) {
+ if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
return km;
+ }
+ }
+ }
return NULL;
}
@@ -876,10 +911,13 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
{
wmKeyMap *km;
- for (km = keyconf->keymaps.first; km; km = km->next)
- if (km->flag & KEYMAP_MODAL)
- if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
+ for (km = keyconf->keymaps.first; km; km = km->next) {
+ if (km->flag & KEYMAP_MODAL) {
+ if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
break;
+ }
+ }
+ }
return km;
}
@@ -966,8 +1004,9 @@ static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km)
defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
- if (!defaultkm)
+ if (!defaultkm) {
return;
+ }
km->modal_items = defaultkm->modal_items;
km->poll = defaultkm->poll;
@@ -976,8 +1015,9 @@ static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km)
if (km->modal_items) {
for (kmi = km->items.first; kmi; kmi = kmi->next) {
if (kmi->propvalue_str[0]) {
- if (RNA_enum_value_from_id(km->modal_items, kmi->propvalue_str, &propvalue))
+ if (RNA_enum_value_from_id(km->modal_items, kmi->propvalue_str, &propvalue)) {
kmi->propvalue = propvalue;
+ }
kmi->propvalue_str[0] = '\0';
}
}
@@ -1245,7 +1285,9 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
}
}
/* ensure un-initialized keymap is never used */
- if (r_keymap) *r_keymap = NULL;
+ if (r_keymap) {
+ *r_keymap = NULL;
+ }
return NULL;
}
@@ -1270,36 +1312,44 @@ static wmKeyMapItem *wm_keymap_item_find_props(
}
}
- if (sa && found == NULL)
+ if (sa && found == NULL) {
found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ }
if (found == NULL) {
if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
if (sa) {
- if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
+ if (!(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ }
- if (ar)
+ if (ar) {
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ }
}
}
else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
- if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
+ if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS)) {
ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+ }
- if (ar)
+ if (ar) {
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ }
}
else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
- if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
+ if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) {
ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ }
- if (ar)
+ if (ar) {
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ }
}
else {
- if (ar)
+ if (ar) {
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ }
}
}
@@ -1466,40 +1516,50 @@ bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
{
int k1type, k2type;
- if (k1->flag & KMI_INACTIVE || k2->flag & KMI_INACTIVE)
+ if (k1->flag & KMI_INACTIVE || k2->flag & KMI_INACTIVE) {
return 0;
+ }
/* take event mapping into account */
k1type = WM_userdef_event_map(k1->type);
k2type = WM_userdef_event_map(k2->type);
- if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
+ if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type) {
return 0;
+ }
if (k1->val != KM_ANY && k2->val != KM_ANY) {
/* take click, press, release conflict into account */
- if (k1->val == KM_CLICK && ELEM(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
+ if (k1->val == KM_CLICK && ELEM(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0) {
return 0;
- if (k2->val == KM_CLICK && ELEM(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
+ }
+ if (k2->val == KM_CLICK && ELEM(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0) {
return 0;
- if (k1->val != k2->val)
+ }
+ if (k1->val != k2->val) {
return 0;
+ }
}
- if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
+ if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift) {
return 0;
+ }
- if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
+ if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl) {
return 0;
+ }
- if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
+ if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt) {
return 0;
+ }
- if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
+ if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey) {
return 0;
+ }
- if (k1->keymodifier != k2->keymodifier)
+ if (k1->keymodifier != k2->keymodifier) {
return 0;
+ }
return 1;
}
@@ -1524,10 +1584,12 @@ void WM_keyconfig_update_tag(wmKeyMap *km, wmKeyMapItem *kmi)
/* quick tag to do delayed keymap updates */
wm_keymap_update_flag |= WM_KEYMAP_UPDATE_RECONFIGURE;
- if (km)
+ if (km) {
km->flag |= KEYMAP_UPDATE;
- if (kmi)
+ }
+ if (kmi) {
kmi->flag |= KMI_UPDATE;
+ }
}
void WM_keyconfig_update_operatortype(void)
@@ -1557,8 +1619,9 @@ static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
wmKeyMap *keymap;
keymap = WM_keymap_list_find(&keyconf->keymaps, km->idname, km->spaceid, km->regionid);
- if (!keymap && wm->defaultconf)
+ if (!keymap && wm->defaultconf) {
keymap = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, km->spaceid, km->regionid);
+ }
return keymap;
}
@@ -1570,11 +1633,13 @@ void WM_keyconfig_update(wmWindowManager *wm)
wmKeyMapDiffItem *kmdi;
bool compat_update = false;
- if (G.background)
+ if (G.background) {
return;
+ }
- if (wm_keymap_update_flag == 0)
+ if (wm_keymap_update_flag == 0) {
return;
+ }
if (wm_keymap_update_flag & WM_KEYMAP_UPDATE_OPERATORTYPE) {
/* an operatortype has been removed, this wont happen often
@@ -1603,22 +1668,25 @@ void WM_keyconfig_update(wmWindowManager *wm)
}
- if (wm_keymap_update_flag == 0)
+ if (wm_keymap_update_flag == 0) {
return;
-
+ }
/* update operator properties for non-modal user keymaps */
for (km = U.user_keymaps.first; km; km = km->next) {
if ((km->flag & KEYMAP_MODAL) == 0) {
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
- if (kmdi->add_item)
+ if (kmdi->add_item) {
wm_keymap_item_properties_set(kmdi->add_item);
- if (kmdi->remove_item)
+ }
+ if (kmdi->remove_item) {
wm_keymap_item_properties_set(kmdi->remove_item);
+ }
}
- for (kmi = km->items.first; kmi; kmi = kmi->next)
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
wm_keymap_item_properties_set(kmi);
+ }
}
}
@@ -1631,8 +1699,9 @@ void WM_keyconfig_update(wmWindowManager *wm)
addonmap = WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
/* diff */
- if (defaultmap)
+ if (defaultmap) {
wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km);
+ }
}
}
@@ -1678,14 +1747,16 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
{
wmKeyMap *km;
- if (!keymap)
+ if (!keymap) {
return NULL;
+ }
/* first user defined keymaps */
km = WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
- if (km)
+ if (km) {
return km;
+ }
return keymap;
}
@@ -1699,8 +1770,9 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
wmKeyMap *defaultmap, *addonmap;
wmKeyMapItem *orig;
- if (!keymap)
+ if (!keymap) {
return;
+ }
/* construct default keymap from preset + addons */
defaultmap = wm_keymap_preset(wm, keymap);
diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c
index 1c3e09dac29..7a5c0d4d2b8 100644
--- a/source/blender/windowmanager/intern/wm_keymap_utils.c
+++ b/source/blender/windowmanager/intern/wm_keymap_utils.c
@@ -207,10 +207,12 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
}
else if (STRPREFIX(opname, "OBJECT_OT")) {
/* exception, this needs to work outside object mode too */
- if (STRPREFIX(opname, "OBJECT_OT_mode_set"))
+ if (STRPREFIX(opname, "OBJECT_OT_mode_set")) {
km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
- else
+ }
+ else {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
}
/* Object mode related */
else if (STRPREFIX(opname, "GROUP_OT") ||
diff --git a/source/blender/windowmanager/intern/wm_menu_type.c b/source/blender/windowmanager/intern/wm_menu_type.c
index 76bd36885fd..f466ac44939 100644
--- a/source/blender/windowmanager/intern/wm_menu_type.c
+++ b/source/blender/windowmanager/intern/wm_menu_type.c
@@ -45,12 +45,14 @@ MenuType *WM_menutype_find(const char *idname, bool quiet)
if (idname[0]) {
mt = BLI_ghash_lookup(menutypes_hash, idname);
- if (mt)
+ if (mt) {
return mt;
+ }
}
- if (!quiet)
+ if (!quiet) {
printf("search for unknown menutype %s\n", idname);
+ }
return NULL;
}
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 820123621f7..0e4d8a7bf71 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -64,17 +64,21 @@ void WM_operator_properties_filesel(
{0, NULL, 0, NULL, NULL},
};
- if (flag & WM_FILESEL_FILEPATH)
+ if (flag & WM_FILESEL_FILEPATH) {
RNA_def_string_file_path(ot->srna, "filepath", NULL, FILE_MAX, "File Path", "Path to file");
+ }
- if (flag & WM_FILESEL_DIRECTORY)
+ if (flag & WM_FILESEL_DIRECTORY) {
RNA_def_string_dir_path(ot->srna, "directory", NULL, FILE_MAX, "Directory", "Directory of the file");
+ }
- if (flag & WM_FILESEL_FILENAME)
+ if (flag & WM_FILESEL_FILENAME) {
RNA_def_string_file_name(ot->srna, "filename", NULL, FILE_MAX, "File Name", "Name of the file");
+ }
- if (flag & WM_FILESEL_FILES)
+ if (flag & WM_FILESEL_FILES) {
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
+ }
if (action == FILE_SAVE) {
/* note, this is only used to check if we should highlight the filename area red when the
@@ -116,8 +120,9 @@ void WM_operator_properties_filesel(
FILE_LOADLIB, FILE_SPECIAL);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- if (flag & WM_FILESEL_RELPATH)
+ if (flag & WM_FILESEL_RELPATH) {
RNA_def_boolean(ot->srna, "relative_path", true, "Relative Path", "Select the file relative to the blend file");
+ }
if ((filter & FILE_TYPE_IMAGE) || (filter & FILE_TYPE_MOVIE)) {
prop = RNA_def_boolean(ot->srna, "show_multiview", 0, "Enable Multi-View", "");
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c
index 76586ee2a0b..606fb822e67 100644
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@ -158,8 +158,9 @@ void WM_operatortype_remove_ptr(wmOperatorType *ot)
MEM_freeN(ot->last_properties);
}
- if (ot->macro.first)
+ if (ot->macro.first) {
wm_operatortype_free_macro(ot);
+ }
BLI_ghash_remove(global_ops_hash, ot->idname, NULL, NULL);
@@ -172,8 +173,9 @@ bool WM_operatortype_remove(const char *idname)
{
wmOperatorType *ot = WM_operatortype_find(idname, 0);
- if (ot == NULL)
+ if (ot == NULL) {
return false;
+ }
WM_operatortype_remove_ptr(ot);
@@ -194,11 +196,14 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot)
MEM_freeN(ot->last_properties);
}
- if (ot->macro.first)
+ if (ot->macro.first) {
wm_operatortype_free_macro(ot);
+ }
- if (ot->ext.srna) /* python operator, allocs own string */
+ if (ot->ext.srna) {
+ /* python operator, allocs own string */
MEM_freeN((void *)ot->idname);
+ }
MEM_freeN(ot);
}
@@ -354,10 +359,12 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, const wmEvent *
/* start from operator received as argument */
for (; opm; opm = opm->next) {
- if (opm->type->invoke)
+ if (opm->type->invoke) {
retval = opm->type->invoke(C, opm, event);
- else if (opm->type->exec)
+ }
+ else if (opm->type->exec) {
retval = opm->type->exec(C, opm);
+ }
OPERATOR_RETVAL_CHECK(retval);
@@ -480,8 +487,10 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
ot->cancel = wm_macro_cancel;
ot->poll = NULL;
- if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
+ if (!ot->description) {
+ /* XXX All ops should have a description but for now allow them not to. */
ot->description = UNDOCUMENTED_OPERATOR_TIP;
+ }
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
@@ -509,8 +518,9 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *),
ot->cancel = wm_macro_cancel;
ot->poll = NULL;
- if (!ot->description)
+ if (!ot->description) {
ot->description = UNDOCUMENTED_OPERATOR_TIP;
+ }
/* Set the default i18n context now, so that opfunc can redefine it if needed! */
RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6e5f83eba47..1411b8af1fe 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -157,8 +157,9 @@ void WM_operator_bl_idname(char *to, const char *from)
BLI_strncpy(to, from, OP_MAX_TYPENAME);
}
}
- else
+ else {
to[0] = 0;
+ }
}
/**
@@ -550,10 +551,12 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
{
wmOperatorType *ot = WM_operatortype_find(opstring, false);
- if (ot)
+ if (ot) {
WM_operator_properties_create_ptr(ptr, ot);
- else
+ }
+ else {
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
+ }
}
/* similar to the function above except its uses ID properties
@@ -580,10 +583,12 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
{
switch (RNA_property_type(prop)) {
case PROP_ENUM:
- if (no_context)
+ if (no_context) {
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- else
+ }
+ else {
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
+ }
break;
case PROP_POINTER:
{
@@ -834,10 +839,12 @@ int WM_operator_confirm_message_ex(bContext *C, wmOperator *op,
uiLayout *layout;
IDProperty *properties = op->ptr->data;
- if (properties && properties->len)
+ if (properties && properties->len) {
properties = IDP_CopyProperty(op->ptr->data);
- else
+ }
+ else {
properties = NULL;
+ }
pup = UI_popup_menu_begin(C, title, icon);
layout = UI_popup_menu_layout(pup);
@@ -900,7 +907,9 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor
/* op->poll */
bool WM_operator_winactive(bContext *C)
{
- if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_window(C) == NULL) {
+ return 0;
+ }
return 1;
}
@@ -919,9 +928,11 @@ wmOperator *WM_operator_last_redo(const bContext *C)
wmOperator *op;
/* only for operators that are registered and did an undo push */
- for (op = wm->operators.last; op; op = op->prev)
- if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
+ for (op = wm->operators.last; op; op = op->prev) {
+ if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) {
break;
+ }
+ }
return op;
}
@@ -1020,8 +1031,9 @@ static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
wmOperator *op = arg_op;
/* if operator never got executed, free it */
- if (op != WM_operator_last_redo(C))
+ if (op != WM_operator_last_redo(C)) {
WM_operator_free(op);
+ }
}
static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
@@ -1046,17 +1058,20 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
UI_block_func_handle_set(block, wm_block_redo_cb, arg_op);
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style);
- if (op == WM_operator_last_redo(C))
- if (!WM_operator_check_ui_enabled(C, op->type->name))
+ if (op == WM_operator_last_redo(C)) {
+ if (!WM_operator_check_ui_enabled(C, op->type->name)) {
uiLayoutSetEnabled(layout, false);
+ }
+ }
if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) {
uiTemplateOperatorPropertyButs(
C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
- if (op->next)
+ if (op->next) {
uiItemS(layout);
+ }
}
}
else {
@@ -1211,8 +1226,9 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
wmOpPopUp *data = arg;
wmOperator *op = data->op;
- if (op && retval > 0)
+ if (op && retval > 0) {
WM_operator_call_ex(C, op, true);
+ }
MEM_freeN(data);
}
@@ -1251,13 +1267,15 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
/* if we don't have global undo, we can't do undo push for automatic redo,
* so we require manual OK clicking in this popup */
- if (!do_redo || !(U.uiflag & USER_GLOBALUNDO))
+ if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) {
return WM_operator_props_dialog_popup(C, op, 300, 20);
+ }
UI_popup_block_ex(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op, op);
- if (do_call)
+ if (do_call) {
wm_block_redo_cb(C, op, 0);
+ }
return OPERATOR_RUNNING_MODAL;
}
@@ -1754,10 +1772,12 @@ static bool wm_operator_winactive_normal(bContext *C)
wmWindow *win = CTX_wm_window(C);
bScreen *screen;
- if (win == NULL)
+ if (win == NULL) {
return 0;
- if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL)))
+ }
+ if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL))) {
return 0;
+ }
return 1;
}
@@ -2090,8 +2110,9 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
immEnd();
/* undo rotation */
- if (rc->rot_prop)
+ if (rc->rot_prop) {
GPU_matrix_pop();
+ }
}
else {
/* flat color if no texture available */
@@ -2173,8 +2194,9 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
radial_control_paint_tex(rc, tex_radius, alpha);
/* set line color */
- if (rc->col_prop)
+ if (rc->col_prop) {
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
+ }
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -2205,8 +2227,9 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
/* draw circles on top */
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r1, 40);
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r2, 40);
- if (rmin > 0.0f)
+ if (rmin > 0.0f) {
imm_draw_circle_wire_2d(pos, 0.0, 0.0f, rmin, 40);
+ }
immUnbindProgram();
BLF_size(fontid, 1.5 * fstyle_points * U.pixelsize, U.dpi);
@@ -2253,23 +2276,28 @@ static int radial_control_get_path(
}
/* get an rna string path from the operator's properties */
- if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
+ if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0))) {
return 1;
+ }
if (str[0] == '\0') {
- if (r_prop) *r_prop = NULL;
+ if (r_prop) {
+ *r_prop = NULL;
+ }
MEM_freeN(str);
return 1;
}
- if (!r_prop)
+ if (!r_prop) {
r_prop = &unused_prop;
+ }
/* get rna from path */
if (!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
MEM_freeN(str);
- if (flags & RC_PROP_ALLOW_MISSING)
+ if (flags & RC_PROP_ALLOW_MISSING) {
return 1;
+ }
else {
BKE_reportf(op->reports, RPT_ERROR, "Could not resolve path '%s'", name);
return 0;
@@ -2331,18 +2359,22 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
}
}
- if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
+ if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0)) {
return 0;
+ }
/* data path is required */
- if (!rc->prop)
+ if (!rc->prop) {
return 0;
+ }
- if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
- return 0;
- if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+ if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT)) {
return 0;
+ }
+ if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT)) {
+ return 0;
+ }
if (!radial_control_get_path(
&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
@@ -2373,8 +2405,9 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
return 0;
}
- if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
+ if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0)) {
return 0;
+ }
else if (rc->image_id_ptr.data) {
/* extra check, pointer must be to an ID */
if (!RNA_struct_is_ID(rc->image_id_ptr.type)) {
@@ -2394,8 +2427,9 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
RadialControl *rc;
- if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
+ if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl"))) {
return OPERATOR_CANCELLED;
+ }
if (!radial_control_get_properties(C, op)) {
MEM_freeN(rc);
@@ -2534,8 +2568,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
if (rc->subtype == PROP_ANGLE) {
numValue = DEG2RADF(numValue);
numValue = fmod(numValue, 2.0f * (float)M_PI);
- if (numValue < 0.0f)
+ if (numValue < 0.0f) {
numValue += 2.0f * (float)M_PI;
+ }
}
CLAMP(numValue, rc->min_value, rc->max_value);
@@ -2619,22 +2654,31 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
case PROP_DISTANCE:
case PROP_PIXEL:
new_value = dist;
- if (snap) new_value = ((int)new_value + 5) / 10 * 10;
+ if (snap) {
+ new_value = ((int)new_value + 5) / 10 * 10;
+ }
break;
case PROP_PERCENTAGE:
new_value = ((dist - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE) / WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f;
- if (snap) new_value = ((int)(new_value + 2.5f)) / 5 * 5;
+ if (snap) {
+ new_value = ((int)(new_value + 2.5f)) / 5 * 5;
+ }
break;
case PROP_FACTOR:
new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH;
- if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
+ if (snap) {
+ new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
+ }
break;
case PROP_ANGLE:
new_value = atan2f(delta[1], delta[0]) + (float)M_PI + angle_precision;
new_value = fmod(new_value, 2.0f * (float)M_PI);
- if (new_value < 0.0f)
+ if (new_value < 0.0f) {
new_value += 2.0f * (float)M_PI;
- if (snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
+ }
+ if (snap) {
+ new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
+ }
break;
default:
new_value = dist; /* dummy value, should this ever happen? - campbell */
@@ -2685,8 +2729,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
if (rc->subtype == PROP_ANGLE) {
numValue = DEG2RADF(numValue);
numValue = fmod(numValue, 2.0f * (float)M_PI);
- if (numValue < 0.0f)
+ if (numValue < 0.0f) {
numValue += 2.0f * (float)M_PI;
+ }
}
CLAMP(numValue, rc->min_value, rc->max_value);
@@ -2703,8 +2748,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
ED_region_tag_redraw(CTX_wm_region(C));
radial_control_update_header(op, C);
- if (ret != OPERATOR_RUNNING_MODAL)
+ if (ret != OPERATOR_RUNNING_MODAL) {
radial_control_cancel(C, op);
+ }
return ret;
}
@@ -2766,8 +2812,9 @@ static void redraw_timer_window_swap(bContext *C)
ScrArea *sa;
CTX_wm_menu_set(C, NULL);
- for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next)
+ for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) {
ED_area_tag_redraw(sa);
+ }
wm_draw_update(C);
CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
@@ -2853,8 +2900,9 @@ static void redraw_timer_step(
while (tot--) {
/* todo, ability to escape! */
scene->r.cfra++;
- if (scene->r.cfra > scene->r.efra)
+ if (scene->r.cfra > scene->r.efra) {
scene->r.cfra = scene->r.sfra;
+ }
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
redraw_timer_window_swap(C);
@@ -3058,8 +3106,9 @@ static int previews_clear_exec(bContext *C, wmOperator *op)
for (i = 0; lb[i]; i++) {
ID *id = lb[i]->first;
-
- if (!id) continue;
+ if (!id) {
+ continue;
+ }
// printf("%s: %d, %d, %d -> %d\n", id->name, GS(id->name), BKE_idcode_to_idfilter(GS(id->name)),
// id_filters, BKE_idcode_to_idfilter(GS(id->name)) & id_filters);
@@ -3226,7 +3275,9 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Gesture Circle", modal_items);
@@ -3254,7 +3305,9 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
@@ -3279,7 +3332,9 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Box");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "Gesture Box", modal_items);
@@ -3327,7 +3382,9 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "Gesture Zoom Border", modal_items);
diff --git a/source/blender/windowmanager/intern/wm_panel_type.c b/source/blender/windowmanager/intern/wm_panel_type.c
index 5c0fd4ca520..f00129c139b 100644
--- a/source/blender/windowmanager/intern/wm_panel_type.c
+++ b/source/blender/windowmanager/intern/wm_panel_type.c
@@ -45,12 +45,14 @@ PanelType *WM_paneltype_find(const char *idname, bool quiet)
if (idname[0]) {
pt = BLI_ghash_lookup(g_paneltypes_hash, idname);
- if (pt)
+ if (pt) {
return pt;
+ }
}
- if (!quiet)
+ if (!quiet) {
printf("search for unknown paneltype %s\n", idname);
+ }
return NULL;
}
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 0a1ec29c01c..12931c2f5ac 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -291,8 +291,9 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
IMB_rect_from_float(ibuf);
imb_freerectfloatImBuf(ibuf);
}
- if (ibuf->rect == NULL)
+ if (ibuf->rect == NULL) {
return;
+ }
GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
@@ -673,13 +674,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
key_data = (GHOST_TEventKeyData *)GHOST_GetEventData(evt);
switch (key_data->key) {
case GHOST_kKeyA:
- if (val) ps->noskip = !ps->noskip;
+ if (val) {
+ ps->noskip = !ps->noskip;
+ }
break;
case GHOST_kKeyI:
- if (val) ps->indicator = !ps->indicator;
+ if (val) {
+ ps->indicator = !ps->indicator;
+ }
break;
case GHOST_kKeyP:
- if (val) ps->pingpong = !ps->pingpong;
+ if (val) {
+ ps->pingpong = !ps->pingpong;
+ }
break;
case GHOST_kKeyF:
{
@@ -811,9 +818,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kKeyNumpadSlash:
if (val) {
if (g_WS.qual & WS_QUAL_SHIFT) {
- if (ps->curframe_ibuf)
+ if (ps->curframe_ibuf) {
printf(" Name: %s | Speed: %.2f frames/s\n",
ps->curframe_ibuf->name, ps->fstep / swaptime);
+ }
}
else {
swaptime = ps->fstep / 5.0;
@@ -849,11 +857,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
i++;
picture = picture->next;
}
- if (playback_handle)
+ if (playback_handle) {
AUD_Handle_stop(playback_handle);
+ }
playback_handle = AUD_Device_play(audio_device, source, 1);
- if (playback_handle)
+ if (playback_handle) {
AUD_Handle_setPosition(playback_handle, i / fps_movie);
+ }
update_sound_fps();
}
#endif
@@ -883,11 +893,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
i++;
picture = picture->next;
}
- if (playback_handle)
+ if (playback_handle) {
AUD_Handle_stop(playback_handle);
+ }
playback_handle = AUD_Device_play(audio_device, source, 1);
- if (playback_handle)
+ if (playback_handle) {
AUD_Handle_setPosition(playback_handle, i / fps_movie);
+ }
update_sound_fps();
}
#endif
@@ -915,7 +927,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kKeyPlus:
case GHOST_kKeyNumpadPlus:
{
- if (val == 0) break;
+ if (val == 0) {
+ break;
+ }
if (g_WS.qual & WS_QUAL_CTRL) {
playanim_window_zoom(ps, 0.1f);
}
@@ -930,7 +944,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kKeyMinus:
case GHOST_kKeyNumpadMinus:
{
- if (val == 0) break;
+ if (val == 0) {
+ break;
+ }
if (g_WS.qual & WS_QUAL_CTRL) {
playanim_window_zoom(ps, -0.1f);
}
@@ -969,24 +985,29 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
tag_change_frame(ps, cx);
}
}
- else
+ else {
g_WS.qual &= ~WS_QUAL_LMOUSE;
+ }
}
else if (bd->button == GHOST_kButtonMaskMiddle) {
if (type == GHOST_kEventButtonDown) {
- if (inside_window)
+ if (inside_window) {
g_WS.qual |= WS_QUAL_MMOUSE;
+ }
}
- else
+ else {
g_WS.qual &= ~WS_QUAL_MMOUSE;
+ }
}
else if (bd->button == GHOST_kButtonMaskRight) {
if (type == GHOST_kEventButtonDown) {
- if (inside_window)
+ if (inside_window) {
g_WS.qual |= WS_QUAL_RMOUSE;
+ }
}
- else
+ else {
g_WS.qual &= ~WS_QUAL_RMOUSE;
+ }
}
break;
}
@@ -1099,7 +1120,9 @@ static void playanim_window_zoom(PlayState *ps, const float zoom_offset)
int sizex, sizey;
/* int ofsx, ofsy; */ /* UNUSED */
- if (ps->zoom + zoom_offset > 0.0f) ps->zoom += zoom_offset;
+ if (ps->zoom + zoom_offset > 0.0f) {
+ ps->zoom += zoom_offset;
+ }
// playanim_window_get_position(&ofsx, &ofsy);
playanim_window_get_size(&sizex, &sizey);
@@ -1280,8 +1303,12 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
ps.win_x = ps.ibufx;
ps.win_y = ps.ibufy;
- if (maxwinx % ibuf->x) maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
- if (maxwiny % ibuf->y) maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
+ if (maxwinx % ibuf->x) {
+ maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
+ }
+ if (maxwiny % ibuf->y) {
+ maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
+ }
glClearColor(0.1, 0.1, 0.1, 0.0);
@@ -1335,8 +1362,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
#define USE_IMB_CACHE
while (ps.go) {
- if (ps.pingpong)
+ if (ps.pingpong) {
ps.direction = -ps.direction;
+ }
if (ps.direction == 1) {
ps.picture = picsbase.first;
@@ -1357,11 +1385,14 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
ps.picture = ps.picture->prev;
}
}
- if (ptottime > 0.0) ptottime = 0.0;
+ if (ptottime > 0.0) {
+ ptottime = 0.0;
+ }
#ifdef WITH_AUDASPACE
- if (playback_handle)
+ if (playback_handle) {
AUD_Handle_stop(playback_handle);
+ }
playback_handle = AUD_Device_play(audio_device, source, 1);
update_sound_fps();
#endif
@@ -1369,7 +1400,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
while (ps.picture) {
int hasevent;
#ifndef USE_IMB_CACHE
- if (ibuf != NULL && ibuf->ftype == 0) IMB_freeImBuf(ibuf);
+ if (ibuf != NULL && ibuf->ftype == 0) {
+ IMB_freeImBuf(ibuf);
+ }
#endif
if (ps.picture->ibuf) {
ibuf = ps.picture->ibuf;
@@ -1428,7 +1461,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
GHOST_SetTitle(g_WS.ghost_window, ps.picture->name);
#endif
- while (pupdate_time()) PIL_sleep_ms(1);
+ while (pupdate_time()) {
+ PIL_sleep_ms(1);
+ }
ptottime -= swaptime;
playanim_toscreen(&ps, ps.picture, ibuf, ps.fontid, ps.fstep);
} /* else delete */
@@ -1484,7 +1519,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
}
}
- if (ps.wait2 || ptottime < swaptime || ps.turbo || ps.noskip) break;
+ if (ps.wait2 || ptottime < swaptime || ps.turbo || ps.noskip) {
+ break;
+ }
ptottime -= swaptime;
}
if (ps.picture == NULL && ps.sstep) {
@@ -1518,7 +1555,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
/* cleanup */
#ifndef USE_IMB_CACHE
- if (ibuf) IMB_freeImBuf(ibuf);
+ if (ibuf) {
+ IMB_freeImBuf(ibuf);
+ }
#endif
BLI_freelistN(&picsbase);
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 68cbc9b59a7..6691a7f453b 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -162,12 +162,14 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
int soffx = WM_window_pixels_x(win) * 0.5f;
if (view == STEREO_LEFT_ID) {
- if (!cross_eyed)
+ if (!cross_eyed) {
soffx = 0;
+ }
}
else { //RIGHT_LEFT_ID
- if (cross_eyed)
+ if (cross_eyed) {
soffx = 0;
+ }
}
const int sizex = WM_window_pixels_x(win);
@@ -286,8 +288,9 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
*/
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy)
{
- if (!WM_stereo3d_enabled(win, false))
+ if (!WM_stereo3d_enabled(win, false)) {
return;
+ }
if (win->stereo3d_format->display_mode == S3D_DISPLAY_SIDEBYSIDE) {
const int half_x = win->sizex / 2;
@@ -339,19 +342,23 @@ static bool wm_stereo3d_set_properties(bContext *UNUSED(C), wmOperator *op)
prop = RNA_struct_find_property(op->ptr, "use_interlace_swap");
if (RNA_property_is_set(op->ptr, prop)) {
- if (RNA_property_boolean_get(op->ptr, prop))
+ if (RNA_property_boolean_get(op->ptr, prop)) {
s3d->flag |= S3D_INTERLACE_SWAP;
- else
+ }
+ else {
s3d->flag &= ~S3D_INTERLACE_SWAP;
+ }
is_set = true;
}
prop = RNA_struct_find_property(op->ptr, "use_sidebyside_crosseyed");
if (RNA_property_is_set(op->ptr, prop)) {
- if (RNA_property_boolean_get(op->ptr, prop))
+ if (RNA_property_boolean_get(op->ptr, prop)) {
s3d->flag |= S3D_SIDEBYSIDE_CROSSEYED;
- else
+ }
+ else {
s3d->flag &= ~S3D_SIDEBYSIDE_CROSSEYED;
+ }
is_set = true;
}
@@ -379,8 +386,9 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
Stereo3dData *s3dd;
bool ok = true;
- if (G.background)
+ if (G.background) {
return OPERATOR_CANCELLED;
+ }
if (op->customdata == NULL) {
/* no invoke means we need to set the operator properties here */
@@ -460,10 +468,12 @@ int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
{
wm_stereo3d_set_init(C, op);
- if (wm_stereo3d_set_properties(C, op))
+ if (wm_stereo3d_set_properties(C, op)) {
return wm_stereo3d_set_exec(C, op);
- else
+ }
+ else {
return WM_operator_props_dialog_popup(C, op, 250, 100);
+ }
}
void wm_stereo3d_set_draw(bContext *UNUSED(C), wmOperator *op)
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index bf4288e549b..6f856e16047 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -101,8 +101,12 @@ void wmWindowViewport(wmWindow *win)
void wmOrtho2(float x1, float x2, float y1, float y2)
{
/* prevent opengl from generating errors */
- if (x1 == x2) x2 += 1.0f;
- if (y1 == y2) y2 += 1.0f;
+ if (x2 == x1) {
+ x2 += 1.0f;
+ }
+ if (y2 == y1) {
+ y2 += 1.0f;
+ }
GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index a4c953fd958..a1dc822dc97 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -179,8 +179,12 @@ static void wm_window_check_position(rcti *rect)
rect->ymin -= d;
}
- if (rect->xmin < 0) rect->xmin = 0;
- if (rect->ymin < 0) rect->ymin = 0;
+ if (rect->xmin < 0) {
+ rect->xmin = 0;
+ }
+ if (rect->ymin < 0) {
+ rect->ymin = 0;
+ }
}
static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
@@ -220,8 +224,9 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
- if (CTX_wm_window(C) == win)
+ if (CTX_wm_window(C) == win) {
CTX_wm_window_set(C, NULL);
+ }
}
BKE_screen_area_map_free(&win->global_areas);
@@ -229,18 +234,22 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
/* end running jobs, a job end also removes its timer */
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next;
- if (wt->win == win && wt->event_type == TIMERJOBS)
+ if (wt->win == win && wt->event_type == TIMERJOBS) {
wm_jobs_timer_ended(wm, wt);
+ }
}
/* timer removing, need to call this api function */
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next;
- if (wt->win == win)
+ if (wt->win == win) {
WM_event_remove_timer(wm, win, wt);
+ }
}
- if (win->eventstate) MEM_freeN(win->eventstate);
+ if (win->eventstate) {
+ MEM_freeN(win->eventstate);
+ }
if (win->cursor_keymap_status) {
MEM_freeN(win->cursor_keymap_status);
@@ -261,10 +270,11 @@ static int find_free_winid(wmWindowManager *wm)
wmWindow *win;
int id = 1;
- for (win = wm->windows.first; win; win = win->next)
- if (id <= win->winid)
+ for (win = wm->windows.first; win; win = win->next) {
+ if (id <= win->winid) {
id = win->winid + 1;
-
+ }
+ }
return id;
}
@@ -560,8 +570,9 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
G_MAIN->recovered ? " (Recovered)" : "");
GHOST_SetTitle(win->ghostwin, str);
}
- else
+ else {
GHOST_SetTitle(win->ghostwin, "Blender");
+ }
/* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X)
* and to give hint of unsaved changes for a user warning mechanism
@@ -639,8 +650,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
int scr_w, scr_h, posy;
/* a new window is created when pageflip mode is required for a window */
- if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
+ if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
glSettings.flags |= GHOST_glStereoVisual;
+ }
if (G.debug & G_DEBUG_GPU) {
glSettings.flags |= GHOST_glDebugContext;
@@ -897,9 +909,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
wm_window_check_position(&rect);
/* test if we have a temp screen already */
- for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
- if (WM_window_is_temp_screen(win))
+ for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+ if (WM_window_is_temp_screen(win)) {
break;
+ }
+ }
/* add new window? */
if (win == NULL) {
@@ -973,16 +987,21 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
ED_drivers_editor_init(C, sa);
}
- if (sa->spacetype == SPACE_IMAGE)
+ if (sa->spacetype == SPACE_IMAGE) {
title = IFACE_("Blender Render");
- else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
+ }
+ else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) {
title = IFACE_("Blender Preferences");
- else if (sa->spacetype == SPACE_FILE)
+ }
+ else if (sa->spacetype == SPACE_FILE) {
title = IFACE_("Blender File View");
- else if (sa->spacetype == SPACE_GRAPH)
+ }
+ else if (sa->spacetype == SPACE_GRAPH) {
title = IFACE_("Blender Drivers Editor");
- else
+ }
+ else {
title = "Blender";
+ }
if (win->ghostwin) {
GHOST_SetTitle(win->ghostwin, title);
@@ -1034,14 +1053,17 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
wmWindow *window = CTX_wm_window(C);
GHOST_TWindowState state;
- if (G.background)
+ if (G.background) {
return OPERATOR_CANCELLED;
+ }
state = GHOST_GetWindowState(window->ghostwin);
- if (state != GHOST_kWindowStateFullScreen)
+ if (state != GHOST_kWindowStateFullScreen) {
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
- else
+ }
+ else {
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
+ }
return OPERATOR_FINISHED;
@@ -1116,8 +1138,9 @@ static int query_qual(modifierKeyType qual)
}
GHOST_GetModifierKeyState(g_system, left, &val);
- if (!val)
+ if (!val) {
GHOST_GetModifierKeyState(g_system, right, &val);
+ }
return val;
}
@@ -1170,9 +1193,9 @@ void wm_window_reset_drawable(void)
BLI_assert(GPU_framebuffer_active_get() == NULL);
wmWindowManager *wm = G_MAIN->wm.first;
- if (wm == NULL)
+ if (wm == NULL) {
return;
-
+ }
wmWindow *win = wm->windrawable;
if (win && win->ghostwin) {
@@ -1616,12 +1639,15 @@ static int wm_window_timer(const bContext *C)
wt->ltime = time;
wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep);
- if (wt->event_type == TIMERJOBS)
+ if (wt->event_type == TIMERJOBS) {
wm_jobs_timer(C, wm, wt);
- else if (wt->event_type == TIMERAUTOSAVE)
+ }
+ else if (wt->event_type == TIMERAUTOSAVE) {
wm_autosave_timer(C, wm, wt);
- else if (wt->event_type == TIMERNOTIFIER)
+ }
+ else if (wt->event_type == TIMERNOTIFIER) {
WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL);
+ }
else if (win) {
wmEvent event;
wm_event_init_from_window(win, &event);
@@ -1649,14 +1675,15 @@ void wm_window_process_events(const bContext *C)
hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
- if (hasevent)
+ if (hasevent) {
GHOST_DispatchEvents(g_system);
-
+ }
hasevent |= wm_window_timer(C);
/* no event, we sleep 5 milliseconds */
- if (hasevent == 0)
+ if (hasevent == 0) {
PIL_sleep_ms(5);
+ }
}
/* **************** init ********************** */
@@ -1690,9 +1717,9 @@ void wm_ghost_init(bContext *C)
void wm_ghost_exit(void)
{
- if (g_system)
+ if (g_system) {
GHOST_DisposeSystem(g_system);
-
+ }
g_system = NULL;
}
@@ -1703,12 +1730,15 @@ void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *t
{
wmTimer *wt;
- for (wt = wm->timers.first; wt; wt = wt->next)
- if (wt == timer)
+ for (wt = wm->timers.first; wt; wt = wt->next) {
+ if (wt == timer) {
break;
+ }
+ }
- if (wt)
+ if (wt) {
wt->sleep = do_sleep;
+ }
}
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
@@ -1750,14 +1780,17 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
wmTimer *wt;
/* extra security check */
- for (wt = wm->timers.first; wt; wt = wt->next)
- if (wt == timer)
+ for (wt = wm->timers.first; wt; wt = wt->next) {
+ if (wt == timer) {
break;
+ }
+ }
if (wt) {
wmWindow *win;
- if (wm->reports.reporttimer == wt)
+ if (wm->reports.reporttimer == wt) {
wm->reports.reporttimer = NULL;
+ }
BLI_remlink(&wm->timers, wt);
if (wt->customdata != NULL && (wt->flags & WM_TIMER_NO_FREE_CUSTOM_DATA) == 0) {
@@ -1861,10 +1894,12 @@ void WM_clipboard_text_set(const char *buf, bool selection)
int newlen = 0;
for (p = buf; *p; p++) {
- if (*p == '\n')
+ if (*p == '\n') {
newlen += 2;
- else
+ }
+ else {
newlen++;
+ }
}
newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");