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:
authorMartin Felke <martin.felke@googlemail.com>2019-03-02 12:43:27 +0300
committerMartin Felke <martin.felke@googlemail.com>2019-03-02 12:43:27 +0300
commit7faf3f47363058ba4a2dfb15f180deffe706573e (patch)
treee0e3f60ecc3e133abcf09983056860cc9d6ad3bf /source/blender/editors
parent0c0de344aabd0fb2cfbe998d9b54ca2ac6a70120 (diff)
parent42faf52d8bcae3b33164069c4c692152cf42b9b3 (diff)
Merge remote-tracking branch 'origin/master' into fracture_modifier-2.8
# Conflicts: # intern/cycles/blender/blender_mesh.cpp # intern/rigidbody/RBI_api.h # intern/rigidbody/rb_bullet_api.cpp # source/blender/blenkernel/BKE_rigidbody.h # source/blender/blenkernel/intern/rigidbody.c # source/blender/depsgraph/intern/builder/deg_builder_relations.cc # source/blender/draw/intern/draw_manager.c # source/blender/editors/physics/rigidbody_object.c # source/blender/makesdna/DNA_modifier_types.h # source/blender/makesdna/DNA_rigidbody_types.h # source/blender/makesrna/intern/rna_modifier.c # source/blender/makesrna/intern/rna_rigidbody.c # source/blender/modifiers/intern/MOD_boolean.c # source/blender/modifiers/intern/MOD_multires.c # source/blender/modifiers/intern/MOD_remesh.c
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/CMakeLists.txt3
-rw-r--r--source/blender/editors/animation/CMakeLists.txt3
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c91
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c96
-rw-r--r--source/blender/editors/animation/anim_deps.c66
-rw-r--r--source/blender/editors/animation/anim_draw.c21
-rw-r--r--source/blender/editors/animation/anim_filter.c169
-rw-r--r--source/blender/editors/animation/anim_intern.h10
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c11
-rw-r--r--source/blender/editors/animation/anim_markers.c78
-rw-r--r--source/blender/editors/animation/anim_ops.c15
-rw-r--r--source/blender/editors/animation/drivers.c17
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c82
-rw-r--r--source/blender/editors/animation/keyframes_draw.c22
-rw-r--r--source/blender/editors/animation/keyframes_edit.c51
-rw-r--r--source/blender/editors/animation/keyframes_general.c19
-rw-r--r--source/blender/editors/animation/keyframing.c516
-rw-r--r--source/blender/editors/animation/keyingsets.c15
-rw-r--r--source/blender/editors/armature/CMakeLists.txt5
-rw-r--r--source/blender/editors/armature/armature_add.c22
-rw-r--r--source/blender/editors/armature/armature_edit.c19
-rw-r--r--source/blender/editors/armature/armature_intern.h47
-rw-r--r--source/blender/editors/armature/armature_naming.c14
-rw-r--r--source/blender/editors/armature/armature_ops.c11
-rw-r--r--source/blender/editors/armature/armature_relations.c27
-rw-r--r--source/blender/editors/armature/armature_select.c26
-rw-r--r--source/blender/editors/armature/armature_skinning.c12
-rw-r--r--source/blender/editors/armature/armature_utils.c19
-rw-r--r--source/blender/editors/armature/editarmature_undo.c29
-rw-r--r--source/blender/editors/armature/meshlaplacian.c22
-rw-r--r--source/blender/editors/armature/meshlaplacian.h9
-rw-r--r--source/blender/editors/armature/pose_edit.c245
-rw-r--r--source/blender/editors/armature/pose_group.c13
-rw-r--r--source/blender/editors/armature/pose_lib.c97
-rw-r--r--source/blender/editors/armature/pose_select.c20
-rw-r--r--source/blender/editors/armature/pose_slide.c78
-rw-r--r--source/blender/editors/armature/pose_transform.c22
-rw-r--r--source/blender/editors/armature/pose_utils.c14
-rw-r--r--source/blender/editors/curve/CMakeLists.txt3
-rw-r--r--source/blender/editors/curve/curve_intern.h16
-rw-r--r--source/blender/editors/curve/curve_ops.c11
-rw-r--r--source/blender/editors/curve/editcurve.c126
-rw-r--r--source/blender/editors/curve/editcurve_add.c18
-rw-r--r--source/blender/editors/curve/editcurve_paint.c13
-rw-r--r--source/blender/editors/curve/editcurve_select.c17
-rw-r--r--source/blender/editors/curve/editcurve_undo.c34
-rw-r--r--source/blender/editors/curve/editfont.c21
-rw-r--r--source/blender/editors/curve/editfont_undo.c13
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt4
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c10
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_draw_utils.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_geometry.h8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_intern.h10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_presets.c10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_utils.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c13
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c17
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c13
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c25
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c19
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c15
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c8
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt12
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c44
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c161
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c127
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c2686
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c18
-rw-r--r--source/blender/editors/gpencil/gpencil_armature.c17
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c40
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c24
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c52
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c689
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c129
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h226
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c24
-rw-r--r--source/blender/editors/gpencil/gpencil_merge.c565
-rw-r--r--source/blender/editors/gpencil/gpencil_old.c24
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c20
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c892
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c285
-rw-r--r--source/blender/editors/gpencil/gpencil_select.c61
-rw-r--r--source/blender/editors/gpencil/gpencil_undo.c13
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c521
-rw-r--r--source/blender/editors/include/BIF_gl.h12
-rw-r--r--source/blender/editors/include/BIF_glutil.h17
-rw-r--r--source/blender/editors/include/ED_anim_api.h254
-rw-r--r--source/blender/editors/include/ED_armature.h80
-rw-r--r--source/blender/editors/include/ED_buttons.h8
-rw-r--r--source/blender/editors/include/ED_clip.h17
-rw-r--r--source/blender/editors/include/ED_curve.h21
-rw-r--r--source/blender/editors/include/ED_datafiles.h11
-rw-r--r--source/blender/editors/include/ED_fileselect.h17
-rw-r--r--source/blender/editors/include/ED_gizmo_library.h10
-rw-r--r--source/blender/editors/include/ED_gizmo_utils.h8
-rw-r--r--source/blender/editors/include/ED_gpencil.h55
-rw-r--r--source/blender/editors/include/ED_image.h22
-rw-r--r--source/blender/editors/include/ED_info.h12
-rw-r--r--source/blender/editors/include/ED_keyframes_draw.h51
-rw-r--r--source/blender/editors/include/ED_keyframes_edit.h57
-rw-r--r--source/blender/editors/include/ED_keyframing.h55
-rw-r--r--source/blender/editors/include/ED_lattice.h14
-rw-r--r--source/blender/editors/include/ED_logic.h10
-rw-r--r--source/blender/editors/include/ED_markers.h19
-rw-r--r--source/blender/editors/include/ED_mask.h17
-rw-r--r--source/blender/editors/include/ED_mball.h15
-rw-r--r--source/blender/editors/include/ED_mesh.h61
-rw-r--r--source/blender/editors/include/ED_node.h23
-rw-r--r--source/blender/editors/include/ED_numinput.h42
-rw-r--r--source/blender/editors/include/ED_object.h44
-rw-r--r--source/blender/editors/include/ED_outliner.h10
-rw-r--r--source/blender/editors/include/ED_paint.h16
-rw-r--r--source/blender/editors/include/ED_particle.h24
-rw-r--r--source/blender/editors/include/ED_physics.h16
-rw-r--r--source/blender/editors/include/ED_render.h12
-rw-r--r--source/blender/editors/include/ED_scene.h8
-rw-r--r--source/blender/editors/include/ED_screen.h56
-rw-r--r--source/blender/editors/include/ED_screen_types.h29
-rw-r--r--source/blender/editors/include/ED_sculpt.h18
-rw-r--r--source/blender/editors/include/ED_select_utils.h10
-rw-r--r--source/blender/editors/include/ED_sequencer.h10
-rw-r--r--source/blender/editors/include/ED_sound.h11
-rw-r--r--source/blender/editors/include/ED_space_api.h11
-rw-r--r--source/blender/editors/include/ED_text.h14
-rw-r--r--source/blender/editors/include/ED_transform.h31
-rw-r--r--source/blender/editors/include/ED_transform_snap_object_context.h17
-rw-r--r--source/blender/editors/include/ED_transverts.h20
-rw-r--r--source/blender/editors/include/ED_types.h11
-rw-r--r--source/blender/editors/include/ED_undo.h20
-rw-r--r--source/blender/editors/include/ED_userpref.h26
-rw-r--r--source/blender/editors/include/ED_util.h25
-rw-r--r--source/blender/editors/include/ED_uvedit.h45
-rw-r--r--source/blender/editors/include/ED_view3d.h46
-rw-r--r--source/blender/editors/include/UI_icons.h35
-rw-r--r--source/blender/editors/include/UI_interface.h616
-rw-r--r--source/blender/editors/include/UI_interface_icons.h18
-rw-r--r--source/blender/editors/include/UI_resources.h30
-rw-r--r--source/blender/editors/include/UI_view2d.h22
-rw-r--r--source/blender/editors/interface/CMakeLists.txt3
-rw-r--r--source/blender/editors/interface/interface.c74
-rw-r--r--source/blender/editors/interface/interface_align.c111
-rw-r--r--source/blender/editors/interface/interface_anim.c20
-rw-r--r--source/blender/editors/interface/interface_context_menu.c58
-rw-r--r--source/blender/editors/interface/interface_draw.c164
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c16
-rw-r--r--source/blender/editors/interface/interface_eyedropper_color.c72
-rw-r--r--source/blender/editors/interface/interface_eyedropper_colorband.c40
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c35
-rw-r--r--source/blender/editors/interface/interface_eyedropper_depth.c37
-rw-r--r--source/blender/editors/interface/interface_eyedropper_driver.c38
-rw-r--r--source/blender/editors/interface/interface_eyedropper_intern.h8
-rw-r--r--source/blender/editors/interface/interface_handlers.c301
-rw-r--r--source/blender/editors/interface/interface_icons.c97
-rw-r--r--source/blender/editors/interface/interface_icons_event.c12
-rw-r--r--source/blender/editors/interface/interface_intern.h183
-rw-r--r--source/blender/editors/interface/interface_layout.c117
-rw-r--r--source/blender/editors/interface/interface_ops.c53
-rw-r--r--source/blender/editors/interface/interface_panel.c100
-rw-r--r--source/blender/editors/interface/interface_query.c8
-rw-r--r--source/blender/editors/interface/interface_region_color_picker.c100
-rw-r--r--source/blender/editors/interface/interface_region_hud.c23
-rw-r--r--source/blender/editors/interface/interface_region_menu_pie.c13
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c48
-rw-r--r--source/blender/editors/interface/interface_region_popover.c17
-rw-r--r--source/blender/editors/interface/interface_region_popup.c40
-rw-r--r--source/blender/editors/interface/interface_region_search.c27
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c52
-rw-r--r--source/blender/editors/interface/interface_regions.c10
-rw-r--r--source/blender/editors/interface/interface_regions_intern.h10
-rw-r--r--source/blender/editors/interface/interface_style.c48
-rw-r--r--source/blender/editors/interface/interface_templates.c150
-rw-r--r--source/blender/editors/interface/interface_utils.c23
-rw-r--r--source/blender/editors/interface/interface_widgets.c257
-rw-r--r--source/blender/editors/interface/resources.c183
-rw-r--r--source/blender/editors/interface/view2d.c89
-rw-r--r--source/blender/editors/interface/view2d_ops.c126
-rw-r--r--source/blender/editors/io/CMakeLists.txt3
-rw-r--r--source/blender/editors/io/io_alembic.c45
-rw-r--r--source/blender/editors/io/io_alembic.h9
-rw-r--r--source/blender/editors/io/io_cache.c9
-rw-r--r--source/blender/editors/io/io_cache.h9
-rw-r--r--source/blender/editors/io/io_collada.c78
-rw-r--r--source/blender/editors/io/io_collada.h11
-rw-r--r--source/blender/editors/io/io_ops.c11
-rw-r--r--source/blender/editors/io/io_ops.h11
-rw-r--r--source/blender/editors/lattice/CMakeLists.txt3
-rw-r--r--source/blender/editors/lattice/editlattice_select.c10
-rw-r--r--source/blender/editors/lattice/editlattice_tools.c18
-rw-r--r--source/blender/editors/lattice/editlattice_undo.c28
-rw-r--r--source/blender/editors/lattice/lattice_intern.h8
-rw-r--r--source/blender/editors/lattice/lattice_ops.c11
-rw-r--r--source/blender/editors/mask/CMakeLists.txt4
-rw-r--r--source/blender/editors/mask/mask_add.c18
-rw-r--r--source/blender/editors/mask/mask_draw.c38
-rw-r--r--source/blender/editors/mask/mask_edit.c12
-rw-r--r--source/blender/editors/mask/mask_editaction.c10
-rw-r--r--source/blender/editors/mask/mask_intern.h16
-rw-r--r--source/blender/editors/mask/mask_ops.c26
-rw-r--r--source/blender/editors/mask/mask_relationships.c12
-rw-r--r--source/blender/editors/mask/mask_select.c12
-rw-r--r--source/blender/editors/mask/mask_shapekey.c12
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt3
-rw-r--r--source/blender/editors/mesh/editface.c13
-rw-r--r--source/blender/editors/mesh/editmesh_add.c20
-rw-r--r--source/blender/editors/mesh/editmesh_add_gizmo.c8
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c567
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c15
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c12
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_screw.c18
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin.c18
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c30
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c19
-rw-r--r--source/blender/editors/mesh/editmesh_intersect.c30
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c46
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c14
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c24
-rw-r--r--source/blender/editors/mesh/editmesh_path.c17
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c8
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_edgering.c8
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_elem.c10
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c20
-rw-r--r--source/blender/editors/mesh/editmesh_rip_edge.c8
-rw-r--r--source/blender/editors/mesh/editmesh_select.c56
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c16
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c180
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c35
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c76
-rw-r--r--source/blender/editors/mesh/mesh_data.c68
-rw-r--r--source/blender/editors/mesh/mesh_intern.h18
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c30
-rw-r--r--source/blender/editors/mesh/mesh_ops.c13
-rw-r--r--source/blender/editors/mesh/meshtools.c36
-rw-r--r--source/blender/editors/metaball/CMakeLists.txt3
-rw-r--r--source/blender/editors/metaball/editmball_undo.c26
-rw-r--r--source/blender/editors/metaball/mball_edit.c19
-rw-r--r--source/blender/editors/metaball/mball_intern.h11
-rw-r--r--source/blender/editors/metaball/mball_ops.c11
-rw-r--r--source/blender/editors/object/CMakeLists.txt11
-rw-r--r--source/blender/editors/object/object_add.c336
-rw-r--r--source/blender/editors/object/object_bake.c42
-rw-r--r--source/blender/editors/object/object_bake_api.c60
-rw-r--r--source/blender/editors/object/object_collection.c18
-rw-r--r--source/blender/editors/object/object_constraint.c29
-rw-r--r--source/blender/editors/object/object_data_transfer.c21
-rw-r--r--source/blender/editors/object/object_edit.c423
-rw-r--r--source/blender/editors/object/object_facemap_ops.c25
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c19
-rw-r--r--source/blender/editors/object/object_hook.c14
-rw-r--r--source/blender/editors/object/object_intern.h20
-rw-r--r--source/blender/editors/object/object_modes.c10
-rw-r--r--source/blender/editors/object/object_modifier.c106
-rw-r--r--source/blender/editors/object/object_ops.c13
-rw-r--r--source/blender/editors/object/object_random.c14
-rw-r--r--source/blender/editors/object/object_relations.c231
-rw-r--r--source/blender/editors/object/object_select.c47
-rw-r--r--source/blender/editors/object/object_shader_fx.c22
-rw-r--r--source/blender/editors/object/object_shapekey.c10
-rw-r--r--source/blender/editors/object/object_transform.c111
-rw-r--r--source/blender/editors/object/object_utils.c8
-rw-r--r--source/blender/editors/object/object_vgroup.c79
-rw-r--r--source/blender/editors/object/object_warp.c8
-rw-r--r--source/blender/editors/physics/CMakeLists.txt3
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c10
-rw-r--r--source/blender/editors/physics/particle_boids.c10
-rw-r--r--source/blender/editors/physics/particle_edit.c89
-rw-r--r--source/blender/editors/physics/particle_edit_undo.c18
-rw-r--r--source/blender/editors/physics/particle_edit_utildefines.h12
-rw-r--r--source/blender/editors/physics/particle_object.c56
-rw-r--r--source/blender/editors/physics/physics_fluid.c31
-rw-r--r--source/blender/editors/physics/physics_intern.h12
-rw-r--r--source/blender/editors/physics/physics_ops.c10
-rw-r--r--source/blender/editors/physics/physics_pointcache.c36
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c14
-rw-r--r--source/blender/editors/physics/rigidbody_object.c14
-rw-r--r--source/blender/editors/physics/rigidbody_world.c14
-rw-r--r--source/blender/editors/render/CMakeLists.txt3
-rw-r--r--source/blender/editors/render/render_intern.h15
-rw-r--r--source/blender/editors/render/render_internal.c26
-rw-r--r--source/blender/editors/render/render_opengl.c19
-rw-r--r--source/blender/editors/render/render_ops.c10
-rw-r--r--source/blender/editors/render/render_preview.c52
-rw-r--r--source/blender/editors/render/render_shading.c75
-rw-r--r--source/blender/editors/render/render_update.c51
-rw-r--r--source/blender/editors/render/render_view.c11
-rw-r--r--source/blender/editors/scene/CMakeLists.txt3
-rw-r--r--source/blender/editors/scene/scene_edit.c21
-rw-r--r--source/blender/editors/screen/CMakeLists.txt3
-rw-r--r--source/blender/editors/screen/area.c249
-rw-r--r--source/blender/editors/screen/area_utils.c10
-rw-r--r--source/blender/editors/screen/glutil.c71
-rw-r--r--source/blender/editors/screen/screen_context.c115
-rw-r--r--source/blender/editors/screen/screen_draw.c10
-rw-r--r--source/blender/editors/screen/screen_edit.c25
-rw-r--r--source/blender/editors/screen/screen_geometry.c10
-rw-r--r--source/blender/editors/screen/screen_intern.h18
-rw-r--r--source/blender/editors/screen/screen_ops.c245
-rw-r--r--source/blender/editors/screen/screen_user_menu.c46
-rw-r--r--source/blender/editors/screen/screendump.c13
-rw-r--r--source/blender/editors/screen/workspace_edit.c25
-rw-r--r--source/blender/editors/screen/workspace_layout_edit.c28
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c33
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve_undo.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c68
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c15
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c650
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c172
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h30
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c19
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c41
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_utils.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c11
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c102
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c311
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h17
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c126
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c22
-rw-r--r--source/blender/editors/sound/CMakeLists.txt3
-rw-r--r--source/blender/editors/sound/sound_intern.h11
-rw-r--r--source/blender/editors/sound/sound_ops.c40
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_action/action_buttons.c13
-rw-r--r--source/blender/editors/space_action/action_data.c17
-rw-r--r--source/blender/editors/space_action/action_draw.c13
-rw-r--r--source/blender/editors/space_action/action_edit.c58
-rw-r--r--source/blender/editors/space_action/action_intern.h25
-rw-r--r--source/blender/editors/space_action/action_ops.c11
-rw-r--r--source/blender/editors/space_action/action_select.c49
-rw-r--r--source/blender/editors/space_action/space_action.c83
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_api/spacetypes.c10
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c47
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h17
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c11
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c24
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c51
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c72
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c15
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c12
-rw-r--r--source/blender/editors/space_clip/clip_draw.c22
-rw-r--r--source/blender/editors/space_clip/clip_editor.c34
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c12
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c17
-rw-r--r--source/blender/editors/space_clip/clip_intern.h17
-rw-r--r--source/blender/editors/space_clip/clip_ops.c12
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c12
-rw-r--r--source/blender/editors/space_clip/clip_utils.c13
-rw-r--r--source/blender/editors/space_clip/space_clip.c31
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c26
-rw-r--r--source/blender/editors/space_clip/tracking_ops_detect.c14
-rw-r--r--source/blender/editors/space_clip/tracking_ops_intern.h14
-rw-r--r--source/blender/editors/space_clip/tracking_ops_orient.c26
-rw-r--r--source/blender/editors/space_clip/tracking_ops_plane.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_stabilize.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_track.c13
-rw-r--r--source/blender/editors/space_clip/tracking_ops_utils.c12
-rw-r--r--source/blender/editors/space_clip/tracking_select.c14
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_console/console_draw.c11
-rw-r--r--source/blender/editors/space_console/console_intern.h15
-rw-r--r--source/blender/editors/space_console/console_ops.c25
-rw-r--r--source/blender/editors/space_console/space_console.c12
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_file/file_draw.c38
-rw-r--r--source/blender/editors/space_file/file_intern.h13
-rw-r--r--source/blender/editors/space_file/file_ops.c50
-rw-r--r--source/blender/editors/space_file/file_panels.c11
-rw-r--r--source/blender/editors/space_file/file_utils.c11
-rw-r--r--source/blender/editors/space_file/filelist.c111
-rw-r--r--source/blender/editors/space_file/filelist.h16
-rw-r--r--source/blender/editors/space_file/filesel.c23
-rw-r--r--source/blender/editors/space_file/fsmenu.c27
-rw-r--r--source/blender/editors/space_file/fsmenu.h13
-rw-r--r--source/blender/editors/space_file/space_file.c13
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c53
-rw-r--r--source/blender/editors/space_graph/graph_draw.c78
-rw-r--r--source/blender/editors/space_graph/graph_edit.c63
-rw-r--r--source/blender/editors/space_graph/graph_intern.h27
-rw-r--r--source/blender/editors/space_graph/graph_ops.c30
-rw-r--r--source/blender/editors/space_graph/graph_select.c34
-rw-r--r--source/blender/editors/space_graph/graph_utils.c21
-rw-r--r--source/blender/editors/space_graph/space_graph.c77
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_image/image_buttons.c60
-rw-r--r--source/blender/editors/space_image/image_draw.c29
-rw-r--r--source/blender/editors/space_image/image_edit.c11
-rw-r--r--source/blender/editors/space_image/image_intern.h16
-rw-r--r--source/blender/editors/space_image/image_ops.c44
-rw-r--r--source/blender/editors/space_image/space_image.c89
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt9
-rw-r--r--source/blender/editors/space_info/info_draw.c14
-rw-r--r--source/blender/editors/space_info/info_intern.h13
-rw-r--r--source/blender/editors/space_info/info_ops.c29
-rw-r--r--source/blender/editors/space_info/info_report.c10
-rw-r--r--source/blender/editors/space_info/info_stats.c146
-rw-r--r--source/blender/editors/space_info/space_info.c14
-rw-r--r--source/blender/editors/space_info/textview.c20
-rw-r--r--source/blender/editors/space_info/textview.h13
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c14
-rw-r--r--source/blender/editors/space_nla/nla_channels.c23
-rw-r--r--source/blender/editors/space_nla/nla_draw.c35
-rw-r--r--source/blender/editors/space_nla/nla_edit.c61
-rw-r--r--source/blender/editors/space_nla/nla_intern.h15
-rw-r--r--source/blender/editors/space_nla/nla_ops.c11
-rw-r--r--source/blender/editors/space_nla/nla_select.c22
-rw-r--r--source/blender/editors/space_nla/space_nla.c18
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_node/drawnode.c47
-rw-r--r--source/blender/editors/space_node/node_add.c12
-rw-r--r--source/blender/editors/space_node/node_buttons.c17
-rw-r--r--source/blender/editors/space_node/node_draw.c41
-rw-r--r--source/blender/editors/space_node/node_edit.c45
-rw-r--r--source/blender/editors/space_node/node_gizmo.c15
-rw-r--r--source/blender/editors/space_node/node_group.c41
-rw-r--r--source/blender/editors/space_node/node_intern.h21
-rw-r--r--source/blender/editors/space_node/node_ops.c11
-rw-r--r--source/blender/editors/space_node/node_relationships.c28
-rw-r--r--source/blender/editors/space_node/node_select.c13
-rw-r--r--source/blender/editors/space_node/node_templates.c14
-rw-r--r--source/blender/editors/space_node/node_toolbar.c11
-rw-r--r--source/blender/editors/space_node/node_view.c11
-rw-r--r--source/blender/editors/space_node/space_node.c20
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c576
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c43
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c278
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c183
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h86
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c28
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c204
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c209
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c88
-rw-r--r--source/blender/editors/space_outliner/outliner_utils.c29
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c34
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_script/script_edit.c28
-rw-r--r--source/blender/editors/space_script/script_intern.h11
-rw-r--r--source/blender/editors/space_script/script_ops.c11
-rw-r--r--source/blender/editors/space_script/space_script.c12
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c42
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c66
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c630
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c80
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h35
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c11
-rw-r--r--source/blender/editors/space_sequencer/sequencer_preview.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_scopes.c13
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c17
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c11
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c20
-rw-r--r--source/blender/editors/space_statusbar/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c8
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_text/space_text.c12
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c11
-rw-r--r--source/blender/editors/space_text/text_draw.c54
-rw-r--r--source/blender/editors/space_text/text_format.c12
-rw-r--r--source/blender/editors/space_text/text_format.h41
-rw-r--r--source/blender/editors/space_text/text_format_lua.c8
-rw-r--r--source/blender/editors/space_text/text_format_osl.c8
-rw-r--r--source/blender/editors/space_text/text_format_pov.c8
-rw-r--r--source/blender/editors/space_text/text_format_pov_ini.c8
-rw-r--r--source/blender/editors/space_text/text_format_py.c8
-rw-r--r--source/blender/editors/space_text/text_header.c11
-rw-r--r--source/blender/editors/space_text/text_intern.h13
-rw-r--r--source/blender/editors/space_text/text_ops.c44
-rw-r--r--source/blender/editors/space_text/text_undo.c100
-rw-r--r--source/blender/editors/space_topbar/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_topbar/space_topbar.c12
-rw-r--r--source/blender/editors/space_userpref/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c66
-rw-r--r--source/blender/editors/space_userpref/userpref_intern.h11
-rw-r--r--source/blender/editors/space_userpref/userpref_ops.c65
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt13
-rw-r--r--source/blender/editors/space_view3d/drawobject.c192
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c45
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c531
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c51
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c136
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c95
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c144
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c57
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_armature.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c31
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_forcefield.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_light.c (renamed from source/blender/editors/space_view3d/view3d_gizmo_lamp.c)100
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c53
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c134
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c87
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h47
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c20
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c385
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c38
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c52
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c193
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c33
-rw-r--r--source/blender/editors/transform/CMakeLists.txt3
-rw-r--r--source/blender/editors/transform/transform.c463
-rw-r--r--source/blender/editors/transform/transform.h689
-rw-r--r--source/blender/editors/transform/transform_constraints.c54
-rw-r--r--source/blender/editors/transform/transform_conversions.c364
-rw-r--r--source/blender/editors/transform/transform_generics.c188
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c9
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c108
-rw-r--r--source/blender/editors/transform/transform_gizmo_extrude_3d.c34
-rw-r--r--source/blender/editors/transform/transform_input.c19
-rw-r--r--source/blender/editors/transform/transform_ops.c96
-rw-r--r--source/blender/editors/transform/transform_orientations.c50
-rw-r--r--source/blender/editors/transform/transform_snap.c24
-rw-r--r--source/blender/editors/transform/transform_snap_object.c49
-rw-r--r--source/blender/editors/undo/CMakeLists.txt3
-rw-r--r--source/blender/editors/undo/ed_undo.c124
-rw-r--r--source/blender/editors/undo/memfile_undo.c47
-rw-r--r--source/blender/editors/undo/undo_intern.h8
-rw-r--r--source/blender/editors/undo/undo_system_types.c8
-rw-r--r--source/blender/editors/util/CMakeLists.txt3
-rw-r--r--source/blender/editors/util/ed_transverts.c8
-rw-r--r--source/blender/editors/util/ed_util.c131
-rw-r--r--source/blender/editors/util/gizmo_utils.c8
-rw-r--r--source/blender/editors/util/numinput.c68
-rw-r--r--source/blender/editors/util/select_utils.c8
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt3
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c132
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h20
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c109
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c63
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.h16
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c67
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c323
558 files changed, 17702 insertions, 15167 deletions
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index cf1db751c85..3b06e1784e6 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
if(WITH_BLENDER)
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 13432e38669..933b4815175 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 341bc25875e..d1cef1cfa17 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_channels_defines.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -48,7 +42,7 @@
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
@@ -82,8 +76,6 @@
#include "ED_anim_api.h"
#include "ED_keyframing.h"
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -175,9 +167,9 @@ static bool acf_show_channel_colors(bAnimContext *ac)
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
break;
@@ -542,7 +534,7 @@ static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
/* visible only in Graph Editor */
case ACHANNEL_SETTING_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -702,7 +694,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
/* visible only in Graph Editor */
case ACHANNEL_SETTING_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -710,7 +702,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
return true;
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
default:
return false;
@@ -870,10 +862,10 @@ static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
/* conditionally supported */
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
default: /* always supported */
return true;
@@ -896,7 +888,7 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
* allowing different collapsing of groups there, since sharing the flag
* proved to be a hazard for workflows...
*/
- return (ac->spacetype == SPACE_IPO) ?
+ return (ac->spacetype == SPACE_GRAPH) ?
AGRP_EXPANDED_G : /* Graph Editor case */
AGRP_EXPANDED; /* DopeSheet and elsewhere */
}
@@ -1002,7 +994,7 @@ static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
return false;
@@ -1491,7 +1483,7 @@ static int acf_dslight_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
/* get pointer to the setting */
static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
- Lamp *la = (Lamp *)ale->data;
+ Light *la = (Light *)ale->data;
/* clear extra return data first */
*type = 0;
@@ -1512,7 +1504,7 @@ static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings s
}
}
-/* lamp expander type define */
+/* light expander type define */
static bAnimChannelType ACF_DSLIGHT =
{
"Light Expander", /* type name */
@@ -2036,7 +2028,7 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- return 0;
+ return PART_DS_EXPAND;
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
@@ -2054,18 +2046,22 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
}
/* get pointer to the setting */
-static void *acf_dspart_setting_ptr(bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting, short *type)
+static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
+ ParticleSettings *part = (ParticleSettings *)ale->data;
+
/* clear extra return data first */
*type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- return NULL;
+ return GET_ACF_FLAG_PTR(part->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (part->adt)
+ return GET_ACF_FLAG_PTR(part->adt->flag, type);
return NULL;
default: /* unsupported */
@@ -3531,7 +3527,8 @@ static bAnimChannelType ACF_NLAACTION =
"NLA Active Action", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
- acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too, since it needs special hacks) */
+ acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too,
+ * since it needs special hacks) */
acf_nlaaction_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */ // XXX?
@@ -3864,7 +3861,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
* - in Grease Pencil mode, color swatches for layer color
*/
if (ac->sl) {
- if ((ac->spacetype == SPACE_IPO) &&
+ if ((ac->spacetype == SPACE_GRAPH) &&
(acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)))
{
@@ -3964,7 +3961,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
immUniformColor3fv(color);
/* check if we need to show the sliders */
- if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
switch (ac->spacetype) {
case SPACE_ACTION:
{
@@ -3972,9 +3969,9 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
draw_sliders = (saction->flag & SACTION_SLIDERS);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
draw_sliders = (sipo->flag & SIPO_SLIDERS);
break;
}
@@ -4064,7 +4061,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
/* tag copy-on-write flushing (so that the settings will have an effect) */
if (ale_setting->id) {
- DEG_id_tag_update(ale_setting->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(ale_setting->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
}
if (ale_setting->adt && ale_setting->adt->action) {
/* action is it's own datablock, so has to be tagged specifically... */
@@ -4095,10 +4092,11 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
}
/* callback for wrapping NLA Track "solo" toggle logic */
-static void achannel_nlatrack_solo_widget_cb(bContext *C, void *adt_poin, void *nlt_poin)
+static void achannel_nlatrack_solo_widget_cb(bContext *C, void *ale_poin, void *UNUSED(arg2))
{
- AnimData *adt = adt_poin;
- NlaTrack *nlt = nlt_poin;
+ bAnimListElem *ale = ale_poin;
+ AnimData *adt = ale->adt;
+ NlaTrack *nlt = ale->data;
/* Toggle 'solo' mode. There are several complications here which need explaining:
* - The method call is needed to perform a few additional validation operations
@@ -4111,7 +4109,8 @@ static void achannel_nlatrack_solo_widget_cb(bContext *C, void *adt_poin, void *
BKE_nlatrack_solo_toggle(adt, nlt);
/* send notifiers */
- WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
+ DEG_id_tag_update(ale->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
}
/* callback for widget sliders - insert keyframes */
@@ -4407,17 +4406,24 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
/* settings needing special attention */
case ACHANNEL_SETTING_SOLO: /* NLA Tracks - Solo toggle */
- UI_but_func_set(but, achannel_nlatrack_solo_widget_cb, ale->adt, ale->data);
+ UI_but_funcN_set(but, achannel_nlatrack_solo_widget_cb, MEM_dupallocN(ale), NULL);
break;
/* no flushing */
- case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */
+ case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush,
+ * otherwise all would open/close at once */
default:
UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL);
break;
}
}
}
+
+ if ((ale->fcurve_owner_id != NULL && ID_IS_LINKED(ale->fcurve_owner_id)) ||
+ (ale->id != NULL && ID_IS_LINKED(ale->id)))
+ {
+ UI_but_flag_enable(but, UI_BUT_DISABLED);
+ }
}
/* Draw UI widgets the given channel */
@@ -4465,7 +4471,7 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
* - in Grease Pencil mode, color swatches for layer color
*/
if (ac->sl) {
- if ((ac->spacetype == SPACE_IPO) &&
+ if ((ac->spacetype == SPACE_GRAPH) &&
(acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)))
{
@@ -4562,7 +4568,7 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
short draw_sliders = 0;
/* check if we need to show the sliders */
- if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
switch (ac->spacetype) {
case SPACE_ACTION:
{
@@ -4570,9 +4576,9 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
draw_sliders = (saction->flag & SACTION_SLIDERS);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
draw_sliders = (sipo->flag & SIPO_SLIDERS);
break;
}
@@ -4599,7 +4605,8 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
/* modifiers disable */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
- offset += ICON_WIDTH * 1.2f; /* hack: extra spacing, to avoid touching the mute toggle */
+ /* hack: extra spacing, to avoid touching the mute toggle */
+ offset += ICON_WIDTH * 1.2f;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF);
}
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 84b59835750..3bcbe2d99e3 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_channels_edit.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -58,6 +52,7 @@
#include "BKE_global.h"
#include "BKE_scene.h"
+#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "UI_view2d.h"
@@ -669,7 +664,7 @@ static bool animedit_poll_channels_active(bContext *C)
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA) == 0)
return 0;
return 1;
@@ -686,7 +681,7 @@ static bool animedit_poll_channels_nla_tweakmode_off(bContext *C)
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA) == 0)
return 0;
/* NLA TweakMode test */
@@ -706,7 +701,7 @@ typedef enum eRearrangeAnimChan_Mode {
REARRANGE_ANIMCHAN_TOP = -2,
REARRANGE_ANIMCHAN_UP = -1,
REARRANGE_ANIMCHAN_DOWN = 1,
- REARRANGE_ANIMCHAN_BOTTOM = 2
+ REARRANGE_ANIMCHAN_BOTTOM = 2,
} eRearrangeAnimChan_Mode;
/* defines for rearranging channels */
@@ -715,7 +710,7 @@ static const EnumPropertyItem prop_animchannel_rearrange_types[] = {
{REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""},
{REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""},
{REARRANGE_ANIMCHAN_BOTTOM, "BOTTOM", 0, "To Bottom", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Reordering "Islands" Defines ----------------------------------- */
@@ -880,7 +875,8 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
Link *channel, eAnim_ChannelType type,
const bool is_hidden)
{
- tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
+ /* always try to add to last island if possible */
+ tReorderChannelIsland *island = islands->last;
bool is_sel = false, is_untouchable = false;
/* get flags - selected and untouchable from the channel */
@@ -1354,6 +1350,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
switch (ac.datatype) {
case ANIMCONT_NLA: /* NLA-tracks only */
rearrange_nla_channels(&ac, adt, mode);
+ DEG_id_tag_update(ale->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
break;
case ANIMCONT_DRIVERS: /* Drivers list only */
@@ -1441,9 +1438,9 @@ static bool animchannels_grouping_poll(bContext *C)
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
/* drivers can't have groups... */
if (sipo->mode != SIPO_MODE_ANIMATION)
@@ -1559,7 +1556,8 @@ static void ANIM_OT_channels_group(wmOperatorType *ot)
ot->prop = RNA_def_string(ot->srna, "name", "New Group",
sizeof(((bActionGroup *)NULL)->name),
"Name", "Name of newly created group");
- /* RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE); */ /* XXX: still not too sure about this - keeping same text is confusing... */
+ /* XXX: still not too sure about this - keeping same text is confusing... */
+ // RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
/* ----------------------------------------------------------- */
@@ -1628,6 +1626,27 @@ static void ANIM_OT_channels_ungroup(wmOperatorType *ot)
/* ******************** Delete Channel Operator *********************** */
+static void update_dependencies_on_delete(bAnimListElem *ale)
+{
+ ID *id = ale->id;
+ AnimData *adt = BKE_animdata_from_id(id);
+ /* TODO(sergey): Technically, if the animation element is being deleted
+ * from a driver we don't have to tag action. This is something we can check
+ * for in the future. For now just do most reliable tag whic hwas always
+ * happening. */
+ if (adt != NULL) {
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+ if (adt->action != NULL) {
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+ /* Deals with NLA and drivers.
+ * Doesn't cause overhead for action updates, since object will receive
+ * animation update after dependency graph flushes update from action to
+ * all its users. */
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+}
+
static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1672,8 +1691,10 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
}
/* free the group itself */
- if (adt->action)
+ if (adt->action) {
BLI_freelinkN(&adt->action->groups, agrp);
+ DEG_id_tag_update_ex(CTX_data_main(C), &adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
else
MEM_freeN(agrp);
}
@@ -1698,6 +1719,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* try to free F-Curve */
ANIM_fcurve_delete_from_animdata(&ac, adt, fcu);
+ update_dependencies_on_delete(ale);
break;
}
case ANIMTYPE_NLACURVE:
@@ -1719,6 +1741,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* unlink and free the F-Curve */
BLI_remlink(&strip->fcurves, fcu);
free_fcurve(fcu);
+ update_dependencies_on_delete(ale);
break;
}
case ANIMTYPE_GPLAYER:
@@ -1729,6 +1752,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* try to delete the layer's data and the layer itself */
BKE_gpencil_layer_delete(gpd, gpl);
+ ale->update = ANIM_UPDATE_DEPS;
break;
}
case ANIMTYPE_MASKLAYER:
@@ -1777,7 +1801,7 @@ static const EnumPropertyItem prop_animchannel_setflag_types[] = {
{ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""},
{ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""},
{ACHANNEL_SETFLAG_INVERT, "INVERT", 0, "Invert", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* defines for set animation-channel settings */
@@ -1785,7 +1809,7 @@ static const EnumPropertyItem prop_animchannel_setflag_types[] = {
static const EnumPropertyItem prop_animchannel_settings_types[] = {
{ACHANNEL_SETTING_PROTECT, "PROTECT", 0, "Protect", ""},
{ACHANNEL_SETTING_MUTE, "MUTE", 0, "Mute", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1821,7 +1845,7 @@ static void setflag_anim_channels(bAnimContext *ac, eAnimChannel_Settings settin
* - but for Graph Editor, this gets used also from main region
* where hierarchy doesn't apply [#21276]
*/
- if ((ac->spacetype == SPACE_IPO) && (ac->regiontype != RGN_TYPE_CHANNELS)) {
+ if ((ac->spacetype == SPACE_GRAPH) && (ac->regiontype != RGN_TYPE_CHANNELS)) {
/* graph editor (case 2) */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
}
@@ -2200,7 +2224,7 @@ static bool animchannels_enable_poll(bContext *C)
return 0;
/* animation editor test - Action/Dopesheet/etc. and Graph only */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH) == 0)
return 0;
return 1;
@@ -2272,7 +2296,7 @@ static bool animchannels_find_poll(bContext *C)
return 0;
/* animation editor with dopesheet */
- return ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA);
+ return ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA);
}
/* find_invoke() - Get initial channels */
@@ -2731,7 +2755,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
/* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */
if (ob != CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -2940,7 +2964,8 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
BKE_gpencil_layer_setactive(gpd, gpl);
}
- WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); /* Grease Pencil updates */
+ /* Grease Pencil updates */
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL);
notifierFlags |= (ND_ANIMCHAN | NA_EDITED); /* Animation Editors updates */
break;
}
@@ -3010,17 +3035,24 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
v2d = &ar->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
- if (RNA_boolean_get(op->ptr, "extend"))
+ if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
- else if (RNA_boolean_get(op->ptr, "children_only"))
- selectmode = -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */
- else
+ }
+ else if (RNA_boolean_get(op->ptr, "children_only")) {
+ /* this is a bit of a special case for ActionGroups only...
+ * should it be removed or extended to all instead? */
+ selectmode = -1;
+ }
+ else {
selectmode = SELECT_REPLACE;
+ }
/* figure out which channel user clicked in
- * Note: although channels technically start at (y = ACHANNEL_FIRST), we need to adjust by half a channel's height
- * so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
- * ACHANNEL_HEIGHT_HALF.
+ *
+ * Note:
+ * although channels technically start at (y = ACHANNEL_FIRST),
+ * we need to adjust by half a channel's height so that the tops of channels get caught ok.
+ * Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use ACHANNEL_HEIGHT_HALF.
*/
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP(&ac), 0, (float)ACHANNEL_HEIGHT_HALF(&ac), x, y, NULL, &channel_index);
@@ -3051,7 +3083,7 @@ static void ANIM_OT_channels_click(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- /* NOTE: don't save settings, otherwise, can end up with some weird behaviour (sticky extend) */
+ /* NOTE: don't save settings, otherwise, can end up with some weird behavior (sticky extend) */
prop = RNA_def_boolean(ot->srna, "extend", false, "Extend Select", ""); // SHIFTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index b69d93aaacf..7bef42d8682 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_deps.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -77,7 +70,6 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
/* tag AnimData for refresh so that other views will update in realtime with these changes */
adt = BKE_animdata_from_id(id);
if (adt) {
- adt->recalc |= ADT_RECALC_ANIM;
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
if (adt->action != NULL) {
DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
@@ -117,13 +109,6 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
void ANIM_id_update(Main *bmain, ID *id)
{
if (id) {
- AnimData *adt = BKE_animdata_from_id(id);
-
- /* tag AnimData for refresh so that other views will update in realtime with these changes */
- if (adt)
- adt->recalc |= ADT_RECALC_ANIM;
-
- /* set recalc flags */
DEG_id_tag_update_ex(bmain, id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); // XXX or do we want something more restrictive?
}
}
@@ -199,7 +184,7 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
}
/* perform syncing updates for F-Curves */
-static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **active_fcurve)
+static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale, FCurve **active_fcurve)
{
FCurve *fcu = (FCurve *)ale->data;
ID *owner_id = ale->id;
@@ -210,50 +195,7 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
if (ELEM(NULL, fcu, fcu->rna_path, owner_id))
return;
- if (GS(owner_id->name) == ID_OB) {
- Object *ob = (Object *)owner_id;
-
- /* only affect if F-Curve involves pose.bones */
- if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
- bArmature *arm = (bArmature *)ob->data;
- bPoseChannel *pchan;
- char *bone_name;
-
- /* get bone-name, and check if this bone is selected */
- bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
- if (bone_name) MEM_freeN(bone_name);
-
- /* F-Curve selection depends on whether the bone is selected */
- if ((pchan) && (pchan->bone)) {
- /* F-Curve selection */
- if (pchan->bone->flag & BONE_SELECTED)
- fcu->flag |= FCURVE_SELECTED;
- else
- fcu->flag &= ~FCURVE_SELECTED;
-
- /* Active F-Curve - it should be the first one for this bone on the
- * active object to be considered as active
- */
- if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
- /* if no previous F-Curve has active flag, then we're the first and only one to get it */
- if (*active_fcurve == NULL) {
- fcu->flag |= FCURVE_ACTIVE;
- *active_fcurve = fcu;
- }
- else {
- /* someone else has already taken it - set as not active */
- fcu->flag &= ~FCURVE_ACTIVE;
- }
- }
- else {
- /* this can't possibly be active now */
- fcu->flag &= ~FCURVE_ACTIVE;
- }
- }
- }
- }
- else if (GS(owner_id->name) == ID_SCE) {
+ if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
/* only affect if F-Curve involves sequence_editor.sequences */
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 239ab5f8206..2b168aa9463 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_draw.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
#include "BLI_sys_types.h"
@@ -175,7 +168,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30);
- //immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); /* XXX: Fix this hardcoded color (anim_active) */
+ /* XXX: Fix this hardcoded color (anim_active) */
+ //immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f);
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA + end_frame_width) {
@@ -285,7 +279,8 @@ static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply", i.e. mapping points to NLA-mapped global time */
+/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply",
+ * i.e. mapping points to NLA-mapped global time */
static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
{
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
@@ -336,8 +331,8 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, boo
/* Get flags used for normalization in ANIM_unit_mapping_get_factor. */
short ANIM_get_normalization_flags(bAnimContext *ac)
{
- if (ac->sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *) ac->sl;
+ if (ac->sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *) ac->sl;
bool use_normalization = (sipo->flag & SIPO_NORMALIZE) != 0;
bool freeze_normalization = (sipo->flag & SIPO_NORMALIZE_FREEZE) != 0;
return use_normalization
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 2d528a0f0b9..5a0deaddb35 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (original author)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_filter.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -54,7 +47,7 @@
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_cachefile_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_key_types.h"
@@ -119,7 +112,7 @@ static void animedit_get_yscale_factor(bAnimContext *ac)
* NOTE: This theme setting doesn't have an ID, as it cannot be accessed normally
* since it is a float, and the theme settings methods can only handle chars.
*/
- ac->yscale_fac = btheme->tact.keyframe_scale_fac;
+ ac->yscale_fac = btheme->space_action.keyframe_scale_fac;
/* clamp to avoid problems with uninitialised values... */
if (ac->yscale_fac < 0.1f)
@@ -276,7 +269,7 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
/* ----------- Private Stuff - Graph Editor ------------- */
/* Get data being edited in Graph Editor (depending on current 'mode') */
-static bool graphedit_get_context(bAnimContext *ac, SpaceIpo *sipo)
+static bool graphedit_get_context(bAnimContext *ac, SpaceGraph *sipo)
{
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
@@ -365,9 +358,9 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac)
ok = actedit_get_context(ac, saction);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
ok = graphedit_get_context(ac, sipo);
break;
}
@@ -546,11 +539,11 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
* ! This causes the calling function to return early if we're only "peeking" for channels
*/
// XXX: ale_statement stuff is really a hack for one special case. It shouldn't really be needed...
-#define ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, ale_statement) \
+#define ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \
if (filter_mode & ANIMFILTER_TMP_PEEK) \
return 1; \
else { \
- bAnimListElem *ale = make_new_animlistelem(channel_data, channel_type, (ID *)owner_id); \
+ bAnimListElem *ale = make_new_animlistelem(channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \
if (ale) { \
BLI_addtail(anim_data, ale); \
items ++; \
@@ -558,8 +551,8 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
} \
} (void)0
-#define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id) \
- ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, {})
+#define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id, fcurve_owner_id) \
+ ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, fcurve_owner_id, {})
/* ............................... */
@@ -591,7 +584,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
/* this function allocates memory for a new bAnimListElem struct for the
* provided animation channel-data.
*/
-static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owner_id)
+static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owner_id, ID *fcurve_owner_id)
{
bAnimListElem *ale = NULL;
@@ -605,6 +598,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
ale->id = owner_id;
ale->adt = BKE_animdata_from_id(owner_id);
+ ale->fcurve_owner_id = fcurve_owner_id;
/* do specifics */
switch (datatype) {
@@ -678,7 +672,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
}
case ANIMTYPE_DSLAM:
{
- Lamp *la = (Lamp *)data;
+ Light *la = (Light *)data;
AnimData *adt = la->adt;
ale->flag = FILTER_LAM_OBJD(la);
@@ -907,7 +901,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
break;
}
case ANIMTYPE_FCURVE:
- case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE. Differences are applied post-creation */
+ case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE.
+ * Differences are applied post-creation */
{
FCurve *fcu = (FCurve *)data;
@@ -1000,7 +995,8 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
if (fcu->grp != NULL && fcu->grp->flag & ADT_CURVES_ALWAYS_VISIBLE) {
return false;
}
- /* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
+ /* hidden items should be skipped if we only care about visible data,
+ * but we aren't interested in hidden stuff */
const bool skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
if (GS(owner_id->name) == ID_OB) {
@@ -1249,7 +1245,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
FCurve *first, eAnim_ChannelType fcurve_type,
int filter_mode,
- void *owner, ID *owner_id)
+ void *owner, ID *owner_id, ID *fcurve_owner_id)
{
FCurve *fcu;
size_t items = 0;
@@ -1265,15 +1261,16 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
*/
for (fcu = first; ( (fcu = animfilter_fcurve_next(ads, fcu, fcurve_type, filter_mode, owner, owner_id)) ); fcu = fcu->next) {
if (UNLIKELY(fcurve_type == ANIMTYPE_NLACURVE)) {
- /* NLA Control Curve - Basically the same as normal F-Curves, except we need to set some stuff differently */
- ANIMCHANNEL_NEW_CHANNEL_FULL(fcu, ANIMTYPE_NLACURVE, owner_id, {
+ /* NLA Control Curve - Basically the same as normal F-Curves,
+ * except we need to set some stuff differently */
+ ANIMCHANNEL_NEW_CHANNEL_FULL(fcu, ANIMTYPE_NLACURVE, owner_id, fcurve_owner_id, {
ale->owner = owner; /* strip */
ale->adt = NULL; /* to prevent time mapping from causing problems */
});
}
else {
/* Normal FCurve */
- ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id, fcurve_owner_id);
}
}
@@ -1281,7 +1278,7 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
return items;
}
-static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id)
+static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, bActionGroup *agrp, int filter_mode, ID *owner_id)
{
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
@@ -1294,8 +1291,11 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
* - Hierarchy matters: this hack should be applied
* - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack
*/
- if ( ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) && /* care about hierarchy but group isn't expanded */
- (filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) ) /* care about selection status */
+ if (
+ /* care about hierarchy but group isn't expanded */
+ ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) &&
+ /* care about selection status */
+ (filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) )
{
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@@ -1317,9 +1317,9 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
{
/* special filter so that we can get just the F-Curves within the active group */
if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) {
- /* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
- * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
- * all its sub-curves to be shown
+ /* for the Graph Editor, curves may be set to not be visible in the view to lessen
+ * clutter, but to do this, we need to check that the group doesn't have it's
+ * not-visible flag set preventing all its sub-curves to be shown
*/
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) {
/* group must be editable for its children to be editable (if we care about this) */
@@ -1328,7 +1328,7 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
FCurve *first_fcu = animfilter_fcurve_next(ads, agrp->channels.first, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
/* filter list, starting from this F-Curve */
- tmp_items += animfilter_fcurves(&tmp_data, ads, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
+ tmp_items += animfilter_fcurves(&tmp_data, ads, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id, &act->id);
}
}
}
@@ -1342,9 +1342,10 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
/* restore original filter mode so that this next step works ok... */
//filter_mode = ofilter;
- /* filter selection of channel specially here again, since may be open and not subject to previous test */
+ /* filter selection of channel specially here again,
+ * since may be open and not subject to previous test */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
- ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id, NULL);
}
}
@@ -1384,7 +1385,7 @@ static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeShee
/* un-grouped F-Curves (only if we're not only considering those channels in the active group) */
if (!(filter_mode & ANIMFILTER_ACTGROUPED)) {
FCurve *firstfcu = (lastchan) ? (lastchan->next) : (act->curves.first);
- items += animfilter_fcurves(anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, NULL, owner_id);
+ items += animfilter_fcurves(anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, NULL, owner_id, &act->id);
}
/* return the number of items added to the list */
@@ -1417,7 +1418,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
* - as AnimData may not have an action, we pass a dummy pointer just to get the list elem created, then
* overwrite this with the real value - REVIEW THIS...
*/
- ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id,
+ ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id, NULL,
{
ale->data = adt->action ? adt->action : NULL;
});
@@ -1477,7 +1478,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
}
/* add the track now that it has passed all our tests */
- ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id, NULL);
}
}
}
@@ -1507,7 +1508,10 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* pass strip as the "owner", so that the name lookups (used while filtering) will resolve */
- tmp_items += animfilter_fcurves(&tmp_data, ads, strip->fcurves.first, ANIMTYPE_NLACURVE, filter_mode, strip, owner_id);
+ /* NLA tracks are coming from AnimData, so owner of f-curves
+ * is the same as owner of animation data. */
+ tmp_items += animfilter_fcurves(&tmp_data, ads, strip->fcurves.first, ANIMTYPE_NLACURVE,
+ filter_mode, strip, owner_id, owner_id);
}
}
}
@@ -1519,7 +1523,7 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* currently these channels cannot be selected, so they should be skipped */
if ((filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) == 0) {
- ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_NLACONTROLS, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_NLACONTROLS, owner_id, NULL);
}
}
@@ -1551,14 +1555,15 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope
{ /* AnimData */
/* specifically filter animdata block */
if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(adt)) ) {
- ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id);
+ ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id, NULL);
}
},
{ /* NLA */
items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id);
},
{ /* Drivers */
- items += animfilter_fcurves(anim_data, ads, adt->drivers.first, ANIMTYPE_FCURVE, filter_mode, NULL, id);
+ items += animfilter_fcurves(anim_data, ads, adt->drivers.first, ANIMTYPE_FCURVE,
+ filter_mode, NULL, id, id);
},
{ /* NLA Control Keyframes */
items += animfilter_nla_controls(anim_data, ads, adt, filter_mode, id);
@@ -1595,7 +1600,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
// TODO: consider 'active' too?
/* owner-id here must be key so that the F-Curve can be resolved... */
- ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key);
+ ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key, NULL);
}
}
}
@@ -1606,7 +1611,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
if (key->adt) {
if (filter_mode & ANIMFILTER_ANIMDATA) {
if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(key->adt)) ) {
- ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key);
+ ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key, NULL);
}
}
else if (key->adt->action) {
@@ -1638,10 +1643,8 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
if (name_matches_dopesheet_filter(ads, gpl->info) == false)
continue;
}
-
-
/* add to list */
- ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL);
}
}
}
@@ -1661,7 +1664,7 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
*/
if (filter_mode & ANIMFILTER_ANIMDATA) {
/* just add GPD as a channel - this will add everything needed */
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, gpd, NULL);
}
else {
ListBase tmp_data = {NULL, NULL};
@@ -1679,7 +1682,7 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* add gpd as channel too (if for drawing, and it has layers) */
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL, NULL);
}
/* now add the list of collected channels */
@@ -1756,7 +1759,8 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
else {
bGPdata *gpd;
- /* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */
+ /* Grab all Grease Pencil datablocks directly from main,
+ * but only those that seem to be useful somewhere */
for (gpd = ac->bmain->gpencil.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1)
@@ -1797,7 +1801,7 @@ static size_t animdata_filter_ds_gpencil(bAnimContext *ac, ListBase *anim_data,
/* check if filtering by active status */
// XXX: active check here needs checking
if (ANIMCHANNEL_ACTIVEOK(gpd)) {
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd, NULL);
}
}
@@ -1833,7 +1837,7 @@ static size_t animdata_filter_ds_cachefile(bAnimContext *ac, ListBase *anim_data
/* check if filtering by active status */
// XXX: active check here needs checking
if (ANIMCHANNEL_ACTIVEOK(cache_file)) {
- ANIMCHANNEL_NEW_CHANNEL(cache_file, ANIMTYPE_DSCACHEFILE, cache_file);
+ ANIMCHANNEL_NEW_CHANNEL(cache_file, ANIMTYPE_DSCACHEFILE, cache_file, NULL);
}
}
@@ -1863,7 +1867,7 @@ static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const i
/* active... */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (masklay_act == masklay)) {
/* add to list */
- ANIMCHANNEL_NEW_CHANNEL(masklay, ANIMTYPE_MASKLAYER, mask);
+ ANIMCHANNEL_NEW_CHANNEL(masklay, ANIMTYPE_MASKLAYER, mask, NULL);
}
}
}
@@ -1899,8 +1903,8 @@ static size_t animdata_filter_mask(Main *bmain, ListBase *anim_data, void *UNUSE
if (tmp_items) {
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
- /* add gpd as channel too (if for drawing, and it has layers) */
- ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL);
+ /* add mask datablock as channel too (if for drawing, and it has layers) */
+ ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL, NULL);
}
/* now add the list of collected channels */
@@ -1935,7 +1939,7 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ntree)) {
- ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id, NULL);
}
}
@@ -2018,7 +2022,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(linestyle)) {
- ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce);
+ ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce, NULL);
}
}
@@ -2063,7 +2067,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(tex)) {
- ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id, NULL);
}
}
@@ -2078,7 +2082,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
}
/* NOTE: owner_id is the direct owner of the texture stack in question
- * It used to be Material/Lamp/World before the Blender Internal removal for 2.8
+ * It used to be Material/Light/World before the Blender Internal removal for 2.8
*/
static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode)
{
@@ -2147,7 +2151,7 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data,
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ma)) {
- ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
+ ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma, NULL);
}
}
@@ -2321,7 +2325,7 @@ static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(psys->part)) {
- ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part);
+ ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part, NULL);
}
}
@@ -2359,9 +2363,9 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
expanded = FILTER_CAM_OBJD(ca);
break;
}
- case OB_LAMP: /* ---------- Lamp ----------- */
+ case OB_LAMP: /* ---------- Light ----------- */
{
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
if (ads->filterflag & ADS_FILTER_NOLAM)
return 0;
@@ -2445,9 +2449,9 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
/* sub-data filtering... */
switch (ob->type) {
- case OB_LAMP: /* lamp - textures + nodetree */
+ case OB_LAMP: /* light - textures + nodetree */
{
- Lamp *la = ob->data;
+ Light *la = ob->data;
bNodeTree *ntree = la->nodetree;
/* nodetree */
@@ -2465,7 +2469,7 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(iat)) {
- ANIMCHANNEL_NEW_CHANNEL(iat, type, iat);
+ ANIMCHANNEL_NEW_CHANNEL(iat, type, iat, NULL);
}
}
@@ -2499,7 +2503,7 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
/* include key-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (ANIMCHANNEL_ACTIVEOK(key)) {
- ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob);
+ ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob, NULL);
}
}
@@ -2556,7 +2560,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (type != ANIMTYPE_NONE) {
/* NOTE: active-status (and the associated checks) don't apply here... */
- ANIMCHANNEL_NEW_CHANNEL(cdata, type, ob);
+ ANIMCHANNEL_NEW_CHANNEL(cdata, type, ob, NULL);
}
}
@@ -2632,7 +2636,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
if (ANIMCHANNEL_SELOK((base->flag & BASE_SELECTED))) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ob)) {
- ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob);
+ ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob, NULL);
}
}
}
@@ -2671,7 +2675,7 @@ static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bD
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(wo)) {
- ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce);
+ ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce, NULL);
}
}
@@ -2726,7 +2730,7 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (type != ANIMTYPE_NONE) {
/* NOTE: active-status (and the associated checks) don't apply here... */
- ANIMCHANNEL_NEW_CHANNEL(cdata, type, sce);
+ ANIMCHANNEL_NEW_CHANNEL(cdata, type, sce, NULL);
}
}
@@ -2789,7 +2793,7 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
/* check if filtering by selection */
if (ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED))) {
/* NOTE: active-status doesn't matter for this! */
- ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce);
+ ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce, NULL);
}
}
@@ -2821,7 +2825,7 @@ static size_t animdata_filter_ds_movieclip(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(clip)) {
- ANIMCHANNEL_NEW_CHANNEL(clip, ANIMTYPE_DSMCLIP, clip);
+ ANIMCHANNEL_NEW_CHANNEL(clip, ANIMTYPE_DSMCLIP, clip, NULL);
}
}
/* now add the list of collected channels */
@@ -2976,9 +2980,11 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
}
/* Cache files level animations (frame duration and such). */
- CacheFile *cache_file = ac->bmain->cachefiles.first;
- for (; cache_file; cache_file = cache_file->id.next) {
- items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
+ if (!(ads->filterflag2 & ADS_FILTER_NOCACHEFILES) && !(ads->filterflag & ADS_FILTER_ONLYSEL)) {
+ CacheFile *cache_file = ac->bmain->cachefile.first;
+ for (; cache_file; cache_file = cache_file->id.next) {
+ items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
+ }
}
/* movie clip's animation */
@@ -2991,7 +2997,7 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
* to make it easier to predict where items are in the hierarchy
* - This order only really matters if we need to show all channels in the list (e.g. for drawing)
* (XXX: What about lingering "active" flags? The order may now become unpredictable)
- * - Don't do this if this behaviour has been turned off (i.e. due to it being too slow)
+ * - Don't do this if this behavior has been turned off (i.e. due to it being too slow)
* - Don't do this if there's just a single object
*/
if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && !(ads->flag & ADS_FLAG_NO_DB_SORT) &&
@@ -3057,7 +3063,7 @@ static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_
* - only useful for DopeSheet/Action/etc. editors where it is actually useful
*/
if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
- bAnimListElem *ale = make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL);
+ bAnimListElem *ale = make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL, NULL);
if (ale) {
BLI_addtail(anim_data, ale);
(*items)++;
@@ -3198,7 +3204,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(obact->adt)) {
- ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact);
+ ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact, NULL);
}
}
else {
@@ -3217,7 +3223,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(key->adt)) {
- ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key);
+ ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key, NULL);
}
}
else {
@@ -3257,7 +3263,8 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
case ANIMCONT_NLA: /* NLA Editor */
{
- /* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */
+ /* all of these editors use the basic DopeSheet data for filtering options,
+ * but don't have all the same features */
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
break;
}
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index 73f2e85164b..af1fd0e31c4 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender (with some old code)
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_intern.h
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index d88a418fa06..03cc4855a4b 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2005. Full recode
- * Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_ipo_utils.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 74169128e5a..5d85a78905b 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_markers.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
#include <math.h>
@@ -57,8 +50,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_glutil.h"
-
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
@@ -377,11 +368,35 @@ static void draw_marker_name(
UI_fontstyle_draw_simple(fstyle, x, y, name, text_col);
}
+static void draw_marker_line(const float color[4], float x, float ymin, float ymax)
+{
+ GPUVertFormat *format = immVertexFormat();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+
+ float viewport_size[4];
+ GPU_viewport_size_get_f(viewport_size);
+ immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
+
+ immUniformColor4fv(color);
+ immUniform1i("colors_len", 0); /* "simple" mode */
+ immUniform1f("dash_width", 6.0f);
+ immUniform1f("dash_factor", 0.5f);
+
+ immBegin(GPU_PRIM_LINES, 2);
+ immVertex2f(pos, x, ymin);
+ immVertex2f(pos, x, ymax);
+ immEnd();
+
+ immUnbindProgram();
+}
+
/* function to draw markers */
static void draw_marker(
- View2D *v2d, const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int flag,
+ const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int flag,
/* avoid re-calculating each time */
- const float ypixels, const float xscale, const float yscale)
+ const float ypixels, const float xscale, int height)
{
const float xpos = marker->frame * xscale;
#ifdef DURIAN_CAMERA_SWITCH
@@ -401,31 +416,15 @@ static void draw_marker(
if (flag & DRAW_MARKERS_LINES)
#endif
{
- GPUVertFormat *format = immVertexFormat();
- uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
-
- immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
-
- float viewport_size[4];
- GPU_viewport_size_get_f(viewport_size);
- immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
-
+ float color[4];
if (marker->flag & SELECT) {
- immUniformColor4f(1.0f, 1.0f, 1.0f, 0.38f);
+ copy_v4_fl4(color, 1.0f, 1.0f, 1.0f, 0.38f);
}
else {
- immUniformColor4f(0.0f, 0.0f, 0.0f, 0.38f);
+ copy_v4_fl4(color, 0.0f, 0.0f, 0.0f, 0.38f);
}
- immUniform1i("colors_len", 0); /* "simple" mode */
- immUniform1f("dash_width", 6.0f);
- immUniform1f("dash_factor", 0.5f);
-
- immBegin(GPU_PRIM_LINES, 2);
- immVertex2f(pos, xpos + 0.5f, 12.0f);
- immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
- immEnd();
- immUnbindProgram();
+ draw_marker_line(color, xpos, yoffs + 1.5f * UI_DPI_ICON_SIZE, height);
}
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
@@ -445,7 +444,7 @@ static void draw_marker(
ICON_MARKER;
}
- UI_icon_draw(xpos - 0.45f * UI_DPI_ICON_SIZE, yoffs + UI_DPI_ICON_SIZE, icon_id);
+ UI_icon_draw(xpos - 0.55f * UI_DPI_ICON_SIZE, yoffs + UI_DPI_ICON_SIZE, icon_id);
GPU_blend(false);
@@ -486,6 +485,7 @@ void ED_markers_draw(const bContext *C, int flag)
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
+ int height = v2d->mask.ymax - v2d->mask.ymin;
if (flag & DRAW_MARKERS_MARGIN) {
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -524,8 +524,8 @@ void ED_markers_draw(const bContext *C, int flag)
if ((marker->frame >= v2d_clip_range_x[0]) &&
(marker->frame <= v2d_clip_range_x[1]))
{
- draw_marker(v2d, fstyle, marker, scene->r.cfra, flag,
- ypixels, xscale, yscale);
+ draw_marker(fstyle, marker, scene->r.cfra, flag,
+ ypixels, xscale, height);
}
}
}
@@ -616,7 +616,8 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wm
BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!");
- /* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
+ /* unless successful, must add "pass-through"
+ * to let normal operator's have a chance at tackling this event */
if ((retval & (OPERATOR_FINISHED | OPERATOR_INTERFACE)) == 0) {
retval |= OPERATOR_PASS_THROUGH;
}
@@ -707,7 +708,6 @@ static void MARKER_OT_add(wmOperatorType *ot)
* invoke() calls init, adds modal handler
*
* modal() accept modal events while doing it, ends with apply and exit, or cancel
- *
*/
typedef struct MarkerMove {
@@ -722,7 +722,7 @@ static bool ed_marker_move_use_time(MarkerMove *mm)
{
if (((mm->slink->spacetype == SPACE_SEQ) && !(((SpaceSeq *)mm->slink)->flag & SEQ_DRAWFRAMES)) ||
((mm->slink->spacetype == SPACE_ACTION) && (((SpaceAction *)mm->slink)->flag & SACTION_DRAWTIME)) ||
- ((mm->slink->spacetype == SPACE_IPO) && !(((SpaceIpo *)mm->slink)->flag & SIPO_DRAWTIME)) ||
+ ((mm->slink->spacetype == SPACE_GRAPH) && !(((SpaceGraph *)mm->slink)->flag & SIPO_DRAWTIME)) ||
((mm->slink->spacetype == SPACE_NLA) && !(((SpaceNla *)mm->slink)->flag & SNLA_DRAWTIME)))
{
return true;
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 8914cf9492c..b4e60d29a40 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_ops.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -79,7 +72,7 @@ static bool change_frame_poll(bContext *C)
if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
return true;
}
- else if (sa->spacetype == SPACE_IPO) {
+ else if (sa->spacetype == SPACE_GRAPH) {
/* NOTE: Graph Editor has special version which does some extra stuff.
* No need to show the generic error message for that case though!
*/
@@ -294,7 +287,7 @@ static bool anim_set_end_frames_poll(bContext *C)
* this shouldn't show up in 3D editor (or others without 2D timeline view) via search
*/
if (sa) {
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
return true;
}
}
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index ac57f77bac9..d726c25816b 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/drivers.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -329,7 +321,8 @@ int ANIM_add_driver_with_target(
/* handle curve-property mappings based on mapping_type */
switch (mapping_type) {
- case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible, then use the first one */
+ case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible,
+ * then use the first one */
{
/* Use the shorter of the two (to avoid out of bounds access) */
int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;
@@ -772,7 +765,7 @@ EnumPropertyItem prop_driver_create_mapping_types[] = {
"Create drivers for all properties without assigning any targets yet"},
{CREATEDRIVER_MAPPING_NONE, "NONE_SINGLE", 0, "Manually Create Later (Single)",
"Create driver for this property only and without assigning any targets yet"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Filtering callback for driver mapping types enum */
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 3136b3e7137..40454bcad0c 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/fmodifier_ui.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -50,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -64,6 +58,8 @@
#include "ED_anim_api.h"
#include "ED_undo.h"
+#include "DEG_depsgraph.h"
+
/* ********************************************** */
/* UI STUFF */
@@ -86,9 +82,14 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED
}
/* callback to remove the given modifier */
-static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
+typedef struct FModifierDeleteContext {
+ ID *fcurve_owner_id;
+ ListBase *modifiers;
+} FModifierDeleteContext;
+static void delete_fmodifier_cb(bContext *C, void *ctx_v, void *fcm_v)
{
- ListBase *modifiers = (ListBase *)fmods_v;
+ FModifierDeleteContext *ctx = (FModifierDeleteContext *)ctx_v;
+ ListBase *modifiers = ctx->modifiers;
FModifier *fcm = (FModifier *)fcm_v;
/* remove the given F-Modifier from the active modifier-stack */
@@ -99,12 +100,13 @@ static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
/* send notifiers */
// XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ DEG_id_tag_update(ctx->fcurve_owner_id, ID_RECALC_COPY_ON_WRITE);
}
/* --------------- */
/* draw settings for generator modifier */
-static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__generator(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short width)
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
uiLayout /* *col, */ /* UNUSED */ *row;
@@ -114,7 +116,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
short bwidth = width - 1.5 * UI_UNIT_X; /* max button width */
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* basic settings (backdrop + mode selector + some padding) */
/* col = uiLayoutColumn(layout, true); */ /* UNUSED */
@@ -252,13 +254,13 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* --------------- */
/* draw settings for generator modifier */
-static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__fn_generator(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* add the settings */
col = uiLayoutColumn(layout, true);
@@ -275,13 +277,13 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
/* --------------- */
/* draw settings for cycles modifier */
-static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__cycles(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierCycles, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierCycles, fcm, &ptr);
/* split into 2 columns
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
@@ -304,13 +306,13 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for noise modifier */
-static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__noise(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierNoise, fcm, &ptr);
/* blending mode */
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
@@ -349,9 +351,11 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
bool exists;
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
- /* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
- if (exists)
+ /* binarysearch_...() will set exists by default to 0,
+ * so if it is non-zero, that means that the point exists already */
+ if (exists) {
return;
+ }
/* add new */
fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
@@ -413,7 +417,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
}
/* draw settings for envelope modifier */
-static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__envelope(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
@@ -424,7 +428,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
int i;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierEnvelope, fcm, &ptr);
/* general settings */
col = uiLayoutColumn(layout, true);
@@ -473,13 +477,13 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* --------------- */
/* draw settings for limits modifier */
-static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__limits(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col /* , *row */ /* UNUSED */;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierLimits, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierLimits, fcm, &ptr);
/* row 1: minimum */
{
@@ -521,13 +525,13 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for stepped interpolation modifier */
-static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__stepped(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col, *sub;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierStepped, fcm, &ptr);
/* block 1: "stepping" settings */
col = uiLayoutColumn(layout, false);
@@ -553,7 +557,8 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *fcurve_owner_id,
+ ListBase *modifiers, FModifier *fcm)
{
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *sub, *col;
@@ -563,7 +568,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifier, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifier, fcm, &ptr);
/* draw header */
{
@@ -604,7 +609,10 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* delete button */
but = uiDefIconBut(block, UI_BTYPE_BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
- UI_but_func_set(but, delete_fmodifier_cb, modifiers, fcm);
+ FModifierDeleteContext *ctx = MEM_mallocN(sizeof(FModifierDeleteContext), "fmodifier ctx");
+ ctx->fcurve_owner_id = fcurve_owner_id;
+ ctx->modifiers = modifiers;
+ UI_but_funcN_set(but, delete_fmodifier_cb, ctx, fcm);
UI_block_emboss_set(block, UI_EMBOSS);
}
@@ -617,31 +625,31 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* draw settings for individual modifiers */
switch (fcm->type) {
case FMODIFIER_TYPE_GENERATOR: /* Generator */
- draw_modifier__generator(box, id, fcm, width);
+ draw_modifier__generator(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_FN_GENERATOR: /* Built-In Function Generator */
- draw_modifier__fn_generator(box, id, fcm, width);
+ draw_modifier__fn_generator(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_CYCLES: /* Cycles */
- draw_modifier__cycles(box, id, fcm, width);
+ draw_modifier__cycles(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_ENVELOPE: /* Envelope */
- draw_modifier__envelope(box, id, fcm, width);
+ draw_modifier__envelope(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_LIMITS: /* Limits */
- draw_modifier__limits(box, id, fcm, width);
+ draw_modifier__limits(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_NOISE: /* Noise */
- draw_modifier__noise(box, id, fcm, width);
+ draw_modifier__noise(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_STEPPED: /* Stepped */
- draw_modifier__stepped(box, id, fcm, width);
+ draw_modifier__stepped(box, fcurve_owner_id, fcm, width);
break;
default: /* unknown type */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 72da71a8a0e..19ac0ea18a0 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_draw.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -557,7 +549,8 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
size *= 0.85f;
break;
- case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes (but by less than for breakdowns) */
+ case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes
+ * (but by less than for breakdowns) */
size *= 0.925f;
break;
@@ -942,9 +935,10 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, int saction_flag)
/* loop through each F-Curve, grabbing the keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
/* Why not use all #eAnim_KeyType here?
- * All of the other key types are actually "summaries" themselves, and will just end up duplicating stuff
- * that comes up through standard filtering of just F-Curves.
- * Given the way that these work, there isn't really any benefit at all from including them. - Aligorith */
+ * All of the other key types are actually "summaries" themselves,
+ * and will just end up duplicating stuff that comes up through
+ * standard filtering of just F-Curves. Given the way that these work,
+ * there isn't really any benefit at all from including them. - Aligorith */
switch (ale->datatype) {
case ALE_FCURVE:
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index e733bb0f8b7..837a25946da 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_edit.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -369,7 +363,8 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bA
return 0;
}
-/* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */
+/* This function is used to apply operation to all keyframes,
+ * regardless of the type without needed an AnimListElem wrapper */
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
/* sanity checks */
@@ -670,25 +665,35 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
{
/* eEditKeyframes_Validate */
switch (mode) {
- case BEZT_OK_FRAME: /* only if bezt falls on the right frame (float) */
+ case BEZT_OK_FRAME:
+ /* only if bezt falls on the right frame (float) */
return ok_bezier_frame;
- case BEZT_OK_FRAMERANGE: /* only if bezt falls within the specified frame range (floats) */
+ case BEZT_OK_FRAMERANGE:
+ /* only if bezt falls within the specified frame range (floats) */
return ok_bezier_framerange;
- case BEZT_OK_SELECTED: /* only if bezt is selected (self) */
+ case BEZT_OK_SELECTED:
+ /* only if bezt is selected (self) */
return ok_bezier_selected;
- case BEZT_OK_VALUE: /* only if bezt value matches (float) */
+ case BEZT_OK_VALUE:
+ /* only if bezt value matches (float) */
return ok_bezier_value;
- case BEZT_OK_VALUERANGE: /* only if bezier falls within the specified value range (floats) */
+ case BEZT_OK_VALUERANGE:
+ /* only if bezier falls within the specified value range (floats) */
return ok_bezier_valuerange;
- case BEZT_OK_REGION: /* only if bezier falls within the specified rect (data -> rectf) */
+ case BEZT_OK_REGION:
+ /* only if bezier falls within the specified rect (data -> rectf) */
return ok_bezier_region;
- case BEZT_OK_REGION_LASSO: /* only if the point falls within KeyframeEdit_LassoData defined data */
+ case BEZT_OK_REGION_LASSO:
+ /* only if the point falls within KeyframeEdit_LassoData defined data */
return ok_bezier_region_lasso;
- case BEZT_OK_REGION_CIRCLE: /* only if the point falls within KeyframeEdit_CircleData defined data */
+ case BEZT_OK_REGION_CIRCLE:
+ /* only if the point falls within KeyframeEdit_CircleData defined data */
return ok_bezier_region_circle;
- case BEZT_OK_CHANNEL_LASSO: /* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */
+ case BEZT_OK_CHANNEL_LASSO:
+ /* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */
return ok_bezier_channel_lasso;
- case BEZT_OK_CHANNEL_CIRCLE: /* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
+ case BEZT_OK_CHANNEL_CIRCLE:
+ /* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
return ok_bezier_channel_circle;
default: /* nothing was ok */
return NULL;
@@ -698,7 +703,10 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
/* ******************************************* */
/* Assorted Utility Functions */
-/* helper callback for <animeditor>_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
+/**
+ * Helper callback for <animeditor>_cfrasnap_exec() ->
+ * used to help get the average time of all selected beztriples
+ */
short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
@@ -718,7 +726,8 @@ short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-/* helper callback for columnselect_<animeditor>_keys() -> populate list CfraElems with frame numbers from selected beztriples */
+/* helper callback for columnselect_<animeditor>_keys() -> populate
+ * list CfraElems with frame numbers from selected beztriples */
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index df87e1b7a5f..d186a0bb757 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_general.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -48,7 +42,6 @@
#include "BKE_fcurve.h"
#include "BKE_report.h"
#include "BKE_main.h"
-#include "BKE_global.h"
#include "BKE_deform.h"
#include "RNA_access.h"
@@ -739,7 +732,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(
/* check that paths exist */
if (aci->rna_path && fcu->rna_path) {
/* find the property of the fcurve and compare against the end of the tAnimCopybufItem
- * more involved since it needs to to path lookups.
+ * more involved since it needs to do path lookups.
* This is not 100% reliable since the user could be editing the curves on a path that wont
* resolve, or a bone could be renamed after copying for eg. but in normal copy & paste
* this should work out ok.
@@ -904,14 +897,16 @@ const EnumPropertyItem rna_enum_keyframe_paste_offset_items[] = {
{KEYFRAME_PASTE_OFFSET_CFRA_END, "END", 0, "Frame End", "Paste keys ending at current frame"},
{KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, "RELATIVE", 0, "Frame Relative", "Paste keys relative to the current frame when copying"},
{KEYFRAME_PASTE_OFFSET_NONE, "NONE", 0, "No Offset", "Paste keys from original time"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
const EnumPropertyItem rna_enum_keyframe_paste_merge_items[] = {
{KEYFRAME_PASTE_MERGE_MIX, "MIX", 0, "Mix", "Overlay existing with new keys"},
{KEYFRAME_PASTE_MERGE_OVER, "OVER_ALL", 0, "Overwrite All", "Replace all keys"},
{KEYFRAME_PASTE_MERGE_OVER_RANGE, "OVER_RANGE", 0, "Overwrite Range", "Overwrite keys in pasted range"},
{KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL, "OVER_RANGE_ALL", 0, "Overwrite Entire Range", "Overwrite keys in pasted range, using the range of all copied keys"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/**
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index b93c2ae5c7b..1922b876d1e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframing.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -425,6 +417,9 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
fcu->totvert++;
}
+ else {
+ return -1;
+ }
}
/* no keyframes already, but can only add if...
* 1) keyframing modes say that keyframes can only be replaced, so adding new ones won't know
@@ -479,7 +474,7 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
/* set default handle types and interpolation mode */
if (flag & INSERTKEY_NO_USERPREF) {
- /* for Py-API, we want scripts to have predictable behaviour,
+ /* for Py-API, we want scripts to have predictable behavior,
* hence the option to not depend on the userpref defaults
*/
beztr.h1 = beztr.h2 = HD_AUTO_ANIM;
@@ -509,11 +504,15 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
* to these later, we want these to work in a sane way out of
* the box.
*/
- beztr.back = 1.70158f; /* "back" easing - this value used to be used when overshoot=0, but that */
- /* introduced discontinuities in how the param worked */
- beztr.amplitude = 0.8f; /* "elastic" easing - values here were hand-optimised for a default duration of */
- beztr.period = 4.1f; /* ~10 frames (typical mograph motion length) */
+ /* "back" easing - this value used to be used when overshoot=0, but that
+ * introduced discontinuities in how the param worked. */
+ beztr.back = 1.70158f;
+
+ /* "elastic" easing - values here were hand-optimised for a default duration of
+ * ~10 frames (typical mograph motion length) */
+ beztr.amplitude = 0.8f;
+ beztr.period = 4.1f;
/* add temp beztriple to keyframes */
a = insert_bezt_fcurve(fcu, &beztr, flag);
@@ -678,42 +677,73 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
/* ------------------ RNA Data-Access Functions ------------------ */
/* Try to read value using RNA-properties obtained already */
-static float setting_get_rna_value(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, int index, const bool get_evaluated)
+static float *setting_get_rna_values(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, const bool get_evaluated, float *buffer, int buffer_size, int *r_count)
{
- PointerRNA ptr_eval = *ptr;
- float value = 0.0f;
+ BLI_assert(buffer_size >= 1);
+
+ float *values = buffer;
+ PointerRNA ptr_eval;
if (get_evaluated) {
DEG_get_evaluated_rna_pointer(depsgraph, ptr, &ptr_eval);
+ ptr = &ptr_eval;
}
- switch (RNA_property_type(prop)) {
- case PROP_BOOLEAN:
- if (RNA_property_array_check(prop))
- value = (float)RNA_property_boolean_get_index(&ptr_eval, prop, index);
- else
- value = (float)RNA_property_boolean_get(&ptr_eval, prop);
- break;
- case PROP_INT:
- if (RNA_property_array_check(prop))
- value = (float)RNA_property_int_get_index(&ptr_eval, prop, index);
- else
- value = (float)RNA_property_int_get(&ptr_eval, prop);
- break;
- case PROP_FLOAT:
- if (RNA_property_array_check(prop))
- value = RNA_property_float_get_index(&ptr_eval, prop, index);
- else
- value = RNA_property_float_get(&ptr_eval, prop);
- break;
- case PROP_ENUM:
- value = (float)RNA_property_enum_get(&ptr_eval, prop);
- break;
- default:
- break;
+ if (RNA_property_array_check(prop)) {
+ int length = *r_count = RNA_property_array_length(ptr, prop);
+ bool *tmp_bool;
+ int *tmp_int;
+
+ if (length > buffer_size) {
+ values = MEM_malloc_arrayN(sizeof(float), length, __func__);
+ }
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ tmp_bool = MEM_malloc_arrayN(sizeof(*tmp_bool), length, __func__);
+ RNA_property_boolean_get_array(ptr, prop, tmp_bool);
+ for (int i = 0; i < length; i++) {
+ values[i] = (float)tmp_bool[i];
+ }
+ MEM_freeN(tmp_bool);
+ break;
+ case PROP_INT:
+ tmp_int = MEM_malloc_arrayN(sizeof(*tmp_int), length, __func__);
+ RNA_property_int_get_array(ptr, prop, tmp_int);
+ for (int i = 0; i < length; i++) {
+ values[i] = (float)tmp_int[i];
+ }
+ MEM_freeN(tmp_int);
+ break;
+ case PROP_FLOAT:
+ RNA_property_float_get_array(ptr, prop, values);
+ break;
+ default:
+ memset(values, 0, sizeof(float) * length);
+ }
+ }
+ else {
+ *r_count = 1;
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ *values = (float)RNA_property_boolean_get(ptr, prop);
+ break;
+ case PROP_INT:
+ *values = (float)RNA_property_int_get(ptr, prop);
+ break;
+ case PROP_FLOAT:
+ *values = RNA_property_float_get(ptr, prop);
+ break;
+ case PROP_ENUM:
+ *values = (float)RNA_property_enum_get(ptr, prop);
+ break;
+ default:
+ *values = 0.0f;
+ }
}
- return value;
+ return values;
}
/* ------------------ 'Visual' Keyframing Functions ------------------ */
@@ -869,8 +899,10 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
* In the event that it is not possible to perform visual keying, try to fall-back
* to using the default method. Assumes that all data it has been passed is valid.
*/
-static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, int array_index)
+static float *visualkey_get_values(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, float *buffer, int buffer_size, int *r_count)
{
+ BLI_assert(buffer_size >= 4);
+
const char *identifier = RNA_property_identifier(prop);
float tmat[4][4];
int rotmode;
@@ -888,7 +920,9 @@ static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, Property
/* Loc code is specific... */
if (strstr(identifier, "location")) {
- return ob_eval->obmat[3][array_index];
+ copy_v3_v3(buffer, ob_eval->obmat[3]);
+ *r_count = 3;
+ return buffer;
}
copy_m4_m4(tmat, ob_eval->obmat);
@@ -907,58 +941,162 @@ static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, Property
/* Loc code is specific... */
if (strstr(identifier, "location")) {
/* only use for non-connected bones */
- if ((pchan->bone->parent == NULL) || !(pchan->bone->flag & BONE_CONNECTED))
- return tmat[3][array_index];
+ if ((pchan->bone->parent == NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
+ copy_v3_v3(buffer, tmat[3]);
+ *r_count = 3;
+ return buffer;
+ }
}
}
else {
- return setting_get_rna_value(depsgraph, ptr, prop, array_index, true);
+ return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count);
}
/* Rot/Scale code are common! */
if (strstr(identifier, "rotation_euler")) {
- float eul[3];
+ mat4_to_eulO(buffer, rotmode, tmat);
- mat4_to_eulO(eul, rotmode, tmat);
- return eul[array_index];
+ *r_count = 3;
+ return buffer;
}
else if (strstr(identifier, "rotation_quaternion")) {
- float mat3[3][3], quat[4];
+ float mat3[3][3];
copy_m3_m4(mat3, tmat);
- mat3_to_quat_is_ok(quat, mat3);
+ mat3_to_quat_is_ok(buffer, mat3);
- return quat[array_index];
+ *r_count = 4;
+ return buffer;
}
else if (strstr(identifier, "rotation_axis_angle")) {
- float axis[3], angle;
-
- mat4_to_axis_angle(axis, &angle, tmat);
-
/* w = 0, x,y,z = 1,2,3 */
- if (array_index == 0)
- return angle;
- else
- return axis[array_index - 1];
+ mat4_to_axis_angle(buffer + 1, buffer, tmat);
+
+ *r_count = 4;
+ return buffer;
}
else if (strstr(identifier, "scale")) {
- float scale[3];
-
- mat4_to_size(scale, tmat);
+ mat4_to_size(buffer, tmat);
- return scale[array_index];
+ *r_count = 3;
+ return buffer;
}
/* as the function hasn't returned yet, read value from system in the default way */
- return setting_get_rna_value(depsgraph, ptr, prop, array_index, true);
+ return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count);
}
/* ------------------------- Insert Key API ------------------------- */
+/* Retrieve current property values to keyframe, possibly applying NLA correction when necessary. */
+static float *get_keyframe_values(
+ Depsgraph *depsgraph, ReportList *reports, PointerRNA ptr, PropertyRNA *prop, int index,
+ struct NlaKeyframingContext *nla_context, eInsertKeyFlags flag,
+ float *buffer, int buffer_size, int *r_count, bool *r_force_all)
+{
+ float *values;
+
+ if ( (flag & INSERTKEY_MATRIX) &&
+ (visualkey_can_use(&ptr, prop)) )
+ {
+ /* visual-keying is only available for object and pchan datablocks, as
+ * it works by keyframing using a value extracted from the final matrix
+ * instead of using the kt system to extract a value.
+ */
+ values = visualkey_get_values(depsgraph, &ptr, prop, buffer, buffer_size, r_count);
+ }
+ else {
+ /* read value from system */
+ values = setting_get_rna_values(depsgraph, &ptr, prop, false, buffer, buffer_size, r_count);
+ }
+
+ /* adjust the value for NLA factors */
+ if (!BKE_animsys_nla_remap_keyframe_values(nla_context, &ptr, prop, values, *r_count, index, r_force_all)) {
+ BKE_report(reports, RPT_ERROR, "Could not insert keyframe due to zero NLA influence or base value");
+
+ if (values != buffer) {
+ MEM_freeN(values);
+ }
+ return NULL;
+ }
+
+ return values;
+}
+
+/* Insert the specified keyframe value into a single F-Curve. */
+static bool insert_keyframe_value(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, FCurve *fcu, float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
+{
+ /* F-Curve not editable? */
+ if (fcurve_is_keyframable(fcu) == 0) {
+ BKE_reportf(reports, RPT_ERROR,
+ "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
+ "and try removing F-Modifiers",
+ fcu->rna_path, fcu->array_index);
+ return false;
+ }
+
+ /* adjust frame on which to add keyframe */
+ if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
+ PathResolvedRNA anim_rna;
+
+ if (RNA_path_resolved_create(ptr, prop, fcu->array_index, &anim_rna)) {
+ /* for making it easier to add corrective drivers... */
+ cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, cfra);
+ }
+ else {
+ cfra = 0.0f;
+ }
+ }
+
+ /* adjust coordinates for cycle aware insertion */
+ if (flag & INSERTKEY_CYCLE_AWARE) {
+ if (remap_cyclic_keyframe_location(fcu, &cfra, &curval) != FCU_CYCLE_PERFECT) {
+ /* inhibit action from insert_vert_fcurve unless it's a perfect cycle */
+ flag &= ~INSERTKEY_CYCLE_AWARE;
+ }
+ }
+
+ /* only insert keyframes where they are needed */
+ if (flag & INSERTKEY_NEEDED) {
+ short insert_mode;
+
+ /* check whether this curve really needs a new keyframe */
+ insert_mode = new_key_needed(fcu, cfra, curval);
+
+ /* only return success if keyframe added */
+ if (insert_mode == KEYNEEDED_DONTADD) {
+ return false;
+ }
+
+ /* insert new keyframe at current frame */
+ if (insert_vert_fcurve(fcu, cfra, curval, keytype, flag) < 0) {
+ return false;
+ }
+
+ /* delete keyframe immediately before/after newly added */
+ switch (insert_mode) {
+ case KEYNEEDED_DELPREV:
+ delete_fcurve_key(fcu, fcu->totvert - 2, 1);
+ break;
+ case KEYNEEDED_DELNEXT:
+ delete_fcurve_key(fcu, 1, 1);
+ break;
+ }
+
+ return true;
+ }
+ else {
+ /* just insert keyframe */
+ return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0;
+ }
+}
+
/* Secondary Keyframing API call:
* Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
* data being keyframed, and a pointer to the F-Curve to use have both been provided.
*
+ * This function can't keyframe quaternion channels on some NLA strip types.
+ *
* keytype is the "keyframe type" (eBezTriple_KeyframeType), as shown in the Dope Sheet.
*
* The flag argument is used for special settings that alter the behavior of
@@ -974,14 +1112,6 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN
BKE_report(reports, RPT_ERROR, "No F-Curve to add keyframes to");
return false;
}
- /* F-Curve not editable? */
- if (fcurve_is_keyframable(fcu) == 0) {
- BKE_reportf(reports, RPT_ERROR,
- "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
- "and try removing F-Modifiers",
- fcu->rna_path, fcu->array_index);
- return false;
- }
/* if no property given yet, try to validate from F-Curve info */
if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
@@ -1007,86 +1137,70 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN
}
}
- /* update F-Curve flags to ensure proper behaviour for property type */
+ /* update F-Curve flags to ensure proper behavior for property type */
update_autoflags_fcurve_direct(fcu, prop);
- /* adjust frame on which to add keyframe */
- if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
- PathResolvedRNA anim_rna;
+ /* Obtain the value to insert. */
+ float value_buffer[RNA_MAX_ARRAY_LENGTH];
+ int value_count;
+ int index = fcu->array_index;
- if (RNA_path_resolved_create(&ptr, prop, fcu->array_index, &anim_rna)) {
- /* for making it easier to add corrective drivers... */
- cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, cfra);
- }
- else {
- cfra = 0.0f;
- }
- }
-
- /* obtain value to give keyframe */
- if ( (flag & INSERTKEY_MATRIX) &&
- (visualkey_can_use(&ptr, prop)) )
- {
- /* visual-keying is only available for object and pchan datablocks, as
- * it works by keyframing using a value extracted from the final matrix
- * instead of using the kt system to extract a value.
- */
- curval = visualkey_get_value(depsgraph, &ptr, prop, fcu->array_index);
- }
- else {
- /* read value from system */
- curval = setting_get_rna_value(depsgraph, &ptr, prop, fcu->array_index, false);
- }
+ float *values = get_keyframe_values(depsgraph, reports, ptr, prop, index, nla_context, flag,
+ value_buffer, RNA_MAX_ARRAY_LENGTH, &value_count, NULL);
- /* adjust the value for NLA factors */
- if (!BKE_animsys_nla_remap_keyframe_value(nla_context, &ptr, prop, fcu->array_index, &curval)) {
- BKE_report(reports, RPT_ERROR, "Could not insert keyframe due to zero NLA influence or base value");
+ if (values == NULL) {
+ /* This happens if NLA rejects this insertion. */
return false;
}
- /* adjust coordinates for cycle aware insertion */
- if (flag & INSERTKEY_CYCLE_AWARE) {
- if (remap_cyclic_keyframe_location(fcu, &cfra, &curval) != FCU_CYCLE_PERFECT) {
- /* inhibit action from insert_vert_fcurve unless it's a perfect cycle */
- flag &= ~INSERTKEY_CYCLE_AWARE;
- }
+ if (index >= 0 && index < value_count) {
+ curval = values[index];
}
- /* only insert keyframes where they are needed */
- if (flag & INSERTKEY_NEEDED) {
- short insert_mode;
-
- /* check whether this curve really needs a new keyframe */
- insert_mode = new_key_needed(fcu, cfra, curval);
+ if (values != value_buffer) {
+ MEM_freeN(values);
+ }
- /* insert new keyframe at current frame */
- if (insert_mode)
- insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
+ return insert_keyframe_value(reports, &ptr, prop, fcu, cfra, curval, keytype, flag);
+}
- /* delete keyframe immediately before/after newly added */
- switch (insert_mode) {
- case KEYNEEDED_DELPREV:
- delete_fcurve_key(fcu, fcu->totvert - 2, 1);
- break;
- case KEYNEEDED_DELNEXT:
- delete_fcurve_key(fcu, 1, 1);
- break;
+/* Find or create the FCurve based on the given path, and insert the specified value into it. */
+static bool insert_keyframe_fcurve_value(
+ Main *bmain, ReportList *reports, PointerRNA *ptr, PropertyRNA *prop,
+ bAction *act, const char group[], const char rna_path[], int array_index,
+ float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
+{
+ /* make sure the F-Curve exists
+ * - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
+ * but still try to get the F-Curve if it exists...
+ */
+ FCurve *fcu = verify_fcurve(bmain, act, group, ptr, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
+
+ /* we may not have a F-Curve when we're replacing only... */
+ if (fcu) {
+ /* set color mode if the F-Curve is new (i.e. without any keyframes) */
+ if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) {
+ /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
+ * is determined by the array index for the F-Curve
+ */
+ PropertySubType prop_subtype = RNA_property_subtype(prop);
+ if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
+ fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
+ }
+ else if (ELEM(prop_subtype, PROP_QUATERNION)) {
+ fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
+ }
}
- /* only return success if keyframe added */
- if (insert_mode)
- return true;
+ /* update F-Curve flags to ensure proper behavior for property type */
+ update_autoflags_fcurve_direct(fcu, prop);
+
+ /* insert keyframe */
+ return insert_keyframe_value(reports, ptr, prop, fcu, cfra, curval, keytype, flag);
}
else {
- /* just insert keyframe */
- insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
-
- /* return success */
- return true;
+ return false;
}
-
- /* failed */
- return false;
}
/* Main Keyframing API call:
@@ -1105,10 +1219,8 @@ short insert_keyframe(
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
AnimData *adt;
- FCurve *fcu;
ListBase tmp_nla_cache = {NULL, NULL};
NlaKeyframingContext *nla_context = NULL;
- int array_index_max = array_index + 1;
int ret = 0;
/* validate pointer first - exit if failure */
@@ -1149,48 +1261,58 @@ short insert_keyframe(
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
- /* key entire array convenience method */
- if (array_index == -1) {
- array_index = 0;
- array_index_max = RNA_property_array_length(&ptr, prop);
+ /* Obtain values to insert. */
+ float value_buffer[RNA_MAX_ARRAY_LENGTH];
+ int value_count;
+ bool force_all;
- /* for single properties, increase max_index so that the property itself gets included,
- * but don't do this for standard arrays since that can cause corruption issues
- * (extra unused curves)
- */
- if (array_index_max == array_index)
- array_index_max++;
- }
+ float *values = get_keyframe_values(depsgraph, reports, ptr, prop, array_index, nla_context, flag,
+ value_buffer, RNA_MAX_ARRAY_LENGTH, &value_count, &force_all);
- /* will only loop once unless the array index was -1 */
- for (; array_index < array_index_max; array_index++) {
- /* make sure the F-Curve exists
- * - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
- * but still try to get the F-Curve if it exists...
- */
- fcu = verify_fcurve(bmain, act, group, &ptr, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
-
- /* we may not have a F-Curve when we're replacing only... */
- if (fcu) {
- /* set color mode if the F-Curve is new (i.e. without any keyframes) */
- if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) {
- /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
- * is determined by the array index for the F-Curve
- */
- PropertySubType prop_subtype = RNA_property_subtype(prop);
- if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
- fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
+ if (values != NULL) {
+ /* Key the entire array. */
+ if (array_index == -1 || force_all) {
+ /* In force mode, if any of the curves succeeds, drop the replace mode and restart. */
+ if (force_all && (flag & INSERTKEY_REPLACE) != 0) {
+ int exclude = -1;
+
+ for (array_index = 0; array_index < value_count; array_index++) {
+ if (insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag)) {
+ ret++;
+ exclude = array_index;
+ break;
+ }
}
- else if (ELEM(prop_subtype, PROP_QUATERNION)) {
- fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
+
+ if (exclude != -1) {
+ flag &= ~INSERTKEY_REPLACE;
+
+ for (array_index = 0; array_index < value_count; array_index++) {
+ if (array_index != exclude) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
+ }
+ }
+ }
+ }
+ /* Simply insert all channels. */
+ else {
+ for (array_index = 0; array_index < value_count; array_index++) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
}
}
-
- /* insert keyframe */
- ret += insert_keyframe_direct(depsgraph, reports, ptr, prop, fcu, cfra, keytype, nla_context, flag);
+ }
+ /* Key a single index. */
+ else {
+ if (array_index >= 0 && array_index < value_count) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
+ }
}
}
+ if (values != value_buffer) {
+ MEM_freeN(values);
+ }
+
BKE_animsys_free_nla_keyframing_context_cache(&tmp_nla_cache);
if (ret) {
@@ -1243,6 +1365,20 @@ static bool delete_keyframe_fcurve(AnimData *adt, FCurve *fcu, float cfra)
return false;
}
+static void deg_tag_after_keyframe_delete(Main *bmain, ID *id, AnimData *adt)
+{
+ if (adt->action == NULL) {
+ /* In the case last f-curve wes removed need to inform dependency graph
+ * about relations update, since it needs to get rid of animation operation
+ * for this datablock. */
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ }
+ else {
+ DEG_id_tag_update_ex(bmain, &adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+}
+
short delete_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act,
const char group[], const char rna_path[], int array_index, float cfra,
eInsertKeyFlags UNUSED(flag))
@@ -1319,12 +1455,8 @@ short delete_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act,
ret += delete_keyframe_fcurve(adt, fcu, cfra);
}
- /* In the case last f-curve wes removed need to inform dependency graph
- * about relations update, since it needs to get rid of animation operation
- * for this datablock. */
- if (ret && adt->action == NULL) {
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
+ if (ret) {
+ deg_tag_after_keyframe_delete(bmain, id, adt);
}
/* return success/failure */
return ret;
@@ -1415,12 +1547,8 @@ static short clear_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *a
/* return success */
ret++;
}
- /* In the case last f-curve wes removed need to inform dependency graph
- * about relations update, since it needs to get rid of animation operation
- * for this datablock. */
- if (ret && adt->action == NULL) {
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
+ if (ret) {
+ deg_tag_after_keyframe_delete(bmain, id, adt);
}
/* return success/failure */
return ret;
@@ -1949,9 +2077,9 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
/* Special exception for keyframing transforms:
* Set "group" for this manually, instead of having them appearing at the bottom (ungrouped)
- * part of the channels list. Leaving these ungrouped is not a nice user behaviour in this case.
+ * part of the channels list. Leaving these ungrouped is not a nice user behavior in this case.
*
- * TODO: Perhaps we can extend this behaviour in future for other properties...
+ * TODO: Perhaps we can extend this behavior in future for other properties...
*/
if (ptr.type == &RNA_PoseBone) {
bPoseChannel *pchan = (bPoseChannel *)ptr.data;
@@ -2267,8 +2395,16 @@ bool fcurve_is_changed(PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float fra
anim_rna.prop = prop;
anim_rna.prop_index = fcu->array_index;
+ float buffer[RNA_MAX_ARRAY_LENGTH];
+ int count, index = fcu->array_index;
+ float *values = setting_get_rna_values(NULL, &ptr, prop, false, buffer, RNA_MAX_ARRAY_LENGTH, &count);
+
float fcurve_val = calculate_fcurve(&anim_rna, fcu, frame);
- float cur_val = setting_get_rna_value(NULL, &ptr, prop, fcu->array_index, false);
+ float cur_val = (index >= 0 && index < count) ? values[index] : 0.0f;
+
+ if (values != buffer) {
+ MEM_freeN(values);
+ }
return !compare_ff_relative(fcurve_val, cur_val, FLT_EPSILON, 64);
}
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d980e4322dd..aac7559774f 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyingsets.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -1026,7 +1018,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
RNA_id_pointer_create(ksp->id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, ksp->rna_path, &ptr, &prop)) {
arraylen = RNA_property_array_length(&ptr, prop);
- i = 0; /* start from start of array, instead of the previously specified index - T48020 */
+ /* start from start of array, instead of the previously specified index - T48020 */
+ i = 0;
}
}
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 96467ee2c2a..0dd213d3bef 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -50,8 +47,8 @@ set(SRC
editarmature_undo.c
meshlaplacian.c
pose_edit.c
- pose_lib.c
pose_group.c
+ pose_lib.c
pose_select.c
pose_slide.c
pose_transform.c
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index fb0766d3bed..20978a42812 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators and API's for creating bones
*/
-/** \file blender/editors/armature/armature_add.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_armature_types.h"
@@ -238,7 +231,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
copy_v3_v3(oldcurs, cursor->location);
- VECCOPY2D(mval_f, event->mval);
+ copy_v2fl_v2i(mval_f, event->mval);
ED_view3d_win_to_3d(v3d, ar, cursor->location, mval_f, tvec);
copy_v3_v3(cursor->location, tvec);
@@ -491,7 +484,9 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
EditBone *ebone_iter;
- EditBone *ebone_first_dupe = NULL; /* The beginning of the duplicated bones in the edbo list */
+ /* The beginning of the duplicated bones in the edbo list */
+ EditBone *ebone_first_dupe = NULL;
+
Object *ob = objects[ob_index];
bArmature *arm = ob->data;
@@ -664,7 +659,8 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
bArmature *arm = obedit->data;
EditBone *ebone_iter;
- EditBone *ebone_first_dupe = NULL; /* The beginning of the duplicated mirrored bones in the edbo list */
+ /* The beginning of the duplicated mirrored bones in the edbo list */
+ EditBone *ebone_first_dupe = NULL;
ED_armature_edit_sync_selection(arm->edbo); // XXX why is this needed?
@@ -845,7 +841,7 @@ void ARMATURE_OT_symmetrize(wmOperatorType *ot)
static const EnumPropertyItem arm_symmetrize_direction_items[] = {
{-1, "NEGATIVE_X", 0, "-X to +X", ""},
{+1, "POSITIVE_X", 0, "+X to -X", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 7aa6b578475..f3a4fef2789 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Armature EditMode tools - transforms, chain based editing, and other settings
*/
-/** \file blender/editors/armature/armature_edit.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <assert.h>
@@ -87,7 +80,7 @@ void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], const
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props)
{
EditBone *ebone;
- float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
+ float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
float mat3[3][3];
copy_m3_m4(mat3, mat);
@@ -141,7 +134,7 @@ void ED_armature_transform(Main *bmain, bArmature *arm, float mat[4][4], const b
/* exported for use in editors/object/ */
/* 0 == do center, 1 == center new, 2 == center cursor */
-void ED_armature_origin_set(Main *bmain, Object *ob, float cursor[3], int centermode, int around)
+void ED_armature_origin_set(Main *bmain, Object *ob, const float cursor[3], int centermode, int around)
{
const bool is_editmode = BKE_object_is_in_editmode(ob);
EditBone *ebone;
@@ -289,7 +282,7 @@ static const EnumPropertyItem prop_calc_roll_types[] = {
{CALC_ROLL_ACTIVE, "ACTIVE", 0, "Active Bone", ""},
{CALC_ROLL_VIEW, "VIEW", 0, "View Axis", ""},
{CALC_ROLL_CURSOR, "CURSOR", 0, "Cursor", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1029,7 +1022,7 @@ void ARMATURE_OT_merge(wmOperatorType *ot)
{
static const EnumPropertyItem merge_types[] = {
{1, "WITHIN_CHAIN", 0, "Within Chains", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index da24787fc18..7fe4810762e 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_intern.h
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#ifndef __ARMATURE_INTERN_H__
@@ -34,19 +27,19 @@
/* internal exports only */
struct wmOperatorType;
-struct bContext;
-struct Scene;
-struct Object;
struct Base;
+struct Object;
+struct Scene;
struct bAction;
+struct bContext;
struct bPoseChannel;
-struct bArmature;
-struct EditBone;
struct Bone;
+struct EditBone;
+struct bArmature;
-struct ListBase;
struct LinkData;
+struct ListBase;
/* ******************************************************* */
/* Armature EditMode Operators */
@@ -147,27 +140,35 @@ void POSE_OT_bone_layers(struct wmOperatorType *ot);
typedef struct tPChanFCurveLink {
struct tPChanFCurveLink *next, *prev;
- struct Object *ob; /* Object this Pose Channel belongs to. */
+ /** Object this Pose Channel belongs to. */
+ struct Object *ob;
- ListBase fcurves; /* F-Curves for this PoseChannel (wrapped with LinkData) */
- struct bPoseChannel *pchan; /* Pose Channel which data is attached to */
+ /** F-Curves for this PoseChannel (wrapped with LinkData) */
+ ListBase fcurves;
+ /** Pose Channel which data is attached to */
+ struct bPoseChannel *pchan;
- char *pchan_path; /* RNA Path to this Pose Channel (needs to be freed when we're done) */
+ /** RNA Path to this Pose Channel (needs to be freed when we're done) */
+ char *pchan_path;
- float oldloc[3]; /* transform values at start of operator (to be restored before each modal step) */
+ /** transform values at start of operator (to be restored before each modal step) */
+ float oldloc[3];
float oldrot[3];
float oldscale[3];
float oldquat[4];
float oldangle;
float oldaxis[3];
- float roll1, roll2; /* old bbone values (to be restored along with the transform properties) */
- float curveInX, curveInY; /* (NOTE: we haven't renamed these this time, as their names are already long enough) */
+ /** old bbone values (to be restored along with the transform properties) */
+ float roll1, roll2;
+ /** (NOTE: we haven't renamed these this time, as their names are already long enough) */
+ float curveInX, curveInY;
float curveOutX, curveOutY;
float ease1, ease2;
float scaleIn, scaleOut;
- struct IDProperty *oldprops; /* copy of custom properties at start of operator (to be restored before each modal step) */
+ /** copy of custom properties at start of operator (to be restored before each modal step) */
+ struct IDProperty *oldprops;
} tPChanFCurveLink;
/* ----------- */
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index a027b00f3e1..c14973d793b 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators and API's for renaming bones both in and out of Edit Mode
*/
-/** \file blender/editors/armature/armature_naming.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -52,7 +45,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
@@ -547,7 +539,7 @@ void ARMATURE_OT_autoside_names(wmOperatorType *ot)
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
{1, "YAXIS", 0, "Y-Axis", "Front/Back"},
{2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index b4c872c044d..36ca3dd486d 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_ops.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "RNA_access.h"
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index aadb805feda..a6e4632ef9d 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for relations between bones and for transferring bones between armature objects
*/
-/** \file blender/editors/armature/armature_relations.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -48,7 +41,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -144,7 +136,8 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
const char *old_name = BLI_ghashIterator_getKey(&gh_iter);
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
- /* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
+ /* only remap if changed; this still means there will be some
+ * waste if there aren't many drivers/keys */
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "pose.bones",
old_name, new_name, 0, 0, false);
@@ -542,7 +535,8 @@ static void separate_armature_bones(Main *bmain, Object *ob, short sel)
for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
if (ebo->parent == curbone) {
ebo->parent = NULL;
- ebo->temp.p = NULL; /* this is needed to prevent random crashes with in ED_armature_from_edit */
+ /* this is needed to prevent random crashes with in ED_armature_from_edit */
+ ebo->temp.p = NULL;
ebo->flag &= ~BONE_CONNECTED;
}
}
@@ -623,7 +617,10 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
ED_armature_edit_free(obedit->data);
/* 2) duplicate base */
- newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, USER_DUP_ARM); /* only duplicate linked armature */
+
+ /* only duplicate linked armature */
+ newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, USER_DUP_ARM);
+
DEG_relations_tag_update(bmain);
newob = newbase->object;
@@ -750,7 +747,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
static const EnumPropertyItem prop_editarm_make_parent_types[] = {
{ARM_PAR_CONNECT, "CONNECTED", 0, "Connected", ""},
{ARM_PAR_OFFSET, "OFFSET", 0, "Keep Offset", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int armature_parent_set_exec(bContext *C, wmOperator *op)
@@ -871,7 +868,7 @@ void ARMATURE_OT_parent_set(wmOperatorType *ot)
static const EnumPropertyItem prop_editarm_clear_parent_types[] = {
{1, "CLEAR", 0, "Clear Parent", ""},
{2, "DISCONNECT", 0, "Disconnect Bone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void editbone_clear_parent(EditBone *ebone, int mode)
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 830798fa737..8d58ee28f5c 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* API's and Operators for selecting armature bones in EditMode
*/
-/** \file blender/editors/armature/armature_select.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -45,8 +38,6 @@
#include "BKE_report.h"
#include "BKE_layer.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -77,7 +68,7 @@ Base *ED_armature_base_and_ebone_from_select_buffer(
EditBone *ebone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint base_index = 0; base_index < bases_len; base_index++) {
- if (bases[base_index]->object->select_color == hit_object) {
+ if (bases[base_index]->object->select_id == hit_object) {
base = bases[base_index];
break;
}
@@ -99,7 +90,7 @@ Object *ED_armature_object_and_ebone_from_select_buffer(
EditBone *ebone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- if (objects[ob_index]->select_color == hit_object) {
+ if (objects[ob_index]->select_id == hit_object) {
ob = objects[ob_index];
break;
}
@@ -121,7 +112,7 @@ Base *ED_armature_base_and_bone_from_select_buffer(
Bone *bone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint base_index = 0; base_index < bases_len; base_index++) {
- if (bases[base_index]->object->select_color == hit_object) {
+ if (bases[base_index]->object->select_id == hit_object) {
base = bases[base_index];
break;
}
@@ -269,7 +260,8 @@ void *get_nearest_bone(
if (vc.obedit != NULL) {
bases = BKE_view_layer_array_from_bases_in_mode(
vc.view_layer, vc.v3d, &bases_len, {
- .object_mode = OB_MODE_EDIT});
+ .object_mode = OB_MODE_EDIT,
+ });
}
else {
bases = BKE_object_pose_base_array_get(vc.view_layer, vc.v3d, &bases_len);
@@ -1158,7 +1150,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
{SIMEDBONE_GROUP, "GROUP", 0, "Group", ""},
{SIMEDBONE_SHAPE, "SHAPE", 0, "Shape", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float bone_length_squared_worldspace_get(Object *ob, EditBone *ebone)
@@ -1613,7 +1605,7 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""},
{BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 462c17e9008..ee0043f6ccf 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* API's for creating vertex groups from bones
* - Interfaces with heat weighting in meshlaplacian
*/
-/** \file blender/editors/armature/armature_skinning.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_mesh_types.h"
@@ -43,7 +36,6 @@
#include "BKE_action.h"
#include "BKE_armature.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 275d00ded58..f310092942b 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_utils.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_armature_types.h"
@@ -672,7 +666,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
if (eBone == arm->act_edbone) {
/* don't change active selection, this messes up separate which uses
* editmode toggle and can separate active bone which is de-selected originally */
- /* newBone->flag |= BONE_SELECTED; */ /* important, editbones can be active with only 1 point selected */
+
+ /* important, editbones can be active with only 1 point selected */
+ /* newBone->flag |= BONE_SELECTED; */
arm->act_bone = newBone;
}
newBone->roll = 0.0f;
@@ -707,8 +703,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
}
/* Fix parenting in a separate pass to ensure ebone->bone connections are valid at this point.
- * Do not set bone->head/tail here anymore, using EditBone data for that is not OK since our later fiddling
- * with parent's arm_mat (for roll conversion) may have some small but visible impact on locations (T46010). */
+ * Do not set bone->head/tail here anymore,
+ * using EditBone data for that is not OK since our later fiddling with parent's arm_mat
+ * (for roll conversion) may have some small but visible impact on locations (T46010). */
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
newBone = eBone->temp.bone;
if (eBone->parent) {
diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c
index 0fd94f664ab..39e8371a824 100644
--- a/source/blender/editors/armature/editarmature_undo.c
+++ b/source/blender/editors/armature/editarmature_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/editarmature_undo.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +29,6 @@
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
#include "BLI_array_utils.h"
#include "BKE_context.h"
@@ -150,13 +143,15 @@ static bool armature_undosys_poll(bContext *C)
return editarm_object_from_context(C) != NULL;
}
-static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool armature_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -174,14 +169,15 @@ static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void armature_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void armature_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(armature_undosys_poll(C));
-
ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(armature_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
ArmatureUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -234,7 +230,6 @@ void ED_armature_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = armature_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(ArmatureUndoStep);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 96799304845..34fea2e0996 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* meshlaplacian.c: Algorithms using the mesh laplacian.
*/
-/** \file blender/editors/armature/meshlaplacian.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -806,7 +800,7 @@ void heat_bone_weighting(
#define MESHDEFORM_MIN_INFLUENCE 0.0005f
static const int MESHDEFORM_OFFSET[7][3] = {
- {0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}
+ {0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1},
};
typedef struct MDefBoundIsect {
@@ -903,9 +897,10 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
face[1] = mdb->cagecos[mloop[lt->tri[1]].v];
face[2] = mdb->cagecos[mloop[lt->tri[2]].v];
- if (!isect_ray_tri_watertight_v3(
- ray->origin, ray->isect_precalc, UNPACK3(face), &dist, NULL))
- {
+ bool isect_ray_tri = isect_ray_tri_watertight_v3(
+ ray->origin, ray->isect_precalc, UNPACK3(face), &dist, NULL);
+
+ if (!isect_ray_tri || dist > isec->vec_length) {
return;
}
@@ -1466,7 +1461,8 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
mdb->cagemesh_cache.mpoly = me->mpoly;
mdb->cagemesh_cache.mloop = me->mloop;
mdb->cagemesh_cache.looptri = BKE_mesh_runtime_looptri_ensure(me);
- mdb->cagemesh_cache.poly_nors = CustomData_get_layer(&me->pdata, CD_NORMAL); /* can be NULL */
+ /* can be NULL */
+ mdb->cagemesh_cache.poly_nors = CustomData_get_layer(&me->pdata, CD_NORMAL);
}
/* make bounding box equal size in all directions, add padding, and compute
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 6758f9d16ac..cf0c1de6b67 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * ***** END GPL LICENSE BLOCK *****
* BIF_meshlaplacian.h: Algorithms using the mesh laplacian.
*/
-/** \file blender/editors/armature/meshlaplacian.h
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
@@ -29,8 +26,8 @@
//#define RIGID_DEFORM
-struct Object;
struct Mesh;
+struct Object;
struct bDeformGroup;
#ifdef RIGID_DEFORM
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 4b069deefa3..5920a69c60b 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Ton Roosendaal, Blender Foundation '05, full recode.
- * Joshua Leung
- * Reevan McKay (original NaN code)
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Pose Mode API's and Operators for Pose Mode armatures
*/
-/** \file blender/editors/armature/pose_edit.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -89,7 +80,7 @@ Object *ED_pose_object_from_context(bContext *C)
Object *ob;
/* since this call may also be used from the buttons window, we need to check for where to get the object */
- if (sa && sa->spacetype == SPACE_BUTS) {
+ if (sa && sa->spacetype == SPACE_PROPERTIES) {
ob = ED_object_context(C);
}
else {
@@ -532,210 +523,6 @@ void POSE_OT_paths_range_update(wmOperatorType *ot)
}
/* ********************************************** */
-#if 0 /* UNUSED 2.5 */
-static void pose_copy_menu(Scene *scene)
-{
- Object *obedit = scene->obedit; // XXX context
- Object *ob = OBACT;
- bArmature *arm;
- bPoseChannel *pchan, *pchanact;
- short nr = 0;
- int i = 0;
-
- /* paranoia checks */
- if (ELEM(NULL, ob, ob->pose)) return;
- if ((ob == obedit) || (ob->mode & OB_MODE_POSE) == 0) return;
-
- pchan = BKE_pose_channel_active(ob);
-
- if (pchan == NULL) return;
- pchanact = pchan;
- arm = ob->data;
-
- /* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changeable,
- * but for constraints (just add local constraints)
- */
- if (pose_has_protected_selected(ob, 0)) {
- i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i < 25)
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5");
- else
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4");
- }
- else {
- i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i < 25)
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
- else
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
- }
-
- if (nr <= 0)
- return;
-
- if (nr != 5) {
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- if ((arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan != pchanact) )
- {
- switch (nr) {
- case 1: /* Local Location */
- copy_v3_v3(pchan->loc, pchanact->loc);
- break;
- case 2: /* Local Rotation */
- copy_qt_qt(pchan->quat, pchanact->quat);
- copy_v3_v3(pchan->eul, pchanact->eul);
- break;
- case 3: /* Local Size */
- copy_v3_v3(pchan->size, pchanact->size);
- break;
- case 4: /* All Constraints */
- {
- ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
- * appending to list of constraints for this channel
- */
- BKE_constraints_copy(&tmp_constraints, &pchanact->constraints, true);
- if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
- bConstraint *con;
-
- /* add proxy-local tags */
- for (con = tmp_constraints.first; con; con = con->next)
- con->flag |= CONSTRAINT_PROXY_LOCAL;
- }
- BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
-
- /* update flags (need to add here, not just copy) */
- pchan->constflag |= pchanact->constflag;
-
- if (ob->pose)
- BKE_pose_tag_recalc(bmain, ob->pose);
- }
- break;
- case 6: /* Transform Locks */
- pchan->protectflag = pchanact->protectflag;
- break;
- case 7: /* IK (DOF) settings */
- {
- pchan->ikflag = pchanact->ikflag;
- copy_v3_v3(pchan->limitmin, pchanact->limitmin);
- copy_v3_v3(pchan->limitmax, pchanact->limitmax);
- copy_v3_v3(pchan->stiffness, pchanact->stiffness);
- pchan->ikstretch = pchanact->ikstretch;
- pchan->ikrotweight = pchanact->ikrotweight;
- pchan->iklinweight = pchanact->iklinweight;
- }
- break;
- case 8: /* Custom Bone Shape */
- pchan->custom = pchanact->custom;
- if (pchan->custom) {
- id_us_plus(&pchan->custom->id);
- }
- break;
- case 9: /* Visual Location */
- BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc);
- break;
- case 10: /* Visual Rotation */
- {
- float delta_mat[4][4];
-
- BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
-
- if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- float tmp_quat[4];
-
- /* need to convert to quat first (in temp var)... */
- mat4_to_quat(tmp_quat, delta_mat);
- quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, tmp_quat);
- }
- else if (pchan->rotmode == ROT_MODE_QUAT)
- mat4_to_quat(pchan->quat, delta_mat);
- else
- mat4_to_eulO(pchan->eul, pchan->rotmode, delta_mat);
- }
- break;
- case 11: /* Visual Size */
- {
- float delta_mat[4][4], size[4];
-
- BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- mat4_to_size(size, delta_mat);
- copy_v3_v3(pchan->size, size);
- }
- }
- }
- }
- }
- else { /* constraints, optional (note: max we can have is 24 constraints) */
- bConstraint *con, *con_back;
- int const_toggle[24] = {0}; /* XXX, initialize as 0 to quiet errors */
- ListBase const_copy = {NULL, NULL};
-
- BLI_duplicatelist(&const_copy, &(pchanact->constraints));
-
- /* build the puplist of constraints */
- for (con = pchanact->constraints.first, i = 0; con; con = con->next, i++) {
- const_toggle[i] = 1;
-// add_numbut(i, UI_BTYPE_TOGGLE|INT, con->name, 0, 0, &(const_toggle[i]), "");
- }
-
-// if (!do_clever_numbuts("Select Constraints", i, REDRAW)) {
-// BLI_freelistN(&const_copy);
-// return;
-// }
-
- /* now build a new listbase from the options selected */
- for (i = 0, con = const_copy.first; con; i++) {
- /* if not selected, free/remove it from the list */
- if (!const_toggle[i]) {
- con_back = con->next;
- BLI_freelinkN(&const_copy, con);
- con = con_back;
- }
- else
- con = con->next;
- }
-
- /* Copy the temo listbase to the selected posebones */
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- if ((arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan != pchanact) )
- {
- ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
- * appending to list of constraints for this channel
- */
- BKE_constraints_copy(&tmp_constraints, &const_copy, true);
- if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
- /* add proxy-local tags */
- for (con = tmp_constraints.first; con; con = con->next)
- con->flag |= CONSTRAINT_PROXY_LOCAL;
- }
- BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
-
- /* update flags (need to add here, not just copy) */
- pchan->constflag |= pchanact->constflag;
- }
- }
- BLI_freelistN(&const_copy);
- BKE_pose_update_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */
-
- if (ob->pose)
- BKE_pose_tag_recalc(bmain, ob->pose);
- }
-
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); // and all its relations
-
- BIF_undo_push("Copy Pose Attributes");
-
-}
-#endif
-
-/* ********************************************** */
static int pose_flip_names_exec(bContext *C, wmOperator *op)
{
@@ -827,7 +614,7 @@ void POSE_OT_autoside_names(wmOperatorType *ot)
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
{1, "YAXIS", 0, "Y-Axis", "Front/Back"},
{2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -888,7 +675,8 @@ void POSE_OT_rotation_mode_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_posebone_rotmode_items, 0, "Rotation Mode", "");
+ ot->prop = RNA_def_enum(
+ ot->srna, "type", rna_enum_object_rotation_mode_items, 0, "Rotation Mode", "");
}
/* ********************************************** */
@@ -926,7 +714,8 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
- bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {false};
int i;
/* sanity checking */
@@ -978,7 +767,8 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* sanity checking */
if (arm == NULL)
@@ -999,7 +789,8 @@ static int armature_layers_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
if (arm == NULL) {
return OPERATOR_CANCELLED;
@@ -1043,7 +834,8 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0};
/* get layers that are active already */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
@@ -1068,7 +860,8 @@ static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *e
static int pose_bone_layers_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
@@ -1117,7 +910,8 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0};
/* get layers that are active already */
CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
@@ -1145,7 +939,8 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c
index 543645b5c1f..0d1f899ce36 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implementation of Bone Groups operators and editing API's
*/
-/** \file blender/editors/armature/pose_group.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -337,7 +330,7 @@ void POSE_OT_group_move(wmOperatorType *ot)
static const EnumPropertyItem group_slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 14706f89607..7ba6db92a47 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2007, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_lib.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -46,7 +40,6 @@
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -167,7 +160,7 @@ static Object *get_poselib_object(bContext *C)
sa = CTX_wm_area(C);
- if (sa && (sa->spacetype == SPACE_BUTS))
+ if (sa && (sa->spacetype == SPACE_PROPERTIES))
return ED_object_context(C);
else
return BKE_object_pose_armature_get(CTX_data_active_object(C));
@@ -498,7 +491,10 @@ static int poselib_add_exec(bContext *C, wmOperator *op)
BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* use Keying Set to determine what to store for the pose */
- ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID); /* this includes custom props :)*/
+
+ /* this includes custom props :)*/
+ ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID);
+
ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame);
/* store new 'active' pose number */
@@ -730,7 +726,8 @@ void POSELIB_OT_pose_rename(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- /* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */
+ /* NOTE: name not pose is the operator's "main" property,
+ * so that it will get activated in the popup for easy renaming */
ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to rename");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
@@ -792,7 +789,7 @@ void POSELIB_OT_pose_move(wmOperatorType *ot)
static const EnumPropertyItem pose_lib_pose_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -825,30 +822,49 @@ void POSELIB_OT_pose_move(wmOperatorType *ot)
/* Simple struct for storing settings/data for use during PoseLib preview */
typedef struct tPoseLib_PreviewData {
- ListBase backups; /* tPoseLib_Backup structs for restoring poses */
- ListBase searchp; /* LinkData structs storing list of poses which match the current search-string */
-
- Scene *scene; /* active scene */
- ScrArea *sa; /* active area */
-
- PointerRNA rna_ptr; /* RNA-Pointer to Object 'ob' */
- Object *ob; /* object to work on */
- bArmature *arm; /* object's armature data */
- bPose *pose; /* object's pose */
- bAction *act; /* poselib to use */
- TimeMarker *marker; /* 'active' pose */
-
- int totcount; /* total number of elements to work on */
-
- short state; /* state of main loop */
- short redraw; /* redraw/update settings during main loop */
- short flag; /* flags for various settings */
+ /** tPoseLib_Backup structs for restoring poses. */
+ ListBase backups;
+ /** LinkData structs storing list of poses which match the current search-string. */
+ ListBase searchp;
+
+ /** active scene. */
+ Scene *scene;
+ /** active area. */
+ ScrArea *sa;
- short search_cursor; /* position of cursor in searchstr (cursor occurs before the item at the nominated index) */
- char searchstr[64]; /* (Part of) Name to search for to filter poses that get shown */
- char searchold[64]; /* Previously set searchstr (from last loop run), so that we can detected when to rebuild searchp */
+ /** RNA-Pointer to Object 'ob' .*/
+ PointerRNA rna_ptr;
+ /** object to work on. */
+ Object *ob;
+ /** object's armature data. */
+ bArmature *arm;
+ /** object's pose. */
+ bPose *pose;
+ /** poselib to use. */
+ bAction *act;
+ /** 'active' pose. */
+ TimeMarker *marker;
- char headerstr[UI_MAX_DRAW_STR]; /* Info-text to print in header */
+ /** total number of elements to work on. */
+ int totcount;
+
+ /** state of main loop. */
+ short state;
+ /** redraw/update settings during main loop. */
+ short redraw;
+ /** flags for various settings. */
+ short flag;
+
+ /** position of cursor in searchstr (cursor occurs before the item at the nominated index) */
+ short search_cursor;
+ /** (Part of) Name to search for to filter poses that get shown. */
+ char searchstr[64];
+ /** Previously set searchstr (from last loop run),
+ * so that we can detected when to rebuild searchp. */
+ char searchold[64];
+
+ /** Info-text to print in header. */
+ char headerstr[UI_MAX_DRAW_STR];
} tPoseLib_PreviewData;
/* defines for tPoseLib_PreviewData->state values */
@@ -857,7 +873,7 @@ enum {
PL_PREVIEW_RUNNING,
PL_PREVIEW_CONFIRM,
PL_PREVIEW_CANCEL,
- PL_PREVIEW_RUNONCE
+ PL_PREVIEW_RUNONCE,
};
/* defines for tPoseLib_PreviewData->redraw values */
@@ -944,7 +960,8 @@ static void poselib_backup_restore(tPoseLib_PreviewData *pld)
if (plb->oldprops)
IDP_SyncGroupValues(plb->pchan->prop, plb->oldprops);
- /* TODO: constraints settings aren't restored yet, even though these could change (though not that likely) */
+ /* TODO: constraints settings aren't restored yet,
+ * even though these could change (though not that likely) */
}
}
@@ -1766,7 +1783,11 @@ void POSELIB_OT_browse_interactive(wmOperatorType *ot)
// XXX: percentage vs factor?
/* not used yet */
- /* RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); */
+#if 0
+ RNA_def_float_factor(
+ ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor",
+ "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f);
+#endif
}
void POSELIB_OT_apply_pose(wmOperatorType *ot)
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 184c09f5b10..285901f8dd0 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_select.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -107,8 +101,7 @@ void ED_pose_bone_select_tag_update(Object *ob)
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
- /* copy on write tag is needed (for the armature), or else no refresh happens */
- DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
}
@@ -239,7 +232,8 @@ bool ED_armature_pose_select_pick_with_buffer(
}
/* 'select_mode' is usual SEL_SELECT/SEL_DESELECT/SEL_TOGGLE/SEL_INVERT.
- * When true, 'ignore_visibility' makes this func also affect invisible bones (hidden or on hidden layers). */
+ * When true, 'ignore_visibility' makes this func also affect invisible bones
+ * (hidden or on hidden layers). */
bool ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibility)
{
bArmature *arm = ob->data;
@@ -643,7 +637,7 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""},
{BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -988,7 +982,7 @@ void POSE_OT_select_grouped(wmOperatorType *ot)
{POSE_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"},
{POSE_SEL_SAME_GROUP, "GROUP", 0, "Group", "Shared group"},
{POSE_SEL_SAME_KEYINGSET, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 52e580a94af..769398e9e0c 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_slide.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -87,28 +81,43 @@
/* Temporary data shared between these operators */
typedef struct tPoseSlideOp {
- Scene *scene; /* current scene */
- ScrArea *sa; /* area that we're operating in (needed for modal()) */
- ARegion *ar; /* region that we're operating in (needed for modal()) */
- uint objects_len; /* len of the PoseSlideObject array. */
-
- ListBase pfLinks; /* links between posechannels and f-curves for all the pose objects. */
- DLRBT_Tree keys; /* binary tree for quicker searching for keyframes (when applicable) */
+ /** current scene */
+ Scene *scene;
+ /** area that we're operating in (needed for modal()) */
+ ScrArea *sa;
+ /** region that we're operating in (needed for modal()) */
+ ARegion *ar;
+ /** len of the PoseSlideObject array. */
+ uint objects_len;
+
+ /** links between posechannels and f-curves for all the pose objects. */
+ ListBase pfLinks;
+ /** binary tree for quicker searching for keyframes (when applicable) */
+ DLRBT_Tree keys;
- int cframe; /* current frame number - global time */
+ /** current frame number - global time */
+ int cframe;
- int prevFrame; /* frame before current frame (blend-from) - global time */
- int nextFrame; /* frame after current frame (blend-to) - global time */
+ /** frame before current frame (blend-from) - global time */
+ int prevFrame;
+ /** frame after current frame (blend-to) - global time */
+ int nextFrame;
- short mode; /* sliding mode (ePoseSlide_Modes) */
- short flag; /* unused for now, but can later get used for storing runtime settings.... */
+ /** sliding mode (ePoseSlide_Modes) */
+ short mode;
+ /** unused for now, but can later get used for storing runtime settings.... */
+ short flag;
- short channels; /* which transforms/channels are affected (ePoseSlide_Channels) */
- short axislock; /* axis-limits for transforms (ePoseSlide_AxisLock) */
+ /** which transforms/channels are affected (ePoseSlide_Channels) */
+ short channels;
+ /** axis-limits for transforms (ePoseSlide_AxisLock) */
+ short axislock;
- float percentage; /* 0-1 value for determining the influence of whatever is relevant */
+ /** 0-1 value for determining the influence of whatever is relevant */
+ float percentage;
- NumInput num; /* numeric input */
+ /** numeric input */
+ NumInput num;
struct tPoseSlideObject *ob_data_array;
} tPoseSlideOp;
@@ -150,14 +159,14 @@ static const EnumPropertyItem prop_channels_types[] = {
{PS_TFM_SIZE, "SIZE", 0, "Scale", "Scale only"},
{PS_TFM_BBONE_SHAPE, "BBONE", 0, "Bendy Bone", "Bendy Bone shape properties"},
{PS_TFM_PROPS, "CUSTOM", 0, "Custom Properties", "Custom properties"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Axis Locks */
typedef enum ePoseSlide_AxisLock {
PS_LOCK_X = (1 << 0),
PS_LOCK_Y = (1 << 1),
- PS_LOCK_Z = (1 << 2)
+ PS_LOCK_Z = (1 << 2),
} ePoseSlide_AxisLock;
/* Property enum for ePoseSlide_AxisLock */
@@ -167,7 +176,7 @@ static const EnumPropertyItem prop_axis_lock_types[] = {
{PS_LOCK_Y, "Y", 0, "Y", "Only Y-axis transforms are affected"},
{PS_LOCK_Z, "Z", 0, "Z", "Only Z-axis transforms are affected"},
/* TODO: Combinations? */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------------------------ */
@@ -198,8 +207,7 @@ static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
pso->axislock = RNA_enum_get(op->ptr, "axis_lock");
/* for each Pose-Channel which gets affected, get the F-Curves for that channel
- * and set the relevant transform flags...
- */
+ * and set the relevant transform flags... */
poseAnim_mapping_get(C, &pso->pfLinks);
Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(CTX_data_view_layer(C),
@@ -361,7 +369,8 @@ static void pose_slide_apply_val(
* - numerator should be larger than denominator to 'expand' the result
* - perform this weighting a number of times given by the percentage...
*/
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f;
@@ -374,7 +383,8 @@ static void pose_slide_apply_val(
* - numerator should be smaller than denominator to 'relax' the result
* - perform this weighting a number of times given by the percentage...
*/
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f;
@@ -579,7 +589,8 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
}
else {
float quat_interp[4], quat_orig[4];
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
@@ -1647,7 +1658,8 @@ void POSE_OT_propagate(wmOperatorType *ot)
"Propagate pose to all selected keyframes"},
{POSE_PROPAGATE_SELECTED_MARKERS, "SELECTED_MARKERS", 0, "On Selected Markers",
"Propagate pose to all keyframes occurring on frames with Scene Markers after the current frame"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Propagate Pose";
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index ffbe8b52137..0a78669d743 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_transform.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_anim_types.h"
@@ -45,7 +39,6 @@
#include "BKE_blender_copybuffer.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@ -72,7 +65,8 @@
/* ********************************************** */
/* Pose Apply */
-/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
+/* helper for apply_armature_pose2bones - fixes parenting of objects
+ * that are bone-parented to armature */
static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Object *armob)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -100,7 +94,8 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
+ // must be active object, not edit-object
+ Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
bArmature *arm = BKE_armature_from_object(ob);
bPose *pose;
@@ -111,7 +106,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
if (ob->type != OB_ARMATURE)
return OPERATOR_CANCELLED;
if (BKE_object_obdata_is_libdata(ob)) {
- BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); /* error_libdata(); */
+ BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature");
return OPERATOR_CANCELLED;
}
@@ -745,7 +740,8 @@ static void pchan_clear_rot(bPoseChannel *pchan)
}
}
- /* Clear also Bendy Bone stuff - Roll is obvious, but Curve X/Y stuff is also kindof rotational in nature... */
+ /* Clear also Bendy Bone stuff - Roll is obvious,
+ * but Curve X/Y stuff is also kindof rotational in nature... */
pchan->roll1 = 0.0f;
pchan->roll2 = 0.0f;
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index 051940d69ec..ad8cff70e27 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_utils.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -41,7 +35,6 @@
#include "BKE_armature.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_context.h"
@@ -244,7 +237,8 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
else
BKE_pose_where_is(depsgraph, scene, ob);
- DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); /* otherwise animation doesn't get updated */
+ /* otherwise animation doesn't get updated */
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
}
diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt
index 301d333ebdb..9d1b463ec42 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index cd7a344fcb0..c741b5393dc 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/curve_intern.h
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
@@ -33,12 +26,12 @@
#define __CURVE_INTERN_H__
/* internal exports only */
-struct ListBase;
struct EditNurb;
struct GHash;
+struct ListBase;
struct Object;
-struct wmOperatorType;
struct ViewContext;
+struct wmOperatorType;
/* editfont.c */
enum { DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
@@ -67,7 +60,6 @@ bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden);
void FONT_OT_text_insert(struct wmOperatorType *ot);
void FONT_OT_line_break(struct wmOperatorType *ot);
-void FONT_OT_insert_lorem(struct wmOperatorType *ot);
void FONT_OT_case_toggle(struct wmOperatorType *ot);
void FONT_OT_case_set(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index bd1c2248660..de6fe686356 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/curve_ops.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 8c725dc8b9c..d03532a27cd 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_key_types.h"
@@ -160,8 +152,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0;
while (a--) {
/* We cannot keep *any* reference to curve obdata,
- * it might be replaced and freed while editcurve remain in use (in viewport render case e.g.).
- * Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */
+ * it might be replaced and freed while editcurve remain in use
+ * (in viewport render case e.g.). Note that we could use a pool to avoid
+ * lots of malloc's here, but... not really a problem for now. */
BezTriple *origbezt_cpy = MEM_mallocN(sizeof(*origbezt), __func__);
*origbezt_cpy = *origbezt;
keyIndex = init_cvKeyIndex(origbezt_cpy, key_index, nu_index, pt_index, vertex_index);
@@ -180,8 +173,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0;
while (a--) {
/* We cannot keep *any* reference to curve obdata,
- * it might be replaced and freed while editcurve remain in use (in viewport render case e.g.).
- * Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */
+ * it might be replaced and freed while editcurve remain in use
+ * (in viewport render case e.g.). Note that we could use a pool to avoid
+ * lots of malloc's here, but... not really a problem for now. */
BPoint *origbp_cpy = MEM_mallocN(sizeof(*origbp_cpy), __func__);
*origbp_cpy = *origbp;
keyIndex = init_cvKeyIndex(origbp_cpy, key_index, nu_index, pt_index, vertex_index);
@@ -1027,7 +1021,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
}
/* return 0 if animation data wasn't changed, 1 otherwise */
-int ED_curve_updateAnimPaths(Curve *cu)
+int ED_curve_updateAnimPaths(Main *bmain, Curve *cu)
{
AnimData *adt = BKE_animdata_from_id(&cu->id);
EditNurb *editnurb = cu->editnurb;
@@ -1037,10 +1031,16 @@ int ED_curve_updateAnimPaths(Curve *cu)
if (!curve_is_animated(cu)) return 0;
- if (adt->action)
+ if (adt->action != NULL) {
curve_rename_fcurves(cu, &adt->action->curves);
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
curve_rename_fcurves(cu, &adt->drivers);
+ DEG_id_tag_update(&cu->id, ID_RECALC_COPY_ON_WRITE);
+
+ /* TODO(sergey): Only update if something actually changed. */
+ DEG_relations_tag_update(bmain);
return 1;
}
@@ -1224,7 +1224,7 @@ void ED_curve_editnurb_load(Main *bmain, Object *obedit)
cu->nurb = newnurb;
- ED_curve_updateAnimPaths(obedit->data);
+ ED_curve_updateAnimPaths(bmain, obedit->data);
BKE_nurbList_free(&oldnurb);
}
@@ -1272,8 +1272,9 @@ void ED_curve_editnurb_make(Object *obedit)
if (actkey) {
editnurb->shapenr = obedit->shapenr;
- /* Apply shapekey to new nurbs of editnurb, not those of original curve (and *after* we generated keyIndex),
- * else we do not have valid 'original' data to properly restore curve when leaving editmode. */
+ /* Apply shapekey to new nurbs of editnurb, not those of original curve
+ * (and *after* we generated keyIndex), else we do not have valid 'original' data
+ * to properly restore curve when leaving editmode. */
BKE_keyblock_convert_to_curve(actkey, cu, &editnurb->nurbs);
}
}
@@ -1336,7 +1337,8 @@ static int separate_exec(bContext *C, wmOperator *op)
}
/* 2. Duplicate the object and data. */
- newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, 0); /* 0 = fully linked. */
+ newbase = ED_object_add_duplicate(
+ bmain, scene, view_layer, oldbase, 0); /* 0 = fully linked. */
DEG_relations_tag_update(bmain);
newob = newbase->object;
@@ -1426,6 +1428,7 @@ void CURVE_OT_separate(wmOperatorType *ot)
static int curve_split_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
int ok = -1;
@@ -1456,7 +1459,7 @@ static int curve_split_exec(bContext *C, wmOperator *op)
cu->actnu -= len_orig - BLI_listbase_count(editnurb);
BLI_movelisttolist(editnurb, &newnurb);
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -2225,7 +2228,8 @@ static void adduplicateflagNurb(Object *obedit, View3D *v3d, ListBase *newnurb,
newu++;
for (c = a / nu->pntsu, bp3 = bp2; c < nu->pntsv; c++, bp3 += nu->pntsu) {
if (bp3->f1 & flag) {
- bp3->f1 |= SURF_SEEN; /* flag as seen so skipped on future iterations */
+ /* flag as seen so skipped on future iterations */
+ bp3->f1 |= SURF_SEEN;
if (newu == 1) newv++;
}
else {
@@ -2390,6 +2394,7 @@ static void adduplicateflagNurb(Object *obedit, View3D *v3d, ListBase *newnurb,
static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2417,7 +2422,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -2722,7 +2727,8 @@ static void curve_smooth_value(ListBase *editnurb,
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */
- /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
+ /* Start BezTriple code,
+ * this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1;
for (bezt = &nu->bezt[last_sel], a = last_sel; a < nu->pntsu; a++, bezt++) {
if (bezt->f2 & SELECT) {
@@ -2792,7 +2798,8 @@ static void curve_smooth_value(ListBase *editnurb,
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */
- /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
+ /* Start BezTriple code,
+ * this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1;
for (bp = &nu->bp[last_sel], a = last_sel; a < nu->pntsu; a++, bp++) {
if (bp->f1 & SELECT) {
@@ -3497,6 +3504,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
{
const int number_cuts = RNA_int_get(op->ptr, "number_cuts");
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -3512,8 +3520,9 @@ static int subdivide_exec(bContext *C, wmOperator *op)
subdividenurb(obedit, v3d, number_cuts);
- if (ED_curve_updateAnimPaths(cu))
+ if (ED_curve_updateAnimPaths(bmain, cu)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
WM_event_add_notifier(C, NC_GEOM | ND_DATA, cu);
DEG_id_tag_update(obedit->data, 0);
@@ -3696,6 +3705,7 @@ static void findselectedNurbvert(
static int set_spline_type_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
ListBase *editnurb = object_editcurve_get(obedit);
@@ -3726,8 +3736,9 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
}
if (changed) {
- if (ED_curve_updateAnimPaths(obedit->data))
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
DEG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -3752,7 +3763,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
// {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
// {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""},
{CU_NURBS, "NURBS", 0, "NURBS", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3810,7 +3821,7 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
{5, "ALIGNED", 0, "Aligned", ""},
{6, "FREE_ALIGN", 0, "Free", ""},
{3, "TOGGLE_FREE_ALIGN", 0, "Toggle Free/Align", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4251,6 +4262,7 @@ static int merge_nurb(View3D *v3d, Object *obedit)
static int make_segment_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -4343,8 +4355,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu1 = nu;
/* Just in case both of first/last CV are selected check
- * whether we really need to switch the direction.
- */
+ * whether we really need to switch the direction.
+ */
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nu1->bezt)) {
BKE_nurb_direction_switch(nu1);
keyData_switchDirectionNurb(cu, nu1);
@@ -4360,8 +4372,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu2 = nu;
/* Just in case both of first/last CV are selected check
- * whether we really need to switch the direction.
- */
+ * whether we really need to switch the direction.
+ */
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, &(nu->bezt[nu2->pntsu - 1]))) {
BKE_nurb_direction_switch(nu2);
keyData_switchDirectionNurb(cu, nu2);
@@ -4371,9 +4383,9 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
else if (nu->pntsv == 1) {
/* Same logic as above: if first point is selected spline is
- * preferred for nu1, if last point is selected spline is
- * preferred for u2u.
- */
+ * preferred for nu1, if last point is selected spline is
+ * preferred for u2u.
+ */
bp = nu->bp;
if (bp[nu->pntsu - 1].f1 & SELECT) {
@@ -4481,7 +4493,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
continue;
}
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -4768,6 +4780,7 @@ bool ed_editnurb_spin(float viewmat[4][4], View3D *v3d, Object *obedit, const fl
static int spin_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
@@ -4801,7 +4814,7 @@ static int spin_exec(bContext *C, wmOperator *op)
}
ok = 1;
- if (ED_curve_updateAnimPaths(cu)) {
+ if (ED_curve_updateAnimPaths(bmain, cu)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5248,6 +5261,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, cons
static int add_vertex_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
Curve *cu = obedit->data;
@@ -5261,7 +5275,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
mul_m4_v3(imat, location);
if (ed_editcurve_addvert(cu, editnurb, v3d, location)) {
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5388,6 +5402,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -5425,7 +5440,7 @@ static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
}
if (changed) {
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5499,7 +5514,8 @@ static bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
while (a--) {
if (bp->f1 & SELECT) {
nu->flagu ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu);
changed = true;
break;
}
@@ -5515,12 +5531,14 @@ static bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
if (bp->f1 & SELECT) {
if (direction == 0 && nu->pntsu > 1) {
nu->flagu ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu);
changed = true;
}
if (direction == 1 && nu->pntsv > 1) {
nu->flagv ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
+ /* 2==v type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_v(nu);
changed = true;
}
break;
@@ -5592,7 +5610,7 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{0, "CYCLIC_U", 0, "Cyclic U", ""},
{1, "CYCLIC_V", 0, "Cyclic V", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -6079,6 +6097,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
static int curve_delete_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
eCurveElem_Types type = RNA_enum_get(op->ptr, "type");
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -6109,7 +6128,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
changed_multi = true;
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -6130,11 +6149,12 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem curve_delete_type_items[] = {
{CURVE_VERTEX, "VERT", 0, "Vertices", ""},
{CURVE_SEGMENT, "SEGMENT", 0, "Segments", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
-static const EnumPropertyItem *rna_curve_delete_type_itemf(bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_curve_delete_type_itemf(
+ bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *r_free)
{
EnumPropertyItem *item = NULL;
int totitem = 0;
@@ -6183,6 +6203,7 @@ static bool test_bezt_is_sel_any(const void *bezt_v, void *user_data)
static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -6267,7 +6288,9 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
+ WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
DEG_id_tag_update(obedit->data, 0);
@@ -6307,6 +6330,7 @@ static bool nurb_bezt_flag_any(const Nurb *nu, const char flag_test)
static int curve_decimate_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
const float error_sq_max = FLT_MAX;
float ratio = RNA_float_get(op->ptr, "ratio");
bool all_supported_multi = true;
@@ -6346,7 +6370,7 @@ static int curve_decimate_exec(bContext *C, wmOperator *op)
if (changed) {
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -6658,7 +6682,7 @@ static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op))
int a;
if (object->runtime.curve_cache == NULL) {
- BKE_displist_make_curveTypes(depsgraph, scene, object, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, object, false, false, NULL);
}
INIT_MINMAX(min, max);
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index 5308660ddee..0e110edf35f 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_add.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -60,7 +52,7 @@
static const float nurbcircle[8][2] = {
{0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
- {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
+ {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0},
};
/************ add primitive, used by object/ module ****************/
@@ -343,7 +335,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
break;
case CU_PRIM_TUBE: /* Cylinder */
if (cutype == CU_NURBS) {
- nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */
+ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
nu->resolu = cu->resolu;
nu->flag = CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
@@ -420,7 +412,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
float tmp_vec[3] = {0.f, 0.f, 1.f};
xzproj = 1;
- nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */
+ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
xzproj = 0;
nu->resolu = cu->resolu;
nu->resolv = cu->resolv;
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 3fe880865bb..0edee8a84ea 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_paint.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -34,7 +30,6 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_layer.h"
@@ -48,7 +43,6 @@
#include "ED_view3d.h"
#include "ED_curve.h"
-#include "BIF_gl.h"
#include "GPU_batch.h"
#include "GPU_batch_presets.h"
@@ -80,7 +74,6 @@
#define STROKE_CYCLIC_DIST_PX 8
/* -------------------------------------------------------------------- */
-
/** \name StrokeElem / #RNA_OperatorStrokeElement Conversion Functions
* \{ */
@@ -300,7 +293,6 @@ static bool stroke_elem_project_fallback_elem(
/* -------------------------------------------------------------------- */
-
/** \name Operator/Stroke Conversion
* \{ */
@@ -354,7 +346,6 @@ static void curve_draw_stroke_from_operator(wmOperator *op)
/* -------------------------------------------------------------------- */
-
/** \name Operator Callbacks & Helpers
* \{ */
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index cafc3cb076f..25470f7344a 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): John Roper
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_select.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -37,7 +29,6 @@
#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLI_rand.h"
-#include "BLI_heap.h"
#include "BLI_heap_simple.h"
#include "BLI_kdtree.h"
@@ -1335,7 +1326,7 @@ static const EnumPropertyItem curve_prop_similar_compare_types[] = {
{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
{SIM_CMP_LT, "LESS", 0, "Less", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
enum {
@@ -1350,7 +1341,7 @@ static const EnumPropertyItem curve_prop_similar_types[] = {
{SIMCURHAND_RADIUS, "RADIUS", 0, "Radius", ""},
{SIMCURHAND_WEIGHT, "WEIGHT", 0, "Weight", ""},
{SIMCURHAND_DIRECTION, "DIRECTION", 0, "Direction", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void nurb_bezt_direction_worldspace_get(Object *ob, Nurb *nu, BezTriple *bezt, float r_dir[3])
diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c
index 9163272fbf2..30dd7346191 100644
--- a/source/blender/editors/curve/editcurve_undo.c
+++ b/source/blender/editors/curve/editcurve_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_undo.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "MEM_guardedalloc.h"
@@ -39,6 +35,7 @@
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "BKE_layer.h"
+#include "BKE_main.h"
#include "BKE_undo_system.h"
#include "DEG_depsgraph.h"
@@ -76,7 +73,7 @@ typedef struct {
size_t undo_size;
} UndoCurve;
-static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu, short *r_shapenr)
+static void undocurve_to_editcurve(Main *bmain, UndoCurve *ucu, Curve *cu, short *r_shapenr)
{
ListBase *undobase = &ucu->nubase;
ListBase *editbase = BKE_curve_editNurbs_get(cu);
@@ -116,7 +113,7 @@ static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu, short *r_shapenr)
cu->actnu = ucu->actnu;
cu->flag = ucu->flag;
*r_shapenr = ucu->obedit.shapenr;
- ED_curve_updateAnimPaths(cu);
+ ED_curve_updateAnimPaths(bmain, cu);
}
static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shapenr)
@@ -214,13 +211,15 @@ static bool curve_undosys_poll(bContext *C)
return (obedit != NULL);
}
-static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool curve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
CurveUndoStep *us = (CurveUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -237,14 +236,16 @@ static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void curve_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(curve_undosys_poll(C));
-
CurveUndoStep *us = (CurveUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(
+ C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(curve_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
CurveUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -255,7 +256,7 @@ static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UN
us_p->name, obedit->id.name);
continue;
}
- undocurve_to_editcurve(&elem->data, obedit->data, &obedit->shapenr);
+ undocurve_to_editcurve(bmain, &elem->data, obedit->data, &obedit->shapenr);
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
}
@@ -298,7 +299,6 @@ void ED_curve_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = curve_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(CurveUndoStep);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index b6b0100773d..03161df2a29 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editfont.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
@@ -568,7 +562,7 @@ static const EnumPropertyItem style_items[] = {
{CU_CHINFO_ITALIC, "ITALIC", 0, "Italic", ""},
{CU_CHINFO_UNDERLINE, "UNDERLINE", 0, "Underline", ""},
{CU_CHINFO_SMALLCAPS, "SMALL_CAPS", 0, "Small Caps", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int set_style(bContext *C, const int style, const bool clear)
@@ -894,7 +888,8 @@ static const EnumPropertyItem move_type_items[] = {
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int move_cursor(bContext *C, int type, const bool select)
{
@@ -1182,7 +1177,8 @@ static const EnumPropertyItem delete_type_items[] = {
{DEL_SELECTION, "SELECTION", 0, "Selection", ""},
{DEL_NEXT_SEL, "NEXT_OR_SELECTION", 0, "Next or Selection", ""},
{DEL_PREV_SEL, "PREVIOUS_OR_SELECTION", 0, "Previous or Selection", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int delete_exec(bContext *C, wmOperator *op)
{
@@ -1600,7 +1596,8 @@ void ED_curve_editfont_free(Object *obedit)
static const EnumPropertyItem case_items[] = {
{CASE_LOWER, "LOWER", 0, "Lower", ""},
{CASE_UPPER, "UPPER", 0, "Upper", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int set_case(bContext *C, int ccase)
{
diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c
index 85e361b495f..13cbea77ab8 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editfont_undo.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include <stdlib.h>
@@ -339,7 +335,7 @@ static bool font_undosys_poll(bContext *C)
return editfont_object_from_context(C) != NULL;
}
-static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool font_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
FontUndoStep *us = (FontUndoStep *)us_p;
us->obedit_ref.ptr = editfont_object_from_context(C);
@@ -349,7 +345,7 @@ static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void font_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void font_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
@@ -387,7 +383,6 @@ void ED_font_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = font_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(FontUndoStep);
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 46981cf5e6d..2eb2596ad28 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -699,6 +696,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
ops.gpencil.sculpt_thickness
ops.gpencil.sculpt_twist
ops.gpencil.sculpt_weight
+ ops.gpencil.stroke_cutter
ops.mesh.bevel
ops.mesh.bisect
ops.mesh.dupli_extrude_cursor
diff --git a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
index 55b33b0d8ad..d62d397c783 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_arrow_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
index 410e2a5ad6e..e89d20a41bd 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_cube_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
index 22cf0785c64..5ead50f67d1 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_dial_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
index 9ef53d8f696..999e211a492 100644
--- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_draw_utils.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "BLI_listbase.h"
-#include "BLI_ghash.h"
-#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h
index 53541b0aa01..71d8919c91d 100644
--- a/source/blender/editors/gizmo_library/gizmo_geometry.h
+++ b/source/blender/editors/gizmo_library/gizmo_geometry.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_geometry.h
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Geometry
*
diff --git a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
index 274d35269d1..28a5200a041 100644
--- a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
+++ b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file value2d_gizmo_group.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name 2D Value Gizmo
*
diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h
index f58935e1fba..7712767c5ad 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_intern.h
+++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_library_intern.h
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#ifndef __GIZMO_LIBRARY_INTERN_H__
diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c
index 4eeddb92664..9dba0c0d515 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_presets.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gizmo_library/gizmo_library_presets.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Lib Presets
*
@@ -35,8 +31,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-
#include "GPU_draw.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index d8c29eb6675..0ae312d552e 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_library_utils.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Library Utilities
*
@@ -32,7 +26,6 @@
*/
#include "BLI_math.h"
-#include "BLI_listbase.h"
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
index fb3583b7b27..b4bf4c6726c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,29 +15,22 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file arrow2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name 2D Arrow Gizmo
*
* \brief Simple arrow gizmo which is dragged into a certain direction.
*/
-#include "BLI_listbase.h"
#include "BLI_math.h"
-#include "BLI_rect.h"
#include "DNA_windowmanager_types.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_draw.h"
#include "GPU_immediate.h"
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 e02d4b8470c..f31e53d2a1f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file arrow3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Arrow Gizmo
*
@@ -38,7 +32,6 @@
* - `matrix[2]` is the arrow direction (for all arrowes).
*/
-#include "BIF_gl.h"
#include "BLI_math.h"
@@ -457,16 +450,16 @@ static void GIZMO_GT_arrow_3d(wmGizmoType *gzt)
{ED_GIZMO_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
{ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options_items[] = {
{ED_GIZMO_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform_items[] = {
{ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""},
{ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(
diff --git a/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
index 6bff72d75cd..55054d1b4ad 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blank3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Blank Gizmo
*
* \brief Gizmo to use as a fallback (catch events).
*/
-#include "BLI_math.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index 7b625364905..542b9aa19e3 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file button2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Button Gizmo
*
@@ -28,7 +24,6 @@
* \brief Single click button action for use in gizmo groups.
*
* \note Currently only basic icon & vector-shape buttons are supported.
- *
*/
#include "MEM_guardedalloc.h"
@@ -37,8 +32,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -308,7 +301,7 @@ static void GIZMO_GT_button_2d(wmGizmoType *gzt)
{ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""},
{ED_GIZMO_BUTTON_SHOW_BACKDROP, "BACKDROP", 0, "Backdrop", ""},
{ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 04015ee9f1e..92fe643fca6 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file cage2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Cage Gizmo
*
@@ -42,7 +36,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
@@ -761,10 +754,10 @@ static int gizmo_cage2d_test_select(
/* if gizmo does not have a scale intersection, don't do it */
if (transform_flag & (ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) {
- const rctf r_xmin = {.xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1]};
- const rctf r_xmax = {.xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1]};
- const rctf r_ymin = {.xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1]};
- const rctf r_ymax = {.xmin = -size[0], .ymin = size[1] - margin[1], .xmax = size[0], .ymax = size[1]};
+ const rctf r_xmin = { .xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1], };
+ const rctf r_xmax = { .xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1], };
+ const rctf r_ymin = { .xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1], };
+ const rctf r_ymax = { .xmin = -size[0], .ymin = size[1] - margin[1], .xmax = size[0], .ymax = size[1], };
if (BLI_rctf_isect_pt_v(&r_xmin, point_local)) {
if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) {
@@ -1071,18 +1064,18 @@ static void GIZMO_GT_cage_2d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform[] = {
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float unit_v2[2] = {1.0f, 1.0f};
RNA_def_float_vector(gzt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
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 3bbe13362d0..977b7c7a0a5 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file cage3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Cage Gizmo
*
@@ -37,12 +31,9 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_rect.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
-
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "GPU_immediate.h"
@@ -664,17 +655,17 @@ static void GIZMO_GT_cage_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform[] = {
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float unit_v3[3] = {1.0f, 1.0f, 1.0f};
RNA_def_float_vector(gzt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index c391ec812c7..b5be45bb63f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file dial3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Dial Gizmo
*
@@ -44,8 +38,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -598,7 +590,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, "ANGLE_VALUE", 0, "Show Angle Value", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
RNA_def_boolean(gzt->srna, "wrap_angle", true, "Wrap Angle", "");
diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
index b91a193e9a0..0fe5a4e7d80 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file move3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Move Gizmo
*
@@ -30,7 +26,6 @@
* - `matrix[0]` is derived from Y and Z.
* - `matrix[1]` currently not used.
* - `matrix[2]` is the widget direction (for all gizmos).
- *
*/
#include "MEM_guardedalloc.h"
@@ -39,8 +34,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -443,12 +436,12 @@ static void GIZMO_GT_move_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_MOVE_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
{ED_GIZMO_MOVE_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_MOVE_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
{ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_MOVE_STYLE_RING_2D, "Draw Style", "");
diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
index d5f1c23971c..2b13398dc4c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file primitive3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Primitive Gizmo
*
@@ -37,7 +33,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
@@ -178,7 +173,7 @@ static void GIZMO_GT_primitive_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_PRIMITIVE_STYLE_PLANE, "Draw Style", "");
}
diff --git a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
index 46a6b8f3a5f..9854b62dade 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file value2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Value Gizmo
*
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index cea2e5d4269..a12dca3ad16 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -45,20 +42,21 @@ set(SRC
editaction_gpencil.c
gpencil_add_monkey.c
gpencil_add_stroke.c
+ gpencil_armature.c
gpencil_brush.c
gpencil_convert.c
gpencil_data.c
gpencil_edit.c
+ gpencil_fill.c
gpencil_interpolate.c
- gpencil_primitive.c
+ gpencil_merge.c
+ gpencil_old.c
gpencil_ops.c
gpencil_paint.c
- gpencil_fill.c
+ gpencil_primitive.c
gpencil_select.c
gpencil_undo.c
gpencil_utils.c
- gpencil_old.c
- gpencil_armature.c
gpencil_intern.h
)
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index e6747856d1e..29d5aa6df4d 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/annotate_draw.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -41,7 +35,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_polyfill_2d.h"
#include "BLF_api.h"
#include "BLT_translation.h"
@@ -80,13 +73,20 @@
/* ----- General Defines ------ */
/* flags for sflag */
typedef enum eDrawStrokeFlags {
- GP_DRAWDATA_NOSTATUS = (1 << 0), /* don't draw status info */
- GP_DRAWDATA_ONLY3D = (1 << 1), /* only draw 3d-strokes */
- GP_DRAWDATA_ONLYV2D = (1 << 2), /* only draw 'canvas' strokes */
- GP_DRAWDATA_ONLYI2D = (1 << 3), /* only draw 'image' strokes */
- GP_DRAWDATA_IEDITHACK = (1 << 4), /* special hack for drawing strokes in Image Editor (weird coordinates) */
- GP_DRAWDATA_NO_XRAY = (1 << 5), /* don't draw xray in 3D view (which is default) */
- GP_DRAWDATA_NO_ONIONS = (1 << 6), /* no onionskins should be drawn (for animation playback) */
+ /** don't draw status info */
+ GP_DRAWDATA_NOSTATUS = (1 << 0),
+ /** only draw 3d-strokes */
+ GP_DRAWDATA_ONLY3D = (1 << 1),
+ /** only draw 'canvas' strokes */
+ GP_DRAWDATA_ONLYV2D = (1 << 2),
+ /** only draw 'image' strokes */
+ GP_DRAWDATA_ONLYI2D = (1 << 3),
+ /** special hack for drawing strokes in Image Editor (weird coordinates) */
+ GP_DRAWDATA_IEDITHACK = (1 << 4),
+ /** don't draw xray in 3D view (which is default) */
+ GP_DRAWDATA_NO_XRAY = (1 << 5),
+ /** no onionskins should be drawn (for animation playback) */
+ GP_DRAWDATA_NO_ONIONS = (1 << 6),
} eDrawStrokeFlags;
@@ -272,7 +272,8 @@ static void gp_draw_stroke_3d(
* Note: we want more visible levels of pressures when thickness is bigger.
*/
if (fabsf(pt->pressure - curpressure) > 0.2f / (float)thickness) {
- /* if the pressure changes before get at least 2 vertices, need to repeat last point to avoid assert in immEnd() */
+ /* if the pressure changes before get at least 2 vertices,
+ * need to repeat last point to avoid assert in immEnd() */
if (draw_points < 2) {
const bGPDspoint *pt2 = pt - 1;
immVertex3fv(pos, &pt2->x);
@@ -847,7 +848,7 @@ static void gp_draw_data_layers(
* (NOTE: doing it this way means that the toggling editmode shows visible change immediately)
*/
/* XXX: perhaps we don't want to show these when users are drawing... */
- if ((G.f & G_RENDER_OGL) == 0 &&
+ if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 &&
(gpl->flag & GP_LAYER_LOCKED) == 0 &&
(gpd->flag & GP_DATA_STROKE_EDITMODE))
{
@@ -880,7 +881,7 @@ static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar)
rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
- if (G.f & G_RENDER_OGL)
+ if (G.f & G_FLAG_RENDER_VIEWPORT)
return;
/* Get bounds of region - Necessary to avoid problems with region overlap */
@@ -954,7 +955,8 @@ static void gp_draw_data_all(
gpd_source = (scene->gpd ? scene->gpd : NULL);
}
else if (spacetype == SPACE_CLIP && scene->clip) {
- /* currently drawing only gpencil data from either clip or track, but not both - XXX fix logic behind */
+ /* currently drawing only gpencil data from either clip or track,
+ * but not both - XXX fix logic behind */
gpd_source = (scene->clip->gpd ? scene->clip->gpd : NULL);
}
@@ -1097,7 +1099,7 @@ void ED_gpencil_draw_view3d_annotations(
/* when rendering to the offscreen buffer we don't want to
* deal with the camera border, otherwise map the coords to the camera border. */
- if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index f03141c3513..be2cea6f5d8 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008/2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/annotate_paint.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -67,7 +61,6 @@
#include "ED_view3d.h"
#include "ED_clip.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -116,56 +109,84 @@ typedef enum eGPencil_PaintFlags {
*/
typedef struct tGPsdata {
Main *bmain;
- Scene *scene; /* current scene from context */
+ /** current scene from context. */
+ Scene *scene;
struct Depsgraph *depsgraph;
- wmWindow *win; /* window where painting originated */
- ScrArea *sa; /* area where painting originated */
- ARegion *ar; /* region where painting originated */
- View2D *v2d; /* needed for GP_STROKE_2DSPACE */
- rctf *subrect; /* for using the camera rect within the 3d view */
+ /** window where painting originated. */
+ wmWindow *win;
+ /** area where painting originated. */
+ ScrArea *sa;
+ /** region where painting originated. */
+ ARegion *ar;
+ /** needed for GP_STROKE_2DSPACE. */
+ View2D *v2d;
+ /** for using the camera rect within the 3d view. */
+ rctf *subrect;
rctf subrect_data;
- GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */
-
- PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
- bGPdata *gpd; /* gp-datablock layer comes from */
- bGPDlayer *gpl; /* layer we're working on */
- bGPDframe *gpf; /* frame we're working on */
-
- char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
-
- eGPencil_PaintStatus status; /* current status of painting */
- eGPencil_PaintModes paintmode; /* mode for painting */
- eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */
-
- short radius; /* radius of influence for eraser */
-
- float mval[2]; /* current mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- float pressure; /* current stylus pressure */
- float opressure; /* previous stylus pressure */
+ /** settings to pass to gp_points_to_xy(). */
+ GP_SpaceConversion gsc;
+
+ /** pointer to owner of gp-datablock. */
+ PointerRNA ownerPtr;
+ /** gp-datablock layer comes from. */
+ bGPdata *gpd;
+ /** layer we're working on. */
+ bGPDlayer *gpl;
+ /** frame we're working on. */
+ bGPDframe *gpf;
+
+ /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+ char *align_flag;
+
+ /** current status of painting. */
+ eGPencil_PaintStatus status;
+ /** mode for painting. */
+ eGPencil_PaintModes paintmode;
+ /** flags that can get set during runtime (eGPencil_PaintFlags) */
+ eGPencil_PaintFlags flags;
+
+ /** radius of influence for eraser. */
+ short radius;
+
+ /** current mouse-position. */
+ float mval[2];
+ /** previous recorded mouse-position. */
+ float mvalo[2];
+
+ /** current stylus pressure. */
+ float pressure;
+ /** previous stylus pressure. */
+ float opressure;
/* These need to be doubles, as (at least under unix) they are in seconds since epoch,
* float (and its 7 digits precision) is definitively not enough here!
* double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least.
*/
- double inittime; /* Used when converting to path */
- double curtime; /* Used when converting to path */
- double ocurtime; /* Used when converting to path */
-
- float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space
- * to region space */
+ /** Used when converting to path. */
+ double inittime;
+ /** Used when converting to path. */
+ double curtime;
+ /** Used when converting to path. */
+ double ocurtime;
+
+ /** Inverted transformation matrix applying when converting coords from screen-space
+ * to region space. */
+ float imat[4][4];
float mat[4][4];
- float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */
+ /** custom color - hack for enforcing a particular color for track/mask editing. */
+ float custom_color[4];
- void *erasercursor; /* radial cursor data for drawing eraser */
+ /** radial cursor data for drawing eraser. */
+ void *erasercursor;
- short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */
+ /** 1: line horizontal, 2: line vertical, other: not defined, second element position. */
+ short straight[2];
- short keymodifier; /* key used for invoking the operator */
+ /** key used for invoking the operator. */
+ short keymodifier;
} tGPsdata;
/* ------ */
@@ -348,7 +369,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -363,7 +385,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -385,7 +408,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
pt->pressure = pressure;
- pt->strength = 1.0f; /* unused for annotations, but initialise for easier conversions to GP Object */
+ /* unused for annotations, but initialise for easier conversions to GP Object */
+ pt->strength = 1.0f;
/* point time */
pt->time = (float)(curtime - p->inittime);
@@ -405,7 +429,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -447,7 +472,7 @@ static short gp_stroke_addpoint(
pts->time = pt->time;
/* force fill recalc */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* increment counters */
@@ -586,7 +611,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->inittime = p->inittime;
/* enable recalculation flag by default (only used if hq fill) */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* allocate enough memory for a continuous array for storage points */
gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
@@ -875,7 +900,7 @@ static void gp_stroke_eraser_dostroke(
/* Second Pass: Remove any points that are tagged */
if (do_cull) {
- gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
}
}
}
@@ -1297,7 +1322,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */
+ /* no shift */
+ ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -1689,7 +1715,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg
int tablet = 0;
/* convert from window-space to area-space mouse coordinates
- * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
+ * NOTE: float to ints conversions,
+ * +1 factor is probably used to ensure a bit more accurate rounding...
*/
p->mval[0] = event->mval[0] + 1;
p->mval[1] = event->mval[1] + 1;
@@ -1697,8 +1724,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg
/* verify key status for straight lines */
if ((event->ctrl > 0) || (event->alt > 0)) {
if (p->straight[0] == 0) {
- int dx = abs(p->mval[0] - p->mvalo[0]);
- int dy = abs(p->mval[1] - p->mvalo[1]);
+ int dx = abs((int)(p->mval[0] - p->mvalo[0]));
+ int dy = abs((int)(p->mval[1] - p->mvalo[1]));
if ((dx > 0) || (dy > 0)) {
/* check mouse direction to replace the other coordinate with previous values */
if (dx >= dy) {
@@ -1789,7 +1816,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg
gpencil_draw_apply(op, p, depsgraph);
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
}
/* ------------------------------- */
@@ -1877,6 +1905,11 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
Scene *scene = CTX_data_scene(C);
tGPsdata *p = NULL;
+ /* support for tablets eraser pen */
+ if (gpencil_is_tablet_eraser_active(event)) {
+ RNA_enum_set(op->ptr, "mode", GP_PAINTMODE_ERASER);
+ }
+
/* if try to do annotations with a gp object selected, first
* unselect the object to avoid conflicts.
* The solution is not perfect but we can keep running the annotations while
@@ -2006,7 +2039,8 @@ static void gpencil_stroke_end(wmOperator *op)
static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = op->customdata;
- int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */
+ /* default exit state - pass through to support MMB view nav, etc. */
+ int estate = OPERATOR_PASS_THROUGH;
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
@@ -2249,7 +2283,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
@@ -2269,7 +2304,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else {
/* update status indicators - cursor, header, etc. */
gpencil_draw_status_indicators(C, p);
- gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
+ /* cursor may have changed outside our control - T44084 */
+ gpencil_draw_cursor_set(p);
}
/* process last operations before exiting */
@@ -2304,7 +2340,7 @@ static const EnumPropertyItem prop_gpencil_drawmodes[] = {
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"},
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"},
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", "Erase Annotation strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void GPENCIL_OT_annotate(wmOperatorType *ot)
@@ -2332,7 +2368,8 @@ void GPENCIL_OT_annotate(wmOperatorType *ot)
prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
+ /* NOTE: wait for input is enabled by default,
+ * so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index c16ea84ec81..b36929f66b0 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/drawgpencil.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -90,15 +84,24 @@
/* ----- General Defines ------ */
/* flags for sflag */
typedef enum eDrawStrokeFlags {
- GP_DRAWDATA_NOSTATUS = (1 << 0), /* don't draw status info */
- GP_DRAWDATA_ONLY3D = (1 << 1), /* only draw 3d-strokes */
- GP_DRAWDATA_ONLYV2D = (1 << 2), /* only draw 'canvas' strokes */
- GP_DRAWDATA_ONLYI2D = (1 << 3), /* only draw 'image' strokes */
- GP_DRAWDATA_IEDITHACK = (1 << 4), /* special hack for drawing strokes in Image Editor (weird coordinates) */
- GP_DRAWDATA_NO_XRAY = (1 << 5), /* don't draw xray in 3D view (which is default) */
- GP_DRAWDATA_NO_ONIONS = (1 << 6), /* no onionskins should be drawn (for animation playback) */
- GP_DRAWDATA_VOLUMETRIC = (1 << 7), /* draw strokes as "volumetric" circular billboards */
- GP_DRAWDATA_FILL = (1 << 8) /* fill insides/bounded-regions of strokes */
+ /** don't draw status info */
+ GP_DRAWDATA_NOSTATUS = (1 << 0),
+ /** only draw 3d-strokes */
+ GP_DRAWDATA_ONLY3D = (1 << 1),
+ /** only draw 'canvas' strokes */
+ GP_DRAWDATA_ONLYV2D = (1 << 2),
+ /** only draw 'image' strokes */
+ GP_DRAWDATA_ONLYI2D = (1 << 3),
+ /** special hack for drawing strokes in Image Editor (weird coordinates) */
+ GP_DRAWDATA_IEDITHACK = (1 << 4),
+ /** don't draw xray in 3D view (which is default) */
+ GP_DRAWDATA_NO_XRAY = (1 << 5),
+ /** no onionskins should be drawn (for animation playback) */
+ GP_DRAWDATA_NO_ONIONS = (1 << 6),
+ /** draw strokes as "volumetric" circular billboards */
+ GP_DRAWDATA_VOLUMETRIC = (1 << 7),
+ /** fill insides/bounded-regions of strokes */
+ GP_DRAWDATA_FILL = (1 << 8),
} eDrawStrokeFlags;
@@ -342,7 +345,10 @@ static void gp_draw_stroke_volumetric_buffer(
const tGPspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
gp_set_tpoint_varying_color(pt, ink, color);
- immAttr1f(size, pt->pressure * thickness); /* TODO: scale based on view transform (zoom level) */
+
+ /* TODO: scale based on view transform (zoom level) */
+ immAttr1f(size, pt->pressure * thickness);
+
immVertex2f(pos, pt->x, pt->y);
}
@@ -403,8 +409,10 @@ static void gp_draw_stroke_volumetric_3d(
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints && pt; i++, pt++) {
gp_set_point_varying_color(pt, ink, color);
- immAttr1f(size, pt->pressure * thickness); /* TODO: scale based on view transform */
- immVertex3fv(pos, &pt->x); /* we can adjust size in vertex shader based on view/projection! */
+ /* TODO: scale based on view transform */
+ immAttr1f(size, pt->pressure * thickness);
+ /* we can adjust size in vertex shader based on view/projection! */
+ immVertex3fv(pos, &pt->x);
}
immEnd();
@@ -459,50 +467,6 @@ static void gp_calc_stroke_text_coordinates(const float(*points2d)[2], int totpo
}
}
-/* Get points of stroke always flat to view not affected by camera view or view position */
-static void gp_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
-{
- const bGPDspoint *pt0 = &points[0];
- const bGPDspoint *pt1 = &points[1];
- const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
-
- float locx[3];
- float locy[3];
- float loc3[3];
- float normal[3];
-
- /* local X axis (p0 -> p1) */
- sub_v3_v3v3(locx, &pt1->x, &pt0->x);
-
- /* point vector at 3/4 */
- sub_v3_v3v3(loc3, &pt3->x, &pt0->x);
-
- /* vector orthogonal to polygon plane */
- cross_v3_v3v3(normal, locx, loc3);
-
- /* local Y axis (cross to normal/x axis) */
- cross_v3_v3v3(locy, normal, locx);
-
- /* Normalize vectors */
- normalize_v3(locx);
- normalize_v3(locy);
-
- /* Get all points in local space */
- for (int i = 0; i < totpoints; i++) {
- const bGPDspoint *pt = &points[i];
- float loc[3];
-
- /* Get local space using first point as origin */
- sub_v3_v3v3(loc, &pt->x, &pt0->x);
-
- points2d[i][0] = dot_v3v3(loc, locx);
- points2d[i][1] = dot_v3v3(loc, locy);
- }
-
- /* Concave (-1), Convex (1), or Autodetect (0)? */
- *r_direction = (int)locy[2];
-}
-
/* Triangulate stroke for high quality fill (this is done only if cache is null or stroke was modified) */
static void gp_triangulate_stroke_fill(bGPDstroke *gps)
{
@@ -517,7 +481,7 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
int direction = 0;
/* convert to 2d and triangulate */
- gp_stroke_2d_flat(gps->points, gps->totpoints, points2d, &direction);
+ BKE_gpencil_stroke_2d_flat(gps->points, gps->totpoints, points2d, &direction);
BLI_polyfill_calc(points2d, (uint)gps->totpoints, direction, tmp_triangles);
/* calc texture coordinates automatically */
@@ -557,8 +521,8 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
}
/* disable recalculation flag */
- if (gps->flag & GP_STROKE_RECALC_CACHES) {
- gps->flag &= ~GP_STROKE_RECALC_CACHES;
+ if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
+ gps->flag &= ~GP_STROKE_RECALC_GEOMETRY;
}
/* clear memory */
@@ -632,10 +596,10 @@ static void gp_draw_stroke_fill(
{
BLI_assert(gps->totpoints >= 3);
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
/* Calculate triangles cache for filling area (must be done only after changes) */
- if ((gps->flag & GP_STROKE_RECALC_CACHES) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
+ if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
gp_triangulate_stroke_fill(gps);
}
BLI_assert(gps->tot_triangles >= 1);
@@ -750,13 +714,14 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
immBindBuiltinProgram(GPU_SHADER_GPENCIL_STROKE);
immUniform2fv("Viewport", viewport);
immUniform1f("pixsize", tgpw->rv3d->pixsize);
- float obj_scale = tgpw->ob ? (tgpw->ob->size[0] + tgpw->ob->size[1] + tgpw->ob->size[2]) / 3.0f : 1.0f;
+ float obj_scale = tgpw->ob ? (tgpw->ob->scale[0] + tgpw->ob->scale[1] + tgpw->ob->scale[2]) / 3.0f : 1.0f;
immUniform1f("objscale", obj_scale);
int keep_size = (int)((tgpw->gpd) && (tgpw->gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS));
immUniform1i("keep_size", keep_size);
immUniform1i("pixfactor", tgpw->gpd->pixfactor);
- immUniform1i("xraymode", tgpw->gpd->xray_mode);
+ /* xray mode always to 3D space to avoid wrong zdepth calculation (T60051) */
+ immUniform1i("xraymode", GP_XRAY_3DSPACE);
/* draw stroke curve */
GPU_line_width(max_ff(curpressure * thickness, 1.0f));
@@ -1042,7 +1007,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
}
/* check if the color is visible */
Material *ma = tgpw->gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
if ((gp_style == NULL) ||
(gp_style->flag & GP_STYLE_COLOR_HIDE) ||
@@ -1262,7 +1227,7 @@ static void gp_draw_strokes_edit(
/* verify color lock */
{
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
if (gp_style != NULL) {
if (gp_style->flag & GP_STYLE_COLOR_HIDE) {
@@ -1292,7 +1257,7 @@ static void gp_draw_strokes_edit(
/* for now, we assume that the base color of the points is not too close to the real color */
/* set color using material */
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
float selectColor[4];
UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor);
@@ -1336,10 +1301,14 @@ static void gp_draw_strokes_edit(
immAttr3fv(color, selectColor);
immAttr1f(size, vsize);
}
- else {
+ else if (gp_style) {
immAttr3fv(color, gp_style->stroke_rgba);
immAttr1f(size, bsize);
}
+ else {
+ immAttr3f(color, 0.0f, 0.0f, 0.0f);
+ immAttr1f(size, bsize);
+ }
/* then position */
if (gps->flag & GP_STROKE_3DSPACE) {
@@ -1507,7 +1476,7 @@ static void gp_draw_data_layers(RegionView3D *rv3d,
* (NOTE: doing it this way means that the toggling editmode shows visible change immediately)
*/
/* XXX: perhaps we don't want to show these when users are drawing... */
- if ((G.f & G_RENDER_OGL) == 0 &&
+ if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 &&
(gpl->flag & GP_LAYER_LOCKED) == 0 &&
(gpd->flag & GP_DATA_STROKE_EDITMODE))
{
@@ -1549,7 +1518,7 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar
rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
- if (G.f & G_RENDER_OGL)
+ if (G.f & G_FLAG_RENDER_VIEWPORT)
return;
/* Get bounds of region - Necessary to avoid problems with region overlap */
@@ -1674,7 +1643,7 @@ void ED_gpencil_draw_view3d(
/* when rendering to the offscreen buffer we don't want to
* deal with the camera border, otherwise map the coords to the camera border. */
- if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
@@ -1730,7 +1699,7 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, Depsgraph
/* when rendering to the offscreen buffer we don't want to
* deal with the camera border, otherwise map the coords to the camera border. */
- if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 335dc254f40..8ada5a05618 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/editaction_gpencil.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index 3d0f302d538..302a6fb10f6 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Matias Mendiola
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_add_monkey.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -54,7 +47,8 @@ typedef struct ColorTemplate {
} ColorTemplate;
/* Add color an ensure duplications (matched by name) */
-static int gpencil_monkey_color(Main *bmain, Object *ob, const ColorTemplate *pct)
+static int gpencil_monkey_color(
+ Main *bmain, Object *ob, const ColorTemplate *pct, bool stroke, bool fill)
{
short *totcol = give_totcolp(ob);
Material *ma = NULL;
@@ -73,1311 +67,1322 @@ static int gpencil_monkey_color(Main *bmain, Object *ob, const ColorTemplate *pc
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
+ if (!stroke) {
+ ma->gp_style->flag &= ~GP_STYLE_STROKE_SHOW;
+ }
+
+ if (!fill) {
+ ma->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
+ }
+ else {
+ ma->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ }
+
return BKE_gpencil_get_material_index(ob, ma) - 1;
}
/* ***************************************************************** */
/* Monkey Geometry */
-
-static const float data0[538 * GP_PRIM_DATABUF_SIZE] = {
- -0.509f, 0.0f, -0.156f, 0.267f, 0.362f, -0.522f, 0.0f, -0.159f, 0.31f, 0.407f, -0.531f, 0.0f, -0.16f, 0.347f, 0.426f, -0.543f, -0.0f, -0.162f, 0.38f, 0.439f,
- -0.554f, -0.0f, -0.163f, 0.409f, 0.448f, -0.566f, -0.0f, -0.165f, 0.433f, 0.458f, -0.578f, -0.0f, -0.167f, 0.454f, 0.478f, -0.591f, -0.0f, -0.168f, 0.471f, 0.5f,
- -0.604f, -0.0f, -0.169f, 0.485f, 0.51f, -0.619f, -0.0f, -0.171f, 0.496f, 0.516f, -0.634f, -0.0f, -0.171f, 0.504f, 0.519f, -0.649f, -0.0f, -0.171f, 0.511f, 0.519f,
- -0.665f, -0.0f, -0.17f, 0.516f, 0.521f, -0.681f, -0.0f, -0.17f, 0.521f, 0.53f, -0.697f, -0.0f, -0.169f, 0.524f, 0.533f, -0.713f, -0.0f, -0.167f, 0.527f, 0.533f,
- -0.729f, 0.0f, -0.165f, 0.53f, 0.534f, -0.745f, 0.0f, -0.161f, 0.531f, 0.534f, -0.761f, 0.0f, -0.157f, 0.533f, 0.535f, -0.777f, 0.0f, -0.153f, 0.534f, 0.535f,
- -0.792f, 0.0f, -0.148f, 0.535f, 0.536f, -0.808f, 0.0f, -0.144f, 0.535f, 0.535f, -0.822f, 0.0f, -0.139f, 0.536f, 0.537f, -0.837f, 0.0f, -0.133f, 0.536f, 0.537f,
- -0.852f, 0.0f, -0.128f, 0.536f, 0.537f, -0.866f, 0.0f, -0.122f, 0.536f, 0.537f, -0.88f, 0.0f, -0.115f, 0.536f, 0.537f, -0.894f, 0.0f, -0.109f, 0.536f, 0.537f,
- -0.908f, 0.0f, -0.101f, 0.535f, 0.535f, -0.922f, 0.0f, -0.092f, 0.535f, 0.535f, -0.936f, 0.0f, -0.082f, 0.534f, 0.534f, -0.949f, 0.0f, -0.072f, 0.534f, 0.534f,
- -0.963f, 0.0f, -0.061f, 0.534f, 0.534f, -0.976f, 0.0f, -0.05f, 0.534f, 0.534f, -0.988f, 0.0f, -0.039f, 0.534f, 0.534f, -1.0f, 0.0f, -0.028f, 0.533f, 0.534f,
- -1.011f, 0.0f, -0.017f, 0.533f, 0.533f, -1.022f, 0.0f, -0.007f, 0.533f, 0.534f, -1.033f, 0.0f, 0.004f, 0.533f, 0.533f, -1.043f, 0.0f, 0.014f, 0.532f, 0.532f,
- -1.053f, 0.0f, 0.025f, 0.532f, 0.532f, -1.062f, 0.0f, 0.036f, 0.531f, 0.531f, -1.071f, 0.0f, 0.046f, 0.531f, 0.531f, -1.078f, 0.0f, 0.057f, 0.531f, 0.531f,
- -1.085f, 0.0f, 0.068f, 0.531f, 0.531f, -1.092f, 0.0f, 0.08f, 0.532f, 0.532f, -1.098f, 0.0f, 0.091f, 0.533f, 0.533f, -1.104f, 0.0f, 0.105f, 0.535f, 0.535f,
- -1.11f, 0.0f, 0.119f, 0.539f, 0.539f, -1.115f, 0.0f, 0.133f, 0.54f, 0.54f, -1.118f, 0.0f, 0.148f, 0.541f, 0.541f, -1.121f, 0.0f, 0.162f, 0.542f, 0.542f,
- -1.123f, 0.0f, 0.177f, 0.542f, 0.542f, -1.125f, 0.0f, 0.193f, 0.543f, 0.543f, -1.125f, 0.0f, 0.208f, 0.543f, 0.543f, -1.125f, 0.0f, 0.225f, 0.543f, 0.543f,
- -1.124f, 0.0f, 0.241f, 0.545f, 0.545f, -1.122f, 0.0f, 0.258f, 0.546f, 0.546f, -1.119f, 0.0f, 0.274f, 0.548f, 0.548f, -1.116f, 0.0f, 0.29f, 0.549f, 0.549f,
- -1.111f, 0.0f, 0.305f, 0.549f, 0.549f, -1.106f, 0.0f, 0.318f, 0.549f, 0.549f, -1.1f, 0.0f, 0.33f, 0.549f, 0.549f, -1.094f, 0.0f, 0.34f, 0.549f, 0.549f,
- -1.087f, 0.0f, 0.349f, 0.55f, 0.55f, -1.08f, 0.0f, 0.357f, 0.549f, 0.549f, -1.072f, 0.0f, 0.365f, 0.55f, 0.55f, -1.063f, 0.0f, 0.372f, 0.551f, 0.551f,
- -1.054f, 0.0f, 0.379f, 0.552f, 0.552f, -1.044f, 0.0f, 0.385f, 0.553f, 0.553f, -1.034f, 0.0f, 0.391f, 0.553f, 0.553f, -1.024f, 0.0f, 0.396f, 0.554f, 0.554f,
- -1.013f, 0.0f, 0.401f, 0.554f, 0.554f, -1.003f, 0.0f, 0.405f, 0.554f, 0.554f, -0.991f, 0.0f, 0.409f, 0.554f, 0.554f, -0.978f, 0.0f, 0.412f, 0.555f, 0.555f,
- -0.964f, -0.0f, 0.414f, 0.555f, 0.555f, -0.949f, -0.0f, 0.414f, 0.556f, 0.556f, -0.934f, -0.0f, 0.413f, 0.556f, 0.556f, -0.919f, -0.0f, 0.412f, 0.557f, 0.557f,
- -0.905f, -0.0f, 0.41f, 0.557f, 0.557f, -0.892f, -0.0f, 0.406f, 0.557f, 0.557f, -0.879f, -0.0f, 0.402f, 0.557f, 0.558f, -0.867f, -0.0f, 0.398f, 0.557f, 0.557f,
- -0.855f, -0.0f, 0.394f, 0.557f, 0.557f, -0.843f, -0.0f, 0.388f, 0.557f, 0.557f, -0.831f, -0.0f, 0.381f, 0.558f, 0.557f, -0.82f, -0.0f, 0.375f, 0.558f, 0.557f,
- -0.81f, -0.0f, 0.368f, 0.558f, 0.558f, -0.801f, -0.0f, 0.362f, 0.558f, 0.558f, -0.793f, -0.0f, 0.357f, 0.557f, 0.559f, -0.784f, 0.0f, 0.353f, 0.557f, 0.559f,
- -0.776f, 0.0f, 0.35f, 0.556f, 0.559f, -0.768f, 0.0f, 0.348f, 0.556f, 0.559f, -0.76f, 0.0f, 0.346f, 0.555f, 0.559f, -0.752f, 0.0f, 0.346f, 0.554f, 0.559f,
- -0.744f, 0.0f, 0.347f, 0.553f, 0.554f, -0.737f, 0.0f, 0.348f, 0.552f, 0.548f, -0.729f, 0.0f, 0.351f, 0.551f, 0.544f, -0.723f, 0.0f, 0.355f, 0.551f, 0.546f,
- -0.716f, 0.0f, 0.36f, 0.55f, 0.546f, -0.709f, 0.0f, 0.366f, 0.55f, 0.547f, -0.702f, 0.0f, 0.372f, 0.549f, 0.547f, -0.696f, 0.0f, 0.379f, 0.549f, 0.547f,
- -0.689f, 0.0f, 0.386f, 0.549f, 0.548f, -0.683f, 0.0f, 0.394f, 0.549f, 0.548f, -0.676f, 0.0f, 0.403f, 0.549f, 0.549f, -0.67f, 0.0f, 0.413f, 0.549f, 0.548f,
- -0.664f, 0.0f, 0.422f, 0.549f, 0.549f, -0.658f, 0.0f, 0.432f, 0.55f, 0.549f, -0.652f, 0.0f, 0.441f, 0.551f, 0.548f, -0.646f, 0.0f, 0.451f, 0.552f, 0.548f,
- -0.639f, 0.0f, 0.46f, 0.554f, 0.548f, -0.632f, 0.0f, 0.469f, 0.556f, 0.549f, -0.624f, 0.0f, 0.478f, 0.559f, 0.549f, -0.616f, 0.0f, 0.487f, 0.563f, 0.549f,
- -0.609f, 0.0f, 0.497f, 0.567f, 0.549f, -0.6f, 0.0f, 0.507f, 0.572f, 0.558f, -0.592f, 0.0f, 0.518f, 0.577f, 0.574f, -0.584f, 0.0f, 0.528f, 0.582f, 0.587f,
- -0.575f, 0.0f, 0.538f, 0.586f, 0.592f, -0.566f, 0.0f, 0.548f, 0.591f, 0.595f, -0.556f, 0.0f, 0.557f, 0.594f, 0.597f, -0.546f, 0.0f, 0.567f, 0.597f, 0.598f,
- -0.536f, 0.0f, 0.577f, 0.6f, 0.6f, -0.525f, 0.0f, 0.586f, 0.602f, 0.603f, -0.514f, 0.0f, 0.596f, 0.604f, 0.605f, -0.503f, 0.0f, 0.606f, 0.605f, 0.606f,
- -0.492f, 0.0f, 0.615f, 0.606f, 0.607f, -0.482f, 0.0f, 0.624f, 0.607f, 0.607f, -0.471f, 0.0f, 0.632f, 0.608f, 0.607f, -0.462f, 0.0f, 0.64f, 0.609f, 0.607f,
- -0.453f, 0.0f, 0.647f, 0.61f, 0.61f, -0.444f, 0.0f, 0.654f, 0.612f, 0.611f, -0.435f, 0.0f, 0.66f, 0.614f, 0.613f, -0.427f, 0.0f, 0.666f, 0.616f, 0.615f,
- -0.418f, 0.0f, 0.672f, 0.617f, 0.618f, -0.409f, 0.0f, 0.677f, 0.619f, 0.621f, -0.399f, 0.0f, 0.683f, 0.621f, 0.622f, -0.389f, 0.0f, 0.69f, 0.623f, 0.623f,
- -0.379f, 0.0f, 0.696f, 0.624f, 0.624f, -0.368f, 0.0f, 0.702f, 0.626f, 0.626f, -0.356f, 0.0f, 0.708f, 0.628f, 0.628f, -0.345f, 0.0f, 0.713f, 0.63f, 0.63f,
- -0.333f, 0.0f, 0.719f, 0.633f, 0.631f, -0.32f, 0.0f, 0.724f, 0.637f, 0.632f, -0.307f, 0.0f, 0.729f, 0.641f, 0.64f, -0.294f, 0.0f, 0.732f, 0.646f, 0.644f,
- -0.281f, 0.0f, 0.736f, 0.65f, 0.655f, -0.268f, 0.0f, 0.739f, 0.654f, 0.657f, -0.255f, 0.0f, 0.742f, 0.657f, 0.658f, -0.243f, 0.0f, 0.745f, 0.659f, 0.661f,
- -0.23f, 0.0f, 0.747f, 0.662f, 0.663f, -0.217f, 0.0f, 0.75f, 0.664f, 0.664f, -0.203f, 0.0f, 0.753f, 0.666f, 0.666f, -0.19f, 0.0f, 0.755f, 0.667f, 0.668f,
- -0.177f, 0.0f, 0.757f, 0.669f, 0.67f, -0.163f, 0.0f, 0.76f, 0.671f, 0.671f, -0.15f, 0.0f, 0.762f, 0.673f, 0.672f, -0.136f, 0.0f, 0.764f, 0.674f, 0.674f,
- -0.122f, 0.0f, 0.767f, 0.676f, 0.676f, -0.108f, 0.0f, 0.769f, 0.677f, 0.678f, -0.093f, 0.0f, 0.771f, 0.678f, 0.68f, -0.079f, 0.0f, 0.773f, 0.678f, 0.68f,
- -0.064f, 0.0f, 0.774f, 0.679f, 0.679f, -0.049f, 0.0f, 0.775f, 0.68f, 0.68f, -0.033f, 0.0f, 0.775f, 0.68f, 0.68f, -0.018f, 0.0f, 0.776f, 0.68f, 0.68f,
- -0.002f, 0.0f, 0.776f, 0.681f, 0.68f, 0.013f, 0.0f, 0.777f, 0.681f, 0.681f, 0.029f, 0.0f, 0.777f, 0.682f, 0.681f, 0.045f, 0.0f, 0.777f, 0.682f, 0.681f,
- 0.061f, 0.0f, 0.777f, 0.683f, 0.683f, 0.077f, 0.0f, 0.776f, 0.683f, 0.683f, 0.094f, 0.0f, 0.775f, 0.684f, 0.684f, 0.11f, 0.0f, 0.774f, 0.685f, 0.683f,
- 0.126f, 0.0f, 0.773f, 0.685f, 0.685f, 0.142f, 0.0f, 0.771f, 0.687f, 0.685f, 0.158f, 0.0f, 0.769f, 0.688f, 0.685f, 0.174f, 0.0f, 0.767f, 0.69f, 0.686f,
- 0.19f, 0.0f, 0.765f, 0.691f, 0.692f, 0.206f, 0.0f, 0.762f, 0.693f, 0.694f, 0.222f, 0.0f, 0.757f, 0.695f, 0.696f, 0.238f, 0.0f, 0.752f, 0.697f, 0.697f,
- 0.254f, 0.0f, 0.747f, 0.699f, 0.698f, 0.27f, 0.0f, 0.742f, 0.7f, 0.7f, 0.286f, 0.0f, 0.736f, 0.702f, 0.702f, 0.302f, 0.0f, 0.73f, 0.704f, 0.704f,
- 0.318f, 0.0f, 0.724f, 0.705f, 0.71f, 0.335f, 0.0f, 0.717f, 0.707f, 0.71f, 0.351f, 0.0f, 0.709f, 0.708f, 0.71f, 0.367f, 0.0f, 0.701f, 0.709f, 0.711f,
- 0.382f, 0.0f, 0.692f, 0.71f, 0.713f, 0.397f, 0.0f, 0.683f, 0.711f, 0.713f, 0.41f, 0.0f, 0.675f, 0.712f, 0.713f, 0.422f, 0.0f, 0.666f, 0.712f, 0.714f,
- 0.434f, 0.0f, 0.658f, 0.713f, 0.714f, 0.446f, 0.0f, 0.649f, 0.714f, 0.714f, 0.458f, 0.0f, 0.641f, 0.714f, 0.714f, 0.47f, 0.0f, 0.632f, 0.715f, 0.715f,
- 0.483f, 0.0f, 0.622f, 0.715f, 0.716f, 0.496f, 0.0f, 0.611f, 0.715f, 0.716f, 0.51f, 0.0f, 0.6f, 0.716f, 0.717f, 0.523f, 0.0f, 0.588f, 0.716f, 0.716f,
- 0.536f, 0.0f, 0.576f, 0.717f, 0.717f, 0.55f, 0.0f, 0.563f, 0.717f, 0.717f, 0.564f, 0.0f, 0.549f, 0.717f, 0.717f, 0.577f, 0.0f, 0.536f, 0.718f, 0.717f,
- 0.59f, 0.0f, 0.522f, 0.718f, 0.717f, 0.603f, 0.0f, 0.508f, 0.718f, 0.718f, 0.615f, 0.0f, 0.496f, 0.718f, 0.718f, 0.625f, 0.0f, 0.484f, 0.718f, 0.718f,
- 0.635f, 0.0f, 0.473f, 0.719f, 0.718f, 0.645f, 0.0f, 0.461f, 0.719f, 0.718f, 0.654f, 0.0f, 0.45f, 0.719f, 0.718f, 0.662f, 0.0f, 0.44f, 0.719f, 0.719f,
- 0.67f, 0.0f, 0.431f, 0.719f, 0.719f, 0.676f, 0.0f, 0.422f, 0.719f, 0.719f, 0.682f, 0.0f, 0.414f, 0.719f, 0.719f, 0.687f, 0.0f, 0.407f, 0.719f, 0.719f,
- 0.692f, 0.0f, 0.4f, 0.719f, 0.719f, 0.697f, 0.0f, 0.394f, 0.719f, 0.719f, 0.701f, 0.0f, 0.388f, 0.718f, 0.718f, 0.705f, 0.0f, 0.383f, 0.718f, 0.717f,
- 0.708f, 0.0f, 0.378f, 0.718f, 0.717f, 0.711f, 0.0f, 0.374f, 0.717f, 0.717f, 0.714f, 0.0f, 0.37f, 0.717f, 0.717f, 0.717f, 0.0f, 0.366f, 0.717f, 0.717f,
- 0.719f, 0.0f, 0.362f, 0.718f, 0.717f, 0.722f, 0.0f, 0.359f, 0.718f, 0.718f, 0.724f, 0.0f, 0.356f, 0.718f, 0.717f, 0.727f, 0.0f, 0.352f, 0.717f, 0.719f,
- 0.73f, 0.0f, 0.349f, 0.717f, 0.719f, 0.734f, 0.0f, 0.347f, 0.715f, 0.719f, 0.737f, 0.0f, 0.344f, 0.714f, 0.714f, 0.742f, 0.0f, 0.341f, 0.713f, 0.709f,
- 0.746f, 0.0f, 0.339f, 0.714f, 0.707f, 0.751f, 0.0f, 0.336f, 0.718f, 0.704f, 0.757f, 0.0f, 0.334f, 0.724f, 0.705f, 0.763f, 0.0f, 0.332f, 0.732f, 0.705f,
- 0.769f, -0.0f, 0.329f, 0.742f, 0.704f, 0.775f, -0.0f, 0.328f, 0.753f, 0.713f, 0.782f, -0.0f, 0.327f, 0.764f, 0.804f, 0.789f, -0.0f, 0.327f, 0.774f, 0.813f,
- 0.797f, -0.0f, 0.327f, 0.783f, 0.815f, 0.805f, -0.0f, 0.328f, 0.791f, 0.815f, 0.814f, -0.0f, 0.329f, 0.797f, 0.816f, 0.823f, -0.0f, 0.331f, 0.802f, 0.815f,
- 0.832f, 0.0f, 0.335f, 0.806f, 0.816f, 0.841f, 0.0f, 0.341f, 0.809f, 0.816f, 0.851f, 0.0f, 0.346f, 0.811f, 0.816f, 0.861f, 0.0f, 0.351f, 0.812f, 0.816f,
- 0.871f, 0.0f, 0.356f, 0.813f, 0.815f, 0.881f, 0.0f, 0.361f, 0.814f, 0.816f, 0.893f, 0.0f, 0.365f, 0.814f, 0.816f, 0.906f, 0.0f, 0.368f, 0.814f, 0.817f,
- 0.922f, 0.0f, 0.372f, 0.813f, 0.816f, 0.939f, 0.0f, 0.375f, 0.812f, 0.817f, 0.957f, 0.0f, 0.377f, 0.811f, 0.817f, 0.977f, 0.0f, 0.379f, 0.81f, 0.815f,
- 0.995f, 0.0f, 0.38f, 0.808f, 0.813f, 1.012f, 0.0f, 0.379f, 0.806f, 0.807f, 1.028f, 0.0f, 0.377f, 0.803f, 0.803f, 1.042f, 0.0f, 0.374f, 0.8f, 0.801f,
- 1.054f, 0.0f, 0.371f, 0.797f, 0.8f, 1.065f, 0.0f, 0.366f, 0.794f, 0.8f, 1.076f, 0.0f, 0.361f, 0.791f, 0.792f, 1.085f, 0.0f, 0.355f, 0.788f, 0.781f,
- 1.093f, 0.0f, 0.348f, 0.785f, 0.781f, 1.1f, 0.0f, 0.34f, 0.783f, 0.78f, 1.106f, 0.0f, 0.33f, 0.782f, 0.78f, 1.113f, 0.0f, 0.321f, 0.781f, 0.778f,
- 1.117f, 0.0f, 0.31f, 0.78f, 0.777f, 1.122f, -0.0f, 0.299f, 0.779f, 0.777f, 1.125f, -0.0f, 0.286f, 0.778f, 0.776f, 1.129f, -0.0f, 0.274f, 0.778f, 0.777f,
- 1.131f, -0.0f, 0.262f, 0.778f, 0.777f, 1.132f, -0.0f, 0.249f, 0.777f, 0.777f, 1.134f, -0.0f, 0.237f, 0.777f, 0.778f, 1.134f, -0.0f, 0.225f, 0.777f, 0.778f,
- 1.135f, -0.0f, 0.213f, 0.776f, 0.777f, 1.134f, -0.0f, 0.201f, 0.776f, 0.776f, 1.134f, -0.0f, 0.189f, 0.776f, 0.775f, 1.132f, -0.0f, 0.177f, 0.775f, 0.776f,
- 1.13f, -0.0f, 0.164f, 0.775f, 0.775f, 1.129f, -0.0f, 0.152f, 0.774f, 0.774f, 1.126f, -0.0f, 0.141f, 0.774f, 0.773f, 1.122f, -0.0f, 0.13f, 0.774f, 0.772f,
- 1.118f, -0.0f, 0.118f, 0.773f, 0.772f, 1.113f, -0.0f, 0.108f, 0.773f, 0.773f, 1.107f, -0.0f, 0.097f, 0.773f, 0.774f, 1.102f, -0.0f, 0.087f, 0.772f, 0.773f,
- 1.095f, -0.0f, 0.077f, 0.772f, 0.773f, 1.088f, -0.0f, 0.067f, 0.771f, 0.772f, 1.081f, -0.0f, 0.057f, 0.771f, 0.773f, 1.073f, -0.0f, 0.048f, 0.77f, 0.772f,
- 1.066f, -0.0f, 0.038f, 0.769f, 0.767f, 1.058f, -0.0f, 0.029f, 0.768f, 0.766f, 1.05f, -0.0f, 0.019f, 0.768f, 0.765f, 1.041f, -0.0f, 0.011f, 0.767f, 0.765f,
- 1.032f, -0.0f, 0.003f, 0.767f, 0.766f, 1.023f, -0.0f, -0.004f, 0.766f, 0.765f, 1.013f, -0.0f, -0.011f, 0.766f, 0.765f, 1.003f, -0.0f, -0.019f, 0.765f, 0.766f,
- 0.993f, -0.0f, -0.026f, 0.765f, 0.765f, 0.983f, -0.0f, -0.034f, 0.764f, 0.765f, 0.972f, -0.0f, -0.041f, 0.762f, 0.765f, 0.962f, -0.0f, -0.048f, 0.761f, 0.765f,
- 0.951f, -0.0f, -0.055f, 0.759f, 0.762f, 0.94f, -0.0f, -0.063f, 0.756f, 0.761f, 0.929f, -0.0f, -0.07f, 0.754f, 0.755f, 0.918f, -0.0f, -0.078f, 0.751f, 0.751f,
- 0.907f, -0.0f, -0.085f, 0.748f, 0.747f, 0.896f, -0.0f, -0.092f, 0.745f, 0.744f, 0.884f, -0.0f, -0.099f, 0.742f, 0.742f, 0.873f, -0.0f, -0.105f, 0.739f, 0.738f,
- 0.861f, -0.0f, -0.11f, 0.736f, 0.737f, 0.849f, 0.0f, -0.115f, 0.733f, 0.731f, 0.836f, 0.0f, -0.119f, 0.73f, 0.73f, 0.823f, 0.0f, -0.124f, 0.728f, 0.727f,
- 0.81f, 0.0f, -0.128f, 0.725f, 0.725f, 0.796f, 0.0f, -0.132f, 0.723f, 0.723f, 0.783f, 0.0f, -0.136f, 0.72f, 0.719f, 0.77f, 0.0f, -0.141f, 0.718f, 0.717f,
- 0.756f, 0.0f, -0.145f, 0.715f, 0.712f, 0.742f, 0.0f, -0.15f, 0.713f, 0.708f, 0.728f, 0.0f, -0.152f, 0.711f, 0.707f, 0.713f, 0.0f, -0.155f, 0.709f, 0.706f,
- 0.699f, 0.0f, -0.156f, 0.706f, 0.706f, 0.684f, 0.0f, -0.158f, 0.704f, 0.705f, 0.67f, 0.0f, -0.159f, 0.702f, 0.705f, 0.656f, 0.0f, -0.16f, 0.7f, 0.704f,
- 0.642f, 0.0f, -0.161f, 0.698f, 0.702f, 0.628f, 0.0f, -0.161f, 0.695f, 0.698f, 0.614f, 0.0f, -0.162f, 0.693f, 0.695f, 0.6f, 0.0f, -0.162f, 0.691f, 0.691f,
- 0.587f, 0.0f, -0.162f, 0.688f, 0.686f, 0.574f, 0.0f, -0.162f, 0.686f, 0.685f, 0.561f, 0.0f, -0.161f, 0.683f, 0.683f, 0.548f, 0.0f, -0.161f, 0.681f, 0.683f,
- 0.535f, 0.0f, -0.161f, 0.678f, 0.678f, 0.523f, 0.0f, -0.16f, 0.676f, 0.676f, 0.512f, 0.0f, -0.16f, 0.673f, 0.674f, 0.501f, 0.0f, -0.16f, 0.671f, 0.67f,
- 0.49f, 0.0f, -0.16f, 0.668f, 0.668f, 0.48f, 0.0f, -0.161f, 0.666f, 0.663f, 0.469f, 0.0f, -0.162f, 0.665f, 0.66f, 0.458f, 0.0f, -0.165f, 0.663f, 0.66f,
- 0.447f, 0.0f, -0.167f, 0.662f, 0.659f, 0.437f, 0.0f, -0.171f, 0.661f, 0.659f, 0.426f, 0.0f, -0.175f, 0.66f, 0.659f, 0.415f, 0.0f, -0.18f, 0.66f, 0.659f,
- 0.404f, 0.0f, -0.185f, 0.659f, 0.659f, 0.393f, 0.0f, -0.191f, 0.659f, 0.657f, 0.383f, 0.0f, -0.196f, 0.659f, 0.657f, 0.373f, 0.0f, -0.202f, 0.658f, 0.659f,
- 0.363f, -0.0f, -0.208f, 0.658f, 0.658f, 0.353f, -0.0f, -0.215f, 0.658f, 0.659f, 0.344f, -0.0f, -0.223f, 0.658f, 0.659f, 0.336f, -0.0f, -0.23f, 0.658f, 0.659f,
- 0.327f, -0.0f, -0.238f, 0.658f, 0.658f, 0.319f, -0.0f, -0.245f, 0.657f, 0.657f, 0.312f, -0.0f, -0.253f, 0.657f, 0.656f, 0.305f, -0.0f, -0.261f, 0.656f, 0.658f,
- 0.299f, -0.0f, -0.269f, 0.655f, 0.658f, 0.293f, 0.0f, -0.278f, 0.653f, 0.657f, 0.288f, 0.0f, -0.287f, 0.65f, 0.657f, 0.283f, 0.0f, -0.295f, 0.646f, 0.656f,
- 0.279f, 0.0f, -0.304f, 0.642f, 0.655f, 0.275f, 0.0f, -0.313f, 0.637f, 0.642f, 0.271f, 0.0f, -0.322f, 0.633f, 0.637f, 0.268f, 0.0f, -0.331f, 0.628f, 0.609f,
- 0.265f, 0.0f, -0.341f, 0.624f, 0.607f, 0.263f, 0.0f, -0.35f, 0.62f, 0.608f, 0.261f, 0.0f, -0.359f, 0.617f, 0.608f, 0.259f, 0.0f, -0.369f, 0.614f, 0.607f,
- 0.258f, 0.0f, -0.379f, 0.612f, 0.606f, 0.257f, 0.0f, -0.389f, 0.61f, 0.606f, 0.258f, 0.0f, -0.399f, 0.609f, 0.605f, 0.258f, 0.0f, -0.41f, 0.608f, 0.604f,
- 0.26f, 0.0f, -0.421f, 0.608f, 0.606f, 0.263f, 0.0f, -0.431f, 0.607f, 0.606f, 0.266f, 0.0f, -0.441f, 0.607f, 0.606f, 0.27f, 0.0f, -0.452f, 0.606f, 0.607f,
- 0.274f, 0.0f, -0.463f, 0.606f, 0.607f, 0.279f, 0.0f, -0.475f, 0.605f, 0.607f, 0.283f, 0.0f, -0.487f, 0.604f, 0.607f, 0.288f, 0.0f, -0.498f, 0.603f, 0.607f,
- 0.293f, 0.0f, -0.511f, 0.601f, 0.607f, 0.297f, 0.0f, -0.523f, 0.598f, 0.606f, 0.301f, 0.0f, -0.536f, 0.595f, 0.605f, 0.305f, 0.0f, -0.549f, 0.591f, 0.602f,
- 0.309f, 0.0f, -0.562f, 0.588f, 0.597f, 0.312f, 0.0f, -0.576f, 0.583f, 0.585f, 0.315f, 0.0f, -0.59f, 0.579f, 0.577f, 0.318f, 0.0f, -0.604f, 0.574f, 0.576f,
- 0.321f, 0.0f, -0.618f, 0.569f, 0.57f, 0.323f, 0.0f, -0.633f, 0.564f, 0.564f, 0.326f, 0.0f, -0.647f, 0.559f, 0.554f, 0.328f, 0.0f, -0.663f, 0.555f, 0.549f,
- 0.33f, 0.0f, -0.678f, 0.551f, 0.546f, 0.332f, 0.0f, -0.693f, 0.547f, 0.543f, 0.334f, 0.0f, -0.709f, 0.544f, 0.543f, 0.336f, 0.0f, -0.726f, 0.541f, 0.541f,
- 0.338f, 0.0f, -0.742f, 0.538f, 0.54f, 0.338f, 0.0f, -0.758f, 0.536f, 0.538f, 0.338f, 0.0f, -0.773f, 0.534f, 0.53f, 0.337f, 0.0f, -0.787f, 0.532f, 0.528f,
- 0.337f, 0.0f, -0.801f, 0.53f, 0.528f, 0.336f, 0.0f, -0.814f, 0.529f, 0.528f, 0.334f, 0.0f, -0.827f, 0.527f, 0.528f, 0.333f, 0.0f, -0.84f, 0.525f, 0.529f,
- 0.331f, 0.0f, -0.853f, 0.523f, 0.529f, 0.328f, 0.0f, -0.866f, 0.521f, 0.528f, 0.324f, 0.0f, -0.877f, 0.519f, 0.516f, 0.32f, 0.0f, -0.889f, 0.516f, 0.515f,
- 0.315f, 0.0f, -0.9f, 0.513f, 0.515f, 0.31f, 0.0f, -0.91f, 0.51f, 0.514f, 0.304f, 0.0f, -0.921f, 0.507f, 0.513f, 0.297f, 0.0f, -0.931f, 0.505f, 0.507f,
- 0.289f, 0.0f, -0.94f, 0.502f, 0.498f, 0.281f, 0.0f, -0.948f, 0.499f, 0.494f, 0.272f, 0.0f, -0.956f, 0.497f, 0.491f, 0.262f, 0.0f, -0.963f, 0.495f, 0.49f,
- 0.253f, 0.0f, -0.969f, 0.494f, 0.491f, 0.242f, 0.0f, -0.975f, 0.493f, 0.491f, 0.231f, 0.0f, -0.98f, 0.492f, 0.49f, 0.22f, 0.0f, -0.986f, 0.491f, 0.489f,
- 0.208f, 0.0f, -0.99f, 0.491f, 0.49f, 0.195f, 0.0f, -0.994f, 0.491f, 0.491f, 0.181f, 0.0f, -0.998f, 0.491f, 0.491f, 0.168f, 0.0f, -1.001f, 0.491f, 0.492f,
- 0.154f, 0.0f, -1.005f, 0.491f, 0.492f, 0.141f, 0.0f, -1.008f, 0.492f, 0.492f, 0.126f, 0.0f, -1.01f, 0.492f, 0.492f, 0.112f, 0.0f, -1.011f, 0.492f, 0.492f,
- 0.097f, 0.0f, -1.013f, 0.492f, 0.492f, 0.081f, 0.0f, -1.013f, 0.492f, 0.492f, 0.066f, 0.0f, -1.014f, 0.493f, 0.493f, 0.05f, 0.0f, -1.014f, 0.493f, 0.494f,
- 0.035f, 0.0f, -1.014f, 0.493f, 0.494f, 0.019f, 0.0f, -1.013f, 0.493f, 0.494f, 0.004f, 0.0f, -1.012f, 0.493f, 0.494f, -0.011f, 0.0f, -1.011f, 0.493f, 0.493f,
- -0.026f, 0.0f, -1.01f, 0.492f, 0.493f, -0.041f, 0.0f, -1.008f, 0.492f, 0.492f, -0.056f, 0.0f, -1.006f, 0.492f, 0.492f, -0.07f, 0.0f, -1.004f, 0.491f, 0.492f,
- -0.084f, 0.0f, -1.001f, 0.491f, 0.492f, -0.098f, 0.0f, -0.999f, 0.491f, 0.491f, -0.112f, 0.0f, -0.995f, 0.491f, 0.49f, -0.125f, 0.0f, -0.992f, 0.49f, 0.49f,
- -0.138f, 0.0f, -0.987f, 0.49f, 0.491f, -0.15f, 0.0f, -0.983f, 0.49f, 0.49f, -0.162f, 0.0f, -0.978f, 0.49f, 0.49f, -0.174f, 0.0f, -0.973f, 0.489f, 0.489f,
- -0.185f, 0.0f, -0.967f, 0.489f, 0.488f, -0.196f, 0.0f, -0.961f, 0.489f, 0.489f, -0.207f, 0.0f, -0.955f, 0.489f, 0.489f, -0.218f, 0.0f, -0.949f, 0.489f, 0.49f,
- -0.229f, 0.0f, -0.943f, 0.489f, 0.489f, -0.24f, 0.0f, -0.936f, 0.489f, 0.489f, -0.25f, 0.0f, -0.929f, 0.489f, 0.489f, -0.261f, 0.0f, -0.922f, 0.489f, 0.489f,
- -0.271f, 0.0f, -0.914f, 0.489f, 0.49f, -0.28f, 0.0f, -0.907f, 0.49f, 0.49f, -0.289f, 0.0f, -0.898f, 0.49f, 0.489f, -0.298f, 0.0f, -0.89f, 0.49f, 0.489f,
- -0.306f, 0.0f, -0.882f, 0.49f, 0.49f, -0.314f, 0.0f, -0.875f, 0.491f, 0.489f, -0.322f, 0.0f, -0.866f, 0.492f, 0.489f, -0.328f, 0.0f, -0.857f, 0.492f, 0.489f,
- -0.333f, 0.0f, -0.847f, 0.493f, 0.49f, -0.336f, 0.0f, -0.836f, 0.494f, 0.488f, -0.338f, 0.0f, -0.824f, 0.496f, 0.49f, -0.338f, 0.0f, -0.811f, 0.497f, 0.49f,
- -0.338f, 0.0f, -0.798f, 0.499f, 0.491f, -0.337f, 0.0f, -0.785f, 0.501f, 0.497f, -0.337f, 0.0f, -0.772f, 0.503f, 0.5f, -0.337f, 0.0f, -0.759f, 0.505f, 0.504f,
- -0.336f, -0.0f, -0.746f, 0.507f, 0.505f, -0.336f, -0.0f, -0.733f, 0.51f, 0.51f, -0.335f, -0.0f, -0.719f, 0.512f, 0.513f, -0.334f, -0.0f, -0.706f, 0.515f, 0.515f,
- -0.333f, -0.0f, -0.692f, 0.518f, 0.516f, -0.332f, -0.0f, -0.678f, 0.52f, 0.522f, -0.331f, -0.0f, -0.665f, 0.523f, 0.523f, -0.329f, -0.0f, -0.651f, 0.525f, 0.528f,
- -0.327f, -0.0f, -0.637f, 0.528f, 0.53f, -0.325f, -0.0f, -0.624f, 0.53f, 0.532f, -0.322f, -0.0f, -0.61f, 0.532f, 0.534f, -0.319f, -0.0f, -0.597f, 0.535f, 0.535f,
- -0.316f, -0.0f, -0.584f, 0.537f, 0.538f, -0.313f, -0.0f, -0.57f, 0.539f, 0.54f, -0.31f, -0.0f, -0.557f, 0.541f, 0.542f, -0.307f, -0.0f, -0.544f, 0.542f, 0.545f,
- -0.303f, -0.0f, -0.531f, 0.544f, 0.546f, -0.3f, -0.0f, -0.519f, 0.546f, 0.549f, -0.298f, -0.0f, -0.506f, 0.547f, 0.549f, -0.295f, -0.0f, -0.494f, 0.548f, 0.549f,
- -0.292f, -0.0f, -0.482f, 0.549f, 0.55f, -0.29f, -0.0f, -0.47f, 0.55f, 0.552f, -0.287f, -0.0f, -0.459f, 0.551f, 0.552f, -0.285f, -0.0f, -0.447f, 0.551f, 0.552f,
- -0.284f, -0.0f, -0.436f, 0.552f, 0.552f, -0.282f, -0.0f, -0.425f, 0.552f, 0.553f, -0.281f, -0.0f, -0.413f, 0.553f, 0.553f, -0.28f, -0.0f, -0.402f, 0.553f, 0.553f,
- -0.28f, -0.0f, -0.392f, 0.553f, 0.553f, -0.281f, -0.0f, -0.381f, 0.554f, 0.553f, -0.283f, -0.0f, -0.369f, 0.554f, 0.554f, -0.286f, -0.0f, -0.359f, 0.554f, 0.554f,
- -0.289f, -0.0f, -0.348f, 0.555f, 0.554f, -0.294f, -0.0f, -0.337f, 0.555f, 0.555f, -0.299f, -0.0f, -0.327f, 0.555f, 0.554f, -0.305f, -0.0f, -0.317f, 0.556f, 0.555f,
- -0.312f, -0.0f, -0.307f, 0.556f, 0.555f, -0.319f, -0.0f, -0.297f, 0.556f, 0.557f, -0.326f, 0.0f, -0.287f, 0.557f, 0.558f, -0.334f, 0.0f, -0.278f, 0.557f, 0.557f,
- -0.341f, 0.0f, -0.268f, 0.557f, 0.558f, -0.349f, 0.0f, -0.259f, 0.558f, 0.558f, -0.359f, 0.0f, -0.251f, 0.558f, 0.558f, -0.368f, 0.0f, -0.243f, 0.558f, 0.558f,
- -0.378f, 0.0f, -0.235f, 0.558f, 0.559f, -0.388f, 0.0f, -0.228f, 0.558f, 0.558f, -0.398f, 0.0f, -0.221f, 0.559f, 0.559f, -0.408f, 0.0f, -0.214f, 0.559f, 0.559f,
- -0.418f, 0.0f, -0.208f, 0.559f, 0.559f, -0.427f, 0.0f, -0.202f, 0.559f, 0.558f, -0.436f, 0.0f, -0.196f, 0.559f, 0.559f, -0.445f, 0.0f, -0.191f, 0.559f, 0.559f,
- -0.453f, 0.0f, -0.187f, 0.558f, 0.559f, -0.462f, 0.0f, -0.183f, 0.558f, 0.558f, -0.469f, 0.0f, -0.18f, 0.558f, 0.558f, -0.477f, 0.0f, -0.176f, 0.558f, 0.558f,
- -0.484f, 0.0f, -0.174f, 0.557f, 0.558f, -0.493f, 0.0f, -0.17f, 0.555f, 0.559f,
-};
-
-
-static const float data1[136 * GP_PRIM_DATABUF_SIZE] = {
- -0.369f, 0.0f, -0.048f, 0.065f, 0.065f, -0.378f, 0.0f, -0.046f, 0.239f, 0.293f, -0.383f, 0.0f, -0.044f, 0.316f, 0.339f, -0.39f, 0.0f, -0.041f, 0.348f, 0.355f,
- -0.398f, 0.0f, -0.038f, 0.364f, 0.368f, -0.405f, 0.0f, -0.035f, 0.373f, 0.374f, -0.413f, 0.0f, -0.031f, 0.381f, 0.381f, -0.421f, 0.0f, -0.026f, 0.388f, 0.391f,
- -0.429f, 0.0f, -0.02f, 0.392f, 0.394f, -0.437f, 0.0f, -0.014f, 0.395f, 0.396f, -0.445f, 0.0f, -0.008f, 0.397f, 0.397f, -0.453f, 0.0f, -0.001f, 0.399f, 0.4f,
- -0.461f, 0.0f, 0.007f, 0.401f, 0.401f, -0.468f, -0.0f, 0.016f, 0.404f, 0.404f, -0.474f, 0.0f, 0.023f, 0.406f, 0.407f, -0.479f, 0.0f, 0.03f, 0.409f, 0.409f,
- -0.485f, 0.0f, 0.039f, 0.412f, 0.412f, -0.49f, 0.0f, 0.048f, 0.415f, 0.415f, -0.495f, 0.0f, 0.057f, 0.417f, 0.417f, -0.499f, 0.0f, 0.068f, 0.42f, 0.421f,
- -0.503f, 0.0f, 0.079f, 0.421f, 0.421f, -0.507f, -0.0f, 0.091f, 0.423f, 0.423f, -0.51f, -0.0f, 0.102f, 0.424f, 0.424f, -0.513f, -0.0f, 0.112f, 0.424f, 0.425f,
- -0.515f, -0.0f, 0.123f, 0.425f, 0.425f, -0.517f, -0.0f, 0.135f, 0.425f, 0.425f, -0.518f, -0.0f, 0.146f, 0.426f, 0.425f, -0.519f, -0.0f, 0.158f, 0.426f, 0.425f,
- -0.52f, -0.0f, 0.169f, 0.426f, 0.426f, -0.52f, -0.0f, 0.181f, 0.427f, 0.427f, -0.519f, -0.0f, 0.192f, 0.427f, 0.427f, -0.518f, -0.0f, 0.203f, 0.427f, 0.427f,
- -0.517f, -0.0f, 0.213f, 0.427f, 0.428f, -0.515f, -0.0f, 0.222f, 0.428f, 0.427f, -0.513f, -0.0f, 0.232f, 0.428f, 0.427f, -0.51f, -0.0f, 0.241f, 0.429f, 0.427f,
- -0.508f, -0.0f, 0.25f, 0.43f, 0.428f, -0.505f, -0.0f, 0.259f, 0.431f, 0.431f, -0.501f, -0.0f, 0.267f, 0.431f, 0.432f, -0.497f, -0.0f, 0.276f, 0.432f, 0.433f,
- -0.493f, -0.0f, 0.284f, 0.433f, 0.433f, -0.488f, -0.0f, 0.293f, 0.434f, 0.434f, -0.484f, -0.0f, 0.301f, 0.434f, 0.435f, -0.479f, -0.0f, 0.308f, 0.435f, 0.436f,
- -0.474f, -0.0f, 0.316f, 0.435f, 0.435f, -0.468f, -0.0f, 0.322f, 0.436f, 0.436f, -0.463f, -0.0f, 0.329f, 0.436f, 0.436f, -0.457f, -0.0f, 0.335f, 0.436f, 0.436f,
- -0.451f, -0.0f, 0.341f, 0.437f, 0.436f, -0.445f, -0.0f, 0.347f, 0.438f, 0.437f, -0.438f, -0.0f, 0.352f, 0.44f, 0.437f, -0.432f, -0.0f, 0.357f, 0.442f, 0.441f,
- -0.426f, 0.0f, 0.362f, 0.444f, 0.446f, -0.419f, 0.0f, 0.366f, 0.445f, 0.447f, -0.413f, 0.0f, 0.369f, 0.446f, 0.447f, -0.407f, 0.0f, 0.373f, 0.446f, 0.447f,
- -0.401f, 0.0f, 0.376f, 0.447f, 0.447f, -0.395f, 0.0f, 0.378f, 0.447f, 0.448f, -0.388f, 0.0f, 0.381f, 0.447f, 0.448f, -0.382f, 0.0f, 0.383f, 0.448f, 0.448f,
- -0.375f, 0.0f, 0.384f, 0.448f, 0.448f, -0.369f, 0.0f, 0.386f, 0.448f, 0.448f, -0.362f, 0.0f, 0.387f, 0.448f, 0.448f, -0.355f, 0.0f, 0.388f, 0.448f, 0.448f,
- -0.348f, 0.0f, 0.388f, 0.448f, 0.448f, -0.341f, 0.0f, 0.387f, 0.448f, 0.449f, -0.334f, 0.0f, 0.387f, 0.448f, 0.448f, -0.327f, 0.0f, 0.386f, 0.448f, 0.449f,
- -0.32f, 0.0f, 0.384f, 0.449f, 0.449f, -0.313f, 0.0f, 0.382f, 0.449f, 0.449f, -0.307f, 0.0f, 0.38f, 0.449f, 0.449f, -0.3f, 0.0f, 0.377f, 0.449f, 0.45f,
- -0.294f, 0.0f, 0.375f, 0.45f, 0.45f, -0.288f, -0.0f, 0.372f, 0.45f, 0.45f, -0.282f, -0.0f, 0.368f, 0.45f, 0.451f, -0.276f, -0.0f, 0.365f, 0.45f, 0.451f,
- -0.27f, -0.0f, 0.361f, 0.45f, 0.451f, -0.264f, -0.0f, 0.357f, 0.45f, 0.451f, -0.258f, -0.0f, 0.352f, 0.45f, 0.45f, -0.251f, -0.0f, 0.347f, 0.45f, 0.451f,
- -0.245f, -0.0f, 0.341f, 0.451f, 0.451f, -0.24f, -0.0f, 0.335f, 0.451f, 0.451f, -0.234f, -0.0f, 0.329f, 0.451f, 0.451f, -0.228f, -0.0f, 0.323f, 0.452f, 0.452f,
- -0.223f, -0.0f, 0.316f, 0.452f, 0.453f, -0.218f, -0.0f, 0.309f, 0.452f, 0.453f, -0.213f, -0.0f, 0.301f, 0.453f, 0.453f, -0.208f, -0.0f, 0.294f, 0.453f, 0.453f,
- -0.204f, -0.0f, 0.286f, 0.453f, 0.453f, -0.2f, -0.0f, 0.277f, 0.453f, 0.454f, -0.196f, -0.0f, 0.269f, 0.453f, 0.454f, -0.192f, -0.0f, 0.26f, 0.454f, 0.454f,
- -0.189f, -0.0f, 0.25f, 0.454f, 0.454f, -0.186f, -0.0f, 0.241f, 0.454f, 0.455f, -0.183f, -0.0f, 0.231f, 0.454f, 0.455f, -0.181f, -0.0f, 0.221f, 0.454f, 0.455f,
- -0.179f, -0.0f, 0.209f, 0.455f, 0.455f, -0.177f, -0.0f, 0.197f, 0.455f, 0.455f, -0.176f, -0.0f, 0.184f, 0.455f, 0.455f, -0.176f, -0.0f, 0.171f, 0.455f, 0.456f,
- -0.176f, -0.0f, 0.158f, 0.455f, 0.456f, -0.177f, -0.0f, 0.145f, 0.455f, 0.456f, -0.178f, -0.0f, 0.132f, 0.455f, 0.456f, -0.18f, -0.0f, 0.12f, 0.456f, 0.456f,
- -0.182f, -0.0f, 0.108f, 0.456f, 0.456f, -0.185f, -0.0f, 0.097f, 0.456f, 0.456f, -0.188f, -0.0f, 0.086f, 0.456f, 0.457f, -0.191f, -0.0f, 0.076f, 0.456f, 0.457f,
- -0.194f, -0.0f, 0.067f, 0.457f, 0.457f, -0.198f, -0.0f, 0.058f, 0.457f, 0.457f, -0.202f, -0.0f, 0.05f, 0.457f, 0.457f, -0.206f, -0.0f, 0.042f, 0.457f, 0.457f,
- -0.21f, -0.0f, 0.034f, 0.458f, 0.457f, -0.215f, -0.0f, 0.027f, 0.458f, 0.457f, -0.22f, -0.0f, 0.02f, 0.458f, 0.458f, -0.225f, -0.0f, 0.014f, 0.458f, 0.458f,
- -0.23f, -0.0f, 0.007f, 0.458f, 0.458f, -0.235f, -0.0f, 0.002f, 0.459f, 0.458f, -0.24f, -0.0f, -0.004f, 0.459f, 0.458f, -0.246f, -0.0f, -0.009f, 0.46f, 0.459f,
- -0.251f, 0.0f, -0.013f, 0.464f, 0.463f, -0.257f, 0.0f, -0.018f, 0.467f, 0.468f, -0.262f, 0.0f, -0.022f, 0.469f, 0.469f, -0.268f, 0.0f, -0.026f, 0.471f, 0.47f,
- -0.274f, 0.0f, -0.029f, 0.477f, 0.478f, -0.28f, 0.0f, -0.033f, 0.478f, 0.478f, -0.286f, 0.0f, -0.036f, 0.478f, 0.478f, -0.292f, 0.0f, -0.038f, 0.479f, 0.479f,
- -0.298f, 0.0f, -0.041f, 0.48f, 0.48f, -0.305f, 0.0f, -0.043f, 0.48f, 0.48f, -0.311f, 0.0f, -0.045f, 0.482f, 0.482f, -0.318f, 0.0f, -0.047f, 0.482f, 0.482f,
- -0.324f, 0.0f, -0.048f, 0.482f, 0.482f, -0.331f, 0.0f, -0.049f, 0.48f, 0.482f, -0.336f, 0.0f, -0.05f, 0.457f, 0.485f, -0.344f, 0.0f, -0.05f, 0.32f, 0.32f,
-};
-
-static const float data2[2 * GP_PRIM_DATABUF_SIZE] = {
- -0.512f, 0.0f, -0.168f, 0.545f, 0.557f, -0.521f, 0.0f, -0.167f, 0.535f, 0.558f,
-};
-
-static const float data3[1 * GP_PRIM_DATABUF_SIZE] = {
- -1.014f, 0.0f, 0.186f, 0.0f, 0.003f,
-};
-
-static const float data4[1 * GP_PRIM_DATABUF_SIZE] = {
- -1.014f, 0.0f, 0.186f, 0.02f, 0.02f,
-};
-
-static const float data5[48 * GP_PRIM_DATABUF_SIZE] = {
- -1.014f, 0.0f, 0.187f, 0.066f, 0.066f, -1.013f, 0.0f, 0.2f, 0.222f, 0.356f, -1.01f, 0.0f, 0.208f, 0.295f, 0.404f, -1.006f, 0.0f, 0.218f, 0.354f, 0.431f,
- -1.001f, 0.0f, 0.226f, 0.392f, 0.445f, -0.994f, 0.0f, 0.233f, 0.418f, 0.453f, -0.987f, 0.0f, 0.238f, 0.437f, 0.457f, -0.979f, 0.0f, 0.242f, 0.45f, 0.47f,
- -0.97f, 0.0f, 0.245f, 0.459f, 0.473f, -0.96f, -0.0f, 0.246f, 0.465f, 0.474f, -0.951f, -0.0f, 0.245f, 0.469f, 0.475f, -0.942f, 0.0f, 0.242f, 0.471f, 0.473f,
- -0.932f, 0.0f, 0.239f, 0.472f, 0.474f, -0.924f, 0.0f, 0.234f, 0.471f, 0.474f, -0.915f, 0.0f, 0.228f, 0.469f, 0.474f, -0.906f, 0.0f, 0.22f, 0.464f, 0.47f,
- -0.898f, 0.0f, 0.212f, 0.458f, 0.46f, -0.89f, 0.0f, 0.203f, 0.451f, 0.453f, -0.882f, 0.0f, 0.193f, 0.443f, 0.443f, -0.875f, 0.0f, 0.182f, 0.435f, 0.437f,
- -0.869f, 0.0f, 0.172f, 0.426f, 0.428f, -0.863f, 0.0f, 0.161f, 0.417f, 0.415f, -0.858f, 0.0f, 0.148f, 0.409f, 0.41f, -0.854f, 0.0f, 0.137f, 0.399f, 0.399f,
- -0.85f, 0.0f, 0.126f, 0.39f, 0.392f, -0.847f, 0.0f, 0.116f, 0.379f, 0.386f, -0.846f, 0.0f, 0.109f, 0.369f, 0.371f, -0.846f, 0.0f, 0.104f, 0.361f, 0.357f,
- -0.847f, 0.0f, 0.101f, 0.355f, 0.339f, -0.849f, 0.0f, 0.101f, 0.353f, 0.334f, -0.853f, 0.0f, 0.103f, 0.354f, 0.345f, -0.859f, 0.0f, 0.108f, 0.357f, 0.35f,
- -0.865f, 0.0f, 0.116f, 0.363f, 0.365f, -0.873f, 0.0f, 0.126f, 0.369f, 0.375f, -0.881f, 0.0f, 0.137f, 0.375f, 0.379f, -0.89f, 0.0f, 0.149f, 0.381f, 0.38f,
- -0.899f, 0.0f, 0.159f, 0.387f, 0.385f, -0.908f, 0.0f, 0.168f, 0.394f, 0.394f, -0.919f, 0.0f, 0.177f, 0.401f, 0.398f, -0.932f, 0.0f, 0.184f, 0.409f, 0.404f,
- -0.945f, 0.0f, 0.191f, 0.418f, 0.415f, -0.958f, 0.0f, 0.195f, 0.427f, 0.431f, -0.969f, 0.0f, 0.197f, 0.434f, 0.443f, -0.979f, 0.0f, 0.197f, 0.436f, 0.445f,
- -0.987f, 0.0f, 0.195f, 0.428f, 0.463f, -0.995f, 0.0f, 0.192f, 0.398f, 0.46f, -1.001f, 0.0f, 0.189f, 0.345f, 0.465f, -1.01f, 0.0f, 0.183f, 0.236f, 0.236f,
-};
-
-static const float data6[47 * GP_PRIM_DATABUF_SIZE] = {
- 0.022f, 0.0f, -0.353f, 0.125f, 0.125f, 0.012f, 0.0f, -0.352f, 0.175f, 0.288f, 0.004f, 0.0f, -0.352f, 0.206f, 0.313f, -0.006f, 0.0f, -0.352f, 0.241f, 0.323f,
- -0.017f, 0.0f, -0.352f, 0.27f, 0.33f, -0.029f, 0.0f, -0.351f, 0.295f, 0.334f, -0.041f, 0.0f, -0.349f, 0.314f, 0.337f, -0.052f, 0.0f, -0.344f, 0.327f, 0.341f,
- -0.063f, 0.0f, -0.337f, 0.336f, 0.344f, -0.072f, 0.0f, -0.329f, 0.341f, 0.345f, -0.081f, 0.0f, -0.32f, 0.345f, 0.345f, -0.088f, 0.0f, -0.311f, 0.348f, 0.345f,
- -0.093f, 0.0f, -0.303f, 0.352f, 0.347f, -0.098f, 0.0f, -0.295f, 0.356f, 0.352f, -0.101f, 0.0f, -0.287f, 0.361f, 0.357f, -0.102f, 0.0f, -0.279f, 0.367f, 0.364f,
- -0.103f, 0.0f, -0.271f, 0.373f, 0.378f, -0.102f, 0.0f, -0.263f, 0.379f, 0.382f, -0.1f, 0.0f, -0.255f, 0.383f, 0.389f, -0.098f, 0.0f, -0.247f, 0.387f, 0.391f,
- -0.094f, 0.0f, -0.24f, 0.389f, 0.393f, -0.09f, 0.0f, -0.233f, 0.391f, 0.393f, -0.086f, 0.0f, -0.227f, 0.392f, 0.393f, -0.082f, 0.0f, -0.222f, 0.393f, 0.393f,
- -0.078f, 0.0f, -0.219f, 0.394f, 0.393f, -0.075f, 0.0f, -0.217f, 0.397f, 0.393f, -0.072f, 0.0f, -0.217f, 0.4f, 0.393f, -0.07f, 0.0f, -0.219f, 0.402f, 0.408f,
- -0.069f, 0.0f, -0.222f, 0.404f, 0.408f, -0.069f, 0.0f, -0.228f, 0.406f, 0.409f, -0.069f, 0.0f, -0.234f, 0.407f, 0.409f, -0.07f, 0.0f, -0.241f, 0.408f, 0.409f,
- -0.07f, 0.0f, -0.248f, 0.408f, 0.409f, -0.07f, 0.0f, -0.256f, 0.409f, 0.409f, -0.07f, 0.0f, -0.263f, 0.409f, 0.41f, -0.069f, 0.0f, -0.271f, 0.41f, 0.411f,
- -0.068f, 0.0f, -0.279f, 0.41f, 0.411f, -0.065f, 0.0f, -0.287f, 0.41f, 0.411f, -0.062f, 0.0f, -0.295f, 0.409f, 0.411f, -0.057f, 0.0f, -0.303f, 0.409f, 0.409f,
- -0.052f, 0.0f, -0.31f, 0.408f, 0.409f, -0.047f, 0.0f, -0.318f, 0.407f, 0.408f, -0.041f, 0.0f, -0.324f, 0.406f, 0.407f, -0.035f, 0.0f, -0.329f, 0.403f, 0.407f,
- -0.027f, 0.0f, -0.333f, 0.4f, 0.408f, -0.021f, 0.0f, -0.336f, 0.398f, 0.403f, -0.012f, 0.0f, -0.339f, 0.393f, 0.393f,
-};
-
-static const float data7[162 * GP_PRIM_DATABUF_SIZE] = {
- -0.291f, 0.0f, -0.34f, 0.093f, 0.093f, -0.289f, -0.0f, -0.35f, 0.149f, 0.176f, -0.287f, -0.0f, -0.357f, 0.182f, 0.242f, -0.284f, -0.0f, -0.365f, 0.215f, 0.257f,
- -0.281f, -0.0f, -0.374f, 0.242f, 0.266f, -0.278f, -0.0f, -0.384f, 0.266f, 0.287f, -0.275f, -0.0f, -0.394f, 0.285f, 0.304f, -0.271f, 0.0f, -0.405f, 0.302f, 0.316f,
- -0.267f, 0.0f, -0.417f, 0.317f, 0.326f, -0.263f, 0.0f, -0.429f, 0.33f, 0.337f, -0.259f, 0.0f, -0.442f, 0.342f, 0.346f, -0.256f, 0.0f, -0.454f, 0.354f, 0.351f,
- -0.253f, 0.0f, -0.467f, 0.365f, 0.362f, -0.251f, 0.0f, -0.48f, 0.376f, 0.38f, -0.249f, -0.0f, -0.493f, 0.386f, 0.391f, -0.247f, -0.0f, -0.505f, 0.394f, 0.396f,
- -0.246f, -0.0f, -0.518f, 0.401f, 0.405f, -0.245f, 0.0f, -0.53f, 0.408f, 0.409f, -0.245f, 0.0f, -0.542f, 0.415f, 0.413f, -0.245f, 0.0f, -0.554f, 0.421f, 0.42f,
- -0.245f, 0.0f, -0.565f, 0.426f, 0.43f, -0.246f, 0.0f, -0.575f, 0.43f, 0.433f, -0.246f, -0.0f, -0.585f, 0.432f, 0.435f, -0.247f, -0.0f, -0.594f, 0.434f, 0.436f,
- -0.247f, -0.0f, -0.603f, 0.435f, 0.436f, -0.248f, -0.0f, -0.612f, 0.436f, 0.436f, -0.25f, -0.0f, -0.621f, 0.437f, 0.438f, -0.252f, -0.0f, -0.631f, 0.437f, 0.438f,
- -0.254f, -0.0f, -0.642f, 0.438f, 0.438f, -0.255f, 0.0f, -0.653f, 0.438f, 0.438f, -0.258f, 0.0f, -0.664f, 0.438f, 0.439f, -0.26f, 0.0f, -0.674f, 0.439f, 0.439f,
- -0.261f, 0.0f, -0.685f, 0.439f, 0.439f, -0.262f, 0.0f, -0.696f, 0.439f, 0.439f, -0.264f, 0.0f, -0.706f, 0.439f, 0.439f, -0.265f, 0.0f, -0.717f, 0.439f, 0.439f,
- -0.265f, 0.0f, -0.727f, 0.438f, 0.439f, -0.266f, 0.0f, -0.738f, 0.437f, 0.439f, -0.266f, 0.0f, -0.749f, 0.435f, 0.438f, -0.266f, 0.0f, -0.76f, 0.433f, 0.433f,
- -0.265f, 0.0f, -0.771f, 0.431f, 0.428f, -0.265f, 0.0f, -0.781f, 0.43f, 0.428f, -0.263f, 0.0f, -0.792f, 0.429f, 0.428f, -0.26f, 0.0f, -0.802f, 0.428f, 0.429f,
- -0.257f, 0.0f, -0.812f, 0.426f, 0.427f, -0.254f, 0.0f, -0.821f, 0.423f, 0.426f, -0.25f, 0.0f, -0.829f, 0.421f, 0.42f, -0.247f, 0.0f, -0.837f, 0.418f, 0.416f,
- -0.242f, 0.0f, -0.844f, 0.417f, 0.415f, -0.238f, 0.0f, -0.85f, 0.415f, 0.413f, -0.234f, 0.0f, -0.857f, 0.415f, 0.413f, -0.229f, 0.0f, -0.864f, 0.414f, 0.413f,
- -0.224f, 0.0f, -0.87f, 0.414f, 0.413f, -0.219f, 0.0f, -0.877f, 0.414f, 0.414f, -0.214f, 0.0f, -0.883f, 0.414f, 0.413f, -0.208f, 0.0f, -0.89f, 0.413f, 0.413f,
- -0.203f, 0.0f, -0.897f, 0.413f, 0.413f, -0.197f, 0.0f, -0.903f, 0.413f, 0.413f, -0.191f, 0.0f, -0.909f, 0.413f, 0.413f, -0.186f, 0.0f, -0.914f, 0.413f, 0.413f,
- -0.181f, 0.0f, -0.92f, 0.413f, 0.413f, -0.175f, -0.0f, -0.925f, 0.413f, 0.413f, -0.17f, -0.0f, -0.931f, 0.413f, 0.413f, -0.164f, -0.0f, -0.936f, 0.413f, 0.413f,
- -0.159f, -0.0f, -0.942f, 0.413f, 0.413f, -0.152f, -0.0f, -0.948f, 0.413f, 0.413f, -0.145f, -0.0f, -0.955f, 0.413f, 0.413f, -0.137f, -0.0f, -0.961f, 0.414f, 0.413f,
- -0.13f, -0.0f, -0.967f, 0.414f, 0.413f, -0.122f, -0.0f, -0.974f, 0.414f, 0.414f, -0.114f, -0.0f, -0.979f, 0.414f, 0.413f, -0.106f, -0.0f, -0.985f, 0.414f, 0.413f,
- -0.098f, -0.0f, -0.989f, 0.414f, 0.414f, -0.091f, -0.0f, -0.993f, 0.414f, 0.413f, -0.083f, -0.0f, -0.997f, 0.414f, 0.414f, -0.075f, -0.0f, -0.999f, 0.414f, 0.414f,
- -0.066f, -0.0f, -1.001f, 0.414f, 0.414f, -0.057f, -0.0f, -1.003f, 0.414f, 0.413f, -0.046f, -0.0f, -1.006f, 0.414f, 0.413f, -0.038f, -0.0f, -1.008f, 0.414f, 0.413f,
- -0.031f, -0.0f, -1.009f, 0.421f, 0.413f, -0.036f, -0.0f, -1.008f, 0.423f, 0.424f, -0.045f, -0.0f, -1.006f, 0.425f, 0.425f, -0.054f, -0.0f, -1.005f, 0.425f, 0.425f,
- -0.064f, -0.0f, -1.005f, 0.425f, 0.425f, -0.073f, -0.0f, -1.004f, 0.425f, 0.425f, -0.084f, -0.0f, -1.003f, 0.425f, 0.425f, -0.095f, -0.0f, -1.001f, 0.424f, 0.424f,
- -0.105f, -0.0f, -0.997f, 0.423f, 0.424f, -0.116f, -0.0f, -0.994f, 0.422f, 0.422f, -0.127f, -0.0f, -0.991f, 0.421f, 0.419f, -0.137f, -0.0f, -0.987f, 0.42f, 0.419f,
- -0.148f, -0.0f, -0.983f, 0.42f, 0.419f, -0.158f, -0.0f, -0.98f, 0.42f, 0.419f, -0.167f, -0.0f, -0.976f, 0.419f, 0.419f, -0.176f, -0.0f, -0.973f, 0.419f, 0.419f,
- -0.184f, -0.0f, -0.969f, 0.419f, 0.419f, -0.192f, -0.0f, -0.966f, 0.419f, 0.418f, -0.2f, 0.0f, -0.962f, 0.419f, 0.418f, -0.207f, 0.0f, -0.957f, 0.419f, 0.419f,
- -0.215f, 0.0f, -0.953f, 0.419f, 0.418f, -0.223f, 0.0f, -0.948f, 0.419f, 0.419f, -0.231f, 0.0f, -0.944f, 0.419f, 0.419f, -0.239f, 0.0f, -0.939f, 0.419f, 0.419f,
- -0.247f, 0.0f, -0.934f, 0.419f, 0.419f, -0.255f, 0.0f, -0.929f, 0.419f, 0.419f, -0.262f, 0.0f, -0.924f, 0.419f, 0.419f, -0.269f, 0.0f, -0.919f, 0.419f, 0.418f,
- -0.275f, 0.0f, -0.914f, 0.419f, 0.419f, -0.281f, 0.0f, -0.909f, 0.419f, 0.418f, -0.287f, 0.0f, -0.904f, 0.419f, 0.418f, -0.293f, 0.0f, -0.899f, 0.419f, 0.418f,
- -0.299f, 0.0f, -0.894f, 0.42f, 0.419f, -0.304f, 0.0f, -0.888f, 0.421f, 0.42f, -0.311f, 0.0f, -0.882f, 0.423f, 0.422f, -0.317f, 0.0f, -0.876f, 0.424f, 0.424f,
- -0.322f, 0.0f, -0.869f, 0.426f, 0.426f, -0.328f, 0.0f, -0.861f, 0.427f, 0.427f, -0.332f, 0.0f, -0.853f, 0.429f, 0.429f, -0.336f, 0.0f, -0.843f, 0.43f, 0.429f,
- -0.339f, 0.0f, -0.834f, 0.432f, 0.431f, -0.341f, 0.0f, -0.821f, 0.435f, 0.434f, -0.342f, 0.0f, -0.809f, 0.438f, 0.439f, -0.343f, 0.0f, -0.796f, 0.44f, 0.44f,
- -0.343f, 0.0f, -0.783f, 0.442f, 0.442f, -0.343f, 0.0f, -0.772f, 0.446f, 0.445f, -0.342f, 0.0f, -0.76f, 0.45f, 0.45f, -0.342f, 0.0f, -0.748f, 0.454f, 0.455f,
- -0.34f, 0.0f, -0.735f, 0.457f, 0.457f, -0.339f, 0.0f, -0.723f, 0.46f, 0.46f, -0.338f, 0.0f, -0.711f, 0.463f, 0.464f, -0.336f, 0.0f, -0.7f, 0.465f, 0.465f,
- -0.335f, 0.0f, -0.688f, 0.466f, 0.466f, -0.332f, 0.0f, -0.676f, 0.467f, 0.467f, -0.331f, 0.0f, -0.664f, 0.467f, 0.467f, -0.33f, 0.0f, -0.651f, 0.467f, 0.467f,
- -0.328f, 0.0f, -0.638f, 0.467f, 0.467f, -0.325f, 0.0f, -0.625f, 0.467f, 0.467f, -0.323f, 0.0f, -0.614f, 0.467f, 0.467f, -0.321f, 0.0f, -0.603f, 0.467f, 0.466f,
- -0.318f, 0.0f, -0.592f, 0.467f, 0.466f, -0.315f, 0.0f, -0.581f, 0.467f, 0.466f, -0.313f, 0.0f, -0.569f, 0.467f, 0.467f, -0.311f, -0.0f, -0.557f, 0.467f, 0.467f,
- -0.309f, -0.0f, -0.543f, 0.467f, 0.467f, -0.306f, -0.0f, -0.531f, 0.467f, 0.467f, -0.303f, -0.0f, -0.519f, 0.467f, 0.467f, -0.301f, -0.0f, -0.507f, 0.467f, 0.468f,
- -0.299f, -0.0f, -0.497f, 0.467f, 0.467f, -0.297f, -0.0f, -0.487f, 0.467f, 0.467f, -0.295f, 0.0f, -0.476f, 0.465f, 0.467f, -0.293f, 0.0f, -0.466f, 0.463f, 0.467f,
- -0.292f, 0.0f, -0.456f, 0.46f, 0.466f, -0.291f, 0.0f, -0.445f, 0.455f, 0.459f, -0.29f, 0.0f, -0.435f, 0.449f, 0.457f, -0.29f, 0.0f, -0.424f, 0.44f, 0.448f,
- -0.29f, 0.0f, -0.413f, 0.43f, 0.44f, -0.29f, 0.0f, -0.403f, 0.418f, 0.437f, -0.29f, -0.0f, -0.393f, 0.404f, 0.415f, -0.291f, -0.0f, -0.384f, 0.388f, 0.393f,
- -0.29f, -0.0f, -0.376f, 0.374f, 0.379f, -0.29f, -0.0f, -0.365f, 0.352f, 0.352f,
+static const float data0[270 * GP_PRIM_DATABUF_SIZE] = {
+ -0.4911f, 0.0f, -0.1781f, 0.267f, 0.362f,
+ -0.5168f, 0.0f, -0.1806f, 0.31f, 0.407f,
+ -0.5361f, 0.0f, -0.1817f, 0.38f, 0.439f,
+ -0.5618f, 0.0f, -0.1829f, 0.433f, 0.458f,
+ -0.5892f, 0.0f, -0.1827f, 0.471f, 0.5f,
+ -0.6193f, 0.0f, -0.1814f, 0.496f, 0.516f,
+ -0.6499f, 0.0f, -0.1782f, 0.511f, 0.519f,
+ -0.6808f, 0.0f, -0.1729f, 0.521f, 0.53f,
+ -0.7107f, 0.0f, -0.1651f, 0.527f, 0.533f,
+ -0.7404f, 0.0f, -0.1555f, 0.531f, 0.534f,
+ -0.7698f, 0.0f, -0.1447f, 0.534f, 0.535f,
+ -0.7993f, 0.0f, -0.1332f, 0.535f, 0.535f,
+ -0.8289f, 0.0f, -0.1209f, 0.536f, 0.537f,
+ -0.8586f, 0.0f, -0.109f, 0.536f, 0.537f,
+ -0.8871f, 0.0f, -0.0973f, 0.536f, 0.537f,
+ -0.9125f, 0.0f, -0.0838f, 0.535f, 0.535f,
+ -0.9353f, 0.0f, -0.0688f, 0.534f, 0.534f,
+ -0.9561f, 0.0f, -0.0525f, 0.534f, 0.534f,
+ -0.9752f, 0.0f, -0.0346f, 0.533f, 0.534f,
+ -0.9944f, 0.0f, -0.016f, 0.533f, 0.534f,
+ -1.0148f, 0.0f, 0.0028f, 0.532f, 0.532f,
+ -1.0348f, 0.0f, 0.0215f, 0.531f, 0.531f,
+ -1.05f, 0.0f, 0.0407f, 0.531f, 0.531f,
+ -1.0639f, 0.0f, 0.0613f, 0.532f, 0.532f,
+ -1.0752f, 0.0f, 0.0838f, 0.535f, 0.535f,
+ -1.0848f, 0.0f, 0.1082f, 0.54f, 0.54f,
+ -1.0936f, 0.0f, 0.1346f, 0.542f, 0.542f,
+ -1.1024f, 0.0f, 0.1639f, 0.543f, 0.543f,
+ -1.1102f, 0.0f, 0.1953f, 0.543f, 0.543f,
+ -1.1128f, 0.0f, 0.2277f, 0.546f, 0.546f,
+ -1.1091f, 0.0f, 0.2579f, 0.549f, 0.549f,
+ -1.1023f, 0.0f, 0.2849f, 0.549f, 0.549f,
+ -1.0934f, 0.0f, 0.3086f, 0.549f, 0.549f,
+ -1.0831f, 0.0f, 0.3285f, 0.549f, 0.549f,
+ -1.0724f, 0.0f, 0.3451f, 0.551f, 0.551f,
+ -1.0607f, 0.0f, 0.3594f, 0.553f, 0.553f,
+ -1.0474f, 0.0f, 0.3713f, 0.554f, 0.554f,
+ -1.031f, 0.0f, 0.3804f, 0.554f, 0.554f,
+ -1.0108f, 0.0f, 0.3874f, 0.555f, 0.555f,
+ -0.9862f, 0.0f, 0.3922f, 0.556f, 0.556f,
+ -0.9568f, 0.0f, 0.3941f, 0.557f, 0.557f,
+ -0.9243f, 0.0f, 0.3934f, 0.557f, 0.557f,
+ -0.8897f, 0.0f, 0.3861f, 0.557f, 0.557f,
+ -0.8556f, 0.0f, 0.3754f, 0.557f, 0.557f,
+ -0.8237f, 0.0f, 0.3608f, 0.558f, 0.557f,
+ -0.7982f, 0.0f, 0.344f, 0.558f, 0.558f,
+ -0.7786f, 0.0f, 0.329f, 0.557f, 0.559f,
+ -0.7633f, 0.0f, 0.3183f, 0.556f, 0.559f,
+ -0.7498f, 0.0f, 0.3135f, 0.554f, 0.559f,
+ -0.7374f, 0.0f, 0.3134f, 0.552f, 0.548f,
+ -0.7261f, 0.0f, 0.3179f, 0.551f, 0.546f,
+ -0.7146f, 0.0f, 0.3262f, 0.55f, 0.547f,
+ -0.703f, 0.0f, 0.3395f, 0.549f, 0.547f,
+ -0.692f, 0.0f, 0.3576f, 0.549f, 0.548f,
+ -0.6831f, 0.0f, 0.3806f, 0.549f, 0.548f,
+ -0.6748f, 0.0f, 0.4052f, 0.55f, 0.549f,
+ -0.6648f, 0.0f, 0.4305f, 0.552f, 0.548f,
+ -0.6527f, 0.0f, 0.4549f, 0.556f, 0.549f,
+ -0.6375f, 0.0f, 0.4783f, 0.563f, 0.549f,
+ -0.6195f, 0.0f, 0.5021f, 0.572f, 0.558f,
+ -0.5985f, 0.0f, 0.5256f, 0.582f, 0.587f,
+ -0.5775f, 0.0f, 0.5488f, 0.591f, 0.595f,
+ -0.556f, 0.0f, 0.5715f, 0.597f, 0.598f,
+ -0.5339f, 0.0f, 0.593f, 0.602f, 0.603f,
+ -0.5119f, 0.0f, 0.613f, 0.605f, 0.606f,
+ -0.4905f, 0.0f, 0.6312f, 0.607f, 0.607f,
+ -0.4697f, 0.0f, 0.6474f, 0.609f, 0.607f,
+ -0.4499f, 0.0f, 0.6613f, 0.612f, 0.611f,
+ -0.4306f, 0.0f, 0.6734f, 0.616f, 0.615f,
+ -0.4116f, 0.0f, 0.6845f, 0.619f, 0.621f,
+ -0.3918f, 0.0f, 0.6954f, 0.623f, 0.623f,
+ -0.3709f, 0.0f, 0.7059f, 0.626f, 0.626f,
+ -0.3486f, 0.0f, 0.7157f, 0.63f, 0.63f,
+ -0.3251f, 0.0f, 0.7249f, 0.637f, 0.632f,
+ -0.3006f, 0.0f, 0.7333f, 0.646f, 0.644f,
+ -0.2755f, 0.0f, 0.7414f, 0.654f, 0.657f,
+ -0.25f, 0.0f, 0.7489f, 0.659f, 0.661f,
+ -0.2242f, 0.0f, 0.7562f, 0.664f, 0.664f,
+ -0.1979f, 0.0f, 0.7631f, 0.667f, 0.668f,
+ -0.171f, 0.0f, 0.7695f, 0.671f, 0.671f,
+ -0.1434f, 0.0f, 0.7752f, 0.674f, 0.674f,
+ -0.1151f, 0.0f, 0.7801f, 0.677f, 0.678f,
+ -0.0861f, 0.0f, 0.7841f, 0.678f, 0.68f,
+ -0.0563f, 0.0f, 0.7869f, 0.68f, 0.68f,
+ -0.026f, 0.0f, 0.7889f, 0.68f, 0.68f,
+ 0.0049f, 0.0f, 0.7899f, 0.681f, 0.681f,
+ 0.0362f, 0.0f, 0.7898f, 0.682f, 0.681f,
+ 0.0679f, 0.0f, 0.7881f, 0.683f, 0.683f,
+ 0.0996f, 0.0f, 0.7853f, 0.685f, 0.683f,
+ 0.1313f, 0.0f, 0.7812f, 0.687f, 0.685f,
+ 0.1632f, 0.0f, 0.7756f, 0.69f, 0.686f,
+ 0.1953f, 0.0f, 0.7687f, 0.693f, 0.694f,
+ 0.2277f, 0.0f, 0.7608f, 0.697f, 0.697f,
+ 0.2606f, 0.0f, 0.7513f, 0.7f, 0.7f,
+ 0.2934f, 0.0f, 0.7404f, 0.704f, 0.704f,
+ 0.3258f, 0.0f, 0.7276f, 0.707f, 0.71f,
+ 0.357f, 0.0f, 0.7135f, 0.709f, 0.711f,
+ 0.387f, 0.0f, 0.6983f, 0.711f, 0.713f,
+ 0.4157f, 0.0f, 0.6819f, 0.712f, 0.714f,
+ 0.444f, 0.0f, 0.6645f, 0.714f, 0.714f,
+ 0.4719f, 0.0f, 0.6459f, 0.715f, 0.715f,
+ 0.4994f, 0.0f, 0.6261f, 0.715f, 0.716f,
+ 0.526f, 0.0f, 0.6046f, 0.716f, 0.716f,
+ 0.552f, 0.0f, 0.5816f, 0.717f, 0.717f,
+ 0.577f, 0.0f, 0.5575f, 0.718f, 0.717f,
+ 0.6008f, 0.0f, 0.5328f, 0.718f, 0.718f,
+ 0.6231f, 0.0f, 0.5077f, 0.718f, 0.718f,
+ 0.6423f, 0.0f, 0.4829f, 0.719f, 0.718f,
+ 0.658f, 0.0f, 0.4617f, 0.719f, 0.719f,
+ 0.6713f, 0.0f, 0.4432f, 0.719f, 0.719f,
+ 0.6828f, 0.0f, 0.4266f, 0.719f, 0.719f,
+ 0.6928f, 0.0f, 0.4118f, 0.719f, 0.719f,
+ 0.7016f, 0.0f, 0.3987f, 0.718f, 0.717f,
+ 0.7094f, 0.0f, 0.3871f, 0.717f, 0.717f,
+ 0.7165f, 0.0f, 0.3769f, 0.717f, 0.717f,
+ 0.7233f, 0.0f, 0.3679f, 0.718f, 0.718f,
+ 0.7301f, 0.0f, 0.3598f, 0.717f, 0.719f,
+ 0.7373f, 0.0f, 0.3524f, 0.715f, 0.719f,
+ 0.7454f, 0.0f, 0.3458f, 0.713f, 0.709f,
+ 0.7545f, 0.0f, 0.3398f, 0.718f, 0.704f,
+ 0.7651f, 0.0f, 0.3351f, 0.732f, 0.705f,
+ 0.777f, 0.0f, 0.3317f, 0.753f, 0.713f,
+ 0.7909f, 0.0f, 0.3311f, 0.774f, 0.813f,
+ 0.8068f, 0.0f, 0.334f, 0.791f, 0.815f,
+ 0.8246f, 0.0f, 0.3398f, 0.802f, 0.815f,
+ 0.8438f, 0.0f, 0.3486f, 0.809f, 0.816f,
+ 0.8651f, 0.0f, 0.3575f, 0.812f, 0.816f,
+ 0.8893f, 0.0f, 0.3665f, 0.814f, 0.816f,
+ 0.9166f, 0.0f, 0.374f, 0.814f, 0.817f,
+ 0.9459f, 0.0f, 0.3791f, 0.812f, 0.817f,
+ 0.9751f, 0.0f, 0.3811f, 0.81f, 0.815f,
+ 1.0029f, 0.0f, 0.38f, 0.806f, 0.807f,
+ 1.0288f, 0.0f, 0.3754f, 0.8f, 0.801f,
+ 1.052f, 0.0f, 0.3673f, 0.794f, 0.8f,
+ 1.0722f, 0.0f, 0.3556f, 0.788f, 0.781f,
+ 1.0888f, 0.0f, 0.3403f, 0.783f, 0.78f,
+ 1.1027f, 0.0f, 0.322f, 0.781f, 0.778f,
+ 1.1133f, 0.0f, 0.301f, 0.779f, 0.777f,
+ 1.1215f, 0.0f, 0.278f, 0.778f, 0.777f,
+ 1.1269f, 0.0f, 0.2534f, 0.777f, 0.777f,
+ 1.1296f, 0.0f, 0.2284f, 0.777f, 0.778f,
+ 1.1292f, 0.0f, 0.2031f, 0.776f, 0.776f,
+ 1.1254f, 0.0f, 0.1778f, 0.775f, 0.776f,
+ 1.1178f, 0.0f, 0.153f, 0.774f, 0.774f,
+ 1.1076f, 0.0f, 0.1299f, 0.774f, 0.772f,
+ 1.0955f, 0.0f, 0.1079f, 0.773f, 0.773f,
+ 1.0817f, 0.0f, 0.087f, 0.772f, 0.773f,
+ 1.0668f, 0.0f, 0.0677f, 0.771f, 0.772f,
+ 1.0508f, 0.0f, 0.0491f, 0.77f, 0.772f,
+ 1.0339f, 0.0f, 0.0313f, 0.768f, 0.766f,
+ 1.0157f, 0.0f, 0.0144f, 0.767f, 0.765f,
+ 0.9969f, 0.0f, -0.0015f, 0.766f, 0.765f,
+ 0.9784f, 0.0f, -0.017f, 0.765f, 0.766f,
+ 0.96f, 0.0f, -0.0321f, 0.764f, 0.765f,
+ 0.9413f, 0.0f, -0.0468f, 0.761f, 0.765f,
+ 0.9216f, 0.0f, -0.0611f, 0.756f, 0.761f,
+ 0.9009f, 0.0f, -0.0751f, 0.751f, 0.751f,
+ 0.8787f, 0.0f, -0.0893f, 0.745f, 0.744f,
+ 0.8556f, 0.0f, -0.1027f, 0.739f, 0.738f,
+ 0.8312f, 0.0f, -0.1152f, 0.733f, 0.731f,
+ 0.8058f, 0.0f, -0.1268f, 0.728f, 0.727f,
+ 0.7788f, 0.0f, -0.1372f, 0.723f, 0.723f,
+ 0.7505f, 0.0f, -0.1467f, 0.718f, 0.717f,
+ 0.7214f, 0.0f, -0.1549f, 0.713f, 0.708f,
+ 0.6929f, 0.0f, -0.1617f, 0.709f, 0.706f,
+ 0.6652f, 0.0f, -0.1665f, 0.704f, 0.705f,
+ 0.6388f, 0.0f, -0.1691f, 0.7f, 0.704f,
+ 0.6131f, 0.0f, -0.1701f, 0.695f, 0.698f,
+ 0.5883f, 0.0f, -0.1699f, 0.691f, 0.691f,
+ 0.5644f, 0.0f, -0.1691f, 0.686f, 0.685f,
+ 0.5416f, 0.0f, -0.1683f, 0.681f, 0.683f,
+ 0.5195f, 0.0f, -0.168f, 0.676f, 0.676f,
+ 0.4975f, 0.0f, -0.1687f, 0.671f, 0.67f,
+ 0.4754f, 0.0f, -0.1705f, 0.666f, 0.663f,
+ 0.4527f, 0.0f, -0.1741f, 0.663f, 0.66f,
+ 0.4293f, 0.0f, -0.1797f, 0.661f, 0.659f,
+ 0.4054f, 0.0f, -0.1881f, 0.66f, 0.659f,
+ 0.3813f, 0.0f, -0.1992f, 0.659f, 0.657f,
+ 0.3585f, 0.0f, -0.212f, 0.658f, 0.659f,
+ 0.3368f, 0.0f, -0.2266f, 0.658f, 0.659f,
+ 0.3174f, 0.0f, -0.2426f, 0.658f, 0.659f,
+ 0.2996f, 0.0f, -0.2594f, 0.657f, 0.657f,
+ 0.284f, 0.0f, -0.2768f, 0.656f, 0.658f,
+ 0.2702f, 0.0f, -0.2946f, 0.653f, 0.657f,
+ 0.2585f, 0.0f, -0.3127f, 0.646f, 0.656f,
+ 0.25f, 0.0f, -0.3308f, 0.637f, 0.642f,
+ 0.2447f, 0.0f, -0.3489f, 0.628f, 0.609f,
+ 0.2418f, 0.0f, -0.3672f, 0.62f, 0.608f,
+ 0.2412f, 0.0f, -0.386f, 0.614f, 0.607f,
+ 0.2425f, 0.0f, -0.4051f, 0.61f, 0.606f,
+ 0.2456f, 0.0f, -0.4246f, 0.608f, 0.604f,
+ 0.2509f, 0.0f, -0.4447f, 0.607f, 0.606f,
+ 0.2576f, 0.0f, -0.4652f, 0.606f, 0.607f,
+ 0.2666f, 0.0f, -0.4867f, 0.605f, 0.607f,
+ 0.2766f, 0.0f, -0.5091f, 0.603f, 0.607f,
+ 0.2871f, 0.0f, -0.5326f, 0.598f, 0.606f,
+ 0.2973f, 0.0f, -0.5569f, 0.591f, 0.602f,
+ 0.306f, 0.0f, -0.5826f, 0.583f, 0.585f,
+ 0.3131f, 0.0f, -0.61f, 0.574f, 0.576f,
+ 0.3197f, 0.0f, -0.6384f, 0.564f, 0.564f,
+ 0.326f, 0.0f, -0.6681f, 0.555f, 0.549f,
+ 0.3315f, 0.0f, -0.6984f, 0.547f, 0.543f,
+ 0.336f, 0.0f, -0.7291f, 0.541f, 0.541f,
+ 0.3391f, 0.0f, -0.7593f, 0.536f, 0.538f,
+ 0.3399f, 0.0f, -0.7884f, 0.532f, 0.528f,
+ 0.3382f, 0.0f, -0.8158f, 0.529f, 0.528f,
+ 0.334f, 0.0f, -0.8417f, 0.525f, 0.529f,
+ 0.3273f, 0.0f, -0.8657f, 0.521f, 0.528f,
+ 0.3185f, 0.0f, -0.8881f, 0.516f, 0.515f,
+ 0.3073f, 0.0f, -0.9088f, 0.51f, 0.514f,
+ 0.2941f, 0.0f, -0.9278f, 0.505f, 0.507f,
+ 0.2786f, 0.0f, -0.9449f, 0.499f, 0.494f,
+ 0.261f, 0.0f, -0.96f, 0.495f, 0.49f,
+ 0.2413f, 0.0f, -0.9733f, 0.493f, 0.491f,
+ 0.2193f, 0.0f, -0.9845f, 0.491f, 0.489f,
+ 0.1953f, 0.0f, -0.9935f, 0.491f, 0.491f,
+ 0.1693f, 0.0f, -1.0004f, 0.491f, 0.492f,
+ 0.1421f, 0.0f, -1.0051f, 0.492f, 0.492f,
+ 0.1136f, 0.0f, -1.0072f, 0.492f, 0.492f,
+ 0.0842f, 0.0f, -1.0073f, 0.492f, 0.492f,
+ 0.0548f, 0.0f, -1.0059f, 0.493f, 0.494f,
+ 0.0258f, 0.0f, -1.0037f, 0.493f, 0.494f,
+ -0.0027f, 0.0f, -1.0003f, 0.493f, 0.493f,
+ -0.0309f, 0.0f, -0.9959f, 0.492f, 0.492f,
+ -0.0584f, 0.0f, -0.9904f, 0.491f, 0.492f,
+ -0.0858f, 0.0f, -0.9848f, 0.491f, 0.491f,
+ -0.1127f, 0.0f, -0.9783f, 0.49f, 0.49f,
+ -0.1386f, 0.0f, -0.9703f, 0.49f, 0.49f,
+ -0.1649f, 0.0f, -0.9604f, 0.489f, 0.489f,
+ -0.191f, 0.0f, -0.9479f, 0.489f, 0.489f,
+ -0.2165f, 0.0f, -0.9345f, 0.489f, 0.49f,
+ -0.2414f, 0.0f, -0.9205f, 0.489f, 0.489f,
+ -0.2654f, 0.0f, -0.9055f, 0.489f, 0.489f,
+ -0.2877f, 0.0f, -0.8898f, 0.49f, 0.49f,
+ -0.3076f, 0.0f, -0.8723f, 0.49f, 0.489f,
+ -0.324f, 0.0f, -0.8532f, 0.491f, 0.489f,
+ -0.3367f, 0.0f, -0.8316f, 0.492f, 0.489f,
+ -0.3451f, 0.0f, -0.8077f, 0.494f, 0.488f,
+ -0.3505f, 0.0f, -0.7829f, 0.497f, 0.49f,
+ -0.3531f, 0.0f, -0.7584f, 0.501f, 0.497f,
+ -0.3528f, 0.0f, -0.7349f, 0.505f, 0.504f,
+ -0.3503f, 0.0f, -0.7115f, 0.51f, 0.51f,
+ -0.346f, 0.0f, -0.688f, 0.515f, 0.515f,
+ -0.3411f, 0.0f, -0.6643f, 0.52f, 0.522f,
+ -0.3361f, 0.0f, -0.6403f, 0.525f, 0.528f,
+ -0.3304f, 0.0f, -0.6164f, 0.53f, 0.532f,
+ -0.3244f, 0.0f, -0.5925f, 0.535f, 0.535f,
+ -0.318f, 0.0f, -0.5687f, 0.539f, 0.54f,
+ -0.3124f, 0.0f, -0.5441f, 0.542f, 0.545f,
+ -0.3051f, 0.0f, -0.5191f, 0.546f, 0.549f,
+ -0.2959f, 0.0f, -0.4917f, 0.548f, 0.549f,
+ -0.2882f, 0.0f, -0.4639f, 0.55f, 0.552f,
+ -0.2814f, 0.0f, -0.4363f, 0.551f, 0.552f,
+ -0.2759f, 0.0f, -0.4084f, 0.552f, 0.553f,
+ -0.2707f, 0.0f, -0.3827f, 0.553f, 0.553f,
+ -0.2703f, 0.0f, -0.3586f, 0.554f, 0.553f,
+ -0.2772f, 0.0f, -0.3375f, 0.554f, 0.554f,
+ -0.2871f, 0.0f, -0.3178f, 0.555f, 0.555f,
+ -0.2995f, 0.0f, -0.2996f, 0.556f, 0.555f,
+ -0.3145f, 0.0f, -0.283f, 0.556f, 0.557f,
+ -0.332f, 0.0f, -0.2672f, 0.557f, 0.557f,
+ -0.3488f, 0.0f, -0.2531f, 0.558f, 0.558f,
+ -0.3639f, 0.0f, -0.2407f, 0.558f, 0.558f,
+ -0.3778f, 0.0f, -0.2292f, 0.558f, 0.558f,
+ -0.3909f, 0.0f, -0.2191f, 0.559f, 0.559f,
+ -0.4032f, 0.0f, -0.2102f, 0.559f, 0.558f,
+ -0.4146f, 0.0f, -0.2027f, 0.559f, 0.559f,
+ -0.426f, 0.0f, -0.1968f, 0.558f, 0.558f,
+ -0.4348f, 0.0f, -0.1931f, 0.558f, 0.558f,
+ -0.4479f, 0.0f, -0.1886f, 0.555f, 0.559f,
};
-static const float data8[55 * GP_PRIM_DATABUF_SIZE] = {
- 0.781f, 0.0f, 0.098f, 0.109f, 0.109f, 0.784f, 0.0f, 0.105f, 0.202f, 0.338f, 0.785f, 0.0f, 0.108f, 0.254f, 0.369f, 0.787f, 0.0f, 0.113f, 0.306f, 0.382f,
- 0.787f, 0.0f, 0.118f, 0.344f, 0.392f, 0.789f, 0.0f, 0.123f, 0.372f, 0.401f, 0.79f, 0.0f, 0.128f, 0.392f, 0.41f, 0.792f, 0.0f, 0.135f, 0.406f, 0.42f,
- 0.794f, 0.0f, 0.142f, 0.416f, 0.424f, 0.797f, 0.0f, 0.152f, 0.424f, 0.428f, 0.801f, 0.0f, 0.161f, 0.429f, 0.431f, 0.807f, 0.0f, 0.172f, 0.432f, 0.435f,
- 0.814f, 0.0f, 0.182f, 0.435f, 0.438f, 0.821f, 0.0f, 0.19f, 0.437f, 0.439f, 0.828f, 0.0f, 0.197f, 0.439f, 0.44f, 0.836f, 0.0f, 0.204f, 0.44f, 0.441f,
- 0.845f, -0.0f, 0.211f, 0.44f, 0.441f, 0.853f, -0.0f, 0.215f, 0.441f, 0.441f, 0.861f, -0.0f, 0.219f, 0.441f, 0.441f, 0.87f, -0.0f, 0.222f, 0.441f, 0.442f,
- 0.878f, -0.0f, 0.224f, 0.441f, 0.442f, 0.886f, -0.0f, 0.226f, 0.441f, 0.442f, 0.895f, -0.0f, 0.227f, 0.44f, 0.442f, 0.903f, 0.0f, 0.226f, 0.439f, 0.441f,
- 0.911f, 0.0f, 0.225f, 0.436f, 0.441f, 0.919f, 0.0f, 0.224f, 0.432f, 0.441f, 0.927f, 0.0f, 0.221f, 0.425f, 0.436f, 0.934f, 0.0f, 0.218f, 0.415f, 0.429f,
- 0.94f, 0.0f, 0.215f, 0.404f, 0.406f, 0.944f, 0.0f, 0.211f, 0.393f, 0.389f, 0.947f, 0.0f, 0.208f, 0.384f, 0.378f, 0.948f, 0.0f, 0.204f, 0.376f, 0.371f,
- 0.946f, 0.0f, 0.2f, 0.369f, 0.364f, 0.943f, 0.0f, 0.196f, 0.365f, 0.358f, 0.937f, 0.0f, 0.193f, 0.364f, 0.354f, 0.931f, 0.0f, 0.189f, 0.366f, 0.359f,
- 0.925f, 0.0f, 0.186f, 0.37f, 0.367f, 0.917f, 0.0f, 0.182f, 0.374f, 0.375f, 0.908f, 0.0f, 0.177f, 0.378f, 0.382f, 0.899f, 0.0f, 0.172f, 0.381f, 0.384f,
- 0.889f, 0.0f, 0.167f, 0.384f, 0.385f, 0.876f, 0.0f, 0.163f, 0.387f, 0.387f, 0.864f, 0.0f, 0.156f, 0.39f, 0.388f, 0.852f, 0.0f, 0.15f, 0.393f, 0.39f,
- 0.841f, 0.0f, 0.144f, 0.396f, 0.396f, 0.832f, 0.0f, 0.138f, 0.399f, 0.401f, 0.826f, 0.0f, 0.133f, 0.401f, 0.404f, 0.82f, 0.0f, 0.127f, 0.403f, 0.405f,
- 0.816f, 0.0f, 0.122f, 0.403f, 0.407f, 0.812f, 0.0f, 0.119f, 0.399f, 0.406f, 0.808f, 0.0f, 0.115f, 0.39f, 0.405f, 0.805f, 0.0f, 0.113f, 0.371f, 0.407f,
- 0.801f, 0.0f, 0.111f, 0.341f, 0.407f, 0.799f, 0.0f, 0.109f, 0.309f, 0.405f, 0.795f, 0.0f, 0.106f, 0.255f, 0.255f,
+static const float data1[33 * GP_PRIM_DATABUF_SIZE] = {
+ 0.5292f, 0.0f, 0.1742f, 0.1f, 1.0f,
+ 0.5291f, 0.0f, 0.1621f, 0.2199f, 1.0f,
+ 0.5274f, 0.0f, 0.1386f, 0.4615f, 1.0f,
+ 0.5239f, 0.0f, 0.116f, 0.6019f, 1.0f,
+ 0.5185f, 0.0f, 0.0945f, 0.6981f, 1.0f,
+ 0.5115f, 0.0f, 0.0741f, 0.7689f, 1.0f,
+ 0.503f, 0.0f, 0.0548f, 0.8236f, 1.0f,
+ 0.4931f, 0.0f, 0.0368f, 0.866f, 1.0f,
+ 0.482f, 0.0f, 0.02f, 0.9003f, 1.0f,
+ 0.4697f, 0.0f, 0.0046f, 0.9272f, 1.0f,
+ 0.4565f, 0.0f, -0.0094f, 0.9485f, 1.0f,
+ 0.4424f, 0.0f, -0.0219f, 0.9653f, 1.0f,
+ 0.4275f, 0.0f, -0.033f, 0.9781f, 1.0f,
+ 0.4121f, 0.0f, -0.0424f, 0.9876f, 1.0f,
+ 0.3961f, 0.0f, -0.0501f, 0.9942f, 1.0f,
+ 0.3799f, 0.0f, -0.0562f, 0.9983f, 1.0f,
+ 0.3634f, 0.0f, -0.0605f, 0.9997f, 1.0f,
+ 0.3468f, 0.0f, -0.0629f, 0.999f, 1.0f,
+ 0.3303f, 0.0f, -0.0634f, 0.9963f, 1.0f,
+ 0.3139f, 0.0f, -0.062f, 0.9912f, 1.0f,
+ 0.2979f, 0.0f, -0.0585f, 0.9834f, 1.0f,
+ 0.2823f, 0.0f, -0.0529f, 0.9724f, 1.0f,
+ 0.2672f, 0.0f, -0.0452f, 0.9576f, 1.0f,
+ 0.2529f, 0.0f, -0.0352f, 0.9385f, 1.0f,
+ 0.2393f, 0.0f, -0.023f, 0.9143f, 1.0f,
+ 0.2267f, 0.0f, -0.0085f, 0.8841f, 1.0f,
+ 0.2153f, 0.0f, 0.0085f, 0.8461f, 1.0f,
+ 0.205f, 0.0f, 0.0279f, 0.7979f, 1.0f,
+ 0.196f, 0.0f, 0.0499f, 0.7359f, 1.0f,
+ 0.1886f, 0.0f, 0.0745f, 0.6541f, 1.0f,
+ 0.1827f, 0.0f, 0.1017f, 0.5396f, 1.0f,
+ 0.1786f, 0.0f, 0.1316f, 0.36f, 1.0f,
+ 0.1763f, 0.0f, 0.1643f, 0.1f, 1.0f,
};
-static const float data9[70 * GP_PRIM_DATABUF_SIZE] = {
- 0.819f, -0.0f, 0.325f, 0.109f, 0.109f, 0.829f, -0.0f, 0.328f, 0.258f, 0.403f, 0.835f, -0.0f, 0.329f, 0.327f, 0.428f, 0.843f, -0.0f, 0.331f, 0.383f, 0.452f,
- 0.851f, -0.0f, 0.332f, 0.419f, 0.465f, 0.861f, -0.0f, 0.334f, 0.444f, 0.473f, 0.87f, -0.0f, 0.336f, 0.461f, 0.48f, 0.881f, -0.0f, 0.337f, 0.473f, 0.486f,
- 0.892f, -0.0f, 0.339f, 0.482f, 0.496f, 0.904f, -0.0f, 0.341f, 0.489f, 0.501f, 0.917f, -0.0f, 0.342f, 0.494f, 0.503f, 0.931f, -0.0f, 0.342f, 0.498f, 0.505f,
- 0.945f, -0.0f, 0.342f, 0.501f, 0.505f, 0.958f, -0.0f, 0.342f, 0.503f, 0.506f, 0.971f, -0.0f, 0.341f, 0.505f, 0.506f, 0.984f, -0.0f, 0.341f, 0.506f, 0.506f,
- 0.997f, -0.0f, 0.339f, 0.507f, 0.508f, 1.009f, -0.0f, 0.337f, 0.507f, 0.507f, 1.021f, -0.0f, 0.333f, 0.508f, 0.508f, 1.033f, -0.0f, 0.33f, 0.508f, 0.508f,
- 1.044f, -0.0f, 0.326f, 0.508f, 0.508f, 1.056f, -0.0f, 0.322f, 0.508f, 0.508f, 1.068f, -0.0f, 0.317f, 0.508f, 0.508f, 1.078f, -0.0f, 0.311f, 0.507f, 0.508f,
- 1.089f, -0.0f, 0.304f, 0.506f, 0.508f, 1.099f, 0.0f, 0.294f, 0.503f, 0.506f, 1.107f, 0.0f, 0.287f, 0.498f, 0.506f, 1.113f, 0.0f, 0.28f, 0.49f, 0.505f,
- 1.117f, 0.0f, 0.276f, 0.48f, 0.501f, 1.121f, 0.0f, 0.272f, 0.468f, 0.492f, 1.124f, 0.0f, 0.27f, 0.455f, 0.467f, 1.127f, 0.0f, 0.27f, 0.443f, 0.431f,
- 1.129f, 0.0f, 0.271f, 0.431f, 0.4f, 1.13f, 0.0f, 0.274f, 0.422f, 0.399f, 1.13f, 0.0f, 0.278f, 0.414f, 0.399f, 1.13f, 0.0f, 0.286f, 0.408f, 0.399f,
- 1.128f, 0.0f, 0.295f, 0.404f, 0.399f, 1.124f, 0.0f, 0.305f, 0.402f, 0.399f, 1.119f, 0.0f, 0.316f, 0.403f, 0.4f, 1.113f, -0.0f, 0.327f, 0.405f, 0.401f,
- 1.107f, -0.0f, 0.337f, 0.408f, 0.411f, 1.1f, -0.0f, 0.345f, 0.412f, 0.412f, 1.094f, -0.0f, 0.352f, 0.416f, 0.413f, 1.087f, -0.0f, 0.357f, 0.421f, 0.422f,
- 1.08f, -0.0f, 0.363f, 0.426f, 0.428f, 1.071f, -0.0f, 0.368f, 0.429f, 0.43f, 1.062f, -0.0f, 0.373f, 0.431f, 0.431f, 1.051f, -0.0f, 0.377f, 0.433f, 0.431f,
- 1.039f, -0.0f, 0.381f, 0.436f, 0.437f, 1.026f, -0.0f, 0.383f, 0.438f, 0.44f, 1.013f, -0.0f, 0.384f, 0.44f, 0.44f, 1.0f, -0.0f, 0.385f, 0.441f, 0.443f,
- 0.987f, -0.0f, 0.385f, 0.442f, 0.443f, 0.975f, -0.0f, 0.384f, 0.443f, 0.443f, 0.962f, -0.0f, 0.383f, 0.443f, 0.444f, 0.949f, -0.0f, 0.381f, 0.443f, 0.443f,
- 0.936f, -0.0f, 0.38f, 0.443f, 0.444f, 0.923f, -0.0f, 0.378f, 0.443f, 0.444f, 0.909f, -0.0f, 0.375f, 0.443f, 0.444f, 0.897f, -0.0f, 0.371f, 0.443f, 0.444f,
- 0.886f, -0.0f, 0.367f, 0.443f, 0.443f, 0.876f, -0.0f, 0.363f, 0.443f, 0.444f, 0.868f, -0.0f, 0.359f, 0.443f, 0.442f, 0.86f, -0.0f, 0.355f, 0.442f, 0.443f,
- 0.852f, -0.0f, 0.35f, 0.441f, 0.443f, 0.844f, -0.0f, 0.347f, 0.433f, 0.443f, 0.837f, -0.0f, 0.343f, 0.409f, 0.443f, 0.83f, -0.0f, 0.338f, 0.344f, 0.443f,
- 0.824f, -0.0f, 0.335f, 0.239f, 0.437f, 0.815f, -0.0f, 0.326f, 0.0f, 0.003f,
+static const float data2[18 * GP_PRIM_DATABUF_SIZE] = {
+ -0.0844f, 0.0f, -0.301f, 0.1f, 1.0f,
+ -0.0825f, 0.0f, -0.3034f, 0.2199f, 1.0f,
+ -0.0751f, 0.0f, -0.3128f, 0.6019f, 1.0f,
+ -0.0677f, 0.0f, -0.3216f, 0.7689f, 1.0f,
+ -0.06f, 0.0f, -0.3298f, 0.866f, 1.0f,
+ -0.0522f, 0.0f, -0.3372f, 0.9272f, 1.0f,
+ -0.044f, 0.0f, -0.3437f, 0.9653f, 1.0f,
+ -0.0354f, 0.0f, -0.3491f, 0.9876f, 1.0f,
+ -0.0264f, 0.0f, -0.3535f, 0.9983f, 1.0f,
+ -0.0168f, 0.0f, -0.3566f, 0.999f, 1.0f,
+ -0.0065f, 0.0f, -0.3583f, 0.9912f, 1.0f,
+ 0.0045f, 0.0f, -0.3585f, 0.9724f, 1.0f,
+ 0.0163f, 0.0f, -0.3571f, 0.9385f, 1.0f,
+ 0.029f, 0.0f, -0.354f, 0.8841f, 1.0f,
+ 0.0427f, 0.0f, -0.3491f, 0.7979f, 1.0f,
+ 0.0574f, 0.0f, -0.3421f, 0.6541f, 1.0f,
+ 0.0732f, 0.0f, -0.3331f, 0.36f, 1.0f,
+ 0.0816f, 0.0f, -0.3278f, 0.1f, 1.0f,
};
-static const float data10[227 * GP_PRIM_DATABUF_SIZE] = {
- -0.675f, 0.0f, 0.411f, 0.099f, 0.099f, -0.669f, 0.0f, 0.418f, 0.358f, 0.358f, -0.666f, 0.0f, 0.424f, 0.381f, 0.381f, -0.662f, 0.0f, 0.431f, 0.389f, 0.389f,
- -0.658f, 0.0f, 0.438f, 0.393f, 0.393f, -0.649f, 0.0f, 0.448f, 0.404f, 0.404f, -0.641f, 0.0f, 0.458f, 0.419f, 0.419f, -0.632f, 0.0f, 0.468f, 0.431f, 0.434f,
- -0.626f, 0.0f, 0.476f, 0.435f, 0.436f, -0.62f, 0.0f, 0.484f, 0.437f, 0.438f, -0.615f, 0.0f, 0.492f, 0.439f, 0.439f, -0.61f, 0.0f, 0.499f, 0.439f, 0.44f,
- -0.605f, 0.0f, 0.506f, 0.44f, 0.44f, -0.6f, 0.0f, 0.512f, 0.44f, 0.44f, -0.595f, 0.0f, 0.519f, 0.44f, 0.44f, -0.59f, 0.0f, 0.526f, 0.441f, 0.441f,
- -0.584f, 0.0f, 0.532f, 0.441f, 0.441f, -0.579f, 0.0f, 0.539f, 0.441f, 0.441f, -0.573f, 0.0f, 0.545f, 0.442f, 0.442f, -0.566f, 0.0f, 0.551f, 0.443f, 0.443f,
- -0.559f, 0.0f, 0.557f, 0.443f, 0.443f, -0.552f, 0.0f, 0.563f, 0.444f, 0.444f, -0.545f, 0.0f, 0.569f, 0.445f, 0.445f, -0.538f, 0.0f, 0.576f, 0.447f, 0.447f,
- -0.532f, 0.0f, 0.582f, 0.448f, 0.448f, -0.525f, 0.0f, 0.589f, 0.45f, 0.45f, -0.519f, 0.0f, 0.595f, 0.451f, 0.452f, -0.513f, 0.0f, 0.602f, 0.452f, 0.453f,
- -0.506f, 0.0f, 0.608f, 0.453f, 0.453f, -0.5f, 0.0f, 0.613f, 0.453f, 0.454f, -0.493f, 0.0f, 0.619f, 0.453f, 0.454f, -0.486f, 0.0f, 0.625f, 0.453f, 0.454f,
- -0.479f, 0.0f, 0.631f, 0.453f, 0.454f, -0.472f, 0.0f, 0.637f, 0.453f, 0.454f, -0.464f, 0.0f, 0.642f, 0.453f, 0.454f, -0.457f, 0.0f, 0.649f, 0.453f, 0.454f,
- -0.45f, 0.0f, 0.655f, 0.453f, 0.453f, -0.443f, 0.0f, 0.661f, 0.453f, 0.453f, -0.435f, 0.0f, 0.667f, 0.453f, 0.454f, -0.427f, 0.0f, 0.672f, 0.453f, 0.454f,
- -0.419f, 0.0f, 0.677f, 0.453f, 0.454f, -0.411f, 0.0f, 0.682f, 0.453f, 0.453f, -0.403f, 0.0f, 0.688f, 0.453f, 0.453f, -0.395f, 0.0f, 0.692f, 0.453f, 0.454f,
- -0.387f, 0.0f, 0.697f, 0.453f, 0.454f, -0.379f, 0.0f, 0.702f, 0.453f, 0.454f, -0.372f, 0.0f, 0.707f, 0.454f, 0.454f, -0.364f, 0.0f, 0.712f, 0.454f, 0.454f,
- -0.356f, 0.0f, 0.716f, 0.454f, 0.454f, -0.349f, 0.0f, 0.721f, 0.454f, 0.454f, -0.342f, 0.0f, 0.725f, 0.454f, 0.454f, -0.334f, 0.0f, 0.73f, 0.454f, 0.454f,
- -0.326f, 0.0f, 0.733f, 0.454f, 0.454f, -0.318f, 0.0f, 0.737f, 0.454f, 0.454f, -0.31f, 0.0f, 0.74f, 0.454f, 0.454f, -0.301f, 0.0f, 0.743f, 0.454f, 0.454f,
- -0.293f, 0.0f, 0.746f, 0.454f, 0.455f, -0.284f, 0.0f, 0.749f, 0.454f, 0.455f, -0.274f, 0.0f, 0.752f, 0.455f, 0.455f, -0.265f, 0.0f, 0.755f, 0.455f, 0.455f,
- -0.255f, 0.0f, 0.757f, 0.455f, 0.455f, -0.245f, 0.0f, 0.76f, 0.456f, 0.455f, -0.234f, 0.0f, 0.762f, 0.457f, 0.456f, -0.223f, 0.0f, 0.764f, 0.458f, 0.458f,
- -0.212f, 0.0f, 0.766f, 0.459f, 0.46f, -0.201f, 0.0f, 0.769f, 0.461f, 0.46f, -0.189f, 0.0f, 0.771f, 0.462f, 0.461f, -0.177f, 0.0f, 0.773f, 0.464f, 0.463f,
- -0.166f, 0.0f, 0.775f, 0.465f, 0.465f, -0.153f, 0.0f, 0.777f, 0.467f, 0.467f, -0.141f, 0.0f, 0.779f, 0.469f, 0.469f, -0.128f, 0.0f, 0.781f, 0.472f, 0.472f,
- -0.116f, 0.0f, 0.782f, 0.474f, 0.473f, -0.101f, 0.0f, 0.782f, 0.477f, 0.477f, -0.087f, 0.0f, 0.783f, 0.482f, 0.477f, -0.073f, 0.0f, 0.783f, 0.489f, 0.483f,
- -0.059f, 0.0f, 0.783f, 0.497f, 0.5f, -0.046f, 0.0f, 0.784f, 0.503f, 0.509f, -0.033f, 0.0f, 0.784f, 0.508f, 0.51f, -0.022f, 0.0f, 0.784f, 0.51f, 0.512f,
- -0.011f, 0.0f, 0.785f, 0.512f, 0.512f, -0.0f, 0.0f, 0.786f, 0.513f, 0.512f, 0.011f, 0.0f, 0.786f, 0.515f, 0.513f, 0.022f, 0.0f, 0.786f, 0.517f, 0.517f,
- 0.032f, 0.0f, 0.786f, 0.52f, 0.519f, 0.044f, 0.0f, 0.786f, 0.522f, 0.524f, 0.055f, 0.0f, 0.785f, 0.525f, 0.525f, 0.066f, 0.0f, 0.785f, 0.527f, 0.525f,
- 0.076f, 0.0f, 0.784f, 0.53f, 0.53f, 0.086f, 0.0f, 0.783f, 0.532f, 0.533f, 0.097f, 0.0f, 0.782f, 0.535f, 0.534f, 0.108f, 0.0f, 0.782f, 0.538f, 0.541f,
- 0.119f, 0.0f, 0.781f, 0.54f, 0.542f, 0.13f, 0.0f, 0.781f, 0.543f, 0.543f, 0.141f, 0.0f, 0.78f, 0.545f, 0.545f, 0.154f, 0.0f, 0.779f, 0.547f, 0.547f,
- 0.165f, 0.0f, 0.777f, 0.549f, 0.548f, 0.177f, 0.0f, 0.775f, 0.55f, 0.552f, 0.188f, 0.0f, 0.772f, 0.552f, 0.552f, 0.199f, 0.0f, 0.77f, 0.553f, 0.553f,
- 0.209f, 0.0f, 0.767f, 0.554f, 0.554f, 0.218f, 0.0f, 0.765f, 0.555f, 0.556f, 0.226f, 0.0f, 0.763f, 0.556f, 0.557f, 0.235f, 0.0f, 0.761f, 0.557f, 0.557f,
- 0.244f, 0.0f, 0.758f, 0.558f, 0.558f, 0.253f, 0.0f, 0.755f, 0.559f, 0.559f, 0.263f, 0.0f, 0.752f, 0.56f, 0.559f, 0.272f, 0.0f, 0.749f, 0.561f, 0.56f,
- 0.285f, 0.0f, 0.745f, 0.562f, 0.56f, 0.299f, 0.0f, 0.741f, 0.563f, 0.563f, 0.316f, 0.0f, 0.736f, 0.564f, 0.564f, 0.331f, 0.0f, 0.728f, 0.565f, 0.567f,
- 0.349f, 0.0f, 0.718f, 0.565f, 0.568f, 0.365f, 0.0f, 0.708f, 0.566f, 0.568f, 0.38f, 0.0f, 0.699f, 0.566f, 0.568f, 0.39f, 0.0f, 0.693f, 0.566f, 0.568f,
- 0.397f, 0.0f, 0.687f, 0.566f, 0.569f, 0.4f, 0.0f, 0.683f, 0.566f, 0.569f, 0.401f, 0.0f, 0.681f, 0.565f, 0.57f, 0.4f, 0.0f, 0.679f, 0.565f, 0.57f,
- 0.397f, 0.0f, 0.678f, 0.564f, 0.57f, 0.393f, 0.0f, 0.678f, 0.564f, 0.565f, 0.387f, 0.0f, 0.678f, 0.563f, 0.559f, 0.379f, 0.0f, 0.679f, 0.562f, 0.558f,
- 0.37f, 0.0f, 0.681f, 0.561f, 0.557f, 0.357f, 0.0f, 0.684f, 0.561f, 0.557f, 0.342f, 0.0f, 0.689f, 0.56f, 0.557f, 0.324f, 0.0f, 0.694f, 0.56f, 0.557f,
- 0.307f, 0.0f, 0.697f, 0.559f, 0.558f, 0.291f, 0.0f, 0.699f, 0.559f, 0.558f, 0.274f, 0.0f, 0.701f, 0.559f, 0.557f, 0.26f, 0.0f, 0.703f, 0.558f, 0.558f,
- 0.246f, 0.0f, 0.705f, 0.558f, 0.558f, 0.235f, 0.0f, 0.707f, 0.558f, 0.558f, 0.224f, 0.0f, 0.709f, 0.558f, 0.558f, 0.214f, 0.0f, 0.711f, 0.558f, 0.558f,
- 0.203f, 0.0f, 0.713f, 0.558f, 0.559f, 0.192f, 0.0f, 0.714f, 0.558f, 0.558f, 0.181f, 0.0f, 0.714f, 0.557f, 0.557f, 0.17f, 0.0f, 0.714f, 0.557f, 0.557f,
- 0.16f, 0.0f, 0.715f, 0.557f, 0.556f, 0.149f, 0.0f, 0.715f, 0.557f, 0.556f, 0.139f, 0.0f, 0.716f, 0.557f, 0.556f, 0.129f, 0.0f, 0.716f, 0.558f, 0.556f,
- 0.119f, 0.0f, 0.717f, 0.558f, 0.556f, 0.109f, 0.0f, 0.717f, 0.558f, 0.557f, 0.099f, 0.0f, 0.718f, 0.558f, 0.557f, 0.089f, 0.0f, 0.718f, 0.559f, 0.557f,
- 0.079f, 0.0f, 0.718f, 0.559f, 0.558f, 0.068f, 0.0f, 0.719f, 0.559f, 0.559f, 0.057f, 0.0f, 0.719f, 0.56f, 0.56f, 0.046f, 0.0f, 0.718f, 0.56f, 0.561f,
- 0.035f, 0.0f, 0.718f, 0.561f, 0.561f, 0.024f, 0.0f, 0.718f, 0.561f, 0.562f, 0.013f, 0.0f, 0.717f, 0.562f, 0.562f, 0.002f, 0.0f, 0.717f, 0.562f, 0.563f,
- -0.01f, 0.0f, 0.717f, 0.563f, 0.564f, -0.021f, 0.0f, 0.717f, 0.563f, 0.564f, -0.032f, 0.0f, 0.716f, 0.563f, 0.564f, -0.044f, 0.0f, 0.715f, 0.564f, 0.564f,
- -0.055f, 0.0f, 0.714f, 0.564f, 0.565f, -0.066f, 0.0f, 0.713f, 0.564f, 0.565f, -0.078f, 0.0f, 0.712f, 0.564f, 0.564f, -0.089f, 0.0f, 0.711f, 0.564f, 0.564f,
- -0.101f, 0.0f, 0.709f, 0.565f, 0.564f, -0.112f, 0.0f, 0.708f, 0.565f, 0.564f, -0.124f, 0.0f, 0.707f, 0.565f, 0.564f, -0.135f, 0.0f, 0.705f, 0.565f, 0.564f,
- -0.146f, 0.0f, 0.704f, 0.566f, 0.564f, -0.158f, 0.0f, 0.702f, 0.566f, 0.564f, -0.169f, 0.0f, 0.7f, 0.566f, 0.566f, -0.18f, 0.0f, 0.698f, 0.567f, 0.568f,
- -0.191f, 0.0f, 0.696f, 0.567f, 0.568f, -0.203f, 0.0f, 0.693f, 0.567f, 0.568f, -0.215f, 0.0f, 0.69f, 0.567f, 0.568f, -0.227f, 0.0f, 0.687f, 0.567f, 0.568f,
- -0.238f, 0.0f, 0.684f, 0.567f, 0.568f, -0.25f, 0.0f, 0.681f, 0.567f, 0.569f, -0.262f, 0.0f, 0.678f, 0.567f, 0.569f, -0.273f, 0.0f, 0.675f, 0.567f, 0.567f,
- -0.284f, 0.0f, 0.673f, 0.567f, 0.566f, -0.295f, 0.0f, 0.671f, 0.567f, 0.567f, -0.305f, 0.0f, 0.669f, 0.566f, 0.567f, -0.316f, 0.0f, 0.666f, 0.566f, 0.567f,
- -0.326f, 0.0f, 0.663f, 0.565f, 0.566f, -0.337f, 0.0f, 0.66f, 0.565f, 0.566f, -0.348f, 0.0f, 0.655f, 0.564f, 0.564f, -0.359f, 0.0f, 0.652f, 0.563f, 0.564f,
- -0.369f, 0.0f, 0.648f, 0.562f, 0.563f, -0.379f, 0.0f, 0.644f, 0.561f, 0.56f, -0.389f, 0.0f, 0.64f, 0.561f, 0.559f, -0.399f, 0.0f, 0.636f, 0.56f, 0.559f,
- -0.409f, 0.0f, 0.633f, 0.559f, 0.559f, -0.419f, 0.0f, 0.629f, 0.559f, 0.559f, -0.428f, 0.0f, 0.625f, 0.559f, 0.558f, -0.438f, 0.0f, 0.62f, 0.559f, 0.559f,
- -0.447f, 0.0f, 0.615f, 0.559f, 0.559f, -0.457f, 0.0f, 0.61f, 0.559f, 0.559f, -0.466f, 0.0f, 0.605f, 0.559f, 0.559f, -0.474f, 0.0f, 0.6f, 0.559f, 0.559f,
- -0.483f, 0.0f, 0.595f, 0.559f, 0.559f, -0.492f, 0.0f, 0.591f, 0.559f, 0.559f, -0.5f, 0.0f, 0.586f, 0.559f, 0.559f, -0.508f, 0.0f, 0.58f, 0.559f, 0.559f,
- -0.515f, 0.0f, 0.574f, 0.559f, 0.559f, -0.523f, 0.0f, 0.568f, 0.559f, 0.559f, -0.531f, 0.0f, 0.562f, 0.559f, 0.558f, -0.54f, 0.0f, 0.556f, 0.559f, 0.558f,
- -0.548f, 0.0f, 0.549f, 0.559f, 0.559f, -0.556f, 0.0f, 0.543f, 0.559f, 0.559f, -0.562f, 0.0f, 0.537f, 0.559f, 0.559f, -0.568f, 0.0f, 0.531f, 0.559f, 0.559f,
- -0.574f, 0.0f, 0.524f, 0.559f, 0.559f, -0.58f, 0.0f, 0.518f, 0.558f, 0.559f, -0.586f, 0.0f, 0.512f, 0.557f, 0.558f, -0.591f, 0.0f, 0.506f, 0.555f, 0.557f,
- -0.597f, 0.0f, 0.5f, 0.551f, 0.556f, -0.603f, 0.0f, 0.493f, 0.546f, 0.547f, -0.609f, 0.0f, 0.487f, 0.541f, 0.538f, -0.614f, 0.0f, 0.48f, 0.536f, 0.535f,
- -0.621f, 0.0f, 0.473f, 0.534f, 0.534f, -0.628f, 0.0f, 0.467f, 0.534f, 0.534f, -0.637f, 0.0f, 0.459f, 0.534f, 0.534f, -0.642f, 0.0f, 0.452f, 0.532f, 0.532f,
- -0.65f, 0.0f, 0.445f, 0.528f, 0.528f, -0.654f, 0.0f, 0.438f, 0.525f, 0.525f, -0.659f, 0.0f, 0.431f, 0.522f, 0.522f,
+static const float data3[64 * GP_PRIM_DATABUF_SIZE] = {
+ -0.6551f, 0.0f, 0.4448f, 0.1f, 1.0f,
+ -0.6353f, 0.0f, 0.4689f, 0.2199f, 1.0f,
+ -0.6211f, 0.0f, 0.4845f, 0.36f, 1.0f,
+ -0.6033f, 0.0f, 0.5034f, 0.4615f, 1.0f,
+ -0.5856f, 0.0f, 0.5211f, 0.5396f, 1.0f,
+ -0.5672f, 0.0f, 0.5387f, 0.6019f, 1.0f,
+ -0.5485f, 0.0f, 0.5555f, 0.6541f, 1.0f,
+ -0.5295f, 0.0f, 0.5718f, 0.6981f, 1.0f,
+ -0.5103f, 0.0f, 0.5875f, 0.7359f, 1.0f,
+ -0.4909f, 0.0f, 0.6028f, 0.7689f, 1.0f,
+ -0.4712f, 0.0f, 0.6174f, 0.7979f, 1.0f,
+ -0.4512f, 0.0f, 0.6313f, 0.8236f, 1.0f,
+ -0.4307f, 0.0f, 0.6444f, 0.8461f, 1.0f,
+ -0.4099f, 0.0f, 0.6568f, 0.866f, 1.0f,
+ -0.3884f, 0.0f, 0.6684f, 0.8841f, 1.0f,
+ -0.3665f, 0.0f, 0.6793f, 0.9003f, 1.0f,
+ -0.3439f, 0.0f, 0.6893f, 0.9143f, 1.0f,
+ -0.3207f, 0.0f, 0.6984f, 0.9272f, 1.0f,
+ -0.2971f, 0.0f, 0.7069f, 0.9385f, 1.0f,
+ -0.2731f, 0.0f, 0.7148f, 0.9485f, 1.0f,
+ -0.249f, 0.0f, 0.7222f, 0.9576f, 1.0f,
+ -0.2247f, 0.0f, 0.7292f, 0.9653f, 1.0f,
+ -0.2003f, 0.0f, 0.7356f, 0.9724f, 1.0f,
+ -0.1759f, 0.0f, 0.7416f, 0.9781f, 1.0f,
+ -0.1515f, 0.0f, 0.7471f, 0.9834f, 1.0f,
+ -0.1272f, 0.0f, 0.7518f, 0.9876f, 1.0f,
+ -0.1028f, 0.0f, 0.7556f, 0.9912f, 1.0f,
+ -0.0785f, 0.0f, 0.7586f, 0.9942f, 1.0f,
+ -0.0543f, 0.0f, 0.7607f, 0.9963f, 1.0f,
+ -0.0302f, 0.0f, 0.7621f, 0.9983f, 1.0f,
+ -0.0062f, 0.0f, 0.7627f, 0.999f, 1.0f,
+ 0.0177f, 0.0f, 0.7625f, 0.9997f, 1.0f,
+ 0.0415f, 0.0f, 0.7616f, 0.9997f, 1.0f,
+ 0.0652f, 0.0f, 0.7602f, 0.999f, 1.0f,
+ 0.0887f, 0.0f, 0.7583f, 0.9983f, 1.0f,
+ 0.1122f, 0.0f, 0.7559f, 0.9963f, 1.0f,
+ 0.1355f, 0.0f, 0.7529f, 0.9942f, 1.0f,
+ 0.1585f, 0.0f, 0.7493f, 0.9912f, 1.0f,
+ 0.1814f, 0.0f, 0.7451f, 0.9876f, 1.0f,
+ 0.2041f, 0.0f, 0.7404f, 0.9834f, 1.0f,
+ 0.2266f, 0.0f, 0.7352f, 0.9781f, 1.0f,
+ 0.2488f, 0.0f, 0.729f, 0.9724f, 1.0f,
+ 0.2706f, 0.0f, 0.7216f, 0.9653f, 1.0f,
+ 0.2921f, 0.0f, 0.7131f, 0.9576f, 1.0f,
+ 0.3135f, 0.0f, 0.7041f, 0.9485f, 1.0f,
+ 0.3348f, 0.0f, 0.6945f, 0.9385f, 1.0f,
+ 0.3559f, 0.0f, 0.6845f, 0.9272f, 1.0f,
+ 0.3769f, 0.0f, 0.6739f, 0.9143f, 1.0f,
+ 0.3978f, 0.0f, 0.6628f, 0.9003f, 1.0f,
+ 0.4185f, 0.0f, 0.651f, 0.8841f, 1.0f,
+ 0.439f, 0.0f, 0.6383f, 0.866f, 1.0f,
+ 0.4594f, 0.0f, 0.6249f, 0.8461f, 1.0f,
+ 0.4795f, 0.0f, 0.6106f, 0.8236f, 1.0f,
+ 0.4995f, 0.0f, 0.5956f, 0.7979f, 1.0f,
+ 0.5193f, 0.0f, 0.5801f, 0.7689f, 1.0f,
+ 0.539f, 0.0f, 0.5642f, 0.7359f, 1.0f,
+ 0.5586f, 0.0f, 0.5479f, 0.6981f, 1.0f,
+ 0.578f, 0.0f, 0.5312f, 0.6541f, 1.0f,
+ 0.597f, 0.0f, 0.5141f, 0.6019f, 1.0f,
+ 0.6153f, 0.0f, 0.4966f, 0.5396f, 1.0f,
+ 0.6324f, 0.0f, 0.4797f, 0.4615f, 1.0f,
+ 0.6498f, 0.0f, 0.462f, 0.36f, 1.0f,
+ 0.6638f, 0.0f, 0.4477f, 0.2199f, 1.0f,
+ 0.6843f, 0.0f, 0.4263f, 0.1f, 1.0f,
};
-static const float data11[1 * GP_PRIM_DATABUF_SIZE] = {
- -0.525f, 0.0f, 0.174f, 0.124f, 0.124f,
+static const float data4[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.7765f, 0.0f, 0.3255f, 0.1f, 1.0f,
+ -0.7908f, 0.0f, 0.3335f, 0.2199f, 1.0f,
+ -0.8048f, 0.0f, 0.3402f, 0.4615f, 1.0f,
+ -0.8225f, 0.0f, 0.3467f, 0.6019f, 1.0f,
+ -0.8426f, 0.0f, 0.3529f, 0.6981f, 1.0f,
+ -0.8651f, 0.0f, 0.3587f, 0.7689f, 1.0f,
+ -0.8878f, 0.0f, 0.3633f, 0.8236f, 1.0f,
+ -0.9105f, 0.0f, 0.367f, 0.866f, 1.0f,
+ -0.9323f, 0.0f, 0.3693f, 0.9003f, 1.0f,
+ -0.9529f, 0.0f, 0.3701f, 0.9272f, 1.0f,
+ -0.972f, 0.0f, 0.3695f, 0.9485f, 1.0f,
+ -0.9896f, 0.0f, 0.3675f, 0.9653f, 1.0f,
+ -1.0057f, 0.0f, 0.364f, 0.9781f, 1.0f,
+ -1.0203f, 0.0f, 0.3592f, 0.9876f, 1.0f,
+ -1.0333f, 0.0f, 0.3528f, 0.9942f, 1.0f,
+ -1.0447f, 0.0f, 0.3452f, 0.9983f, 1.0f,
+ -1.0546f, 0.0f, 0.3362f, 0.9997f, 1.0f,
+ -1.0633f, 0.0f, 0.3261f, 0.999f, 1.0f,
+ -1.0708f, 0.0f, 0.315f, 0.9963f, 1.0f,
+ -1.0767f, 0.0f, 0.3027f, 0.9912f, 1.0f,
+ -1.0818f, 0.0f, 0.2894f, 0.9834f, 1.0f,
+ -1.0861f, 0.0f, 0.2752f, 0.9724f, 1.0f,
+ -1.0897f, 0.0f, 0.2604f, 0.9576f, 1.0f,
+ -1.0922f, 0.0f, 0.2446f, 0.9385f, 1.0f,
+ -1.0938f, 0.0f, 0.2277f, 0.9143f, 1.0f,
+ -1.0944f, 0.0f, 0.2098f, 0.8841f, 1.0f,
+ -1.0939f, 0.0f, 0.191f, 0.8461f, 1.0f,
+ -1.0924f, 0.0f, 0.1714f, 0.7979f, 1.0f,
+ -1.0897f, 0.0f, 0.1511f, 0.7359f, 1.0f,
+ -1.0855f, 0.0f, 0.1303f, 0.6541f, 1.0f,
+ -1.0798f, 0.0f, 0.1095f, 0.5396f, 1.0f,
+ -1.0723f, 0.0f, 0.089f, 0.36f, 1.0f,
+ -1.0642f, 0.0f, 0.0702f, 0.1f, 1.0f,
};
-static const float data12[123 * GP_PRIM_DATABUF_SIZE] = {
- -0.53f, 0.0f, 0.193f, 0.147f, 0.147f, -0.532f, 0.0f, 0.186f, 0.316f, 0.316f, -0.534f, 0.0f, 0.18f, 0.353f, 0.353f, -0.535f, 0.0f, 0.173f, 0.382f, 0.382f,
- -0.537f, 0.0f, 0.165f, 0.384f, 0.384f, -0.538f, 0.0f, 0.155f, 0.387f, 0.387f, -0.539f, 0.0f, 0.145f, 0.393f, 0.393f, -0.54f, -0.0f, 0.134f, 0.399f, 0.399f,
- -0.541f, -0.0f, 0.123f, 0.4f, 0.4f, -0.542f, -0.0f, 0.11f, 0.401f, 0.401f, -0.542f, 0.0f, 0.094f, 0.402f, 0.402f, -0.54f, 0.0f, 0.078f, 0.403f, 0.403f,
- -0.538f, 0.0f, 0.061f, 0.404f, 0.404f, -0.535f, 0.0f, 0.045f, 0.404f, 0.404f, -0.531f, 0.0f, 0.031f, 0.404f, 0.404f, -0.526f, 0.0f, 0.018f, 0.404f, 0.404f,
- -0.52f, -0.0f, 0.005f, 0.405f, 0.405f, -0.513f, -0.0f, -0.01f, 0.405f, 0.405f, -0.505f, -0.0f, -0.024f, 0.405f, 0.405f, -0.495f, -0.0f, -0.037f, 0.405f, 0.405f,
- -0.485f, 0.0f, -0.051f, 0.405f, 0.405f, -0.474f, 0.0f, -0.064f, 0.406f, 0.406f, -0.462f, 0.0f, -0.076f, 0.405f, 0.405f, -0.451f, 0.0f, -0.086f, 0.406f, 0.406f,
- -0.442f, 0.0f, -0.094f, 0.406f, 0.406f, -0.432f, 0.0f, -0.102f, 0.406f, 0.406f, -0.422f, 0.0f, -0.108f, 0.405f, 0.405f, -0.411f, 0.0f, -0.114f, 0.406f, 0.406f,
- -0.4f, 0.0f, -0.119f, 0.405f, 0.405f, -0.389f, 0.0f, -0.122f, 0.406f, 0.406f, -0.378f, 0.0f, -0.125f, 0.407f, 0.407f, -0.365f, 0.0f, -0.127f, 0.412f, 0.412f,
- -0.354f, 0.0f, -0.129f, 0.418f, 0.418f, -0.342f, 0.0f, -0.131f, 0.44f, 0.44f, -0.33f, 0.0f, -0.131f, 0.448f, 0.448f, -0.317f, 0.0f, -0.131f, 0.469f, 0.469f,
- -0.305f, 0.0f, -0.13f, 0.477f, 0.477f, -0.293f, 0.0f, -0.128f, 0.482f, 0.482f, -0.278f, 0.0f, -0.125f, 0.494f, 0.494f, -0.266f, 0.0f, -0.121f, 0.5f, 0.5f,
- -0.253f, 0.0f, -0.116f, 0.507f, 0.507f, -0.242f, 0.0f, -0.111f, 0.509f, 0.509f, -0.231f, 0.0f, -0.105f, 0.511f, 0.511f, -0.222f, 0.0f, -0.099f, 0.511f, 0.511f,
- -0.213f, 0.0f, -0.092f, 0.512f, 0.512f, -0.206f, 0.0f, -0.084f, 0.513f, 0.513f, -0.199f, 0.0f, -0.076f, 0.514f, 0.514f, -0.192f, 0.0f, -0.067f, 0.515f, 0.515f,
- -0.186f, -0.0f, -0.058f, 0.516f, 0.516f, -0.18f, -0.0f, -0.049f, 0.516f, 0.516f, -0.175f, -0.0f, -0.04f, 0.515f, 0.515f, -0.17f, -0.0f, -0.03f, 0.515f, 0.515f,
- -0.166f, -0.0f, -0.02f, 0.516f, 0.516f, -0.163f, -0.0f, -0.01f, 0.504f, 0.504f, -0.159f, -0.0f, 0.002f, 0.502f, 0.502f, -0.155f, -0.0f, 0.014f, 0.501f, 0.501f,
- -0.152f, -0.0f, 0.027f, 0.502f, 0.502f, -0.149f, -0.0f, 0.043f, 0.5f, 0.5f, -0.148f, -0.0f, 0.058f, 0.49f, 0.49f, -0.147f, -0.0f, 0.075f, 0.47f, 0.47f,
- -0.146f, -0.0f, 0.09f, 0.463f, 0.463f, -0.146f, -0.0f, 0.105f, 0.454f, 0.454f, -0.146f, -0.0f, 0.12f, 0.427f, 0.427f, -0.148f, 0.0f, 0.133f, 0.413f, 0.413f,
- -0.15f, 0.0f, 0.144f, 0.4f, 0.4f, -0.153f, 0.0f, 0.152f, 0.383f, 0.383f, -0.156f, 0.0f, 0.157f, 0.369f, 0.369f, -0.158f, 0.0f, 0.16f, 0.36f, 0.36f,
- -0.16f, 0.0f, 0.158f, 0.349f, 0.349f, -0.162f, 0.0f, 0.154f, 0.364f, 0.364f, -0.164f, 0.0f, 0.147f, 0.37f, 0.37f, -0.166f, 0.0f, 0.139f, 0.378f, 0.378f,
- -0.168f, 0.0f, 0.13f, 0.386f, 0.386f, -0.172f, 0.0f, 0.119f, 0.394f, 0.394f, -0.176f, -0.0f, 0.108f, 0.405f, 0.405f, -0.18f, -0.0f, 0.096f, 0.412f, 0.412f,
- -0.185f, -0.0f, 0.084f, 0.417f, 0.417f, -0.191f, -0.0f, 0.073f, 0.425f, 0.425f, -0.196f, -0.0f, 0.063f, 0.431f, 0.431f, -0.202f, -0.0f, 0.053f, 0.441f, 0.441f,
- -0.208f, -0.0f, 0.043f, 0.444f, 0.444f, -0.214f, -0.0f, 0.034f, 0.451f, 0.451f, -0.22f, 0.0f, 0.026f, 0.46f, 0.46f, -0.226f, 0.0f, 0.018f, 0.463f, 0.463f,
- -0.232f, 0.0f, 0.01f, 0.474f, 0.474f, -0.239f, 0.0f, 0.004f, 0.477f, 0.477f, -0.247f, 0.0f, -0.003f, 0.48f, 0.48f, -0.255f, 0.0f, -0.008f, 0.483f, 0.483f,
- -0.264f, 0.0f, -0.013f, 0.497f, 0.497f, -0.274f, 0.0f, -0.018f, 0.501f, 0.501f, -0.285f, 0.0f, -0.022f, 0.505f, 0.505f, -0.297f, 0.0f, -0.024f, 0.509f, 0.509f,
- -0.311f, 0.0f, -0.025f, 0.51f, 0.51f, -0.325f, 0.0f, -0.024f, 0.512f, 0.512f, -0.339f, 0.0f, -0.023f, 0.512f, 0.512f, -0.354f, 0.0f, -0.022f, 0.513f, 0.513f,
- -0.368f, 0.0f, -0.02f, 0.513f, 0.513f, -0.382f, 0.0f, -0.017f, 0.514f, 0.514f, -0.397f, 0.0f, -0.013f, 0.514f, 0.514f, -0.41f, 0.0f, -0.007f, 0.514f, 0.514f,
- -0.422f, 0.0f, 0.001f, 0.513f, 0.513f, -0.434f, 0.0f, 0.009f, 0.514f, 0.514f, -0.446f, 0.0f, 0.018f, 0.514f, 0.514f, -0.458f, 0.0f, 0.028f, 0.514f, 0.514f,
- -0.47f, -0.0f, 0.039f, 0.514f, 0.514f, -0.48f, 0.0f, 0.048f, 0.514f, 0.514f, -0.487f, 0.0f, 0.057f, 0.514f, 0.514f, -0.493f, 0.0f, 0.068f, 0.514f, 0.514f,
- -0.498f, 0.0f, 0.08f, 0.514f, 0.514f, -0.502f, 0.0f, 0.092f, 0.514f, 0.514f, -0.506f, 0.0f, 0.104f, 0.514f, 0.514f, -0.509f, -0.0f, 0.116f, 0.515f, 0.515f,
- -0.511f, -0.0f, 0.125f, 0.515f, 0.515f, -0.513f, -0.0f, 0.133f, 0.515f, 0.515f, -0.515f, -0.0f, 0.141f, 0.515f, 0.515f, -0.517f, 0.0f, 0.148f, 0.515f, 0.515f,
- -0.519f, 0.0f, 0.155f, 0.514f, 0.514f, -0.52f, 0.0f, 0.161f, 0.514f, 0.514f, -0.522f, 0.0f, 0.168f, 0.514f, 0.514f, -0.523f, 0.0f, 0.174f, 0.514f, 0.514f,
- -0.525f, 0.0f, 0.18f, 0.514f, 0.514f, -0.526f, 0.0f, 0.185f, 0.514f, 0.514f, -0.527f, 0.0f, 0.191f, 0.513f, 0.513f,
+static const float data5[64 * GP_PRIM_DATABUF_SIZE] = {
+ 0.8135f, 0.0f, 0.3341f, 0.1f, 1.0f,
+ 0.8191f, 0.0f, 0.3376f, 0.2199f, 1.0f,
+ 0.8246f, 0.0f, 0.3408f, 0.36f, 1.0f,
+ 0.8304f, 0.0f, 0.3438f, 0.4615f, 1.0f,
+ 0.8368f, 0.0f, 0.3465f, 0.5396f, 1.0f,
+ 0.843f, 0.0f, 0.3491f, 0.6019f, 1.0f,
+ 0.8494f, 0.0f, 0.3515f, 0.6541f, 1.0f,
+ 0.8558f, 0.0f, 0.3536f, 0.6981f, 1.0f,
+ 0.8623f, 0.0f, 0.3557f, 0.7359f, 1.0f,
+ 0.8688f, 0.0f, 0.3575f, 0.7689f, 1.0f,
+ 0.8752f, 0.0f, 0.3593f, 0.7979f, 1.0f,
+ 0.8813f, 0.0f, 0.3609f, 0.8236f, 1.0f,
+ 0.8872f, 0.0f, 0.3625f, 0.8461f, 1.0f,
+ 0.8929f, 0.0f, 0.364f, 0.866f, 1.0f,
+ 0.8984f, 0.0f, 0.3653f, 0.8841f, 1.0f,
+ 0.9039f, 0.0f, 0.3665f, 0.9003f, 1.0f,
+ 0.9093f, 0.0f, 0.3675f, 0.9143f, 1.0f,
+ 0.9146f, 0.0f, 0.3684f, 0.9272f, 1.0f,
+ 0.9199f, 0.0f, 0.3692f, 0.9385f, 1.0f,
+ 0.9253f, 0.0f, 0.3698f, 0.9485f, 1.0f,
+ 0.9305f, 0.0f, 0.3703f, 0.9576f, 1.0f,
+ 0.9358f, 0.0f, 0.3706f, 0.9653f, 1.0f,
+ 0.941f, 0.0f, 0.3709f, 0.9724f, 1.0f,
+ 0.9462f, 0.0f, 0.371f, 0.9781f, 1.0f,
+ 0.9514f, 0.0f, 0.371f, 0.9834f, 1.0f,
+ 0.9566f, 0.0f, 0.3708f, 0.9876f, 1.0f,
+ 0.9617f, 0.0f, 0.3706f, 0.9912f, 1.0f,
+ 0.9668f, 0.0f, 0.3702f, 0.9942f, 1.0f,
+ 0.9718f, 0.0f, 0.3697f, 0.9963f, 1.0f,
+ 0.9768f, 0.0f, 0.3692f, 0.9983f, 1.0f,
+ 0.9818f, 0.0f, 0.3685f, 0.999f, 1.0f,
+ 0.9867f, 0.0f, 0.3677f, 0.9997f, 1.0f,
+ 0.9916f, 0.0f, 0.3667f, 0.9997f, 1.0f,
+ 0.9964f, 0.0f, 0.3657f, 0.999f, 1.0f,
+ 1.0012f, 0.0f, 0.3646f, 0.9983f, 1.0f,
+ 1.006f, 0.0f, 0.3634f, 0.9963f, 1.0f,
+ 1.0107f, 0.0f, 0.3621f, 0.9942f, 1.0f,
+ 1.0154f, 0.0f, 0.3607f, 0.9912f, 1.0f,
+ 1.02f, 0.0f, 0.3593f, 0.9876f, 1.0f,
+ 1.0245f, 0.0f, 0.3577f, 0.9834f, 1.0f,
+ 1.029f, 0.0f, 0.3561f, 0.9781f, 1.0f,
+ 1.0335f, 0.0f, 0.3543f, 0.9724f, 1.0f,
+ 1.0379f, 0.0f, 0.3525f, 0.9653f, 1.0f,
+ 1.0422f, 0.0f, 0.3507f, 0.9576f, 1.0f,
+ 1.0465f, 0.0f, 0.3487f, 0.9485f, 1.0f,
+ 1.0507f, 0.0f, 0.3468f, 0.9385f, 1.0f,
+ 1.0549f, 0.0f, 0.3447f, 0.9272f, 1.0f,
+ 1.0591f, 0.0f, 0.3427f, 0.9143f, 1.0f,
+ 1.0633f, 0.0f, 0.3404f, 0.9003f, 1.0f,
+ 1.0675f, 0.0f, 0.338f, 0.8841f, 1.0f,
+ 1.0717f, 0.0f, 0.3351f, 0.866f, 1.0f,
+ 1.0761f, 0.0f, 0.3318f, 0.8461f, 1.0f,
+ 1.0805f, 0.0f, 0.3279f, 0.8236f, 1.0f,
+ 1.0849f, 0.0f, 0.3235f, 0.7979f, 1.0f,
+ 1.0893f, 0.0f, 0.3186f, 0.7689f, 1.0f,
+ 1.0936f, 0.0f, 0.3134f, 0.7359f, 1.0f,
+ 1.0979f, 0.0f, 0.3076f, 0.6981f, 1.0f,
+ 1.102f, 0.0f, 0.3017f, 0.6541f, 1.0f,
+ 1.106f, 0.0f, 0.2953f, 0.6019f, 1.0f,
+ 1.1097f, 0.0f, 0.289f, 0.5396f, 1.0f,
+ 1.1132f, 0.0f, 0.2826f, 0.4615f, 1.0f,
+ 1.1164f, 0.0f, 0.2766f, 0.36f, 1.0f,
+ 1.1193f, 0.0f, 0.2708f, 0.2199f, 1.0f,
+ 1.1221f, 0.0f, 0.2652f, 0.1f, 1.0f,
};
-static const float data13[125 * GP_PRIM_DATABUF_SIZE] = {
- 0.184f, 0.0f, 0.22f, 0.026f, 0.026f, 0.182f, 0.0f, 0.21f, 0.275f, 0.275f, 0.18f, 0.0f, 0.203f, 0.301f, 0.301f, 0.178f, 0.0f, 0.195f, 0.322f, 0.322f,
- 0.176f, 0.0f, 0.186f, 0.343f, 0.343f, 0.173f, 0.0f, 0.176f, 0.36f, 0.36f, 0.17f, -0.0f, 0.166f, 0.367f, 0.367f, 0.168f, -0.0f, 0.156f, 0.38f, 0.38f,
- 0.165f, -0.0f, 0.145f, 0.385f, 0.385f, 0.163f, -0.0f, 0.132f, 0.391f, 0.391f, 0.161f, -0.0f, 0.119f, 0.401f, 0.401f, 0.16f, -0.0f, 0.103f, 0.405f, 0.405f,
- 0.161f, -0.0f, 0.086f, 0.405f, 0.405f, 0.163f, -0.0f, 0.068f, 0.407f, 0.407f, 0.165f, 0.0f, 0.051f, 0.409f, 0.409f, 0.168f, 0.0f, 0.034f, 0.409f, 0.409f,
- 0.172f, 0.0f, 0.018f, 0.409f, 0.409f, 0.177f, 0.0f, 0.004f, 0.409f, 0.409f, 0.183f, 0.0f, -0.008f, 0.411f, 0.411f, 0.19f, 0.0f, -0.022f, 0.411f, 0.411f,
- 0.196f, 0.0f, -0.034f, 0.411f, 0.411f, 0.203f, 0.0f, -0.045f, 0.411f, 0.411f, 0.211f, 0.0f, -0.055f, 0.411f, 0.411f, 0.219f, 0.0f, -0.064f, 0.411f, 0.411f,
- 0.227f, 0.0f, -0.072f, 0.411f, 0.411f, 0.235f, 0.0f, -0.08f, 0.412f, 0.412f, 0.244f, 0.0f, -0.087f, 0.412f, 0.412f, 0.253f, 0.0f, -0.094f, 0.413f, 0.413f,
- 0.262f, 0.0f, -0.1f, 0.413f, 0.413f, 0.273f, 0.0f, -0.105f, 0.413f, 0.413f, 0.284f, 0.0f, -0.11f, 0.413f, 0.413f, 0.295f, 0.0f, -0.114f, 0.419f, 0.419f,
- 0.307f, 0.0f, -0.117f, 0.425f, 0.425f, 0.321f, -0.0f, -0.118f, 0.433f, 0.433f, 0.334f, -0.0f, -0.12f, 0.446f, 0.446f, 0.347f, -0.0f, -0.12f, 0.474f, 0.474f,
- 0.36f, -0.0f, -0.12f, 0.481f, 0.481f, 0.374f, -0.0f, -0.119f, 0.491f, 0.491f, 0.387f, -0.0f, -0.118f, 0.494f, 0.494f, 0.401f, 0.0f, -0.116f, 0.5f, 0.5f,
- 0.414f, 0.0f, -0.112f, 0.505f, 0.505f, 0.426f, -0.0f, -0.107f, 0.51f, 0.51f, 0.438f, -0.0f, -0.101f, 0.513f, 0.513f, 0.449f, -0.0f, -0.094f, 0.515f, 0.515f,
- 0.46f, -0.0f, -0.086f, 0.517f, 0.517f, 0.47f, -0.0f, -0.078f, 0.519f, 0.519f, 0.478f, -0.0f, -0.07f, 0.52f, 0.52f, 0.486f, -0.0f, -0.061f, 0.522f, 0.522f,
- 0.493f, -0.0f, -0.052f, 0.523f, 0.523f, 0.499f, -0.0f, -0.044f, 0.522f, 0.522f, 0.505f, -0.0f, -0.035f, 0.522f, 0.522f, 0.51f, -0.0f, -0.027f, 0.523f, 0.523f,
- 0.514f, -0.0f, -0.018f, 0.523f, 0.523f, 0.517f, -0.0f, -0.009f, 0.523f, 0.523f, 0.52f, -0.0f, -0.001f, 0.524f, 0.524f, 0.522f, -0.0f, 0.008f, 0.523f, 0.523f,
- 0.525f, -0.0f, 0.018f, 0.521f, 0.522f, 0.527f, -0.0f, 0.027f, 0.515f, 0.514f, 0.529f, -0.0f, 0.036f, 0.512f, 0.512f, 0.531f, -0.0f, 0.045f, 0.509f, 0.51f,
- 0.533f, -0.0f, 0.053f, 0.506f, 0.505f, 0.535f, -0.0f, 0.062f, 0.503f, 0.503f, 0.536f, -0.0f, 0.071f, 0.5f, 0.5f, 0.538f, -0.0f, 0.08f, 0.496f, 0.497f,
- 0.538f, -0.0f, 0.09f, 0.491f, 0.492f, 0.539f, -0.0f, 0.1f, 0.485f, 0.486f, 0.539f, 0.0f, 0.11f, 0.475f, 0.476f, 0.539f, 0.0f, 0.12f, 0.46f, 0.459f,
- 0.539f, 0.0f, 0.13f, 0.444f, 0.448f, 0.538f, 0.0f, 0.139f, 0.406f, 0.405f, 0.537f, 0.0f, 0.144f, 0.399f, 0.399f, 0.536f, 0.0f, 0.146f, 0.395f, 0.395f,
- 0.535f, 0.0f, 0.144f, 0.412f, 0.412f, 0.533f, 0.0f, 0.139f, 0.413f, 0.413f, 0.53f, 0.0f, 0.131f, 0.414f, 0.413f, 0.528f, 0.0f, 0.122f, 0.419f, 0.418f,
- 0.525f, 0.0f, 0.112f, 0.425f, 0.424f, 0.521f, 0.0f, 0.102f, 0.444f, 0.444f, 0.518f, 0.0f, 0.094f, 0.451f, 0.452f, 0.514f, 0.0f, 0.085f, 0.457f, 0.457f,
- 0.509f, 0.0f, 0.078f, 0.461f, 0.46f, 0.504f, 0.0f, 0.069f, 0.469f, 0.468f, 0.499f, 0.0f, 0.06f, 0.481f, 0.481f, 0.493f, 0.0f, 0.052f, 0.489f, 0.489f,
- 0.487f, 0.0f, 0.044f, 0.492f, 0.492f, 0.481f, 0.0f, 0.037f, 0.501f, 0.5f, 0.474f, 0.0f, 0.029f, 0.513f, 0.513f, 0.467f, 0.0f, 0.022f, 0.521f, 0.521f,
- 0.458f, 0.0f, 0.015f, 0.524f, 0.524f, 0.449f, 0.0f, 0.008f, 0.525f, 0.525f, 0.439f, 0.0f, 0.001f, 0.528f, 0.528f, 0.427f, 0.0f, -0.005f, 0.532f, 0.532f,
- 0.416f, 0.0f, -0.011f, 0.533f, 0.533f, 0.401f, 0.0f, -0.015f, 0.537f, 0.537f, 0.386f, 0.0f, -0.018f, 0.539f, 0.539f, 0.371f, 0.0f, -0.02f, 0.538f, 0.538f,
- 0.356f, 0.0f, -0.021f, 0.543f, 0.543f, 0.341f, 0.0f, -0.023f, 0.543f, 0.543f, 0.326f, 0.0f, -0.023f, 0.543f, 0.543f, 0.312f, 0.0f, -0.022f, 0.543f, 0.543f,
- 0.298f, 0.0f, -0.018f, 0.543f, 0.543f, 0.286f, 0.0f, -0.014f, 0.543f, 0.543f, 0.273f, 0.0f, -0.006f, 0.543f, 0.543f, 0.26f, 0.0f, 0.004f, 0.543f, 0.543f,
- 0.247f, 0.0f, 0.013f, 0.543f, 0.543f, 0.235f, 0.0f, 0.022f, 0.543f, 0.543f, 0.225f, 0.0f, 0.033f, 0.543f, 0.543f, 0.215f, 0.0f, 0.045f, 0.542f, 0.542f,
- 0.206f, 0.0f, 0.061f, 0.54f, 0.54f, 0.199f, 0.0f, 0.078f, 0.542f, 0.542f, 0.193f, 0.0f, 0.094f, 0.542f, 0.542f, 0.189f, -0.0f, 0.109f, 0.541f, 0.541f,
- 0.186f, -0.0f, 0.119f, 0.542f, 0.542f, 0.185f, -0.0f, 0.127f, 0.542f, 0.542f, 0.184f, -0.0f, 0.135f, 0.542f, 0.542f, 0.184f, -0.0f, 0.142f, 0.542f, 0.542f,
- 0.183f, -0.0f, 0.149f, 0.541f, 0.541f, 0.183f, -0.0f, 0.156f, 0.538f, 0.538f, 0.183f, -0.0f, 0.163f, 0.539f, 0.539f, 0.183f, -0.0f, 0.17f, 0.54f, 0.54f,
- 0.183f, 0.0f, 0.177f, 0.54f, 0.54f, 0.183f, 0.0f, 0.184f, 0.54f, 0.54f, 0.183f, 0.0f, 0.191f, 0.54f, 0.54f, 0.184f, 0.0f, 0.196f, 0.539f, 0.539f,
- 0.184f, 0.0f, 0.204f, 0.518f, 0.518f,
+static const float data6[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.2677f, 0.0f, -0.3496f, 0.1f, 1.0f,
+ -0.2658f, 0.0f, -0.3919f, 0.2199f, 1.0f,
+ -0.2657f, 0.0f, -0.4295f, 0.4615f, 1.0f,
+ -0.2691f, 0.0f, -0.4621f, 0.6019f, 1.0f,
+ -0.275f, 0.0f, -0.4949f, 0.6981f, 1.0f,
+ -0.2828f, 0.0f, -0.527f, 0.7689f, 1.0f,
+ -0.2911f, 0.0f, -0.5578f, 0.8236f, 1.0f,
+ -0.2971f, 0.0f, -0.5884f, 0.866f, 1.0f,
+ -0.303f, 0.0f, -0.6181f, 0.9003f, 1.0f,
+ -0.3089f, 0.0f, -0.6467f, 0.9272f, 1.0f,
+ -0.3148f, 0.0f, -0.6738f, 0.9485f, 1.0f,
+ -0.3196f, 0.0f, -0.7f, 0.9653f, 1.0f,
+ -0.323f, 0.0f, -0.7253f, 0.9781f, 1.0f,
+ -0.3234f, 0.0f, -0.7496f, 0.9876f, 1.0f,
+ -0.3219f, 0.0f, -0.7728f, 0.9942f, 1.0f,
+ -0.3184f, 0.0f, -0.7949f, 0.9983f, 1.0f,
+ -0.3103f, 0.0f, -0.8138f, 0.9997f, 1.0f,
+ -0.3004f, 0.0f, -0.8307f, 0.999f, 1.0f,
+ -0.2892f, 0.0f, -0.8464f, 0.9963f, 1.0f,
+ -0.2766f, 0.0f, -0.8611f, 0.9912f, 1.0f,
+ -0.2618f, 0.0f, -0.8735f, 0.9834f, 1.0f,
+ -0.2469f, 0.0f, -0.8853f, 0.9724f, 1.0f,
+ -0.2315f, 0.0f, -0.8964f, 0.9576f, 1.0f,
+ -0.2158f, 0.0f, -0.9068f, 0.9385f, 1.0f,
+ -0.1997f, 0.0f, -0.9167f, 0.9143f, 1.0f,
+ -0.1833f, 0.0f, -0.9262f, 0.8841f, 1.0f,
+ -0.1663f, 0.0f, -0.9355f, 0.8461f, 1.0f,
+ -0.1481f, 0.0f, -0.9445f, 0.7979f, 1.0f,
+ -0.1282f, 0.0f, -0.9534f, 0.7359f, 1.0f,
+ -0.1077f, 0.0f, -0.9625f, 0.6541f, 1.0f,
+ -0.0854f, 0.0f, -0.9718f, 0.5396f, 1.0f,
+ -0.0616f, 0.0f, -0.9813f, 0.36f, 1.0f,
+ -0.0248f, 0.0f, -0.992f, 0.1f, 1.0f,
};
-static const float data14[45 * GP_PRIM_DATABUF_SIZE] = {
- -0.096f, -0.0f, -0.305f, 0.01f, 0.01f, -0.09f, -0.0f, -0.313f, 0.121f, 0.362f, -0.086f, -0.0f, -0.318f, 0.179f, 0.368f, -0.081f, -0.0f, -0.325f, 0.234f, 0.37f,
- -0.075f, -0.0f, -0.331f, 0.272f, 0.37f, -0.068f, -0.0f, -0.338f, 0.302f, 0.371f, -0.061f, -0.0f, -0.345f, 0.324f, 0.374f, -0.053f, -0.0f, -0.352f, 0.34f, 0.377f,
- -0.044f, -0.0f, -0.358f, 0.352f, 0.378f, -0.035f, -0.0f, -0.362f, 0.362f, 0.377f, -0.026f, -0.0f, -0.366f, 0.37f, 0.378f, -0.018f, -0.0f, -0.368f, 0.377f, 0.378f,
- -0.009f, -0.0f, -0.369f, 0.383f, 0.376f, -0.001f, -0.0f, -0.369f, 0.389f, 0.369f, 0.007f, -0.0f, -0.368f, 0.395f, 0.364f, 0.015f, -0.0f, -0.367f, 0.4f, 0.388f,
- 0.023f, -0.0f, -0.365f, 0.405f, 0.41f, 0.03f, -0.0f, -0.363f, 0.41f, 0.429f, 0.038f, -0.0f, -0.36f, 0.414f, 0.438f, 0.044f, -0.0f, -0.357f, 0.417f, 0.441f,
- 0.05f, -0.0f, -0.355f, 0.419f, 0.444f, 0.055f, -0.0f, -0.352f, 0.42f, 0.441f, 0.06f, -0.0f, -0.349f, 0.421f, 0.445f, 0.063f, -0.0f, -0.347f, 0.421f, 0.446f,
- 0.065f, -0.0f, -0.344f, 0.42f, 0.443f, 0.065f, -0.0f, -0.342f, 0.42f, 0.437f, 0.065f, -0.0f, -0.341f, 0.419f, 0.413f, 0.063f, -0.0f, -0.339f, 0.418f, 0.404f,
- 0.061f, -0.0f, -0.338f, 0.418f, 0.403f, 0.057f, -0.0f, -0.337f, 0.418f, 0.402f, 0.052f, -0.0f, -0.337f, 0.418f, 0.407f, 0.046f, -0.0f, -0.337f, 0.419f, 0.411f,
- 0.04f, 0.0f, -0.336f, 0.42f, 0.416f, 0.032f, 0.0f, -0.337f, 0.422f, 0.421f, 0.023f, 0.0f, -0.339f, 0.424f, 0.425f, 0.014f, 0.0f, -0.34f, 0.426f, 0.427f,
- 0.003f, 0.0f, -0.341f, 0.428f, 0.427f, -0.007f, 0.0f, -0.341f, 0.43f, 0.433f, -0.018f, 0.0f, -0.339f, 0.432f, 0.437f, -0.027f, 0.0f, -0.335f, 0.434f, 0.438f,
- -0.037f, 0.0f, -0.33f, 0.435f, 0.437f, -0.046f, -0.0f, -0.326f, 0.436f, 0.438f, -0.055f, -0.0f, -0.321f, 0.436f, 0.44f, -0.062f, -0.0f, -0.316f, 0.437f, 0.439f,
- -0.073f, -0.0f, -0.31f, 0.437f, 0.437f,
+static const float data7[18 * GP_PRIM_DATABUF_SIZE] = {
+ -0.0618f, 0.0f, -0.1922f, 0.1f, 1.0f,
+ -0.0703f, 0.0f, -0.2021f, 0.2199f, 1.0f,
+ -0.0758f, 0.0f, -0.2103f, 0.6019f, 1.0f,
+ -0.0803f, 0.0f, -0.2206f, 0.7689f, 1.0f,
+ -0.083f, 0.0f, -0.2307f, 0.866f, 1.0f,
+ -0.0851f, 0.0f, -0.2405f, 0.9272f, 1.0f,
+ -0.0865f, 0.0f, -0.2499f, 0.9653f, 1.0f,
+ -0.0872f, 0.0f, -0.2588f, 0.9876f, 1.0f,
+ -0.0869f, 0.0f, -0.2673f, 0.9983f, 1.0f,
+ -0.0858f, 0.0f, -0.2754f, 0.999f, 1.0f,
+ -0.0831f, 0.0f, -0.2829f, 0.9912f, 1.0f,
+ -0.0791f, 0.0f, -0.2898f, 0.9724f, 1.0f,
+ -0.074f, 0.0f, -0.2966f, 0.9385f, 1.0f,
+ -0.0674f, 0.0f, -0.303f, 0.8841f, 1.0f,
+ -0.0591f, 0.0f, -0.3084f, 0.7979f, 1.0f,
+ -0.0465f, 0.0f, -0.3134f, 0.6541f, 1.0f,
+ -0.0331f, 0.0f, -0.3165f, 0.36f, 1.0f,
+ -0.015f, 0.0f, -0.318f, 0.1f, 1.0f,
};
-static const float data16[84 * GP_PRIM_DATABUF_SIZE] = {
- 0.737f, 0.0f, 0.177f, 0.148f, 0.148f, 0.735f, 0.0f, 0.164f, 0.214f, 0.39f, 0.734f, 0.0f, 0.155f, 0.254f, 0.402f, 0.732f, 0.0f, 0.143f, 0.295f, 0.413f,
- 0.73f, 0.0f, 0.132f, 0.328f, 0.415f, 0.728f, 0.0f, 0.121f, 0.355f, 0.415f, 0.726f, 0.0f, 0.109f, 0.375f, 0.416f, 0.724f, 0.0f, 0.097f, 0.39f, 0.417f,
- 0.721f, 0.0f, 0.086f, 0.401f, 0.418f, 0.719f, 0.0f, 0.074f, 0.408f, 0.419f, 0.716f, 0.0f, 0.062f, 0.413f, 0.42f, 0.713f, 0.0f, 0.05f, 0.416f, 0.42f,
- 0.71f, 0.0f, 0.039f, 0.418f, 0.421f, 0.707f, 0.0f, 0.028f, 0.42f, 0.421f, 0.703f, 0.0f, 0.017f, 0.421f, 0.422f, 0.7f, 0.0f, 0.006f, 0.421f, 0.422f,
- 0.696f, 0.0f, -0.005f, 0.422f, 0.422f, 0.693f, 0.0f, -0.015f, 0.422f, 0.422f, 0.689f, 0.0f, -0.025f, 0.423f, 0.423f, 0.685f, 0.0f, -0.034f, 0.423f, 0.423f,
- 0.681f, 0.0f, -0.044f, 0.423f, 0.423f, 0.677f, 0.0f, -0.053f, 0.423f, 0.423f, 0.672f, 0.0f, -0.062f, 0.423f, 0.423f, 0.668f, 0.0f, -0.071f, 0.422f, 0.424f,
- 0.662f, 0.0f, -0.08f, 0.422f, 0.424f, 0.657f, 0.0f, -0.088f, 0.422f, 0.422f, 0.651f, 0.0f, -0.095f, 0.421f, 0.419f, 0.645f, 0.0f, -0.103f, 0.42f, 0.419f,
- 0.638f, 0.0f, -0.109f, 0.42f, 0.419f, 0.631f, 0.0f, -0.115f, 0.419f, 0.419f, 0.624f, 0.0f, -0.12f, 0.419f, 0.419f, 0.617f, 0.0f, -0.125f, 0.419f, 0.419f,
- 0.61f, 0.0f, -0.129f, 0.418f, 0.418f, 0.602f, 0.0f, -0.133f, 0.418f, 0.416f, 0.594f, 0.0f, -0.137f, 0.417f, 0.416f, 0.587f, 0.0f, -0.14f, 0.417f, 0.415f,
- 0.579f, 0.0f, -0.142f, 0.417f, 0.416f, 0.571f, 0.0f, -0.144f, 0.417f, 0.415f, 0.564f, 0.0f, -0.145f, 0.417f, 0.416f, 0.556f, 0.0f, -0.146f, 0.417f, 0.415f,
- 0.549f, 0.0f, -0.146f, 0.417f, 0.415f, 0.541f, 0.0f, -0.146f, 0.417f, 0.415f, 0.535f, 0.0f, -0.145f, 0.417f, 0.416f, 0.53f, 0.0f, -0.143f, 0.418f, 0.418f,
- 0.526f, 0.0f, -0.14f, 0.418f, 0.418f, 0.524f, 0.0f, -0.136f, 0.42f, 0.418f, 0.524f, 0.0f, -0.132f, 0.422f, 0.416f, 0.527f, 0.0f, -0.126f, 0.424f, 0.424f,
- 0.531f, 0.0f, -0.121f, 0.427f, 0.428f, 0.536f, 0.0f, -0.115f, 0.43f, 0.433f, 0.542f, 0.0f, -0.109f, 0.433f, 0.436f, 0.548f, 0.0f, -0.102f, 0.435f, 0.436f,
- 0.555f, 0.0f, -0.095f, 0.436f, 0.437f, 0.562f, 0.0f, -0.088f, 0.437f, 0.438f, 0.568f, 0.0f, -0.081f, 0.437f, 0.438f, 0.575f, 0.0f, -0.073f, 0.438f, 0.438f,
- 0.581f, 0.0f, -0.065f, 0.438f, 0.438f, 0.587f, 0.0f, -0.058f, 0.438f, 0.438f, 0.593f, 0.0f, -0.05f, 0.438f, 0.438f, 0.599f, 0.0f, -0.041f, 0.438f, 0.438f,
- 0.605f, 0.0f, -0.033f, 0.438f, 0.438f, 0.61f, 0.0f, -0.024f, 0.438f, 0.438f, 0.615f, 0.0f, -0.015f, 0.438f, 0.438f, 0.621f, 0.0f, -0.006f, 0.438f, 0.438f,
- 0.626f, 0.0f, 0.004f, 0.438f, 0.438f, 0.631f, 0.0f, 0.013f, 0.437f, 0.438f, 0.636f, 0.0f, 0.023f, 0.436f, 0.438f, 0.641f, 0.0f, 0.032f, 0.434f, 0.438f,
- 0.647f, 0.0f, 0.042f, 0.432f, 0.437f, 0.652f, 0.0f, 0.051f, 0.431f, 0.429f, 0.657f, 0.0f, 0.06f, 0.429f, 0.426f, 0.662f, 0.0f, 0.069f, 0.427f, 0.425f,
- 0.668f, 0.0f, 0.078f, 0.425f, 0.425f, 0.673f, 0.0f, 0.087f, 0.423f, 0.424f, 0.678f, 0.0f, 0.095f, 0.42f, 0.422f, 0.683f, 0.0f, 0.104f, 0.416f, 0.42f,
- 0.688f, 0.0f, 0.112f, 0.411f, 0.421f, 0.693f, 0.0f, 0.12f, 0.403f, 0.417f, 0.698f, 0.0f, 0.128f, 0.394f, 0.411f, 0.702f, 0.0f, 0.135f, 0.382f, 0.404f,
- 0.707f, 0.0f, 0.143f, 0.369f, 0.388f, 0.711f, 0.0f, 0.15f, 0.352f, 0.371f, 0.714f, 0.0f, 0.155f, 0.338f, 0.352f, 0.719f, 0.0f, 0.164f, 0.315f, 0.315f,
+static const float data8[49 * GP_PRIM_DATABUF_SIZE] = {
+ 0.5311f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ 0.5307f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ 0.5277f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ 0.5218f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ 0.513f, 0.0f, 0.256f, 1.0f, 1.0f,
+ 0.5014f, 0.0f, 0.279f, 1.0f, 1.0f,
+ 0.4874f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ 0.4711f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ 0.4529f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ 0.4329f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ 0.4117f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ 0.3894f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ 0.3666f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ 0.3435f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ 0.3207f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ 0.2985f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ 0.2772f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ 0.2573f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ 0.239f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ 0.2227f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ 0.2087f, 0.0f, 0.279f, 1.0f, 1.0f,
+ 0.1972f, 0.0f, 0.256f, 1.0f, 1.0f,
+ 0.1884f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ 0.1824f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ 0.1794f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ 0.1794f, 0.0f, 0.1528f, 1.0f, 1.0f,
+ 0.1824f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ 0.1884f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ 0.1972f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ 0.2087f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ 0.2227f, 0.0f, 0.032f, 1.0f, 1.0f,
+ 0.239f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ 0.2573f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ 0.2772f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ 0.2985f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ 0.3207f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ 0.3435f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ 0.3666f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ 0.3894f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ 0.4117f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ 0.4329f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ 0.4529f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ 0.4711f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ 0.4874f, 0.0f, 0.032f, 1.0f, 1.0f,
+ 0.5014f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ 0.513f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ 0.5218f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ 0.5277f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ 0.5307f, 0.0f, 0.1528f, 1.0f, 1.0f,
};
-static const float data15[44 * GP_PRIM_DATABUF_SIZE] = {
- -0.085f, 0.0f, -0.816f, 0.138f, 0.138f, -0.079f, 0.0f, -0.825f, 0.246f, 0.309f, -0.074f, 0.0f, -0.832f, 0.302f, 0.34f, -0.067f, 0.0f, -0.84f, 0.335f, 0.352f,
- -0.059f, 0.0f, -0.848f, 0.357f, 0.374f, -0.05f, 0.0f, -0.855f, 0.371f, 0.378f, -0.041f, 0.0f, -0.861f, 0.382f, 0.383f, -0.031f, 0.0f, -0.866f, 0.391f, 0.396f,
- -0.021f, 0.0f, -0.871f, 0.398f, 0.401f, -0.011f, 0.0f, -0.874f, 0.404f, 0.407f, -0.001f, 0.0f, -0.877f, 0.409f, 0.411f, 0.01f, 0.0f, -0.878f, 0.415f, 0.412f,
- 0.02f, 0.0f, -0.878f, 0.422f, 0.417f, 0.031f, 0.0f, -0.878f, 0.43f, 0.421f, 0.042f, 0.0f, -0.876f, 0.438f, 0.437f, 0.052f, 0.0f, -0.873f, 0.445f, 0.451f,
- 0.062f, 0.0f, -0.868f, 0.451f, 0.459f, 0.071f, 0.0f, -0.863f, 0.456f, 0.463f, 0.08f, 0.0f, -0.857f, 0.46f, 0.465f, 0.087f, 0.0f, -0.85f, 0.462f, 0.465f,
- 0.094f, 0.0f, -0.842f, 0.461f, 0.465f, 0.098f, 0.0f, -0.835f, 0.458f, 0.467f, 0.101f, 0.0f, -0.827f, 0.451f, 0.457f, 0.103f, 0.0f, -0.82f, 0.436f, 0.451f,
- 0.102f, 0.0f, -0.815f, 0.422f, 0.418f, 0.1f, 0.0f, -0.811f, 0.419f, 0.378f, 0.096f, 0.0f, -0.814f, 0.436f, 0.447f, 0.089f, 0.0f, -0.817f, 0.454f, 0.465f,
- 0.082f, 0.0f, -0.821f, 0.465f, 0.47f, 0.072f, 0.0f, -0.825f, 0.473f, 0.477f, 0.061f, 0.0f, -0.828f, 0.477f, 0.479f, 0.049f, 0.0f, -0.832f, 0.48f, 0.485f,
- 0.036f, 0.0f, -0.834f, 0.483f, 0.48f, 0.023f, 0.0f, -0.836f, 0.484f, 0.485f, 0.01f, 0.0f, -0.838f, 0.486f, 0.487f, -0.003f, 0.0f, -0.84f, 0.486f, 0.488f,
- -0.016f, 0.0f, -0.84f, 0.486f, 0.489f, -0.027f, 0.0f, -0.84f, 0.485f, 0.485f, -0.039f, 0.0f, -0.839f, 0.484f, 0.484f, -0.049f, 0.0f, -0.837f, 0.483f, 0.485f,
- -0.058f, 0.0f, -0.834f, 0.48f, 0.481f, -0.066f, 0.0f, -0.83f, 0.473f, 0.479f, -0.072f, 0.0f, -0.827f, 0.462f, 0.472f, -0.081f, 0.0f, -0.823f, 0.442f, 0.442f,
+static const float data9[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.5271f, 0.0f, 0.1742f, 0.1f, 1.0f,
+ -0.527f, 0.0f, 0.1621f, 0.2199f, 1.0f,
+ -0.5253f, 0.0f, 0.1386f, 0.4615f, 1.0f,
+ -0.5217f, 0.0f, 0.116f, 0.6019f, 1.0f,
+ -0.5164f, 0.0f, 0.0945f, 0.6981f, 1.0f,
+ -0.5094f, 0.0f, 0.0741f, 0.7689f, 1.0f,
+ -0.5009f, 0.0f, 0.0548f, 0.8236f, 1.0f,
+ -0.491f, 0.0f, 0.0368f, 0.866f, 1.0f,
+ -0.4799f, 0.0f, 0.02f, 0.9003f, 1.0f,
+ -0.4676f, 0.0f, 0.0046f, 0.9272f, 1.0f,
+ -0.4544f, 0.0f, -0.0094f, 0.9485f, 1.0f,
+ -0.4402f, 0.0f, -0.0219f, 0.9653f, 1.0f,
+ -0.4254f, 0.0f, -0.033f, 0.9781f, 1.0f,
+ -0.4099f, 0.0f, -0.0424f, 0.9876f, 1.0f,
+ -0.394f, 0.0f, -0.0501f, 0.9942f, 1.0f,
+ -0.3777f, 0.0f, -0.0562f, 0.9983f, 1.0f,
+ -0.3612f, 0.0f, -0.0605f, 0.9997f, 1.0f,
+ -0.3447f, 0.0f, -0.0629f, 0.999f, 1.0f,
+ -0.3281f, 0.0f, -0.0634f, 0.9963f, 1.0f,
+ -0.3118f, 0.0f, -0.062f, 0.9912f, 1.0f,
+ -0.2957f, 0.0f, -0.0585f, 0.9834f, 1.0f,
+ -0.2801f, 0.0f, -0.0529f, 0.9724f, 1.0f,
+ -0.2651f, 0.0f, -0.0452f, 0.9576f, 1.0f,
+ -0.2507f, 0.0f, -0.0352f, 0.9385f, 1.0f,
+ -0.2372f, 0.0f, -0.023f, 0.9143f, 1.0f,
+ -0.2246f, 0.0f, -0.0085f, 0.8841f, 1.0f,
+ -0.2131f, 0.0f, 0.0085f, 0.8461f, 1.0f,
+ -0.2028f, 0.0f, 0.0279f, 0.7979f, 1.0f,
+ -0.1939f, 0.0f, 0.0499f, 0.7359f, 1.0f,
+ -0.1864f, 0.0f, 0.0745f, 0.6541f, 1.0f,
+ -0.1806f, 0.0f, 0.1017f, 0.5396f, 1.0f,
+ -0.1765f, 0.0f, 0.1316f, 0.36f, 1.0f,
+ -0.1742f, 0.0f, 0.1643f, 0.1f, 1.0f,
};
-static const float data17[56 * GP_PRIM_DATABUF_SIZE] = {
- -1.007f, -0.0f, 0.183f, 0.022f, 0.022f, -1.003f, -0.0f, 0.181f, 0.192f, 0.436f, -0.998f, -0.0f, 0.18f, 0.28f, 0.451f, -0.99f, -0.0f, 0.178f, 0.355f, 0.459f,
- -0.98f, -0.0f, 0.175f, 0.402f, 0.464f, -0.967f, -0.0f, 0.169f, 0.432f, 0.467f, -0.952f, -0.0f, 0.152f, 0.449f, 0.468f, -0.943f, 0.0f, 0.138f, 0.459f, 0.469f,
- -0.939f, 0.0f, 0.128f, 0.464f, 0.469f, -0.934f, 0.0f, 0.119f, 0.467f, 0.47f, -0.929f, 0.0f, 0.11f, 0.469f, 0.47f, -0.924f, 0.0f, 0.101f, 0.47f, 0.47f,
- -0.919f, 0.0f, 0.092f, 0.47f, 0.471f, -0.913f, 0.0f, 0.082f, 0.471f, 0.471f, -0.908f, 0.0f, 0.072f, 0.471f, 0.471f, -0.903f, 0.0f, 0.063f, 0.472f, 0.472f,
- -0.897f, 0.0f, 0.053f, 0.472f, 0.472f, -0.892f, 0.0f, 0.044f, 0.473f, 0.473f, -0.886f, 0.0f, 0.035f, 0.473f, 0.473f, -0.881f, 0.0f, 0.026f, 0.473f, 0.473f,
- -0.876f, 0.0f, 0.018f, 0.473f, 0.473f, -0.87f, 0.0f, 0.012f, 0.472f, 0.473f, -0.865f, 0.0f, 0.006f, 0.47f, 0.473f, -0.86f, 0.0f, 0.003f, 0.468f, 0.473f,
- -0.855f, 0.0f, 0.001f, 0.466f, 0.469f, -0.85f, 0.0f, 0.001f, 0.463f, 0.469f, -0.846f, 0.0f, 0.003f, 0.46f, 0.45f, -0.843f, 0.0f, 0.008f, 0.458f, 0.454f,
- -0.84f, 0.0f, 0.014f, 0.456f, 0.454f, -0.838f, 0.0f, 0.021f, 0.455f, 0.454f, -0.836f, 0.0f, 0.03f, 0.453f, 0.455f, -0.835f, 0.0f, 0.039f, 0.451f, 0.455f,
- -0.835f, 0.0f, 0.049f, 0.449f, 0.453f, -0.836f, 0.0f, 0.059f, 0.447f, 0.445f, -0.837f, 0.0f, 0.068f, 0.445f, 0.441f, -0.84f, 0.0f, 0.078f, 0.443f, 0.44f,
- -0.843f, 0.0f, 0.087f, 0.442f, 0.44f, -0.846f, 0.0f, 0.095f, 0.442f, 0.44f, -0.851f, -0.0f, 0.103f, 0.441f, 0.441f, -0.855f, -0.0f, 0.111f, 0.441f, 0.44f,
- -0.86f, -0.0f, 0.119f, 0.441f, 0.441f, -0.865f, -0.0f, 0.127f, 0.441f, 0.441f, -0.871f, -0.0f, 0.134f, 0.441f, 0.441f, -0.877f, -0.0f, 0.141f, 0.441f, 0.441f,
- -0.883f, -0.0f, 0.149f, 0.441f, 0.442f, -0.889f, -0.0f, 0.156f, 0.441f, 0.441f, -0.896f, -0.0f, 0.163f, 0.441f, 0.442f, -0.904f, -0.0f, 0.169f, 0.442f, 0.441f,
- -0.913f, -0.0f, 0.176f, 0.442f, 0.441f, -0.925f, -0.0f, 0.183f, 0.443f, 0.441f, -0.941f, -0.0f, 0.19f, 0.444f, 0.442f, -0.956f, -0.0f, 0.195f, 0.446f, 0.443f,
- -0.971f, -0.0f, 0.198f, 0.448f, 0.443f, -0.983f, -0.0f, 0.198f, 0.451f, 0.452f, -0.992f, -0.0f, 0.198f, 0.454f, 0.456f, -1.001f, 0.0f, 0.196f, 0.457f, 0.457f,
+static const float data10[49 * GP_PRIM_DATABUF_SIZE] = {
+ -0.174f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ -0.1744f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ -0.1774f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ -0.1833f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ -0.1922f, 0.0f, 0.256f, 1.0f, 1.0f,
+ -0.2037f, 0.0f, 0.279f, 1.0f, 1.0f,
+ -0.2177f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ -0.234f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ -0.2522f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ -0.2722f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ -0.2935f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ -0.3157f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ -0.3385f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ -0.3616f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ -0.3844f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ -0.4066f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ -0.4279f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ -0.4479f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ -0.4661f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ -0.4824f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ -0.4964f, 0.0f, 0.279f, 1.0f, 1.0f,
+ -0.508f, 0.0f, 0.256f, 1.0f, 1.0f,
+ -0.5168f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ -0.5227f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ -0.5257f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ -0.5257f, 0.0f, 0.1528f, 1.0f, 1.0f,
+ -0.5227f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ -0.5168f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ -0.508f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ -0.4964f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ -0.4824f, 0.0f, 0.032f, 1.0f, 1.0f,
+ -0.4661f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ -0.4479f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ -0.4279f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ -0.4066f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ -0.3844f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ -0.3616f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ -0.3385f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ -0.3157f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ -0.2935f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ -0.2722f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ -0.2522f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ -0.234f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ -0.2177f, 0.0f, 0.032f, 1.0f, 1.0f,
+ -0.2037f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ -0.1922f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ -0.1833f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ -0.1774f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ -0.1744f, 0.0f, 0.1528f, 1.0f, 1.0f,
};
-static const float data18[59 * GP_PRIM_DATABUF_SIZE] = {
- 0.782f, 0.0f, 0.099f, 0.04f, 0.04f, 0.779f, 0.0f, 0.088f, 0.108f, 0.34f, 0.777f, 0.0f, 0.08f, 0.149f, 0.35f, 0.774f, 0.0f, 0.071f, 0.194f, 0.352f,
- 0.772f, 0.0f, 0.062f, 0.231f, 0.352f, 0.771f, 0.0f, 0.053f, 0.263f, 0.353f, 0.769f, 0.0f, 0.044f, 0.289f, 0.353f, 0.768f, 0.0f, 0.036f, 0.31f, 0.353f,
- 0.767f, 0.0f, 0.029f, 0.327f, 0.353f, 0.767f, 0.0f, 0.023f, 0.341f, 0.353f, 0.767f, 0.0f, 0.017f, 0.353f, 0.353f, 0.768f, 0.0f, 0.013f, 0.363f, 0.353f,
- 0.769f, 0.0f, 0.01f, 0.373f, 0.353f, 0.771f, 0.0f, 0.009f, 0.382f, 0.351f, 0.773f, 0.0f, 0.008f, 0.39f, 0.393f, 0.776f, 0.0f, 0.009f, 0.399f, 0.41f,
- 0.779f, 0.0f, 0.011f, 0.407f, 0.425f, 0.783f, 0.0f, 0.015f, 0.415f, 0.434f, 0.787f, 0.0f, 0.019f, 0.423f, 0.44f, 0.792f, 0.0f, 0.024f, 0.429f, 0.441f,
- 0.797f, 0.0f, 0.03f, 0.435f, 0.444f, 0.802f, 0.0f, 0.037f, 0.441f, 0.447f, 0.807f, 0.0f, 0.044f, 0.445f, 0.453f, 0.813f, 0.0f, 0.051f, 0.449f, 0.457f,
- 0.819f, 0.0f, 0.058f, 0.452f, 0.458f, 0.825f, 0.0f, 0.066f, 0.455f, 0.46f, 0.831f, 0.0f, 0.074f, 0.457f, 0.462f, 0.838f, 0.0f, 0.082f, 0.459f, 0.462f,
- 0.845f, 0.0f, 0.09f, 0.461f, 0.462f, 0.852f, 0.0f, 0.098f, 0.462f, 0.463f, 0.859f, 0.0f, 0.106f, 0.463f, 0.464f, 0.867f, 0.0f, 0.113f, 0.464f, 0.464f,
- 0.874f, 0.0f, 0.121f, 0.465f, 0.465f, 0.882f, 0.0f, 0.129f, 0.465f, 0.465f, 0.889f, 0.0f, 0.136f, 0.466f, 0.466f, 0.897f, 0.0f, 0.143f, 0.466f, 0.467f,
- 0.904f, 0.0f, 0.15f, 0.467f, 0.466f, 0.911f, 0.0f, 0.157f, 0.467f, 0.467f, 0.916f, 0.0f, 0.163f, 0.468f, 0.468f, 0.921f, 0.0f, 0.169f, 0.468f, 0.469f,
- 0.924f, 0.0f, 0.173f, 0.468f, 0.469f, 0.926f, 0.0f, 0.177f, 0.469f, 0.468f, 0.925f, 0.0f, 0.18f, 0.469f, 0.468f, 0.922f, 0.0f, 0.181f, 0.469f, 0.469f,
- 0.918f, 0.0f, 0.181f, 0.469f, 0.469f, 0.912f, 0.0f, 0.18f, 0.469f, 0.469f, 0.905f, 0.0f, 0.178f, 0.468f, 0.47f, 0.898f, 0.0f, 0.175f, 0.466f, 0.471f,
- 0.89f, 0.0f, 0.172f, 0.462f, 0.469f, 0.882f, 0.0f, 0.168f, 0.454f, 0.468f, 0.874f, 0.0f, 0.164f, 0.442f, 0.467f, 0.866f, 0.0f, 0.159f, 0.423f, 0.467f,
- 0.858f, 0.0f, 0.154f, 0.398f, 0.468f, 0.851f, 0.0f, 0.149f, 0.366f, 0.468f, 0.844f, 0.0f, 0.144f, 0.326f, 0.469f, 0.837f, 0.0f, 0.139f, 0.282f, 0.469f,
- 0.83f, 0.0f, 0.134f, 0.231f, 0.467f, 0.824f, 0.0f, 0.13f, 0.184f, 0.415f, 0.816f, 0.0f, 0.124f, 0.111f, 0.111f,
+static const float data11[18 * GP_PRIM_DATABUF_SIZE] = {
+ 0.963f, 0.0f, 0.1753f, 0.1f, 1.0f,
+ 0.9555f, 0.0f, 0.1761f, 0.2199f, 1.0f,
+ 0.9367f, 0.0f, 0.1758f, 0.6019f, 1.0f,
+ 0.9202f, 0.0f, 0.1741f, 0.7689f, 1.0f,
+ 0.9036f, 0.0f, 0.1714f, 0.866f, 1.0f,
+ 0.8885f, 0.0f, 0.1668f, 0.9272f, 1.0f,
+ 0.8746f, 0.0f, 0.1607f, 0.9653f, 1.0f,
+ 0.8621f, 0.0f, 0.1531f, 0.9876f, 1.0f,
+ 0.8503f, 0.0f, 0.1447f, 0.9983f, 1.0f,
+ 0.8389f, 0.0f, 0.1352f, 0.999f, 1.0f,
+ 0.8279f, 0.0f, 0.1244f, 0.9912f, 1.0f,
+ 0.8174f, 0.0f, 0.1125f, 0.9724f, 1.0f,
+ 0.8079f, 0.0f, 0.099f, 0.9385f, 1.0f,
+ 0.7999f, 0.0f, 0.0839f, 0.8841f, 1.0f,
+ 0.7935f, 0.0f, 0.0669f, 0.7979f, 1.0f,
+ 0.7892f, 0.0f, 0.0488f, 0.6541f, 1.0f,
+ 0.787f, 0.0f, 0.0305f, 0.36f, 1.0f,
+ 0.7847f, 0.0f, 0.0139f, 0.1f, 1.0f,
};
-static const float data19[100 * GP_PRIM_DATABUF_SIZE] = {
- -0.279f, 0.0f, 0.568f, 0.154f, 0.154f, -0.266f, 0.0f, 0.569f, 0.249f, 0.318f, -0.258f, 0.0f, 0.57f, 0.296f, 0.357f, -0.248f, 0.0f, 0.571f, 0.337f, 0.383f,
- -0.238f, 0.0f, 0.571f, 0.363f, 0.396f, -0.229f, 0.0f, 0.571f, 0.381f, 0.403f, -0.219f, 0.0f, 0.57f, 0.392f, 0.407f, -0.209f, 0.0f, 0.568f, 0.399f, 0.407f,
- -0.2f, 0.0f, 0.566f, 0.403f, 0.408f, -0.19f, 0.0f, 0.563f, 0.406f, 0.41f, -0.181f, 0.0f, 0.559f, 0.407f, 0.41f, -0.171f, 0.0f, 0.555f, 0.409f, 0.41f,
- -0.161f, 0.0f, 0.551f, 0.409f, 0.411f, -0.152f, 0.0f, 0.546f, 0.41f, 0.411f, -0.142f, 0.0f, 0.542f, 0.41f, 0.412f, -0.132f, 0.0f, 0.537f, 0.411f, 0.411f,
- -0.122f, 0.0f, 0.533f, 0.411f, 0.411f, -0.112f, 0.0f, 0.528f, 0.411f, 0.412f, -0.102f, 0.0f, 0.524f, 0.411f, 0.412f, -0.092f, 0.0f, 0.519f, 0.41f, 0.412f,
- -0.081f, 0.0f, 0.515f, 0.407f, 0.411f, -0.071f, 0.0f, 0.511f, 0.403f, 0.408f, -0.061f, 0.0f, 0.507f, 0.399f, 0.401f, -0.051f, 0.0f, 0.503f, 0.394f, 0.395f,
- -0.041f, 0.0f, 0.499f, 0.39f, 0.388f, -0.031f, 0.0f, 0.495f, 0.386f, 0.383f, -0.021f, 0.0f, 0.491f, 0.383f, 0.38f, -0.011f, 0.0f, 0.488f, 0.381f, 0.378f,
- -0.001f, 0.0f, 0.486f, 0.379f, 0.377f, 0.009f, 0.0f, 0.484f, 0.378f, 0.377f, 0.019f, 0.0f, 0.483f, 0.377f, 0.375f, 0.03f, 0.0f, 0.482f, 0.377f, 0.375f,
- 0.041f, 0.0f, 0.482f, 0.378f, 0.376f, 0.051f, 0.0f, 0.483f, 0.379f, 0.376f, 0.062f, 0.0f, 0.484f, 0.381f, 0.376f, 0.073f, 0.0f, 0.486f, 0.385f, 0.379f,
- 0.085f, 0.0f, 0.488f, 0.389f, 0.382f, 0.096f, 0.0f, 0.491f, 0.395f, 0.392f, 0.108f, 0.0f, 0.494f, 0.402f, 0.4f, 0.12f, 0.0f, 0.497f, 0.409f, 0.409f,
- 0.132f, 0.0f, 0.501f, 0.415f, 0.416f, 0.144f, 0.0f, 0.505f, 0.421f, 0.427f, 0.157f, 0.0f, 0.509f, 0.425f, 0.43f, 0.17f, 0.0f, 0.513f, 0.429f, 0.433f,
- 0.181f, 0.0f, 0.517f, 0.431f, 0.433f, 0.192f, 0.0f, 0.52f, 0.433f, 0.434f, 0.201f, 0.0f, 0.522f, 0.433f, 0.435f, 0.208f, 0.0f, 0.524f, 0.433f, 0.435f,
- 0.213f, 0.0f, 0.524f, 0.432f, 0.436f, 0.216f, 0.0f, 0.523f, 0.431f, 0.435f, 0.217f, 0.0f, 0.521f, 0.43f, 0.426f, 0.215f, 0.0f, 0.518f, 0.429f, 0.427f,
- 0.213f, 0.0f, 0.515f, 0.428f, 0.427f, 0.208f, 0.0f, 0.511f, 0.428f, 0.427f, 0.203f, 0.0f, 0.506f, 0.428f, 0.427f, 0.196f, 0.0f, 0.502f, 0.428f, 0.427f,
- 0.189f, 0.0f, 0.497f, 0.428f, 0.427f, 0.181f, 0.0f, 0.492f, 0.428f, 0.427f, 0.173f, 0.0f, 0.487f, 0.428f, 0.428f, 0.163f, 0.0f, 0.482f, 0.429f, 0.428f,
- 0.154f, 0.0f, 0.477f, 0.429f, 0.429f, 0.145f, 0.0f, 0.472f, 0.43f, 0.43f, 0.135f, 0.0f, 0.467f, 0.431f, 0.431f, 0.125f, 0.0f, 0.462f, 0.432f, 0.43f,
- 0.116f, 0.0f, 0.457f, 0.433f, 0.431f, 0.106f, 0.0f, 0.453f, 0.435f, 0.434f, 0.096f, 0.0f, 0.448f, 0.436f, 0.436f, 0.086f, 0.0f, 0.444f, 0.437f, 0.438f,
- 0.076f, 0.0f, 0.44f, 0.438f, 0.44f, 0.065f, 0.0f, 0.436f, 0.439f, 0.441f, 0.055f, 0.0f, 0.433f, 0.44f, 0.441f, 0.044f, 0.0f, 0.431f, 0.441f, 0.442f,
- 0.033f, 0.0f, 0.429f, 0.441f, 0.442f, 0.022f, 0.0f, 0.427f, 0.441f, 0.442f, 0.011f, 0.0f, 0.426f, 0.442f, 0.443f, -0.0f, 0.0f, 0.426f, 0.442f, 0.442f,
- -0.011f, 0.0f, 0.426f, 0.442f, 0.442f, -0.022f, 0.0f, 0.427f, 0.442f, 0.442f, -0.033f, 0.0f, 0.429f, 0.442f, 0.442f, -0.042f, 0.0f, 0.432f, 0.441f, 0.442f,
- -0.052f, 0.0f, 0.435f, 0.441f, 0.441f, -0.061f, 0.0f, 0.439f, 0.441f, 0.441f, -0.07f, 0.0f, 0.443f, 0.441f, 0.441f, -0.078f, 0.0f, 0.448f, 0.441f, 0.441f,
- -0.087f, 0.0f, 0.453f, 0.441f, 0.442f, -0.095f, 0.0f, 0.458f, 0.441f, 0.441f, -0.104f, 0.0f, 0.463f, 0.44f, 0.44f, -0.113f, 0.0f, 0.468f, 0.44f, 0.44f,
- -0.122f, 0.0f, 0.473f, 0.44f, 0.44f, -0.132f, 0.0f, 0.479f, 0.44f, 0.44f, -0.143f, 0.0f, 0.485f, 0.44f, 0.44f, -0.154f, 0.0f, 0.491f, 0.44f, 0.44f,
- -0.165f, 0.0f, 0.498f, 0.44f, 0.44f, -0.176f, 0.0f, 0.504f, 0.439f, 0.439f, -0.187f, 0.0f, 0.51f, 0.435f, 0.44f, -0.198f, 0.0f, 0.516f, 0.424f, 0.44f,
- -0.209f, 0.0f, 0.522f, 0.393f, 0.44f, -0.219f, 0.0f, 0.527f, 0.324f, 0.44f, -0.228f, 0.0f, 0.532f, 0.222f, 0.404f, -0.241f, 0.0f, 0.538f, 0.037f, 0.037f,
+static const float data12[18 * GP_PRIM_DATABUF_SIZE] = {
+ -1.0227f, 0.0f, 0.1753f, 0.1f, 1.0f,
+ -1.0153f, 0.0f, 0.1761f, 0.2199f, 1.0f,
+ -0.9964f, 0.0f, 0.1758f, 0.6019f, 1.0f,
+ -0.9799f, 0.0f, 0.1741f, 0.7689f, 1.0f,
+ -0.9634f, 0.0f, 0.1714f, 0.866f, 1.0f,
+ -0.9483f, 0.0f, 0.1668f, 0.9272f, 1.0f,
+ -0.9344f, 0.0f, 0.1607f, 0.9653f, 1.0f,
+ -0.9219f, 0.0f, 0.1531f, 0.9876f, 1.0f,
+ -0.9101f, 0.0f, 0.1447f, 0.9983f, 1.0f,
+ -0.8986f, 0.0f, 0.1352f, 0.999f, 1.0f,
+ -0.8876f, 0.0f, 0.1244f, 0.9912f, 1.0f,
+ -0.8772f, 0.0f, 0.1125f, 0.9724f, 1.0f,
+ -0.8677f, 0.0f, 0.099f, 0.9385f, 1.0f,
+ -0.8597f, 0.0f, 0.0839f, 0.8841f, 1.0f,
+ -0.8533f, 0.0f, 0.0669f, 0.7979f, 1.0f,
+ -0.849f, 0.0f, 0.0488f, 0.6541f, 1.0f,
+ -0.8467f, 0.0f, 0.0305f, 0.36f, 1.0f,
+ -0.8444f, 0.0f, 0.0139f, 0.1f, 1.0f,
};
-static const float data20[136 * GP_PRIM_DATABUF_SIZE] = {
- 0.331f, 0.0f, -0.036f, 0.065f, 0.065f, 0.322f, 0.0f, -0.034f, 0.239f, 0.293f, 0.317f, 0.0f, -0.032f, 0.316f, 0.339f, 0.31f, 0.0f, -0.029f, 0.348f, 0.355f,
- 0.302f, 0.0f, -0.027f, 0.364f, 0.368f, 0.295f, 0.0f, -0.023f, 0.373f, 0.374f, 0.287f, 0.0f, -0.02f, 0.381f, 0.381f, 0.279f, 0.0f, -0.015f, 0.388f, 0.391f,
- 0.271f, 0.0f, -0.01f, 0.392f, 0.394f, 0.263f, 0.0f, -0.004f, 0.395f, 0.396f, 0.255f, 0.0f, 0.002f, 0.397f, 0.397f, 0.247f, 0.0f, 0.008f, 0.399f, 0.4f,
- 0.239f, 0.0f, 0.016f, 0.401f, 0.401f, 0.232f, -0.0f, 0.024f, 0.404f, 0.404f, 0.226f, 0.0f, 0.031f, 0.406f, 0.407f, 0.221f, 0.0f, 0.038f, 0.409f, 0.409f,
- 0.215f, 0.0f, 0.045f, 0.412f, 0.412f, 0.21f, 0.0f, 0.054f, 0.415f, 0.415f, 0.205f, 0.0f, 0.063f, 0.417f, 0.417f, 0.201f, 0.0f, 0.073f, 0.42f, 0.421f,
- 0.197f, 0.0f, 0.083f, 0.421f, 0.421f, 0.193f, -0.0f, 0.094f, 0.423f, 0.423f, 0.19f, -0.0f, 0.104f, 0.424f, 0.424f, 0.187f, -0.0f, 0.114f, 0.424f, 0.425f,
- 0.185f, -0.0f, 0.125f, 0.425f, 0.425f, 0.183f, -0.0f, 0.135f, 0.425f, 0.425f, 0.182f, -0.0f, 0.146f, 0.426f, 0.425f, 0.181f, -0.0f, 0.157f, 0.426f, 0.425f,
- 0.18f, -0.0f, 0.168f, 0.426f, 0.426f, 0.18f, -0.0f, 0.179f, 0.427f, 0.427f, 0.181f, -0.0f, 0.189f, 0.427f, 0.427f, 0.182f, -0.0f, 0.199f, 0.427f, 0.427f,
- 0.183f, -0.0f, 0.208f, 0.427f, 0.428f, 0.185f, -0.0f, 0.218f, 0.428f, 0.427f, 0.187f, -0.0f, 0.226f, 0.428f, 0.427f, 0.19f, -0.0f, 0.235f, 0.429f, 0.427f,
- 0.192f, -0.0f, 0.243f, 0.43f, 0.428f, 0.196f, -0.0f, 0.252f, 0.431f, 0.431f, 0.199f, -0.0f, 0.26f, 0.431f, 0.432f, 0.203f, -0.0f, 0.268f, 0.432f, 0.433f,
- 0.207f, -0.0f, 0.276f, 0.433f, 0.433f, 0.212f, -0.0f, 0.283f, 0.434f, 0.434f, 0.216f, -0.0f, 0.291f, 0.434f, 0.435f, 0.221f, -0.0f, 0.298f, 0.435f, 0.436f,
- 0.227f, -0.0f, 0.305f, 0.435f, 0.435f, 0.232f, -0.0f, 0.311f, 0.436f, 0.436f, 0.238f, -0.0f, 0.317f, 0.436f, 0.436f, 0.243f, -0.0f, 0.323f, 0.436f, 0.436f,
- 0.249f, -0.0f, 0.329f, 0.437f, 0.436f, 0.255f, -0.0f, 0.334f, 0.438f, 0.437f, 0.262f, -0.0f, 0.339f, 0.44f, 0.437f, 0.268f, -0.0f, 0.344f, 0.442f, 0.441f,
- 0.274f, 0.0f, 0.348f, 0.444f, 0.446f, 0.281f, 0.0f, 0.352f, 0.445f, 0.447f, 0.287f, 0.0f, 0.355f, 0.446f, 0.447f, 0.293f, 0.0f, 0.358f, 0.446f, 0.447f,
- 0.299f, 0.0f, 0.361f, 0.447f, 0.447f, 0.306f, 0.0f, 0.363f, 0.447f, 0.448f, 0.312f, 0.0f, 0.366f, 0.447f, 0.448f, 0.318f, 0.0f, 0.368f, 0.448f, 0.448f,
- 0.325f, 0.0f, 0.369f, 0.448f, 0.448f, 0.331f, 0.0f, 0.371f, 0.448f, 0.448f, 0.338f, 0.0f, 0.372f, 0.448f, 0.448f, 0.345f, 0.0f, 0.372f, 0.448f, 0.448f,
- 0.352f, 0.0f, 0.372f, 0.448f, 0.448f, 0.359f, 0.0f, 0.372f, 0.448f, 0.449f, 0.366f, 0.0f, 0.371f, 0.448f, 0.448f, 0.373f, 0.0f, 0.37f, 0.448f, 0.449f,
- 0.38f, 0.0f, 0.369f, 0.449f, 0.449f, 0.387f, 0.0f, 0.367f, 0.449f, 0.449f, 0.393f, 0.0f, 0.365f, 0.449f, 0.449f, 0.4f, 0.0f, 0.363f, 0.449f, 0.45f,
- 0.406f, 0.0f, 0.36f, 0.45f, 0.45f, 0.412f, -0.0f, 0.357f, 0.45f, 0.45f, 0.418f, -0.0f, 0.354f, 0.45f, 0.451f, 0.424f, -0.0f, 0.351f, 0.45f, 0.451f,
- 0.43f, -0.0f, 0.347f, 0.45f, 0.451f, 0.436f, -0.0f, 0.343f, 0.45f, 0.451f, 0.443f, -0.0f, 0.339f, 0.45f, 0.45f, 0.449f, -0.0f, 0.334f, 0.45f, 0.451f,
- 0.455f, -0.0f, 0.329f, 0.451f, 0.451f, 0.46f, -0.0f, 0.323f, 0.451f, 0.451f, 0.466f, -0.0f, 0.318f, 0.451f, 0.451f, 0.472f, -0.0f, 0.311f, 0.452f, 0.452f,
- 0.477f, -0.0f, 0.305f, 0.452f, 0.453f, 0.482f, -0.0f, 0.298f, 0.452f, 0.453f, 0.487f, -0.0f, 0.291f, 0.453f, 0.453f, 0.492f, -0.0f, 0.284f, 0.453f, 0.453f,
- 0.496f, -0.0f, 0.277f, 0.453f, 0.453f, 0.5f, -0.0f, 0.269f, 0.453f, 0.454f, 0.504f, -0.0f, 0.261f, 0.453f, 0.454f, 0.508f, -0.0f, 0.252f, 0.454f, 0.454f,
- 0.511f, -0.0f, 0.244f, 0.454f, 0.454f, 0.514f, -0.0f, 0.235f, 0.454f, 0.455f, 0.517f, -0.0f, 0.225f, 0.454f, 0.455f, 0.519f, -0.0f, 0.216f, 0.454f, 0.455f,
- 0.521f, -0.0f, 0.205f, 0.455f, 0.455f, 0.523f, -0.0f, 0.194f, 0.455f, 0.455f, 0.524f, -0.0f, 0.182f, 0.455f, 0.455f, 0.524f, -0.0f, 0.169f, 0.455f, 0.456f,
- 0.524f, -0.0f, 0.157f, 0.455f, 0.456f, 0.523f, -0.0f, 0.145f, 0.455f, 0.456f, 0.522f, -0.0f, 0.133f, 0.455f, 0.456f, 0.52f, -0.0f, 0.122f, 0.456f, 0.456f,
- 0.518f, -0.0f, 0.11f, 0.456f, 0.456f, 0.515f, -0.0f, 0.1f, 0.456f, 0.456f, 0.513f, -0.0f, 0.09f, 0.456f, 0.457f, 0.509f, -0.0f, 0.081f, 0.456f, 0.457f,
- 0.506f, -0.0f, 0.072f, 0.457f, 0.457f, 0.502f, -0.0f, 0.064f, 0.457f, 0.457f, 0.498f, -0.0f, 0.056f, 0.457f, 0.457f, 0.494f, -0.0f, 0.049f, 0.457f, 0.457f,
- 0.49f, -0.0f, 0.041f, 0.458f, 0.457f, 0.485f, -0.0f, 0.034f, 0.458f, 0.457f, 0.48f, -0.0f, 0.028f, 0.458f, 0.458f, 0.475f, -0.0f, 0.022f, 0.458f, 0.458f,
- 0.47f, -0.0f, 0.016f, 0.458f, 0.458f, 0.465f, -0.0f, 0.011f, 0.459f, 0.458f, 0.46f, -0.0f, 0.006f, 0.459f, 0.458f, 0.454f, -0.0f, 0.001f, 0.46f, 0.459f,
- 0.449f, 0.0f, -0.003f, 0.464f, 0.463f, 0.443f, 0.0f, -0.007f, 0.467f, 0.468f, 0.438f, 0.0f, -0.011f, 0.469f, 0.469f, 0.432f, 0.0f, -0.015f, 0.471f, 0.47f,
- 0.426f, 0.0f, -0.018f, 0.477f, 0.478f, 0.42f, 0.0f, -0.021f, 0.478f, 0.478f, 0.414f, 0.0f, -0.024f, 0.478f, 0.478f, 0.408f, 0.0f, -0.027f, 0.479f, 0.479f,
- 0.402f, 0.0f, -0.029f, 0.48f, 0.48f, 0.395f, 0.0f, -0.031f, 0.48f, 0.48f, 0.389f, 0.0f, -0.033f, 0.482f, 0.482f, 0.382f, 0.0f, -0.035f, 0.482f, 0.482f,
- 0.376f, 0.0f, -0.036f, 0.482f, 0.482f, 0.369f, 0.0f, -0.037f, 0.48f, 0.482f, 0.364f, 0.0f, -0.037f, 0.457f, 0.485f, 0.356f, 0.0f, -0.038f, 0.32f, 0.32f,
+static const float data13[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.6794f, 0.0f, 0.3908f, 0.1f, 1.0f,
+ -0.6711f, 0.0f, 0.4112f, 0.2199f, 1.0f,
+ -0.6513f, 0.0f, 0.4509f, 0.4615f, 1.0f,
+ -0.6276f, 0.0f, 0.489f, 0.6019f, 1.0f,
+ -0.6001f, 0.0f, 0.5253f, 0.6981f, 1.0f,
+ -0.5692f, 0.0f, 0.5598f, 0.7689f, 1.0f,
+ -0.535f, 0.0f, 0.5924f, 0.8236f, 1.0f,
+ -0.4979f, 0.0f, 0.6228f, 0.866f, 1.0f,
+ -0.4579f, 0.0f, 0.651f, 0.9003f, 1.0f,
+ -0.4155f, 0.0f, 0.677f, 0.9272f, 1.0f,
+ -0.3707f, 0.0f, 0.7005f, 0.9485f, 1.0f,
+ -0.3239f, 0.0f, 0.7215f, 0.9653f, 1.0f,
+ -0.2753f, 0.0f, 0.7399f, 0.9781f, 1.0f,
+ -0.2251f, 0.0f, 0.7555f, 0.9876f, 1.0f,
+ -0.1736f, 0.0f, 0.7683f, 0.9942f, 1.0f,
+ -0.121f, 0.0f, 0.778f, 0.9983f, 1.0f,
+ -0.0675f, 0.0f, 0.7847f, 0.9997f, 1.0f,
+ -0.0134f, 0.0f, 0.7882f, 0.999f, 1.0f,
+ 0.0411f, 0.0f, 0.7884f, 0.9963f, 1.0f,
+ 0.0957f, 0.0f, 0.7851f, 0.9912f, 1.0f,
+ 0.1503f, 0.0f, 0.7783f, 0.9834f, 1.0f,
+ 0.2045f, 0.0f, 0.7678f, 0.9724f, 1.0f,
+ 0.2581f, 0.0f, 0.7536f, 0.9576f, 1.0f,
+ 0.311f, 0.0f, 0.7355f, 0.9385f, 1.0f,
+ 0.3628f, 0.0f, 0.7134f, 0.9143f, 1.0f,
+ 0.4133f, 0.0f, 0.6873f, 0.8841f, 1.0f,
+ 0.4622f, 0.0f, 0.6569f, 0.8461f, 1.0f,
+ 0.5095f, 0.0f, 0.6221f, 0.7979f, 1.0f,
+ 0.5547f, 0.0f, 0.583f, 0.7359f, 1.0f,
+ 0.5977f, 0.0f, 0.5393f, 0.6541f, 1.0f,
+ 0.6382f, 0.0f, 0.4909f, 0.5396f, 1.0f,
+ 0.676f, 0.0f, 0.4377f, 0.36f, 1.0f,
+ 0.7109f, 0.0f, 0.3797f, 0.1f, 1.0f,
};
-static const float data21[353 * GP_PRIM_DATABUF_SIZE] = {
- -0.382f, 0.0f, 0.397f, 0.0f, 1.0f, -0.386f, 0.0f, 0.394f, 0.0f, 1.0f, -0.389f, 0.0f, 0.392f, 0.0f, 1.0f, -0.392f, 0.0f, 0.39f, 0.0f, 1.0f,
- -0.395f, 0.0f, 0.388f, 0.0f, 1.0f, -0.399f, 0.0f, 0.385f, 0.0f, 1.0f, -0.402f, 0.0f, 0.383f, 0.0f, 1.0f, -0.405f, 0.0f, 0.381f, 0.0f, 1.0f,
- -0.408f, 0.0f, 0.379f, 0.0f, 1.0f, -0.411f, 0.0f, 0.377f, 0.0f, 1.0f, -0.414f, 0.0f, 0.375f, 0.0f, 1.0f, -0.417f, 0.0f, 0.372f, 0.0f, 1.0f,
- -0.42f, 0.0f, 0.37f, 0.0f, 1.0f, -0.423f, 0.0f, 0.368f, 0.0f, 1.0f, -0.425f, 0.0f, 0.366f, 0.0f, 1.0f, -0.428f, 0.0f, 0.364f, 0.0f, 1.0f,
- -0.431f, 0.0f, 0.362f, 0.0f, 1.0f, -0.433f, 0.0f, 0.359f, 0.0f, 1.0f, -0.436f, 0.0f, 0.357f, 0.0f, 1.0f, -0.438f, 0.0f, 0.355f, 0.0f, 1.0f,
- -0.441f, 0.0f, 0.353f, 0.0f, 1.0f, -0.443f, 0.0f, 0.351f, 0.0f, 1.0f, -0.445f, 0.0f, 0.349f, 0.0f, 1.0f, -0.447f, 0.0f, 0.346f, 0.0f, 1.0f,
- -0.45f, 0.0f, 0.344f, 0.0f, 1.0f, -0.452f, 0.0f, 0.342f, 0.0f, 1.0f, -0.454f, 0.0f, 0.34f, 0.0f, 1.0f, -0.456f, 0.0f, 0.337f, 0.0f, 1.0f,
- -0.458f, 0.0f, 0.335f, 0.0f, 1.0f, -0.46f, 0.0f, 0.333f, 0.0f, 1.0f, -0.462f, 0.0f, 0.33f, 0.0f, 1.0f, -0.464f, 0.0f, 0.328f, 0.0f, 1.0f,
- -0.466f, 0.0f, 0.326f, 0.0f, 1.0f, -0.468f, 0.0f, 0.323f, 0.0f, 1.0f, -0.47f, 0.0f, 0.321f, 0.0f, 1.0f, -0.472f, 0.0f, 0.319f, 0.0f, 1.0f,
- -0.474f, 0.0f, 0.316f, 0.0f, 1.0f, -0.475f, 0.0f, 0.314f, 0.0f, 1.0f, -0.477f, 0.0f, 0.311f, 0.0f, 1.0f, -0.479f, 0.0f, 0.309f, 0.0f, 1.0f,
- -0.481f, 0.0f, 0.307f, 0.0f, 1.0f, -0.482f, 0.0f, 0.304f, 0.0f, 1.0f, -0.484f, 0.0f, 0.302f, 0.0f, 1.0f, -0.486f, 0.0f, 0.299f, 0.0f, 1.0f,
- -0.487f, 0.0f, 0.297f, 0.0f, 1.0f, -0.489f, 0.0f, 0.294f, 0.0f, 1.0f, -0.49f, 0.0f, 0.292f, 0.0f, 1.0f, -0.492f, 0.0f, 0.289f, 0.0f, 1.0f,
- -0.494f, 0.0f, 0.286f, 0.0f, 1.0f, -0.495f, 0.0f, 0.284f, 0.0f, 1.0f, -0.497f, 0.0f, 0.281f, 0.0f, 1.0f, -0.498f, 0.0f, 0.279f, 0.001f, 1.0f,
- -0.499f, 0.0f, 0.276f, 0.001f, 1.0f, -0.501f, 0.0f, 0.273f, 0.002f, 1.0f, -0.502f, 0.0f, 0.271f, 0.003f, 1.0f, -0.504f, 0.0f, 0.268f, 0.005f, 1.0f,
- -0.505f, 0.0f, 0.265f, 0.008f, 1.0f, -0.506f, 0.0f, 0.262f, 0.011f, 1.0f, -0.508f, 0.0f, 0.259f, 0.016f, 1.0f, -0.509f, 0.0f, 0.256f, 0.021f, 1.0f,
- -0.51f, 0.0f, 0.254f, 0.027f, 1.0f, -0.512f, 0.0f, 0.251f, 0.035f, 1.0f, -0.513f, 0.0f, 0.248f, 0.043f, 1.0f, -0.514f, 0.0f, 0.245f, 0.053f, 1.0f,
- -0.515f, 0.0f, 0.242f, 0.064f, 1.0f, -0.516f, 0.0f, 0.239f, 0.076f, 1.0f, -0.517f, 0.0f, 0.235f, 0.09f, 1.0f, -0.519f, 0.0f, 0.232f, 0.105f, 1.0f,
- -0.52f, 0.0f, 0.229f, 0.122f, 1.0f, -0.521f, 0.0f, 0.226f, 0.14f, 1.0f, -0.521f, 0.0f, 0.222f, 0.159f, 1.0f, -0.522f, 0.0f, 0.219f, 0.179f, 1.0f,
- -0.523f, 0.0f, 0.216f, 0.2f, 1.0f, -0.524f, 0.0f, 0.212f, 0.221f, 1.0f, -0.525f, 0.0f, 0.209f, 0.243f, 1.0f, -0.526f, 0.0f, 0.205f, 0.265f, 1.0f,
- -0.526f, 0.0f, 0.202f, 0.286f, 1.0f, -0.527f, 0.0f, 0.198f, 0.306f, 1.0f, -0.527f, 0.0f, 0.195f, 0.326f, 1.0f, -0.528f, 0.0f, 0.191f, 0.345f, 1.0f,
- -0.528f, 0.0f, 0.187f, 0.363f, 1.0f, -0.529f, 0.0f, 0.184f, 0.38f, 1.0f, -0.529f, 0.0f, 0.18f, 0.395f, 1.0f, -0.529f, 0.0f, 0.176f, 0.41f, 1.0f,
- -0.53f, 0.0f, 0.173f, 0.424f, 1.0f, -0.53f, 0.0f, 0.169f, 0.438f, 1.0f, -0.53f, 0.0f, 0.165f, 0.452f, 1.0f, -0.53f, 0.0f, 0.161f, 0.465f, 1.0f,
- -0.53f, 0.0f, 0.157f, 0.478f, 1.0f, -0.53f, 0.0f, 0.154f, 0.492f, 1.0f, -0.53f, 0.0f, 0.15f, 0.505f, 1.0f, -0.53f, 0.0f, 0.146f, 0.517f, 1.0f,
- -0.53f, 0.0f, 0.142f, 0.53f, 1.0f, -0.529f, 0.0f, 0.138f, 0.542f, 1.0f, -0.529f, 0.0f, 0.134f, 0.553f, 1.0f, -0.528f, 0.0f, 0.13f, 0.564f, 1.0f,
- -0.528f, 0.0f, 0.127f, 0.574f, 1.0f, -0.527f, 0.0f, 0.123f, 0.583f, 1.0f, -0.527f, 0.0f, 0.119f, 0.592f, 1.0f, -0.526f, 0.0f, 0.115f, 0.6f, 1.0f,
- -0.526f, 0.0f, 0.111f, 0.608f, 1.0f, -0.525f, 0.0f, 0.108f, 0.615f, 1.0f, -0.524f, 0.0f, 0.104f, 0.622f, 1.0f, -0.523f, 0.0f, 0.1f, 0.628f, 1.0f,
- -0.522f, 0.0f, 0.097f, 0.635f, 1.0f, -0.521f, 0.0f, 0.093f, 0.641f, 1.0f, -0.52f, 0.0f, 0.089f, 0.647f, 1.0f, -0.519f, 0.0f, 0.086f, 0.653f, 1.0f,
- -0.518f, 0.0f, 0.082f, 0.659f, 1.0f, -0.517f, 0.0f, 0.079f, 0.664f, 1.0f, -0.515f, 0.0f, 0.075f, 0.67f, 1.0f, -0.514f, 0.0f, 0.072f, 0.675f, 1.0f,
- -0.513f, 0.0f, 0.069f, 0.68f, 1.0f, -0.511f, 0.0f, 0.065f, 0.685f, 1.0f, -0.51f, 0.0f, 0.062f, 0.69f, 1.0f, -0.509f, 0.0f, 0.059f, 0.695f, 1.0f,
- -0.507f, 0.0f, 0.056f, 0.7f, 1.0f, -0.505f, 0.0f, 0.053f, 0.704f, 1.0f, -0.504f, 0.0f, 0.049f, 0.709f, 1.0f, -0.502f, 0.0f, 0.046f, 0.714f, 1.0f,
- -0.5f, 0.0f, 0.043f, 0.719f, 1.0f, -0.499f, 0.0f, 0.04f, 0.724f, 1.0f, -0.497f, 0.0f, 0.038f, 0.73f, 1.0f, -0.495f, 0.0f, 0.035f, 0.735f, 1.0f,
- -0.493f, 0.0f, 0.032f, 0.741f, 1.0f, -0.491f, 0.0f, 0.029f, 0.748f, 1.0f, -0.489f, 0.0f, 0.026f, 0.754f, 1.0f, -0.488f, -0.0f, 0.024f, 0.76f, 1.0f,
- -0.486f, -0.0f, 0.022f, 0.767f, 1.0f, -0.485f, -0.0f, 0.019f, 0.773f, 1.0f, -0.483f, -0.0f, 0.017f, 0.779f, 1.0f, -0.482f, -0.0f, 0.015f, 0.785f, 1.0f,
- -0.48f, -0.0f, 0.013f, 0.79f, 1.0f, -0.478f, -0.0f, 0.01f, 0.795f, 1.0f, -0.476f, -0.0f, 0.008f, 0.8f, 1.0f, -0.474f, -0.0f, 0.006f, 0.804f, 1.0f,
- -0.472f, -0.0f, 0.004f, 0.808f, 1.0f, -0.47f, -0.0f, 0.002f, 0.811f, 1.0f, -0.468f, -0.0f, -0.0f, 0.814f, 1.0f, -0.466f, -0.0f, -0.002f, 0.816f, 1.0f,
- -0.464f, -0.0f, -0.004f, 0.818f, 1.0f, -0.461f, -0.0f, -0.006f, 0.82f, 1.0f, -0.459f, -0.0f, -0.008f, 0.822f, 1.0f, -0.456f, -0.0f, -0.01f, 0.823f, 1.0f,
- -0.454f, -0.0f, -0.012f, 0.825f, 1.0f, -0.451f, -0.0f, -0.014f, 0.826f, 1.0f, -0.448f, -0.0f, -0.016f, 0.827f, 1.0f, -0.445f, -0.0f, -0.018f, 0.828f, 1.0f,
- -0.442f, -0.0f, -0.02f, 0.829f, 1.0f, -0.439f, -0.0f, -0.022f, 0.829f, 1.0f, -0.436f, -0.0f, -0.024f, 0.83f, 1.0f, -0.433f, -0.0f, -0.026f, 0.83f, 1.0f,
- -0.43f, -0.0f, -0.027f, 0.83f, 1.0f, -0.426f, -0.0f, -0.029f, 0.83f, 1.0f, -0.423f, 0.0f, -0.031f, 0.83f, 1.0f, -0.42f, 0.0f, -0.032f, 0.83f, 1.0f,
- -0.417f, 0.0f, -0.033f, 0.831f, 1.0f, -0.414f, 0.0f, -0.034f, 0.831f, 1.0f, -0.411f, 0.0f, -0.035f, 0.831f, 1.0f, -0.408f, 0.0f, -0.037f, 0.831f, 1.0f,
- -0.405f, 0.0f, -0.038f, 0.831f, 1.0f, -0.402f, 0.0f, -0.039f, 0.831f, 1.0f, -0.399f, 0.0f, -0.039f, 0.831f, 1.0f, -0.396f, 0.0f, -0.04f, 0.832f, 1.0f,
- -0.393f, 0.0f, -0.041f, 0.832f, 1.0f, -0.389f, 0.0f, -0.042f, 0.832f, 1.0f, -0.386f, 0.0f, -0.043f, 0.832f, 1.0f, -0.383f, 0.0f, -0.044f, 0.832f, 1.0f,
- -0.379f, 0.0f, -0.044f, 0.832f, 1.0f, -0.376f, 0.0f, -0.045f, 0.832f, 1.0f, -0.372f, 0.0f, -0.045f, 0.832f, 1.0f, -0.369f, 0.0f, -0.046f, 0.832f, 1.0f,
- -0.366f, 0.0f, -0.047f, 0.832f, 1.0f, -0.362f, 0.0f, -0.047f, 0.832f, 1.0f, -0.359f, 0.0f, -0.047f, 0.831f, 1.0f, -0.355f, 0.0f, -0.048f, 0.831f, 1.0f,
- -0.352f, 0.0f, -0.048f, 0.83f, 1.0f, -0.348f, 0.0f, -0.048f, 0.83f, 1.0f, -0.345f, 0.0f, -0.049f, 0.829f, 1.0f, -0.341f, 0.0f, -0.049f, 0.828f, 1.0f,
- -0.338f, 0.0f, -0.049f, 0.827f, 1.0f, -0.334f, 0.0f, -0.049f, 0.826f, 1.0f, -0.331f, 0.0f, -0.049f, 0.823f, 1.0f, -0.327f, 0.0f, -0.049f, 0.82f, 1.0f,
- -0.323f, 0.0f, -0.048f, 0.816f, 1.0f, -0.32f, 0.0f, -0.048f, 0.811f, 1.0f, -0.316f, 0.0f, -0.048f, 0.804f, 1.0f, -0.313f, 0.0f, -0.048f, 0.797f, 1.0f,
- -0.309f, 0.0f, -0.047f, 0.79f, 1.0f, -0.306f, 0.0f, -0.047f, 0.782f, 1.0f, -0.302f, 0.0f, -0.046f, 0.774f, 1.0f, -0.299f, 0.0f, -0.045f, 0.767f, 1.0f,
- -0.295f, 0.0f, -0.044f, 0.76f, 1.0f, -0.292f, 0.0f, -0.044f, 0.753f, 1.0f, -0.288f, 0.0f, -0.043f, 0.748f, 1.0f, -0.285f, 0.0f, -0.042f, 0.742f, 1.0f,
- -0.282f, 0.0f, -0.041f, 0.738f, 1.0f, -0.278f, 0.0f, -0.04f, 0.734f, 1.0f, -0.275f, 0.0f, -0.039f, 0.73f, 1.0f, -0.272f, 0.0f, -0.037f, 0.726f, 1.0f,
- -0.269f, 0.0f, -0.036f, 0.723f, 1.0f, -0.266f, 0.0f, -0.035f, 0.72f, 1.0f, -0.263f, 0.0f, -0.034f, 0.717f, 1.0f, -0.26f, 0.0f, -0.032f, 0.713f, 1.0f,
- -0.257f, 0.0f, -0.031f, 0.71f, 1.0f, -0.255f, 0.0f, -0.029f, 0.706f, 1.0f, -0.252f, 0.0f, -0.028f, 0.702f, 1.0f, -0.249f, 0.0f, -0.026f, 0.698f, 1.0f,
- -0.247f, 0.0f, -0.025f, 0.693f, 1.0f, -0.244f, 0.0f, -0.023f, 0.688f, 1.0f, -0.242f, 0.0f, -0.021f, 0.684f, 1.0f, -0.239f, 0.0f, -0.02f, 0.679f, 1.0f,
- -0.237f, 0.0f, -0.018f, 0.675f, 1.0f, -0.234f, 0.0f, -0.016f, 0.671f, 1.0f, -0.232f, 0.0f, -0.014f, 0.667f, 1.0f, -0.23f, 0.0f, -0.013f, 0.663f, 1.0f,
- -0.228f, 0.0f, -0.011f, 0.66f, 1.0f, -0.225f, 0.0f, -0.009f, 0.657f, 1.0f, -0.223f, 0.0f, -0.007f, 0.654f, 1.0f, -0.221f, 0.0f, -0.005f, 0.651f, 1.0f,
- -0.219f, 0.0f, -0.003f, 0.649f, 1.0f, -0.217f, 0.0f, -0.001f, 0.645f, 1.0f, -0.215f, 0.0f, 0.002f, 0.642f, 1.0f, -0.213f, 0.0f, 0.004f, 0.639f, 1.0f,
- -0.211f, 0.0f, 0.006f, 0.635f, 1.0f, -0.209f, 0.0f, 0.008f, 0.631f, 1.0f, -0.207f, 0.0f, 0.011f, 0.627f, 1.0f, -0.206f, 0.0f, 0.013f, 0.623f, 1.0f,
- -0.204f, 0.0f, 0.016f, 0.619f, 1.0f, -0.202f, 0.0f, 0.018f, 0.615f, 1.0f, -0.2f, 0.0f, 0.021f, 0.61f, 1.0f, -0.199f, 0.0f, 0.023f, 0.606f, 1.0f,
- -0.197f, 0.0f, 0.026f, 0.602f, 1.0f, -0.195f, 0.0f, 0.029f, 0.598f, 1.0f, -0.194f, 0.0f, 0.032f, 0.595f, 1.0f, -0.192f, 0.0f, 0.034f, 0.592f, 1.0f,
- -0.191f, 0.0f, 0.037f, 0.589f, 1.0f, -0.19f, 0.0f, 0.04f, 0.587f, 1.0f, -0.188f, 0.0f, 0.043f, 0.585f, 1.0f, -0.187f, 0.0f, 0.046f, 0.584f, 1.0f,
- -0.186f, 0.0f, 0.05f, 0.583f, 1.0f, -0.185f, 0.0f, 0.053f, 0.582f, 1.0f, -0.183f, 0.0f, 0.056f, 0.581f, 1.0f, -0.182f, 0.0f, 0.059f, 0.581f, 1.0f,
- -0.181f, 0.0f, 0.062f, 0.581f, 1.0f, -0.18f, 0.0f, 0.066f, 0.581f, 1.0f, -0.179f, 0.0f, 0.069f, 0.58f, 1.0f, -0.178f, 0.0f, 0.072f, 0.58f, 1.0f,
- -0.177f, 0.0f, 0.076f, 0.58f, 1.0f, -0.177f, 0.0f, 0.079f, 0.58f, 1.0f, -0.176f, 0.0f, 0.083f, 0.58f, 1.0f, -0.175f, 0.0f, 0.086f, 0.58f, 1.0f,
- -0.174f, 0.0f, 0.09f, 0.58f, 1.0f, -0.174f, 0.0f, 0.093f, 0.58f, 1.0f, -0.173f, 0.0f, 0.097f, 0.58f, 1.0f, -0.172f, 0.0f, 0.1f, 0.58f, 1.0f,
- -0.172f, 0.0f, 0.104f, 0.58f, 1.0f, -0.171f, 0.0f, 0.108f, 0.579f, 1.0f, -0.171f, 0.0f, 0.111f, 0.579f, 1.0f, -0.17f, 0.0f, 0.115f, 0.578f, 1.0f,
- -0.17f, 0.0f, 0.119f, 0.578f, 1.0f, -0.17f, 0.0f, 0.122f, 0.577f, 1.0f, -0.169f, 0.0f, 0.126f, 0.577f, 1.0f, -0.169f, 0.0f, 0.13f, 0.576f, 1.0f,
- -0.169f, 0.0f, 0.134f, 0.576f, 1.0f, -0.169f, 0.0f, 0.137f, 0.575f, 1.0f, -0.169f, 0.0f, 0.141f, 0.575f, 1.0f, -0.169f, 0.0f, 0.145f, 0.574f, 1.0f,
- -0.169f, 0.0f, 0.149f, 0.572f, 1.0f, -0.169f, 0.0f, 0.153f, 0.571f, 1.0f, -0.169f, 0.0f, 0.157f, 0.569f, 1.0f, -0.169f, 0.0f, 0.16f, 0.566f, 1.0f,
- -0.169f, 0.0f, 0.164f, 0.562f, 1.0f, -0.17f, 0.0f, 0.168f, 0.558f, 1.0f, -0.17f, 0.0f, 0.172f, 0.553f, 1.0f, -0.17f, 0.0f, 0.176f, 0.547f, 1.0f,
- -0.171f, 0.0f, 0.18f, 0.539f, 1.0f, -0.171f, 0.0f, 0.183f, 0.531f, 1.0f, -0.172f, 0.0f, 0.187f, 0.522f, 1.0f, -0.172f, 0.0f, 0.191f, 0.513f, 1.0f,
- -0.173f, 0.0f, 0.194f, 0.503f, 1.0f, -0.173f, 0.0f, 0.198f, 0.493f, 1.0f, -0.174f, 0.0f, 0.202f, 0.483f, 1.0f, -0.175f, 0.0f, 0.205f, 0.473f, 1.0f,
- -0.176f, 0.0f, 0.209f, 0.464f, 1.0f, -0.177f, 0.0f, 0.212f, 0.455f, 1.0f, -0.178f, 0.0f, 0.215f, 0.446f, 1.0f, -0.178f, 0.0f, 0.219f, 0.438f, 1.0f,
- -0.179f, 0.0f, 0.222f, 0.428f, 1.0f, -0.18f, 0.0f, 0.226f, 0.418f, 1.0f, -0.182f, 0.0f, 0.229f, 0.407f, 1.0f, -0.183f, 0.0f, 0.232f, 0.394f, 1.0f,
- -0.184f, 0.0f, 0.236f, 0.38f, 1.0f, -0.185f, 0.0f, 0.239f, 0.364f, 1.0f, -0.186f, 0.0f, 0.242f, 0.348f, 1.0f, -0.187f, 0.0f, 0.245f, 0.33f, 1.0f,
- -0.188f, 0.0f, 0.249f, 0.311f, 1.0f, -0.19f, 0.0f, 0.252f, 0.293f, 1.0f, -0.191f, 0.0f, 0.255f, 0.275f, 1.0f, -0.192f, 0.0f, 0.258f, 0.258f, 1.0f,
- -0.194f, 0.0f, 0.261f, 0.242f, 1.0f, -0.195f, 0.0f, 0.264f, 0.228f, 1.0f, -0.196f, 0.0f, 0.267f, 0.214f, 1.0f, -0.198f, 0.0f, 0.27f, 0.202f, 1.0f,
- -0.199f, 0.0f, 0.273f, 0.191f, 1.0f, -0.201f, 0.0f, 0.276f, 0.181f, 1.0f, -0.202f, 0.0f, 0.279f, 0.171f, 1.0f, -0.204f, 0.0f, 0.282f, 0.162f, 1.0f,
- -0.205f, 0.0f, 0.285f, 0.152f, 1.0f, -0.206f, 0.0f, 0.287f, 0.143f, 1.0f, -0.208f, 0.0f, 0.29f, 0.134f, 1.0f, -0.21f, 0.0f, 0.293f, 0.126f, 1.0f,
- -0.211f, 0.0f, 0.295f, 0.117f, 1.0f, -0.213f, 0.0f, 0.298f, 0.109f, 1.0f, -0.214f, 0.0f, 0.301f, 0.101f, 1.0f, -0.216f, 0.0f, 0.303f, 0.094f, 1.0f,
- -0.217f, 0.0f, 0.306f, 0.087f, 1.0f, -0.219f, 0.0f, 0.308f, 0.081f, 1.0f, -0.221f, 0.0f, 0.311f, 0.076f, 1.0f, -0.223f, 0.0f, 0.313f, 0.071f, 1.0f,
- -0.224f, 0.0f, 0.316f, 0.067f, 1.0f, -0.226f, 0.0f, 0.318f, 0.065f, 1.0f, -0.228f, 0.0f, 0.321f, 0.062f, 1.0f, -0.23f, 0.0f, 0.323f, 0.061f, 1.0f,
- -0.232f, 0.0f, 0.326f, 0.06f, 1.0f, -0.233f, 0.0f, 0.328f, 0.06f, 1.0f, -0.235f, 0.0f, 0.331f, 0.061f, 1.0f, -0.237f, 0.0f, 0.334f, 0.061f, 1.0f,
- -0.239f, 0.0f, 0.336f, 0.062f, 1.0f, -0.241f, 0.0f, 0.339f, 0.063f, 1.0f, -0.243f, 0.0f, 0.341f, 0.064f, 1.0f, -0.245f, 0.0f, 0.344f, 0.065f, 1.0f,
- -0.248f, 0.0f, 0.346f, 0.065f, 1.0f, -0.25f, 0.0f, 0.349f, 0.065f, 1.0f, -0.252f, 0.0f, 0.351f, 0.064f, 1.0f, -0.254f, 0.0f, 0.354f, 0.062f, 1.0f,
- -0.256f, 0.0f, 0.356f, 0.06f, 1.0f, -0.258f, 0.0f, 0.359f, 0.058f, 1.0f, -0.261f, 0.0f, 0.361f, 0.055f, 1.0f, -0.263f, 0.0f, 0.364f, 0.051f, 1.0f,
- -0.265f, 0.0f, 0.366f, 0.046f, 1.0f, -0.267f, 0.0f, 0.368f, 0.04f, 1.0f, -0.269f, 0.0f, 0.37f, 0.034f, 1.0f, -0.272f, 0.0f, 0.373f, 0.027f, 1.0f,
- -0.274f, 0.0f, 0.375f, 0.019f, 1.0f, -0.276f, 0.0f, 0.377f, 0.012f, 1.0f, -0.278f, 0.0f, 0.379f, 0.007f, 1.0f, -0.28f, 0.0f, 0.381f, 0.003f, 1.0f,
- -0.282f, 0.0f, 0.383f, 0.001f, 1.0f, -0.284f, 0.0f, 0.385f, 0.0f, 1.0f, -0.286f, 0.0f, 0.387f, 0.0f, 1.0f, -0.287f, 0.0f, 0.388f, 0.0f, 1.0f,
- -0.289f, 0.0f, 0.39f, 0.0f, 1.0f,
+static const float data14[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.7544f, 0.0f, 0.1799f, 0.1f, 1.0f,
+ -0.7495f, 0.0f, 0.162f, 0.2199f, 1.0f,
+ -0.7392f, 0.0f, 0.1283f, 0.4615f, 1.0f,
+ -0.7281f, 0.0f, 0.0975f, 0.6019f, 1.0f,
+ -0.7161f, 0.0f, 0.0693f, 0.6981f, 1.0f,
+ -0.7033f, 0.0f, 0.0435f, 0.7689f, 1.0f,
+ -0.6898f, 0.0f, 0.02f, 0.8236f, 1.0f,
+ -0.6757f, 0.0f, -0.0014f, 0.866f, 1.0f,
+ -0.6609f, 0.0f, -0.0208f, 0.9003f, 1.0f,
+ -0.6455f, 0.0f, -0.0386f, 0.9272f, 1.0f,
+ -0.6297f, 0.0f, -0.0547f, 0.9485f, 1.0f,
+ -0.6133f, 0.0f, -0.0695f, 0.9653f, 1.0f,
+ -0.5966f, 0.0f, -0.083f, 0.9781f, 1.0f,
+ -0.5795f, 0.0f, -0.0955f, 0.9876f, 1.0f,
+ -0.5621f, 0.0f, -0.1071f, 0.9942f, 1.0f,
+ -0.5444f, 0.0f, -0.118f, 0.9983f, 1.0f,
+ -0.5265f, 0.0f, -0.1284f, 0.9997f, 1.0f,
+ -0.5084f, 0.0f, -0.1384f, 0.999f, 1.0f,
+ -0.4902f, 0.0f, -0.1483f, 0.9963f, 1.0f,
+ -0.4719f, 0.0f, -0.1582f, 0.9912f, 1.0f,
+ -0.4537f, 0.0f, -0.1682f, 0.9834f, 1.0f,
+ -0.4355f, 0.0f, -0.1787f, 0.9724f, 1.0f,
+ -0.4173f, 0.0f, -0.1896f, 0.9576f, 1.0f,
+ -0.3993f, 0.0f, -0.2013f, 0.9385f, 1.0f,
+ -0.3815f, 0.0f, -0.2138f, 0.9143f, 1.0f,
+ -0.364f, 0.0f, -0.2274f, 0.8841f, 1.0f,
+ -0.3467f, 0.0f, -0.2422f, 0.8461f, 1.0f,
+ -0.3298f, 0.0f, -0.2584f, 0.7979f, 1.0f,
+ -0.3133f, 0.0f, -0.2762f, 0.7359f, 1.0f,
+ -0.2972f, 0.0f, -0.2958f, 0.6541f, 1.0f,
+ -0.2816f, 0.0f, -0.3173f, 0.5396f, 1.0f,
+ -0.2665f, 0.0f, -0.3409f, 0.36f, 1.0f,
+ -0.2521f, 0.0f, -0.3668f, 0.1f, 1.0f,
};
-static const float data22[309 * GP_PRIM_DATABUF_SIZE] = {
- 0.294f, 0.0f, 0.372f, 0.0f, 1.0f, 0.291f, 0.0f, 0.37f, 0.001f, 1.0f, 0.289f, 0.0f, 0.368f, 0.002f, 1.0f, 0.286f, 0.0f, 0.366f, 0.003f, 1.0f,
- 0.284f, 0.0f, 0.364f, 0.006f, 1.0f, 0.282f, 0.0f, 0.362f, 0.01f, 1.0f, 0.279f, 0.0f, 0.36f, 0.015f, 1.0f, 0.277f, 0.0f, 0.358f, 0.022f, 1.0f,
- 0.274f, 0.0f, 0.356f, 0.03f, 1.0f, 0.272f, 0.0f, 0.353f, 0.04f, 1.0f, 0.269f, 0.0f, 0.351f, 0.051f, 1.0f, 0.267f, 0.0f, 0.349f, 0.062f, 1.0f,
- 0.265f, 0.0f, 0.347f, 0.074f, 1.0f, 0.262f, 0.0f, 0.344f, 0.086f, 1.0f, 0.26f, 0.0f, 0.342f, 0.097f, 1.0f, 0.258f, 0.0f, 0.34f, 0.108f, 1.0f,
- 0.256f, 0.0f, 0.337f, 0.119f, 1.0f, 0.253f, 0.0f, 0.335f, 0.128f, 1.0f, 0.251f, 0.0f, 0.333f, 0.137f, 1.0f, 0.249f, 0.0f, 0.33f, 0.145f, 1.0f,
- 0.247f, 0.0f, 0.328f, 0.153f, 1.0f, 0.246f, 0.0f, 0.325f, 0.161f, 1.0f, 0.244f, 0.0f, 0.323f, 0.168f, 1.0f, 0.242f, 0.0f, 0.321f, 0.176f, 1.0f,
- 0.24f, 0.0f, 0.318f, 0.183f, 1.0f, 0.239f, 0.0f, 0.316f, 0.191f, 1.0f, 0.237f, 0.0f, 0.314f, 0.198f, 1.0f, 0.235f, 0.0f, 0.311f, 0.206f, 1.0f,
- 0.233f, 0.0f, 0.309f, 0.214f, 1.0f, 0.231f, 0.0f, 0.306f, 0.223f, 1.0f, 0.23f, 0.0f, 0.304f, 0.231f, 1.0f, 0.228f, 0.0f, 0.301f, 0.24f, 1.0f,
- 0.226f, 0.0f, 0.299f, 0.248f, 1.0f, 0.224f, 0.0f, 0.296f, 0.256f, 1.0f, 0.223f, 0.0f, 0.294f, 0.264f, 1.0f, 0.221f, 0.0f, 0.291f, 0.272f, 1.0f,
- 0.219f, 0.0f, 0.288f, 0.28f, 1.0f, 0.218f, 0.0f, 0.286f, 0.287f, 1.0f, 0.216f, 0.0f, 0.283f, 0.294f, 1.0f, 0.214f, 0.0f, 0.281f, 0.301f, 1.0f,
- 0.213f, 0.0f, 0.278f, 0.307f, 1.0f, 0.211f, 0.0f, 0.275f, 0.314f, 1.0f, 0.21f, 0.0f, 0.273f, 0.32f, 1.0f, 0.208f, 0.0f, 0.27f, 0.327f, 1.0f,
- 0.206f, 0.0f, 0.267f, 0.333f, 1.0f, 0.205f, 0.0f, 0.265f, 0.339f, 1.0f, 0.204f, 0.0f, 0.262f, 0.345f, 1.0f, 0.202f, 0.0f, 0.259f, 0.351f, 1.0f,
- 0.201f, 0.0f, 0.256f, 0.357f, 1.0f, 0.199f, 0.0f, 0.253f, 0.362f, 1.0f, 0.198f, 0.0f, 0.25f, 0.368f, 1.0f, 0.197f, 0.0f, 0.247f, 0.373f, 1.0f,
- 0.195f, 0.0f, 0.244f, 0.379f, 1.0f, 0.194f, 0.0f, 0.241f, 0.383f, 1.0f, 0.193f, 0.0f, 0.238f, 0.388f, 1.0f, 0.192f, 0.0f, 0.235f, 0.392f, 1.0f,
- 0.191f, 0.0f, 0.232f, 0.396f, 1.0f, 0.19f, 0.0f, 0.229f, 0.399f, 1.0f, 0.189f, 0.0f, 0.226f, 0.402f, 1.0f, 0.188f, 0.0f, 0.222f, 0.405f, 1.0f,
- 0.187f, 0.0f, 0.219f, 0.407f, 1.0f, 0.186f, 0.0f, 0.216f, 0.409f, 1.0f, 0.185f, 0.0f, 0.213f, 0.411f, 1.0f, 0.184f, 0.0f, 0.209f, 0.412f, 1.0f,
- 0.183f, 0.0f, 0.206f, 0.413f, 1.0f, 0.183f, 0.0f, 0.203f, 0.414f, 1.0f, 0.182f, 0.0f, 0.199f, 0.415f, 1.0f, 0.181f, 0.0f, 0.196f, 0.416f, 1.0f,
- 0.181f, 0.0f, 0.193f, 0.417f, 1.0f, 0.18f, 0.0f, 0.189f, 0.417f, 1.0f, 0.18f, 0.0f, 0.186f, 0.418f, 1.0f, 0.179f, 0.0f, 0.182f, 0.419f, 1.0f,
- 0.179f, 0.0f, 0.179f, 0.421f, 1.0f, 0.179f, 0.0f, 0.176f, 0.422f, 1.0f, 0.178f, 0.0f, 0.172f, 0.423f, 1.0f, 0.178f, 0.0f, 0.169f, 0.425f, 1.0f,
- 0.178f, 0.0f, 0.165f, 0.427f, 1.0f, 0.178f, 0.0f, 0.162f, 0.429f, 1.0f, 0.178f, 0.0f, 0.158f, 0.431f, 1.0f, 0.178f, 0.0f, 0.155f, 0.434f, 1.0f,
- 0.178f, 0.0f, 0.152f, 0.436f, 1.0f, 0.178f, 0.0f, 0.148f, 0.439f, 1.0f, 0.178f, 0.0f, 0.145f, 0.442f, 1.0f, 0.178f, 0.0f, 0.141f, 0.446f, 1.0f,
- 0.178f, 0.0f, 0.138f, 0.449f, 1.0f, 0.178f, 0.0f, 0.134f, 0.453f, 1.0f, 0.178f, 0.0f, 0.131f, 0.458f, 1.0f, 0.179f, 0.0f, 0.127f, 0.462f, 1.0f,
- 0.179f, 0.0f, 0.124f, 0.467f, 1.0f, 0.179f, 0.0f, 0.12f, 0.472f, 1.0f, 0.18f, 0.0f, 0.117f, 0.478f, 1.0f, 0.18f, 0.0f, 0.113f, 0.483f, 1.0f,
- 0.181f, 0.0f, 0.11f, 0.489f, 1.0f, 0.182f, 0.0f, 0.106f, 0.494f, 1.0f, 0.182f, 0.0f, 0.103f, 0.5f, 1.0f, 0.183f, 0.0f, 0.099f, 0.505f, 1.0f,
- 0.184f, 0.0f, 0.096f, 0.511f, 1.0f, 0.185f, 0.0f, 0.092f, 0.516f, 1.0f, 0.185f, 0.0f, 0.089f, 0.521f, 1.0f, 0.186f, 0.0f, 0.086f, 0.525f, 1.0f,
- 0.187f, 0.0f, 0.082f, 0.53f, 1.0f, 0.188f, 0.0f, 0.079f, 0.534f, 1.0f, 0.189f, 0.0f, 0.076f, 0.537f, 1.0f, 0.191f, 0.0f, 0.073f, 0.541f, 1.0f,
- 0.192f, 0.0f, 0.069f, 0.544f, 1.0f, 0.193f, 0.0f, 0.066f, 0.547f, 1.0f, 0.194f, 0.0f, 0.063f, 0.55f, 1.0f, 0.196f, 0.0f, 0.061f, 0.553f, 1.0f,
- 0.197f, 0.0f, 0.058f, 0.556f, 1.0f, 0.198f, 0.0f, 0.055f, 0.559f, 1.0f, 0.2f, 0.0f, 0.052f, 0.562f, 1.0f, 0.201f, 0.0f, 0.049f, 0.564f, 1.0f,
- 0.203f, 0.0f, 0.047f, 0.566f, 1.0f, 0.205f, 0.0f, 0.044f, 0.569f, 1.0f, 0.206f, 0.0f, 0.042f, 0.571f, 1.0f, 0.208f, 0.0f, 0.039f, 0.573f, 1.0f,
- 0.21f, 0.0f, 0.037f, 0.575f, 1.0f, 0.212f, 0.0f, 0.035f, 0.576f, 1.0f, 0.214f, 0.0f, 0.032f, 0.578f, 1.0f, 0.215f, 0.0f, 0.03f, 0.579f, 1.0f,
- 0.217f, 0.0f, 0.028f, 0.581f, 1.0f, 0.22f, 0.0f, 0.025f, 0.582f, 1.0f, 0.222f, 0.0f, 0.023f, 0.583f, 1.0f, 0.224f, 0.0f, 0.021f, 0.585f, 1.0f,
- 0.226f, 0.0f, 0.019f, 0.587f, 1.0f, 0.228f, 0.0f, 0.016f, 0.589f, 1.0f, 0.231f, 0.0f, 0.014f, 0.592f, 1.0f, 0.233f, 0.0f, 0.012f, 0.596f, 1.0f,
- 0.236f, 0.0f, 0.01f, 0.599f, 1.0f, 0.238f, 0.0f, 0.008f, 0.604f, 1.0f, 0.241f, 0.0f, 0.006f, 0.608f, 1.0f, 0.243f, 0.0f, 0.004f, 0.612f, 1.0f,
- 0.246f, 0.0f, 0.002f, 0.615f, 1.0f, 0.249f, 0.0f, 0.0f, 0.619f, 1.0f, 0.251f, 0.0f, -0.002f, 0.622f, 1.0f, 0.254f, 0.0f, -0.003f, 0.624f, 1.0f,
- 0.257f, 0.0f, -0.005f, 0.626f, 1.0f, 0.26f, 0.0f, -0.007f, 0.628f, 1.0f, 0.263f, 0.0f, -0.008f, 0.63f, 1.0f, 0.266f, 0.0f, -0.01f, 0.632f, 1.0f,
- 0.269f, 0.0f, -0.011f, 0.634f, 1.0f, 0.272f, 0.0f, -0.013f, 0.636f, 1.0f, 0.275f, 0.0f, -0.014f, 0.638f, 1.0f, 0.278f, 0.0f, -0.015f, 0.64f, 1.0f,
- 0.281f, 0.0f, -0.017f, 0.642f, 1.0f, 0.284f, 0.0f, -0.018f, 0.644f, 1.0f, 0.288f, 0.0f, -0.019f, 0.647f, 1.0f, 0.291f, 0.0f, -0.02f, 0.649f, 1.0f,
- 0.294f, 0.0f, -0.021f, 0.651f, 1.0f, 0.297f, 0.0f, -0.022f, 0.653f, 1.0f, 0.301f, 0.0f, -0.023f, 0.656f, 1.0f, 0.304f, 0.0f, -0.024f, 0.658f, 1.0f,
- 0.307f, 0.0f, -0.025f, 0.659f, 1.0f, 0.31f, 0.0f, -0.026f, 0.661f, 1.0f, 0.314f, 0.0f, -0.027f, 0.662f, 1.0f, 0.317f, 0.0f, -0.027f, 0.664f, 1.0f,
- 0.32f, 0.0f, -0.028f, 0.665f, 1.0f, 0.324f, 0.0f, -0.028f, 0.665f, 1.0f, 0.327f, 0.0f, -0.029f, 0.666f, 1.0f, 0.33f, 0.0f, -0.029f, 0.666f, 1.0f,
- 0.334f, 0.0f, -0.029f, 0.667f, 1.0f, 0.337f, 0.0f, -0.03f, 0.667f, 1.0f, 0.341f, 0.0f, -0.03f, 0.668f, 1.0f, 0.344f, 0.0f, -0.03f, 0.668f, 1.0f,
- 0.348f, 0.0f, -0.03f, 0.668f, 1.0f, 0.351f, 0.0f, -0.03f, 0.668f, 1.0f, 0.354f, 0.0f, -0.03f, 0.668f, 1.0f, 0.358f, 0.0f, -0.029f, 0.668f, 1.0f,
- 0.361f, 0.0f, -0.029f, 0.668f, 1.0f, 0.365f, 0.0f, -0.029f, 0.668f, 1.0f, 0.368f, 0.0f, -0.028f, 0.668f, 1.0f, 0.372f, 0.0f, -0.028f, 0.668f, 1.0f,
- 0.375f, 0.0f, -0.027f, 0.668f, 1.0f, 0.378f, 0.0f, -0.027f, 0.668f, 1.0f, 0.382f, 0.0f, -0.026f, 0.667f, 1.0f, 0.385f, 0.0f, -0.025f, 0.667f, 1.0f,
- 0.388f, 0.0f, -0.025f, 0.666f, 1.0f, 0.392f, 0.0f, -0.024f, 0.666f, 1.0f, 0.395f, 0.0f, -0.023f, 0.665f, 1.0f, 0.398f, 0.0f, -0.022f, 0.664f, 1.0f,
- 0.401f, 0.0f, -0.021f, 0.664f, 1.0f, 0.405f, 0.0f, -0.02f, 0.663f, 1.0f, 0.408f, 0.0f, -0.019f, 0.663f, 1.0f, 0.411f, 0.0f, -0.018f, 0.662f, 1.0f,
- 0.414f, 0.0f, -0.017f, 0.662f, 1.0f, 0.417f, 0.0f, -0.016f, 0.662f, 1.0f, 0.42f, 0.0f, -0.015f, 0.662f, 1.0f, 0.423f, 0.0f, -0.014f, 0.661f, 1.0f,
- 0.426f, 0.0f, -0.012f, 0.661f, 1.0f, 0.429f, 0.0f, -0.011f, 0.661f, 1.0f, 0.432f, 0.0f, -0.01f, 0.661f, 1.0f, 0.434f, 0.0f, -0.009f, 0.66f, 1.0f,
- 0.437f, 0.0f, -0.007f, 0.66f, 1.0f, 0.44f, 0.0f, -0.006f, 0.659f, 1.0f, 0.442f, 0.0f, -0.005f, 0.659f, 1.0f, 0.445f, 0.0f, -0.003f, 0.658f, 1.0f,
- 0.448f, 0.0f, -0.002f, 0.658f, 1.0f, 0.45f, 0.0f, -0.001f, 0.657f, 1.0f, 0.452f, 0.0f, 0.001f, 0.656f, 1.0f, 0.455f, 0.0f, 0.002f, 0.655f, 1.0f,
- 0.457f, 0.0f, 0.004f, 0.654f, 1.0f, 0.459f, 0.0f, 0.005f, 0.653f, 1.0f, 0.462f, 0.0f, 0.007f, 0.652f, 1.0f, 0.464f, 0.0f, 0.009f, 0.651f, 1.0f,
- 0.466f, 0.0f, 0.01f, 0.65f, 1.0f, 0.468f, 0.0f, 0.012f, 0.65f, 1.0f, 0.47f, 0.0f, 0.014f, 0.649f, 1.0f, 0.472f, 0.0f, 0.016f, 0.648f, 1.0f,
- 0.474f, 0.0f, 0.018f, 0.647f, 1.0f, 0.476f, 0.0f, 0.019f, 0.646f, 1.0f, 0.478f, 0.0f, 0.021f, 0.645f, 1.0f, 0.479f, 0.0f, 0.023f, 0.644f, 1.0f,
- 0.481f, 0.0f, 0.025f, 0.643f, 1.0f, 0.483f, 0.0f, 0.027f, 0.642f, 1.0f, 0.485f, 0.0f, 0.03f, 0.642f, 1.0f, 0.486f, 0.0f, 0.032f, 0.641f, 1.0f,
- 0.488f, 0.0f, 0.034f, 0.64f, 1.0f, 0.49f, 0.0f, 0.036f, 0.639f, 1.0f, 0.491f, 0.0f, 0.038f, 0.638f, 1.0f, 0.493f, 0.0f, 0.041f, 0.637f, 1.0f,
- 0.494f, 0.0f, 0.043f, 0.636f, 1.0f, 0.496f, 0.0f, 0.045f, 0.635f, 1.0f, 0.497f, 0.0f, 0.048f, 0.635f, 1.0f, 0.499f, 0.0f, 0.05f, 0.634f, 1.0f,
- 0.5f, 0.0f, 0.053f, 0.633f, 1.0f, 0.502f, 0.0f, 0.055f, 0.632f, 1.0f, 0.503f, 0.0f, 0.058f, 0.631f, 1.0f, 0.505f, 0.0f, 0.06f, 0.63f, 1.0f,
- 0.506f, 0.0f, 0.063f, 0.63f, 1.0f, 0.507f, 0.0f, 0.066f, 0.629f, 1.0f, 0.509f, 0.0f, 0.068f, 0.628f, 1.0f, 0.51f, 0.0f, 0.071f, 0.628f, 1.0f,
- 0.511f, 0.0f, 0.074f, 0.627f, 1.0f, 0.513f, 0.0f, 0.077f, 0.626f, 1.0f, 0.514f, 0.0f, 0.079f, 0.625f, 1.0f, 0.515f, 0.0f, 0.082f, 0.625f, 1.0f,
- 0.516f, 0.0f, 0.085f, 0.624f, 1.0f, 0.518f, 0.0f, 0.088f, 0.623f, 1.0f, 0.519f, 0.0f, 0.091f, 0.622f, 1.0f, 0.52f, 0.0f, 0.094f, 0.62f, 1.0f,
- 0.521f, 0.0f, 0.098f, 0.619f, 1.0f, 0.522f, 0.0f, 0.101f, 0.617f, 1.0f, 0.523f, 0.0f, 0.104f, 0.615f, 1.0f, 0.524f, 0.0f, 0.107f, 0.613f, 1.0f,
- 0.525f, 0.0f, 0.111f, 0.611f, 1.0f, 0.526f, 0.0f, 0.114f, 0.609f, 1.0f, 0.527f, 0.0f, 0.118f, 0.607f, 1.0f, 0.527f, 0.0f, 0.121f, 0.605f, 1.0f,
- 0.528f, 0.0f, 0.124f, 0.603f, 1.0f, 0.529f, 0.0f, 0.128f, 0.602f, 1.0f, 0.529f, 0.0f, 0.132f, 0.6f, 1.0f, 0.53f, 0.0f, 0.135f, 0.599f, 1.0f,
- 0.531f, 0.0f, 0.139f, 0.598f, 1.0f, 0.531f, 0.0f, 0.142f, 0.598f, 1.0f, 0.531f, 0.0f, 0.146f, 0.597f, 1.0f, 0.532f, 0.0f, 0.15f, 0.596f, 1.0f,
- 0.532f, 0.0f, 0.154f, 0.596f, 1.0f, 0.532f, 0.0f, 0.157f, 0.595f, 1.0f, 0.532f, 0.0f, 0.161f, 0.595f, 1.0f, 0.532f, 0.0f, 0.165f, 0.594f, 1.0f,
- 0.532f, 0.0f, 0.169f, 0.593f, 1.0f, 0.532f, 0.0f, 0.173f, 0.592f, 1.0f, 0.532f, 0.0f, 0.177f, 0.591f, 1.0f, 0.532f, 0.0f, 0.181f, 0.59f, 1.0f,
- 0.531f, 0.0f, 0.185f, 0.589f, 1.0f, 0.531f, 0.0f, 0.189f, 0.588f, 1.0f, 0.53f, 0.0f, 0.194f, 0.587f, 1.0f, 0.529f, 0.0f, 0.198f, 0.586f, 1.0f,
- 0.528f, 0.0f, 0.202f, 0.585f, 1.0f, 0.527f, 0.0f, 0.207f, 0.584f, 1.0f, 0.526f, 0.0f, 0.211f, 0.584f, 1.0f, 0.525f, 0.0f, 0.215f, 0.583f, 1.0f,
- 0.523f, 0.0f, 0.22f, 0.583f, 1.0f, 0.522f, 0.0f, 0.224f, 0.583f, 1.0f, 0.52f, 0.0f, 0.229f, 0.582f, 1.0f, 0.518f, 0.0f, 0.234f, 0.582f, 1.0f,
- 0.515f, 0.0f, 0.238f, 0.582f, 1.0f, 0.513f, 0.0f, 0.243f, 0.581f, 1.0f, 0.51f, 0.0f, 0.247f, 0.58f, 1.0f, 0.508f, 0.0f, 0.252f, 0.579f, 1.0f,
- 0.505f, 0.0f, 0.257f, 0.578f, 1.0f, 0.502f, 0.0f, 0.261f, 0.576f, 1.0f, 0.499f, 0.0f, 0.266f, 0.573f, 1.0f, 0.496f, 0.0f, 0.27f, 0.57f, 1.0f,
- 0.492f, 0.0f, 0.275f, 0.566f, 1.0f, 0.489f, 0.0f, 0.279f, 0.561f, 1.0f, 0.485f, 0.0f, 0.284f, 0.555f, 1.0f, 0.481f, 0.0f, 0.288f, 0.548f, 1.0f,
- 0.478f, 0.0f, 0.293f, 0.54f, 1.0f, 0.473f, 0.0f, 0.297f, 0.531f, 1.0f, 0.469f, 0.0f, 0.301f, 0.521f, 1.0f, 0.465f, 0.0f, 0.305f, 0.509f, 1.0f,
- 0.461f, 0.0f, 0.309f, 0.496f, 1.0f, 0.456f, 0.0f, 0.313f, 0.481f, 1.0f, 0.452f, 0.0f, 0.317f, 0.464f, 1.0f, 0.448f, 0.0f, 0.321f, 0.445f, 1.0f,
- 0.443f, 0.0f, 0.324f, 0.424f, 1.0f, 0.438f, 0.0f, 0.328f, 0.401f, 1.0f, 0.434f, 0.0f, 0.331f, 0.374f, 1.0f, 0.429f, 0.0f, 0.334f, 0.346f, 1.0f,
- 0.425f, 0.0f, 0.337f, 0.314f, 1.0f, 0.421f, 0.0f, 0.34f, 0.281f, 1.0f, 0.416f, 0.0f, 0.343f, 0.245f, 1.0f, 0.412f, 0.0f, 0.346f, 0.208f, 1.0f,
- 0.408f, 0.0f, 0.349f, 0.169f, 1.0f, 0.404f, 0.0f, 0.351f, 0.13f, 1.0f, 0.401f, 0.0f, 0.354f, 0.089f, 1.0f, 0.398f, 0.0f, 0.356f, 0.054f, 1.0f,
- 0.394f, 0.0f, 0.359f, 0.0f, 1.0f,
+static const float data15[65 * GP_PRIM_DATABUF_SIZE] = {
+ -0.2854f, 0.0f, -0.4528f, 0.1f, 1.0f,
+ -0.2866f, 0.0f, -0.4623f, 0.1288f, 1.0f,
+ -0.2899f, 0.0f, -0.4814f, 0.2962f, 1.0f,
+ -0.2943f, 0.0f, -0.5008f, 0.4147f, 1.0f,
+ -0.2995f, 0.0f, -0.5203f, 0.5028f, 1.0f,
+ -0.3054f, 0.0f, -0.54f, 0.5723f, 1.0f,
+ -0.3117f, 0.0f, -0.5598f, 0.6291f, 1.0f,
+ -0.3182f, 0.0f, -0.5797f, 0.6768f, 1.0f,
+ -0.3249f, 0.0f, -0.5996f, 0.7177f, 1.0f,
+ -0.3314f, 0.0f, -0.6196f, 0.753f, 1.0f,
+ -0.3376f, 0.0f, -0.6395f, 0.7838f, 1.0f,
+ -0.3432f, 0.0f, -0.6594f, 0.8109f, 1.0f,
+ -0.3482f, 0.0f, -0.6792f, 0.8349f, 1.0f,
+ -0.3523f, 0.0f, -0.6989f, 0.8564f, 1.0f,
+ -0.3552f, 0.0f, -0.7185f, 0.8756f, 1.0f,
+ -0.3569f, 0.0f, -0.7379f, 0.8922f, 1.0f,
+ -0.357f, 0.0f, -0.7571f, 0.9074f, 1.0f,
+ -0.3555f, 0.0f, -0.7761f, 0.9211f, 1.0f,
+ -0.3522f, 0.0f, -0.7948f, 0.9329f, 1.0f,
+ -0.3467f, 0.0f, -0.8132f, 0.944f, 1.0f,
+ -0.339f, 0.0f, -0.8313f, 0.9531f, 1.0f,
+ -0.3289f, 0.0f, -0.849f, 0.9617f, 1.0f,
+ -0.316f, 0.0f, -0.8663f, 0.9688f, 1.0f,
+ -0.3004f, 0.0f, -0.8831f, 0.9755f, 1.0f,
+ -0.2817f, 0.0f, -0.8996f, 0.9808f, 1.0f,
+ -0.2598f, 0.0f, -0.9155f, 0.9858f, 1.0f,
+ -0.2344f, 0.0f, -0.9309f, 0.9894f, 1.0f,
+ -0.2051f, 0.0f, -0.9457f, 0.993f, 1.0f,
+ -0.1716f, 0.0f, -0.9599f, 0.9952f, 1.0f,
+ -0.1341f, 0.0f, -0.9733f, 0.9973f, 1.0f,
+ -0.0928f, 0.0f, -0.9857f, 0.9987f, 1.0f,
+ -0.05f, 0.0f, -0.9962f, 0.9993f, 1.0f,
+ -0.0087f, 0.0f, -1.0041f, 1.0f, 1.0f,
+ 0.0287f, 0.0f, -1.0087f, 0.9993f, 1.0f,
+ 0.062f, 0.0f, -1.0104f, 0.9987f, 1.0f,
+ 0.0924f, 0.0f, -1.0102f, 0.9973f, 1.0f,
+ 0.1205f, 0.0f, -1.0086f, 0.9952f, 1.0f,
+ 0.1465f, 0.0f, -1.0057f, 0.993f, 1.0f,
+ 0.1706f, 0.0f, -1.0017f, 0.9894f, 1.0f,
+ 0.1928f, 0.0f, -0.9964f, 0.9858f, 1.0f,
+ 0.2132f, 0.0f, -0.99f, 0.9808f, 1.0f,
+ 0.2318f, 0.0f, -0.9824f, 0.9755f, 1.0f,
+ 0.2487f, 0.0f, -0.9738f, 0.9688f, 1.0f,
+ 0.2641f, 0.0f, -0.9641f, 0.9617f, 1.0f,
+ 0.2778f, 0.0f, -0.9533f, 0.9531f, 1.0f,
+ 0.2901f, 0.0f, -0.9415f, 0.944f, 1.0f,
+ 0.3009f, 0.0f, -0.9287f, 0.9329f, 1.0f,
+ 0.3103f, 0.0f, -0.9148f, 0.9211f, 1.0f,
+ 0.3183f, 0.0f, -0.8999f, 0.9074f, 1.0f,
+ 0.325f, 0.0f, -0.8841f, 0.8922f, 1.0f,
+ 0.3304f, 0.0f, -0.8672f, 0.8756f, 1.0f,
+ 0.3345f, 0.0f, -0.8493f, 0.8564f, 1.0f,
+ 0.3374f, 0.0f, -0.8305f, 0.8349f, 1.0f,
+ 0.3391f, 0.0f, -0.8107f, 0.8109f, 1.0f,
+ 0.3397f, 0.0f, -0.7899f, 0.7838f, 1.0f,
+ 0.3392f, 0.0f, -0.7682f, 0.753f, 1.0f,
+ 0.3377f, 0.0f, -0.7456f, 0.7177f, 1.0f,
+ 0.3352f, 0.0f, -0.7221f, 0.6768f, 1.0f,
+ 0.3317f, 0.0f, -0.6976f, 0.6291f, 1.0f,
+ 0.3273f, 0.0f, -0.6722f, 0.5723f, 1.0f,
+ 0.322f, 0.0f, -0.646f, 0.5028f, 1.0f,
+ 0.316f, 0.0f, -0.6188f, 0.4147f, 1.0f,
+ 0.3091f, 0.0f, -0.5908f, 0.2962f, 1.0f,
+ 0.3015f, 0.0f, -0.5619f, 0.1288f, 1.0f,
+ 0.2974f, 0.0f, -0.5472f, 0.1f, 1.0f,
};
-static const float data23[209 * GP_PRIM_DATABUF_SIZE] = {
- -0.751f, 0.0f, 0.173f, 0.0f, 1.0f, -0.751f, 0.0f, 0.168f, 0.0f, 1.0f, -0.75f, 0.0f, 0.164f, 0.0f, 1.0f, -0.75f, 0.0f, 0.16f, 0.0f, 1.0f,
- -0.75f, 0.0f, 0.156f, 0.0f, 1.0f, -0.749f, 0.0f, 0.152f, 0.0f, 1.0f, -0.749f, 0.0f, 0.148f, 0.0f, 1.0f, -0.748f, 0.0f, 0.144f, 0.0f, 1.0f,
- -0.747f, 0.0f, 0.14f, 0.001f, 1.0f, -0.747f, 0.0f, 0.137f, 0.002f, 1.0f, -0.746f, 0.0f, 0.133f, 0.005f, 1.0f, -0.745f, 0.0f, 0.129f, 0.008f, 1.0f,
- -0.745f, 0.0f, 0.125f, 0.013f, 1.0f, -0.744f, 0.0f, 0.122f, 0.02f, 1.0f, -0.743f, 0.0f, 0.118f, 0.028f, 1.0f, -0.742f, 0.0f, 0.115f, 0.038f, 1.0f,
- -0.741f, 0.0f, 0.111f, 0.049f, 1.0f, -0.74f, 0.0f, 0.108f, 0.061f, 1.0f, -0.739f, 0.0f, 0.105f, 0.073f, 1.0f, -0.738f, 0.0f, 0.101f, 0.085f, 1.0f,
- -0.736f, 0.0f, 0.098f, 0.097f, 1.0f, -0.735f, 0.0f, 0.095f, 0.109f, 1.0f, -0.734f, 0.0f, 0.091f, 0.119f, 1.0f, -0.732f, 0.0f, 0.088f, 0.129f, 1.0f,
- -0.731f, 0.0f, 0.085f, 0.138f, 1.0f, -0.729f, 0.0f, 0.082f, 0.146f, 1.0f, -0.728f, 0.0f, 0.079f, 0.153f, 1.0f, -0.726f, 0.0f, 0.076f, 0.158f, 1.0f,
- -0.725f, 0.0f, 0.073f, 0.163f, 1.0f, -0.723f, 0.0f, 0.07f, 0.167f, 1.0f, -0.722f, 0.0f, 0.067f, 0.17f, 1.0f, -0.72f, 0.0f, 0.065f, 0.173f, 1.0f,
- -0.718f, 0.0f, 0.062f, 0.174f, 1.0f, -0.717f, 0.0f, 0.059f, 0.175f, 1.0f, -0.715f, 0.0f, 0.057f, 0.176f, 1.0f, -0.714f, 0.0f, 0.054f, 0.176f, 1.0f,
- -0.712f, 0.0f, 0.051f, 0.176f, 1.0f, -0.71f, 0.0f, 0.049f, 0.176f, 1.0f, -0.709f, 0.0f, 0.046f, 0.176f, 1.0f, -0.707f, 0.0f, 0.043f, 0.176f, 1.0f,
- -0.705f, 0.0f, 0.041f, 0.176f, 1.0f, -0.703f, 0.0f, 0.038f, 0.176f, 1.0f, -0.701f, 0.0f, 0.035f, 0.176f, 1.0f, -0.7f, 0.0f, 0.033f, 0.177f, 1.0f,
- -0.698f, 0.0f, 0.03f, 0.177f, 1.0f, -0.696f, 0.0f, 0.027f, 0.178f, 1.0f, -0.694f, 0.0f, 0.024f, 0.179f, 1.0f, -0.692f, 0.0f, 0.022f, 0.18f, 1.0f,
- -0.69f, 0.0f, 0.019f, 0.181f, 1.0f, -0.688f, 0.0f, 0.016f, 0.182f, 1.0f, -0.685f, 0.0f, 0.013f, 0.184f, 1.0f, -0.683f, 0.0f, 0.01f, 0.187f, 1.0f,
- -0.681f, 0.0f, 0.007f, 0.19f, 1.0f, -0.679f, 0.0f, 0.004f, 0.194f, 1.0f, -0.677f, 0.0f, 0.001f, 0.198f, 1.0f, -0.675f, 0.0f, -0.002f, 0.203f, 1.0f,
- -0.673f, 0.0f, -0.005f, 0.209f, 1.0f, -0.67f, 0.0f, -0.008f, 0.215f, 1.0f, -0.668f, 0.0f, -0.011f, 0.222f, 1.0f, -0.666f, 0.0f, -0.014f, 0.229f, 1.0f,
- -0.664f, 0.0f, -0.017f, 0.237f, 1.0f, -0.661f, 0.0f, -0.02f, 0.246f, 1.0f, -0.659f, 0.0f, -0.023f, 0.255f, 1.0f, -0.657f, 0.0f, -0.025f, 0.264f, 1.0f,
- -0.654f, 0.0f, -0.028f, 0.275f, 1.0f, -0.652f, 0.0f, -0.031f, 0.285f, 1.0f, -0.65f, 0.0f, -0.034f, 0.297f, 1.0f, -0.647f, 0.0f, -0.037f, 0.309f, 1.0f,
- -0.644f, 0.0f, -0.04f, 0.322f, 1.0f, -0.642f, 0.0f, -0.043f, 0.335f, 1.0f, -0.639f, 0.0f, -0.046f, 0.348f, 1.0f, -0.636f, 0.0f, -0.049f, 0.361f, 1.0f,
- -0.633f, 0.0f, -0.052f, 0.374f, 1.0f, -0.63f, 0.0f, -0.055f, 0.386f, 1.0f, -0.627f, 0.0f, -0.058f, 0.397f, 1.0f, -0.624f, 0.0f, -0.061f, 0.408f, 1.0f,
- -0.62f, 0.0f, -0.064f, 0.418f, 1.0f, -0.617f, 0.0f, -0.067f, 0.427f, 1.0f, -0.614f, 0.0f, -0.07f, 0.435f, 1.0f, -0.611f, 0.0f, -0.073f, 0.443f, 1.0f,
- -0.607f, 0.0f, -0.075f, 0.451f, 1.0f, -0.604f, 0.0f, -0.078f, 0.458f, 1.0f, -0.6f, 0.0f, -0.081f, 0.465f, 1.0f, -0.597f, 0.0f, -0.084f, 0.472f, 1.0f,
- -0.593f, 0.0f, -0.086f, 0.479f, 1.0f, -0.59f, 0.0f, -0.089f, 0.486f, 1.0f, -0.586f, 0.0f, -0.092f, 0.492f, 1.0f, -0.583f, 0.0f, -0.094f, 0.499f, 1.0f,
- -0.579f, 0.0f, -0.097f, 0.505f, 1.0f, -0.575f, 0.0f, -0.099f, 0.512f, 1.0f, -0.571f, 0.0f, -0.102f, 0.518f, 1.0f, -0.567f, 0.0f, -0.105f, 0.524f, 1.0f,
- -0.563f, 0.0f, -0.107f, 0.53f, 1.0f, -0.559f, 0.0f, -0.11f, 0.536f, 1.0f, -0.555f, 0.0f, -0.112f, 0.541f, 1.0f, -0.551f, 0.0f, -0.115f, 0.546f, 1.0f,
- -0.546f, 0.0f, -0.117f, 0.551f, 1.0f, -0.542f, 0.0f, -0.12f, 0.555f, 1.0f, -0.538f, 0.0f, -0.122f, 0.559f, 1.0f, -0.533f, 0.0f, -0.125f, 0.562f, 1.0f,
- -0.529f, 0.0f, -0.127f, 0.565f, 1.0f, -0.525f, 0.0f, -0.129f, 0.568f, 1.0f, -0.52f, 0.0f, -0.132f, 0.57f, 1.0f, -0.516f, 0.0f, -0.134f, 0.572f, 1.0f,
- -0.512f, 0.0f, -0.137f, 0.574f, 1.0f, -0.508f, 0.0f, -0.139f, 0.576f, 1.0f, -0.503f, 0.0f, -0.141f, 0.577f, 1.0f, -0.499f, 0.0f, -0.144f, 0.578f, 1.0f,
- -0.495f, 0.0f, -0.146f, 0.579f, 1.0f, -0.491f, 0.0f, -0.148f, 0.579f, 1.0f, -0.487f, 0.0f, -0.151f, 0.578f, 1.0f, -0.483f, 0.0f, -0.153f, 0.577f, 1.0f,
- -0.479f, 0.0f, -0.155f, 0.574f, 1.0f, -0.475f, 0.0f, -0.158f, 0.571f, 1.0f, -0.471f, 0.0f, -0.16f, 0.567f, 1.0f, -0.467f, 0.0f, -0.162f, 0.561f, 1.0f,
- -0.463f, 0.0f, -0.165f, 0.555f, 1.0f, -0.459f, 0.0f, -0.167f, 0.548f, 1.0f, -0.456f, 0.0f, -0.169f, 0.54f, 1.0f, -0.452f, 0.0f, -0.172f, 0.532f, 1.0f,
- -0.448f, 0.0f, -0.174f, 0.523f, 1.0f, -0.445f, 0.0f, -0.176f, 0.514f, 1.0f, -0.441f, 0.0f, -0.179f, 0.505f, 1.0f, -0.438f, 0.0f, -0.181f, 0.497f, 1.0f,
- -0.435f, 0.0f, -0.183f, 0.488f, 1.0f, -0.431f, 0.0f, -0.185f, 0.48f, 1.0f, -0.428f, 0.0f, -0.188f, 0.472f, 1.0f, -0.425f, 0.0f, -0.19f, 0.464f, 1.0f,
- -0.422f, 0.0f, -0.192f, 0.457f, 1.0f, -0.419f, 0.0f, -0.194f, 0.451f, 1.0f, -0.416f, 0.0f, -0.196f, 0.444f, 1.0f, -0.413f, 0.0f, -0.198f, 0.439f, 1.0f,
- -0.41f, 0.0f, -0.2f, 0.434f, 1.0f, -0.407f, 0.0f, -0.202f, 0.429f, 1.0f, -0.404f, 0.0f, -0.204f, 0.426f, 1.0f, -0.401f, 0.0f, -0.206f, 0.422f, 1.0f,
- -0.398f, 0.0f, -0.208f, 0.419f, 1.0f, -0.396f, 0.0f, -0.21f, 0.417f, 1.0f, -0.393f, 0.0f, -0.212f, 0.415f, 1.0f, -0.39f, 0.0f, -0.213f, 0.413f, 1.0f,
- -0.388f, 0.0f, -0.215f, 0.412f, 1.0f, -0.385f, 0.0f, -0.217f, 0.411f, 1.0f, -0.382f, 0.0f, -0.219f, 0.41f, 1.0f, -0.38f, 0.0f, -0.221f, 0.41f, 1.0f,
- -0.377f, 0.0f, -0.222f, 0.409f, 1.0f, -0.375f, 0.0f, -0.224f, 0.409f, 1.0f, -0.372f, 0.0f, -0.226f, 0.409f, 1.0f, -0.37f, 0.0f, -0.228f, 0.409f, 1.0f,
- -0.367f, 0.0f, -0.229f, 0.409f, 1.0f, -0.365f, 0.0f, -0.231f, 0.409f, 1.0f, -0.362f, 0.0f, -0.233f, 0.409f, 1.0f, -0.36f, 0.0f, -0.235f, 0.409f, 1.0f,
- -0.357f, 0.0f, -0.236f, 0.409f, 1.0f, -0.355f, 0.0f, -0.238f, 0.409f, 1.0f, -0.352f, 0.0f, -0.24f, 0.408f, 1.0f, -0.35f, 0.0f, -0.242f, 0.408f, 1.0f,
- -0.348f, 0.0f, -0.243f, 0.407f, 1.0f, -0.345f, 0.0f, -0.245f, 0.406f, 1.0f, -0.343f, 0.0f, -0.247f, 0.405f, 1.0f, -0.34f, 0.0f, -0.249f, 0.404f, 1.0f,
- -0.338f, 0.0f, -0.251f, 0.403f, 1.0f, -0.336f, 0.0f, -0.253f, 0.401f, 1.0f, -0.333f, 0.0f, -0.255f, 0.399f, 1.0f, -0.331f, 0.0f, -0.256f, 0.397f, 1.0f,
- -0.329f, 0.0f, -0.258f, 0.394f, 1.0f, -0.327f, 0.0f, -0.26f, 0.391f, 1.0f, -0.324f, 0.0f, -0.262f, 0.387f, 1.0f, -0.322f, 0.0f, -0.264f, 0.383f, 1.0f,
- -0.32f, 0.0f, -0.266f, 0.379f, 1.0f, -0.318f, 0.0f, -0.268f, 0.374f, 1.0f, -0.316f, 0.0f, -0.27f, 0.368f, 1.0f, -0.314f, 0.0f, -0.272f, 0.362f, 1.0f,
- -0.312f, 0.0f, -0.275f, 0.356f, 1.0f, -0.309f, 0.0f, -0.277f, 0.349f, 1.0f, -0.307f, 0.0f, -0.279f, 0.341f, 1.0f, -0.305f, 0.0f, -0.281f, 0.333f, 1.0f,
- -0.303f, 0.0f, -0.283f, 0.325f, 1.0f, -0.301f, 0.0f, -0.286f, 0.316f, 1.0f, -0.299f, 0.0f, -0.288f, 0.307f, 1.0f, -0.297f, 0.0f, -0.29f, 0.298f, 1.0f,
- -0.295f, 0.0f, -0.293f, 0.289f, 1.0f, -0.293f, 0.0f, -0.295f, 0.279f, 1.0f, -0.291f, 0.0f, -0.298f, 0.269f, 1.0f, -0.29f, 0.0f, -0.3f, 0.259f, 1.0f,
- -0.288f, 0.0f, -0.303f, 0.249f, 1.0f, -0.286f, 0.0f, -0.306f, 0.238f, 1.0f, -0.284f, 0.0f, -0.308f, 0.227f, 1.0f, -0.282f, 0.0f, -0.311f, 0.215f, 1.0f,
- -0.28f, 0.0f, -0.314f, 0.203f, 1.0f, -0.278f, 0.0f, -0.317f, 0.191f, 1.0f, -0.277f, 0.0f, -0.32f, 0.178f, 1.0f, -0.275f, 0.0f, -0.323f, 0.165f, 1.0f,
- -0.273f, 0.0f, -0.326f, 0.151f, 1.0f, -0.271f, 0.0f, -0.33f, 0.138f, 1.0f, -0.27f, 0.0f, -0.333f, 0.124f, 1.0f, -0.268f, 0.0f, -0.336f, 0.11f, 1.0f,
- -0.267f, 0.0f, -0.34f, 0.097f, 1.0f, -0.265f, 0.0f, -0.343f, 0.085f, 1.0f, -0.264f, 0.0f, -0.346f, 0.073f, 1.0f, -0.262f, 0.0f, -0.35f, 0.062f, 1.0f,
- -0.261f, 0.0f, -0.353f, 0.052f, 1.0f, -0.259f, 0.0f, -0.357f, 0.043f, 1.0f, -0.258f, 0.0f, -0.36f, 0.035f, 1.0f, -0.257f, 0.0f, -0.363f, 0.028f, 1.0f,
- -0.255f, 0.0f, -0.366f, 0.021f, 1.0f, -0.254f, 0.0f, -0.369f, 0.016f, 1.0f, -0.253f, 0.0f, -0.372f, 0.01f, 1.0f, -0.252f, 0.0f, -0.375f, 0.006f, 1.0f,
- -0.251f, 0.0f, -0.379f, 0.0f, 1.0f,
+static const float data16[34 * GP_PRIM_DATABUF_SIZE] = {
+ -0.4408f, 0.0f, 0.5073f, 0.1f, 1.0f,
+ -0.4312f, 0.0f, 0.5132f, 0.1288f, 1.0f,
+ -0.3945f, 0.0f, 0.5319f, 0.4147f, 1.0f,
+ -0.3605f, 0.0f, 0.5438f, 0.5723f, 1.0f,
+ -0.3288f, 0.0f, 0.5496f, 0.6768f, 1.0f,
+ -0.2992f, 0.0f, 0.5501f, 0.753f, 1.0f,
+ -0.2712f, 0.0f, 0.546f, 0.8109f, 1.0f,
+ -0.2446f, 0.0f, 0.5381f, 0.8564f, 1.0f,
+ -0.2191f, 0.0f, 0.5272f, 0.8922f, 1.0f,
+ -0.1943f, 0.0f, 0.5139f, 0.9211f, 1.0f,
+ -0.1699f, 0.0f, 0.4992f, 0.944f, 1.0f,
+ -0.1456f, 0.0f, 0.4837f, 0.9617f, 1.0f,
+ -0.1211f, 0.0f, 0.4682f, 0.9755f, 1.0f,
+ -0.096f, 0.0f, 0.4535f, 0.9858f, 1.0f,
+ -0.07f, 0.0f, 0.4404f, 0.993f, 1.0f,
+ -0.0428f, 0.0f, 0.4301f, 0.9973f, 1.0f,
+ -0.016f, 0.0f, 0.4235f, 0.9993f, 1.0f,
+ 0.0076f, 0.0f, 0.4216f, 0.9993f, 1.0f,
+ 0.0283f, 0.0f, 0.4237f, 0.9973f, 1.0f,
+ 0.0477f, 0.0f, 0.4291f, 0.993f, 1.0f,
+ 0.067f, 0.0f, 0.4369f, 0.9858f, 1.0f,
+ 0.0866f, 0.0f, 0.4465f, 0.9755f, 1.0f,
+ 0.1068f, 0.0f, 0.4576f, 0.9617f, 1.0f,
+ 0.1278f, 0.0f, 0.4695f, 0.944f, 1.0f,
+ 0.1498f, 0.0f, 0.4819f, 0.9211f, 1.0f,
+ 0.173f, 0.0f, 0.4941f, 0.8922f, 1.0f,
+ 0.1977f, 0.0f, 0.5056f, 0.8564f, 1.0f,
+ 0.2241f, 0.0f, 0.5159f, 0.8109f, 1.0f,
+ 0.2523f, 0.0f, 0.5244f, 0.753f, 1.0f,
+ 0.2825f, 0.0f, 0.5307f, 0.6768f, 1.0f,
+ 0.315f, 0.0f, 0.5342f, 0.5723f, 1.0f,
+ 0.3499f, 0.0f, 0.5345f, 0.4147f, 1.0f,
+ 0.3875f, 0.0f, 0.5311f, 0.1288f, 1.0f,
+ 0.3973f, 0.0f, 0.5295f, 0.1f, 1.0f,
};
-static const float data24[133 * GP_PRIM_DATABUF_SIZE] = {
- 0.233f, 0.0f, -0.376f, 0.021f, 1.0f, 0.234f, 0.0f, -0.372f, 0.08f, 1.0f, 0.234f, 0.0f, -0.369f, 0.116f, 1.0f, 0.234f, 0.0f, -0.366f, 0.156f, 1.0f,
- 0.235f, 0.0f, -0.362f, 0.191f, 1.0f, 0.236f, 0.0f, -0.359f, 0.222f, 1.0f, 0.236f, 0.0f, -0.356f, 0.248f, 1.0f, 0.237f, 0.0f, -0.353f, 0.27f, 1.0f,
- 0.238f, 0.0f, -0.35f, 0.289f, 1.0f, 0.239f, 0.0f, -0.346f, 0.304f, 1.0f, 0.24f, 0.0f, -0.343f, 0.319f, 1.0f, 0.241f, 0.0f, -0.34f, 0.334f, 1.0f,
- 0.242f, 0.0f, -0.337f, 0.35f, 1.0f, 0.243f, 0.0f, -0.335f, 0.367f, 1.0f, 0.244f, 0.0f, -0.332f, 0.385f, 1.0f, 0.245f, 0.0f, -0.329f, 0.401f, 1.0f,
- 0.247f, 0.0f, -0.327f, 0.415f, 1.0f, 0.248f, 0.0f, -0.324f, 0.426f, 1.0f, 0.249f, 0.0f, -0.322f, 0.435f, 1.0f, 0.251f, 0.0f, -0.32f, 0.443f, 1.0f,
- 0.252f, 0.0f, -0.318f, 0.449f, 1.0f, 0.254f, 0.0f, -0.316f, 0.455f, 1.0f, 0.255f, 0.0f, -0.314f, 0.461f, 1.0f, 0.257f, 0.0f, -0.312f, 0.467f, 1.0f,
- 0.258f, 0.0f, -0.311f, 0.474f, 1.0f, 0.26f, 0.0f, -0.309f, 0.48f, 1.0f, 0.262f, 0.0f, -0.307f, 0.487f, 1.0f, 0.263f, 0.0f, -0.305f, 0.493f, 1.0f,
- 0.265f, 0.0f, -0.303f, 0.499f, 1.0f, 0.267f, 0.0f, -0.3f, 0.505f, 1.0f, 0.269f, 0.0f, -0.298f, 0.511f, 1.0f, 0.271f, 0.0f, -0.296f, 0.518f, 1.0f,
- 0.273f, 0.0f, -0.294f, 0.524f, 1.0f, 0.276f, 0.0f, -0.291f, 0.531f, 1.0f, 0.278f, 0.0f, -0.289f, 0.539f, 1.0f, 0.281f, 0.0f, -0.287f, 0.546f, 1.0f,
- 0.283f, 0.0f, -0.284f, 0.552f, 1.0f, 0.286f, 0.0f, -0.281f, 0.557f, 1.0f, 0.289f, 0.0f, -0.279f, 0.561f, 1.0f, 0.292f, 0.0f, -0.276f, 0.565f, 1.0f,
- 0.294f, 0.0f, -0.274f, 0.568f, 1.0f, 0.297f, 0.0f, -0.271f, 0.57f, 1.0f, 0.3f, 0.0f, -0.269f, 0.572f, 1.0f, 0.303f, 0.0f, -0.267f, 0.574f, 1.0f,
- 0.306f, 0.0f, -0.264f, 0.575f, 1.0f, 0.308f, 0.0f, -0.262f, 0.576f, 1.0f, 0.311f, 0.0f, -0.26f, 0.577f, 1.0f, 0.314f, 0.0f, -0.257f, 0.578f, 1.0f,
- 0.316f, 0.0f, -0.255f, 0.578f, 1.0f, 0.319f, 0.0f, -0.253f, 0.579f, 1.0f, 0.322f, 0.0f, -0.25f, 0.579f, 1.0f, 0.325f, 0.0f, -0.248f, 0.58f, 1.0f,
- 0.328f, 0.0f, -0.246f, 0.58f, 1.0f, 0.331f, 0.0f, -0.243f, 0.58f, 1.0f, 0.334f, 0.0f, -0.241f, 0.58f, 1.0f, 0.337f, 0.0f, -0.239f, 0.58f, 1.0f,
- 0.341f, 0.0f, -0.236f, 0.58f, 1.0f, 0.344f, 0.0f, -0.233f, 0.581f, 1.0f, 0.348f, 0.0f, -0.231f, 0.581f, 1.0f, 0.352f, 0.0f, -0.228f, 0.581f, 1.0f,
- 0.356f, 0.0f, -0.225f, 0.582f, 1.0f, 0.36f, 0.0f, -0.222f, 0.582f, 1.0f, 0.365f, 0.0f, -0.219f, 0.582f, 1.0f, 0.369f, 0.0f, -0.216f, 0.582f, 1.0f,
- 0.374f, 0.0f, -0.214f, 0.582f, 1.0f, 0.378f, 0.0f, -0.211f, 0.582f, 1.0f, 0.383f, 0.0f, -0.208f, 0.583f, 1.0f, 0.387f, 0.0f, -0.205f, 0.583f, 1.0f,
- 0.392f, 0.0f, -0.202f, 0.583f, 1.0f, 0.397f, 0.0f, -0.199f, 0.583f, 1.0f, 0.401f, 0.0f, -0.197f, 0.583f, 1.0f, 0.406f, 0.0f, -0.194f, 0.583f, 1.0f,
- 0.411f, 0.0f, -0.191f, 0.583f, 1.0f, 0.416f, 0.0f, -0.188f, 0.583f, 1.0f, 0.42f, 0.0f, -0.186f, 0.583f, 1.0f, 0.425f, 0.0f, -0.183f, 0.583f, 1.0f,
- 0.43f, 0.0f, -0.18f, 0.583f, 1.0f, 0.434f, 0.0f, -0.178f, 0.583f, 1.0f, 0.439f, 0.0f, -0.175f, 0.583f, 1.0f, 0.444f, 0.0f, -0.172f, 0.583f, 1.0f,
- 0.449f, 0.0f, -0.17f, 0.584f, 1.0f, 0.453f, 0.0f, -0.167f, 0.584f, 1.0f, 0.458f, 0.0f, -0.164f, 0.584f, 1.0f, 0.463f, 0.0f, -0.161f, 0.585f, 1.0f,
- 0.468f, 0.0f, -0.158f, 0.585f, 1.0f, 0.473f, 0.0f, -0.155f, 0.585f, 1.0f, 0.478f, 0.0f, -0.152f, 0.585f, 1.0f, 0.483f, 0.0f, -0.149f, 0.585f, 1.0f,
- 0.488f, 0.0f, -0.146f, 0.585f, 1.0f, 0.492f, 0.0f, -0.143f, 0.585f, 1.0f, 0.497f, 0.0f, -0.14f, 0.586f, 1.0f, 0.501f, 0.0f, -0.137f, 0.586f, 1.0f,
- 0.506f, 0.0f, -0.134f, 0.586f, 1.0f, 0.51f, 0.0f, -0.13f, 0.586f, 1.0f, 0.515f, 0.0f, -0.127f, 0.586f, 1.0f, 0.52f, 0.0f, -0.124f, 0.586f, 1.0f,
- 0.524f, 0.0f, -0.12f, 0.586f, 1.0f, 0.529f, 0.0f, -0.117f, 0.586f, 1.0f, 0.534f, 0.0f, -0.113f, 0.586f, 1.0f, 0.539f, 0.0f, -0.109f, 0.586f, 1.0f,
- 0.544f, 0.0f, -0.105f, 0.586f, 1.0f, 0.55f, 0.0f, -0.1f, 0.586f, 1.0f, 0.555f, 0.0f, -0.095f, 0.586f, 1.0f, 0.561f, 0.0f, -0.09f, 0.586f, 1.0f,
- 0.567f, 0.0f, -0.084f, 0.587f, 1.0f, 0.573f, 0.0f, -0.078f, 0.587f, 1.0f, 0.579f, 0.0f, -0.071f, 0.587f, 1.0f, 0.586f, 0.0f, -0.063f, 0.588f, 1.0f,
- 0.593f, 0.0f, -0.055f, 0.588f, 1.0f, 0.6f, 0.0f, -0.047f, 0.588f, 1.0f, 0.607f, 0.0f, -0.038f, 0.589f, 1.0f, 0.614f, 0.0f, -0.028f, 0.589f, 1.0f,
- 0.621f, 0.0f, -0.018f, 0.589f, 1.0f, 0.629f, 0.0f, -0.007f, 0.589f, 1.0f, 0.636f, 0.0f, 0.004f, 0.589f, 1.0f, 0.643f, 0.0f, 0.015f, 0.59f, 1.0f,
- 0.65f, 0.0f, 0.026f, 0.589f, 1.0f, 0.656f, 0.0f, 0.038f, 0.589f, 1.0f, 0.663f, 0.0f, 0.049f, 0.588f, 1.0f, 0.669f, 0.0f, 0.06f, 0.587f, 1.0f,
- 0.676f, 0.0f, 0.072f, 0.584f, 1.0f, 0.682f, 0.0f, 0.084f, 0.579f, 1.0f, 0.688f, 0.0f, 0.096f, 0.571f, 1.0f, 0.694f, 0.0f, 0.108f, 0.558f, 1.0f,
- 0.7f, 0.0f, 0.12f, 0.54f, 1.0f, 0.706f, 0.0f, 0.133f, 0.514f, 1.0f, 0.712f, 0.0f, 0.145f, 0.478f, 1.0f, 0.718f, 0.0f, 0.158f, 0.431f, 1.0f,
- 0.723f, 0.0f, 0.17f, 0.369f, 1.0f, 0.728f, 0.0f, 0.182f, 0.294f, 1.0f, 0.733f, 0.0f, 0.194f, 0.205f, 1.0f, 0.737f, 0.0f, 0.204f, 0.125f, 1.0f,
- 0.743f, 0.0f, 0.218f, 0.0f, 1.0f,
+static const float data17[33 * GP_PRIM_DATABUF_SIZE] = {
+ 0.724f, 0.0f, 0.1799f, 0.1f, 1.0f,
+ 0.7192f, 0.0f, 0.162f, 0.2199f, 1.0f,
+ 0.7089f, 0.0f, 0.1283f, 0.4615f, 1.0f,
+ 0.6977f, 0.0f, 0.0975f, 0.6019f, 1.0f,
+ 0.6858f, 0.0f, 0.0693f, 0.6981f, 1.0f,
+ 0.673f, 0.0f, 0.0435f, 0.7689f, 1.0f,
+ 0.6595f, 0.0f, 0.02f, 0.8236f, 1.0f,
+ 0.6453f, 0.0f, -0.0014f, 0.866f, 1.0f,
+ 0.6306f, 0.0f, -0.0208f, 0.9003f, 1.0f,
+ 0.6152f, 0.0f, -0.0386f, 0.9272f, 1.0f,
+ 0.5994f, 0.0f, -0.0547f, 0.9485f, 1.0f,
+ 0.583f, 0.0f, -0.0695f, 0.9653f, 1.0f,
+ 0.5663f, 0.0f, -0.083f, 0.9781f, 1.0f,
+ 0.5492f, 0.0f, -0.0955f, 0.9876f, 1.0f,
+ 0.5317f, 0.0f, -0.1071f, 0.9942f, 1.0f,
+ 0.514f, 0.0f, -0.118f, 0.9983f, 1.0f,
+ 0.4961f, 0.0f, -0.1284f, 0.9997f, 1.0f,
+ 0.4781f, 0.0f, -0.1384f, 0.999f, 1.0f,
+ 0.4599f, 0.0f, -0.1483f, 0.9963f, 1.0f,
+ 0.4416f, 0.0f, -0.1582f, 0.9912f, 1.0f,
+ 0.4234f, 0.0f, -0.1682f, 0.9834f, 1.0f,
+ 0.4051f, 0.0f, -0.1787f, 0.9724f, 1.0f,
+ 0.387f, 0.0f, -0.1896f, 0.9576f, 1.0f,
+ 0.369f, 0.0f, -0.2013f, 0.9385f, 1.0f,
+ 0.3512f, 0.0f, -0.2138f, 0.9143f, 1.0f,
+ 0.3337f, 0.0f, -0.2274f, 0.8841f, 1.0f,
+ 0.3164f, 0.0f, -0.2422f, 0.8461f, 1.0f,
+ 0.2995f, 0.0f, -0.2584f, 0.7979f, 1.0f,
+ 0.2829f, 0.0f, -0.2762f, 0.7359f, 1.0f,
+ 0.2669f, 0.0f, -0.2958f, 0.6541f, 1.0f,
+ 0.2513f, 0.0f, -0.3173f, 0.5396f, 1.0f,
+ 0.2362f, 0.0f, -0.3409f, 0.36f, 1.0f,
+ 0.2218f, 0.0f, -0.3668f, 0.1f, 1.0f,
};
-static const float data25[389 * GP_PRIM_DATABUF_SIZE] = {
- -0.284f, 0.0f, -0.444f, 0.0f, 1.0f, -0.285f, 0.0f, -0.448f, 0.0f, 1.0f, -0.285f, 0.0f, -0.45f, 0.0f, 1.0f, -0.286f, 0.0f, -0.454f, 0.0f, 1.0f,
- -0.286f, 0.0f, -0.457f, 0.0f, 1.0f, -0.287f, 0.0f, -0.46f, 0.0f, 1.0f, -0.288f, 0.0f, -0.463f, 0.0f, 1.0f, -0.289f, 0.0f, -0.466f, 0.0f, 1.0f,
- -0.289f, 0.0f, -0.47f, 0.0f, 1.0f, -0.29f, 0.0f, -0.473f, 0.0f, 1.0f, -0.291f, 0.0f, -0.476f, 0.0f, 1.0f, -0.292f, 0.0f, -0.48f, 0.0f, 1.0f,
- -0.293f, 0.0f, -0.484f, 0.0f, 1.0f, -0.294f, 0.0f, -0.487f, 0.0f, 1.0f, -0.295f, 0.0f, -0.491f, 0.0f, 1.0f, -0.296f, 0.0f, -0.494f, 0.0f, 1.0f,
- -0.297f, 0.0f, -0.498f, 0.0f, 1.0f, -0.298f, 0.0f, -0.502f, 0.0f, 1.0f, -0.299f, 0.0f, -0.505f, 0.0f, 1.0f, -0.3f, 0.0f, -0.509f, 0.0f, 1.0f,
- -0.301f, 0.0f, -0.513f, 0.0f, 1.0f, -0.302f, 0.0f, -0.517f, 0.0f, 1.0f, -0.303f, 0.0f, -0.52f, 0.0f, 1.0f, -0.304f, 0.0f, -0.524f, 0.0f, 1.0f,
- -0.305f, 0.0f, -0.528f, 0.0f, 1.0f, -0.306f, 0.0f, -0.532f, 0.0f, 1.0f, -0.307f, 0.0f, -0.535f, 0.0f, 1.0f, -0.308f, 0.0f, -0.539f, 0.0f, 1.0f,
- -0.309f, 0.0f, -0.543f, 0.0f, 1.0f, -0.31f, 0.0f, -0.547f, 0.0f, 1.0f, -0.311f, 0.0f, -0.55f, 0.0f, 1.0f, -0.312f, 0.0f, -0.554f, 0.0f, 1.0f,
- -0.313f, 0.0f, -0.558f, 0.0f, 1.0f, -0.314f, 0.0f, -0.562f, 0.0f, 1.0f, -0.315f, 0.0f, -0.565f, 0.0f, 1.0f, -0.316f, 0.0f, -0.569f, 0.0f, 1.0f,
- -0.317f, 0.0f, -0.573f, 0.0f, 1.0f, -0.318f, 0.0f, -0.576f, 0.0f, 1.0f, -0.319f, 0.0f, -0.58f, 0.0f, 1.0f, -0.32f, 0.0f, -0.583f, 0.0f, 1.0f,
- -0.321f, 0.0f, -0.587f, 0.0f, 1.0f, -0.322f, 0.0f, -0.591f, 0.0f, 1.0f, -0.323f, 0.0f, -0.594f, 0.0f, 1.0f, -0.323f, 0.0f, -0.598f, 0.0f, 1.0f,
- -0.324f, 0.0f, -0.601f, 0.0f, 1.0f, -0.325f, 0.0f, -0.605f, 0.0f, 1.0f, -0.326f, 0.0f, -0.608f, 0.0f, 1.0f, -0.326f, 0.0f, -0.612f, 0.0f, 1.0f,
- -0.327f, 0.0f, -0.615f, 0.0f, 1.0f, -0.328f, 0.0f, -0.619f, 0.0f, 1.0f, -0.328f, 0.0f, -0.622f, 0.0f, 1.0f, -0.329f, 0.0f, -0.625f, 0.0f, 1.0f,
- -0.33f, 0.0f, -0.629f, 0.0f, 1.0f, -0.33f, 0.0f, -0.632f, 0.0f, 1.0f, -0.331f, 0.0f, -0.635f, 0.001f, 1.0f, -0.331f, 0.0f, -0.639f, 0.001f, 1.0f,
- -0.332f, 0.0f, -0.642f, 0.002f, 1.0f, -0.332f, 0.0f, -0.645f, 0.002f, 1.0f, -0.333f, 0.0f, -0.649f, 0.003f, 1.0f, -0.333f, 0.0f, -0.652f, 0.005f, 1.0f,
- -0.334f, 0.0f, -0.655f, 0.006f, 1.0f, -0.334f, 0.0f, -0.658f, 0.009f, 1.0f, -0.335f, 0.0f, -0.662f, 0.011f, 1.0f, -0.335f, 0.0f, -0.665f, 0.015f, 1.0f,
- -0.335f, 0.0f, -0.668f, 0.019f, 1.0f, -0.336f, 0.0f, -0.672f, 0.024f, 1.0f, -0.336f, 0.0f, -0.675f, 0.031f, 1.0f, -0.337f, 0.0f, -0.678f, 0.038f, 1.0f,
- -0.337f, 0.0f, -0.682f, 0.046f, 1.0f, -0.337f, 0.0f, -0.685f, 0.056f, 1.0f, -0.338f, 0.0f, -0.689f, 0.067f, 1.0f, -0.338f, 0.0f, -0.692f, 0.079f, 1.0f,
- -0.338f, 0.0f, -0.696f, 0.093f, 1.0f, -0.339f, 0.0f, -0.699f, 0.107f, 1.0f, -0.339f, 0.0f, -0.703f, 0.123f, 1.0f, -0.34f, 0.0f, -0.706f, 0.139f, 1.0f,
- -0.34f, 0.0f, -0.71f, 0.157f, 1.0f, -0.34f, 0.0f, -0.714f, 0.174f, 1.0f, -0.34f, 0.0f, -0.717f, 0.193f, 1.0f, -0.341f, 0.0f, -0.721f, 0.211f, 1.0f,
- -0.341f, 0.0f, -0.725f, 0.23f, 1.0f, -0.341f, 0.0f, -0.729f, 0.248f, 1.0f, -0.342f, 0.0f, -0.732f, 0.266f, 1.0f, -0.342f, 0.0f, -0.736f, 0.284f, 1.0f,
- -0.342f, 0.0f, -0.74f, 0.302f, 1.0f, -0.342f, 0.0f, -0.744f, 0.318f, 1.0f, -0.342f, 0.0f, -0.748f, 0.334f, 1.0f, -0.342f, 0.0f, -0.752f, 0.349f, 1.0f,
- -0.343f, 0.0f, -0.756f, 0.364f, 1.0f, -0.343f, 0.0f, -0.76f, 0.377f, 1.0f, -0.343f, 0.0f, -0.763f, 0.389f, 1.0f, -0.343f, 0.0f, -0.767f, 0.401f, 1.0f,
- -0.343f, 0.0f, -0.771f, 0.411f, 1.0f, -0.343f, 0.0f, -0.775f, 0.421f, 1.0f, -0.342f, 0.0f, -0.779f, 0.429f, 1.0f, -0.342f, 0.0f, -0.783f, 0.437f, 1.0f,
- -0.342f, 0.0f, -0.786f, 0.444f, 1.0f, -0.342f, 0.0f, -0.79f, 0.451f, 1.0f, -0.342f, 0.0f, -0.794f, 0.456f, 1.0f, -0.341f, 0.0f, -0.797f, 0.461f, 1.0f,
- -0.341f, 0.0f, -0.801f, 0.466f, 1.0f, -0.34f, 0.0f, -0.805f, 0.469f, 1.0f, -0.34f, 0.0f, -0.808f, 0.473f, 1.0f, -0.339f, 0.0f, -0.812f, 0.476f, 1.0f,
- -0.339f, 0.0f, -0.815f, 0.478f, 1.0f, -0.338f, 0.0f, -0.818f, 0.48f, 1.0f, -0.338f, 0.0f, -0.822f, 0.482f, 1.0f, -0.337f, 0.0f, -0.825f, 0.483f, 1.0f,
- -0.336f, 0.0f, -0.828f, 0.484f, 1.0f, -0.335f, 0.0f, -0.831f, 0.485f, 1.0f, -0.334f, 0.0f, -0.834f, 0.486f, 1.0f, -0.333f, 0.0f, -0.837f, 0.487f, 1.0f,
- -0.332f, 0.0f, -0.84f, 0.487f, 1.0f, -0.331f, 0.0f, -0.843f, 0.487f, 1.0f, -0.33f, 0.0f, -0.846f, 0.488f, 1.0f, -0.329f, 0.0f, -0.849f, 0.488f, 1.0f,
- -0.328f, 0.0f, -0.852f, 0.488f, 1.0f, -0.326f, 0.0f, -0.855f, 0.488f, 1.0f, -0.325f, 0.0f, -0.857f, 0.488f, 1.0f, -0.324f, 0.0f, -0.86f, 0.488f, 1.0f,
- -0.322f, 0.0f, -0.863f, 0.488f, 1.0f, -0.321f, 0.0f, -0.865f, 0.488f, 1.0f, -0.319f, 0.0f, -0.868f, 0.488f, 1.0f, -0.318f, 0.0f, -0.871f, 0.488f, 1.0f,
- -0.316f, 0.0f, -0.873f, 0.489f, 1.0f, -0.314f, 0.0f, -0.876f, 0.489f, 1.0f, -0.312f, 0.0f, -0.878f, 0.489f, 1.0f, -0.311f, 0.0f, -0.881f, 0.489f, 1.0f,
- -0.309f, 0.0f, -0.883f, 0.489f, 1.0f, -0.307f, 0.0f, -0.885f, 0.489f, 1.0f, -0.305f, 0.0f, -0.888f, 0.49f, 1.0f, -0.303f, 0.0f, -0.89f, 0.491f, 1.0f,
- -0.301f, 0.0f, -0.892f, 0.491f, 1.0f, -0.298f, 0.0f, -0.894f, 0.492f, 1.0f, -0.296f, 0.0f, -0.897f, 0.494f, 1.0f, -0.294f, 0.0f, -0.899f, 0.495f, 1.0f,
- -0.292f, 0.0f, -0.901f, 0.497f, 1.0f, -0.289f, 0.0f, -0.903f, 0.5f, 1.0f, -0.287f, 0.0f, -0.905f, 0.502f, 1.0f, -0.284f, 0.0f, -0.907f, 0.505f, 1.0f,
- -0.282f, 0.0f, -0.909f, 0.509f, 1.0f, -0.279f, 0.0f, -0.912f, 0.512f, 1.0f, -0.277f, 0.0f, -0.914f, 0.517f, 1.0f, -0.274f, 0.0f, -0.916f, 0.521f, 1.0f,
- -0.271f, 0.0f, -0.918f, 0.526f, 1.0f, -0.269f, 0.0f, -0.919f, 0.531f, 1.0f, -0.266f, 0.0f, -0.921f, 0.537f, 1.0f, -0.263f, 0.0f, -0.923f, 0.543f, 1.0f,
- -0.26f, 0.0f, -0.925f, 0.548f, 1.0f, -0.257f, 0.0f, -0.927f, 0.554f, 1.0f, -0.255f, 0.0f, -0.929f, 0.56f, 1.0f, -0.252f, 0.0f, -0.931f, 0.566f, 1.0f,
- -0.249f, 0.0f, -0.932f, 0.571f, 1.0f, -0.246f, 0.0f, -0.934f, 0.577f, 1.0f, -0.243f, 0.0f, -0.936f, 0.582f, 1.0f, -0.24f, 0.0f, -0.938f, 0.587f, 1.0f,
- -0.237f, 0.0f, -0.939f, 0.592f, 1.0f, -0.234f, 0.0f, -0.941f, 0.597f, 1.0f, -0.231f, 0.0f, -0.943f, 0.601f, 1.0f, -0.228f, 0.0f, -0.944f, 0.605f, 1.0f,
- -0.225f, 0.0f, -0.946f, 0.609f, 1.0f, -0.222f, 0.0f, -0.948f, 0.613f, 1.0f, -0.219f, 0.0f, -0.949f, 0.617f, 1.0f, -0.216f, 0.0f, -0.951f, 0.62f, 1.0f,
- -0.213f, 0.0f, -0.953f, 0.624f, 1.0f, -0.21f, 0.0f, -0.954f, 0.627f, 1.0f, -0.207f, 0.0f, -0.956f, 0.63f, 1.0f, -0.204f, 0.0f, -0.958f, 0.633f, 1.0f,
- -0.201f, 0.0f, -0.959f, 0.636f, 1.0f, -0.198f, 0.0f, -0.961f, 0.639f, 1.0f, -0.195f, 0.0f, -0.962f, 0.641f, 1.0f, -0.191f, 0.0f, -0.964f, 0.643f, 1.0f,
- -0.188f, 0.0f, -0.965f, 0.646f, 1.0f, -0.185f, 0.0f, -0.967f, 0.648f, 1.0f, -0.181f, 0.0f, -0.968f, 0.649f, 1.0f, -0.178f, 0.0f, -0.969f, 0.651f, 1.0f,
- -0.175f, 0.0f, -0.971f, 0.653f, 1.0f, -0.171f, 0.0f, -0.972f, 0.654f, 1.0f, -0.168f, 0.0f, -0.973f, 0.655f, 1.0f, -0.165f, 0.0f, -0.974f, 0.657f, 1.0f,
- -0.161f, 0.0f, -0.976f, 0.658f, 1.0f, -0.158f, 0.0f, -0.977f, 0.659f, 1.0f, -0.154f, 0.0f, -0.978f, 0.66f, 1.0f, -0.151f, 0.0f, -0.979f, 0.661f, 1.0f,
- -0.148f, 0.0f, -0.98f, 0.662f, 1.0f, -0.144f, 0.0f, -0.981f, 0.664f, 1.0f, -0.141f, 0.0f, -0.982f, 0.665f, 1.0f, -0.137f, 0.0f, -0.983f, 0.667f, 1.0f,
- -0.134f, 0.0f, -0.984f, 0.669f, 1.0f, -0.13f, 0.0f, -0.985f, 0.671f, 1.0f, -0.127f, 0.0f, -0.986f, 0.673f, 1.0f, -0.124f, 0.0f, -0.987f, 0.675f, 1.0f,
- -0.12f, 0.0f, -0.988f, 0.678f, 1.0f, -0.117f, 0.0f, -0.989f, 0.68f, 1.0f, -0.113f, 0.0f, -0.99f, 0.683f, 1.0f, -0.11f, 0.0f, -0.991f, 0.685f, 1.0f,
- -0.107f, 0.0f, -0.992f, 0.688f, 1.0f, -0.103f, 0.0f, -0.992f, 0.691f, 1.0f, -0.1f, 0.0f, -0.993f, 0.693f, 1.0f, -0.097f, 0.0f, -0.994f, 0.696f, 1.0f,
- -0.093f, 0.0f, -0.995f, 0.698f, 1.0f, -0.09f, 0.0f, -0.996f, 0.701f, 1.0f, -0.087f, 0.0f, -0.997f, 0.703f, 1.0f, -0.084f, 0.0f, -0.997f, 0.705f, 1.0f,
- -0.08f, 0.0f, -0.998f, 0.707f, 1.0f, -0.077f, 0.0f, -0.999f, 0.708f, 1.0f, -0.074f, 0.0f, -1.0f, 0.71f, 1.0f, -0.07f, 0.0f, -1.0f, 0.712f, 1.0f,
- -0.067f, 0.0f, -1.001f, 0.713f, 1.0f, -0.063f, 0.0f, -1.002f, 0.715f, 1.0f, -0.06f, 0.0f, -1.002f, 0.717f, 1.0f, -0.056f, 0.0f, -1.003f, 0.718f, 1.0f,
- -0.053f, 0.0f, -1.003f, 0.72f, 1.0f, -0.049f, 0.0f, -1.004f, 0.723f, 1.0f, -0.045f, 0.0f, -1.004f, 0.725f, 1.0f, -0.041f, 0.0f, -1.005f, 0.728f, 1.0f,
- -0.038f, 0.0f, -1.005f, 0.73f, 1.0f, -0.034f, 0.0f, -1.006f, 0.733f, 1.0f, -0.03f, 0.0f, -1.006f, 0.736f, 1.0f, -0.026f, 0.0f, -1.007f, 0.738f, 1.0f,
- -0.022f, 0.0f, -1.007f, 0.741f, 1.0f, -0.018f, 0.0f, -1.007f, 0.743f, 1.0f, -0.014f, 0.0f, -1.008f, 0.746f, 1.0f, -0.01f, 0.0f, -1.008f, 0.748f, 1.0f,
- -0.006f, 0.0f, -1.009f, 0.75f, 1.0f, -0.001f, 0.0f, -1.009f, 0.752f, 1.0f, 0.003f, 0.0f, -1.009f, 0.754f, 1.0f, 0.007f, 0.0f, -1.01f, 0.755f, 1.0f,
- 0.011f, 0.0f, -1.01f, 0.757f, 1.0f, 0.015f, 0.0f, -1.01f, 0.758f, 1.0f, 0.02f, 0.0f, -1.011f, 0.759f, 1.0f, 0.024f, 0.0f, -1.011f, 0.76f, 1.0f,
- 0.028f, 0.0f, -1.011f, 0.761f, 1.0f, 0.033f, 0.0f, -1.011f, 0.761f, 1.0f, 0.037f, 0.0f, -1.012f, 0.762f, 1.0f, 0.041f, 0.0f, -1.012f, 0.762f, 1.0f,
- 0.045f, 0.0f, -1.012f, 0.763f, 1.0f, 0.05f, 0.0f, -1.012f, 0.763f, 1.0f, 0.054f, 0.0f, -1.012f, 0.764f, 1.0f, 0.058f, 0.0f, -1.013f, 0.764f, 1.0f,
- 0.062f, 0.0f, -1.013f, 0.764f, 1.0f, 0.066f, 0.0f, -1.013f, 0.764f, 1.0f, 0.071f, 0.0f, -1.013f, 0.764f, 1.0f, 0.075f, 0.0f, -1.013f, 0.765f, 1.0f,
- 0.079f, 0.0f, -1.013f, 0.765f, 1.0f, 0.083f, 0.0f, -1.013f, 0.765f, 1.0f, 0.087f, 0.0f, -1.013f, 0.765f, 1.0f, 0.091f, 0.0f, -1.013f, 0.765f, 1.0f,
- 0.095f, 0.0f, -1.013f, 0.765f, 1.0f, 0.099f, 0.0f, -1.013f, 0.766f, 1.0f, 0.103f, 0.0f, -1.013f, 0.766f, 1.0f, 0.108f, 0.0f, -1.012f, 0.766f, 1.0f,
- 0.112f, 0.0f, -1.012f, 0.766f, 1.0f, 0.116f, 0.0f, -1.012f, 0.766f, 1.0f, 0.119f, 0.0f, -1.012f, 0.767f, 1.0f, 0.123f, 0.0f, -1.011f, 0.767f, 1.0f,
- 0.127f, 0.0f, -1.011f, 0.767f, 1.0f, 0.131f, 0.0f, -1.01f, 0.767f, 1.0f, 0.135f, 0.0f, -1.01f, 0.767f, 1.0f, 0.139f, 0.0f, -1.009f, 0.768f, 1.0f,
- 0.143f, 0.0f, -1.009f, 0.768f, 1.0f, 0.147f, 0.0f, -1.008f, 0.768f, 1.0f, 0.151f, 0.0f, -1.007f, 0.769f, 1.0f, 0.154f, 0.0f, -1.007f, 0.769f, 1.0f,
- 0.158f, 0.0f, -1.006f, 0.769f, 1.0f, 0.162f, 0.0f, -1.005f, 0.769f, 1.0f, 0.166f, 0.0f, -1.004f, 0.77f, 1.0f, 0.17f, 0.0f, -1.003f, 0.77f, 1.0f,
- 0.173f, 0.0f, -1.003f, 0.77f, 1.0f, 0.177f, 0.0f, -1.002f, 0.771f, 1.0f, 0.181f, 0.0f, -1.001f, 0.771f, 1.0f, 0.184f, 0.0f, -1.0f, 0.772f, 1.0f,
- 0.188f, 0.0f, -0.999f, 0.772f, 1.0f, 0.192f, 0.0f, -0.998f, 0.773f, 1.0f, 0.195f, 0.0f, -0.997f, 0.773f, 1.0f, 0.199f, 0.0f, -0.996f, 0.774f, 1.0f,
- 0.202f, 0.0f, -0.995f, 0.774f, 1.0f, 0.206f, 0.0f, -0.994f, 0.775f, 1.0f, 0.209f, 0.0f, -0.993f, 0.776f, 1.0f, 0.213f, 0.0f, -0.992f, 0.776f, 1.0f,
- 0.216f, 0.0f, -0.991f, 0.777f, 1.0f, 0.22f, 0.0f, -0.99f, 0.777f, 1.0f, 0.223f, 0.0f, -0.988f, 0.778f, 1.0f, 0.227f, 0.0f, -0.987f, 0.778f, 1.0f,
- 0.23f, 0.0f, -0.986f, 0.778f, 1.0f, 0.233f, 0.0f, -0.985f, 0.779f, 1.0f, 0.237f, 0.0f, -0.983f, 0.779f, 1.0f, 0.24f, 0.0f, -0.982f, 0.779f, 1.0f,
- 0.243f, 0.0f, -0.981f, 0.779f, 1.0f, 0.246f, 0.0f, -0.979f, 0.778f, 1.0f, 0.249f, 0.0f, -0.978f, 0.778f, 1.0f, 0.252f, 0.0f, -0.976f, 0.777f, 1.0f,
- 0.255f, 0.0f, -0.975f, 0.777f, 1.0f, 0.258f, 0.0f, -0.973f, 0.776f, 1.0f, 0.261f, 0.0f, -0.972f, 0.775f, 1.0f, 0.264f, 0.0f, -0.97f, 0.773f, 1.0f,
- 0.267f, 0.0f, -0.968f, 0.772f, 1.0f, 0.269f, 0.0f, -0.967f, 0.77f, 1.0f, 0.272f, 0.0f, -0.965f, 0.769f, 1.0f, 0.275f, 0.0f, -0.963f, 0.767f, 1.0f,
- 0.277f, 0.0f, -0.961f, 0.765f, 1.0f, 0.279f, 0.0f, -0.959f, 0.763f, 1.0f, 0.282f, 0.0f, -0.957f, 0.761f, 1.0f, 0.284f, 0.0f, -0.955f, 0.759f, 1.0f,
- 0.286f, 0.0f, -0.953f, 0.756f, 1.0f, 0.288f, 0.0f, -0.951f, 0.754f, 1.0f, 0.29f, 0.0f, -0.948f, 0.752f, 1.0f, 0.292f, 0.0f, -0.946f, 0.749f, 1.0f,
- 0.294f, 0.0f, -0.944f, 0.746f, 1.0f, 0.296f, 0.0f, -0.941f, 0.744f, 1.0f, 0.298f, 0.0f, -0.939f, 0.741f, 1.0f, 0.3f, 0.0f, -0.937f, 0.738f, 1.0f,
- 0.302f, 0.0f, -0.934f, 0.736f, 1.0f, 0.303f, 0.0f, -0.932f, 0.733f, 1.0f, 0.305f, 0.0f, -0.929f, 0.73f, 1.0f, 0.306f, 0.0f, -0.926f, 0.727f, 1.0f,
- 0.308f, 0.0f, -0.924f, 0.724f, 1.0f, 0.309f, 0.0f, -0.921f, 0.721f, 1.0f, 0.311f, 0.0f, -0.918f, 0.719f, 1.0f, 0.312f, 0.0f, -0.916f, 0.716f, 1.0f,
- 0.313f, 0.0f, -0.913f, 0.713f, 1.0f, 0.315f, 0.0f, -0.91f, 0.71f, 1.0f, 0.316f, 0.0f, -0.907f, 0.707f, 1.0f, 0.317f, 0.0f, -0.904f, 0.704f, 1.0f,
- 0.318f, 0.0f, -0.901f, 0.7f, 1.0f, 0.319f, 0.0f, -0.898f, 0.697f, 1.0f, 0.32f, 0.0f, -0.895f, 0.693f, 1.0f, 0.321f, 0.0f, -0.892f, 0.69f, 1.0f,
- 0.322f, 0.0f, -0.889f, 0.686f, 1.0f, 0.323f, 0.0f, -0.886f, 0.681f, 1.0f, 0.324f, 0.0f, -0.883f, 0.677f, 1.0f, 0.325f, 0.0f, -0.88f, 0.672f, 1.0f,
- 0.326f, 0.0f, -0.876f, 0.667f, 1.0f, 0.326f, 0.0f, -0.873f, 0.661f, 1.0f, 0.327f, 0.0f, -0.87f, 0.655f, 1.0f, 0.328f, 0.0f, -0.867f, 0.649f, 1.0f,
- 0.329f, 0.0f, -0.864f, 0.643f, 1.0f, 0.329f, 0.0f, -0.861f, 0.637f, 1.0f, 0.33f, 0.0f, -0.857f, 0.63f, 1.0f, 0.331f, 0.0f, -0.854f, 0.624f, 1.0f,
- 0.331f, 0.0f, -0.851f, 0.618f, 1.0f, 0.332f, 0.0f, -0.848f, 0.613f, 1.0f, 0.333f, 0.0f, -0.845f, 0.607f, 1.0f, 0.333f, 0.0f, -0.841f, 0.603f, 1.0f,
- 0.334f, 0.0f, -0.838f, 0.598f, 1.0f, 0.334f, 0.0f, -0.835f, 0.594f, 1.0f, 0.335f, 0.0f, -0.832f, 0.591f, 1.0f, 0.335f, 0.0f, -0.828f, 0.588f, 1.0f,
- 0.335f, 0.0f, -0.825f, 0.586f, 1.0f, 0.336f, 0.0f, -0.821f, 0.584f, 1.0f, 0.336f, 0.0f, -0.818f, 0.582f, 1.0f, 0.336f, 0.0f, -0.814f, 0.581f, 1.0f,
- 0.337f, 0.0f, -0.811f, 0.58f, 1.0f, 0.337f, 0.0f, -0.807f, 0.58f, 1.0f, 0.337f, 0.0f, -0.803f, 0.579f, 1.0f, 0.337f, 0.0f, -0.799f, 0.579f, 1.0f,
- 0.337f, 0.0f, -0.795f, 0.578f, 1.0f, 0.337f, 0.0f, -0.79f, 0.578f, 1.0f, 0.337f, 0.0f, -0.786f, 0.578f, 1.0f, 0.338f, 0.0f, -0.782f, 0.577f, 1.0f,
- 0.338f, 0.0f, -0.777f, 0.576f, 1.0f, 0.337f, 0.0f, -0.772f, 0.574f, 1.0f, 0.337f, 0.0f, -0.767f, 0.572f, 1.0f, 0.337f, 0.0f, -0.762f, 0.569f, 1.0f,
- 0.337f, 0.0f, -0.756f, 0.565f, 1.0f, 0.337f, 0.0f, -0.751f, 0.559f, 1.0f, 0.337f, 0.0f, -0.745f, 0.553f, 1.0f, 0.336f, 0.0f, -0.739f, 0.544f, 1.0f,
- 0.336f, 0.0f, -0.732f, 0.534f, 1.0f, 0.335f, 0.0f, -0.725f, 0.521f, 1.0f, 0.334f, 0.0f, -0.718f, 0.505f, 1.0f, 0.333f, 0.0f, -0.711f, 0.487f, 1.0f,
- 0.332f, 0.0f, -0.703f, 0.466f, 1.0f, 0.331f, 0.0f, -0.694f, 0.441f, 1.0f, 0.33f, 0.0f, -0.686f, 0.413f, 1.0f, 0.328f, 0.0f, -0.677f, 0.383f, 1.0f,
- 0.326f, 0.0f, -0.667f, 0.35f, 1.0f, 0.325f, 0.0f, -0.657f, 0.316f, 1.0f, 0.323f, 0.0f, -0.647f, 0.281f, 1.0f, 0.32f, 0.0f, -0.636f, 0.246f, 1.0f,
- 0.318f, 0.0f, -0.625f, 0.212f, 1.0f, 0.316f, 0.0f, -0.614f, 0.18f, 1.0f, 0.313f, 0.0f, -0.603f, 0.149f, 1.0f, 0.311f, 0.0f, -0.592f, 0.12f, 1.0f,
- 0.308f, 0.0f, -0.581f, 0.093f, 1.0f, 0.306f, 0.0f, -0.57f, 0.069f, 1.0f, 0.303f, 0.0f, -0.559f, 0.046f, 1.0f, 0.301f, 0.0f, -0.55f, 0.027f, 1.0f,
- 0.298f, 0.0f, -0.537f, 0.0f, 1.0f,
+static const float data18[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.1119f, 0.0f, -0.7868f, 0.1f, 1.0f,
+ -0.1087f, 0.0f, -0.7905f, 0.2199f, 1.0f,
+ -0.1022f, 0.0f, -0.7974f, 0.4615f, 1.0f,
+ -0.0955f, 0.0f, -0.8038f, 0.6019f, 1.0f,
+ -0.0886f, 0.0f, -0.8097f, 0.6981f, 1.0f,
+ -0.0816f, 0.0f, -0.8152f, 0.7689f, 1.0f,
+ -0.0744f, 0.0f, -0.8201f, 0.8236f, 1.0f,
+ -0.0671f, 0.0f, -0.8246f, 0.866f, 1.0f,
+ -0.0597f, 0.0f, -0.8286f, 0.9003f, 1.0f,
+ -0.0522f, 0.0f, -0.8321f, 0.9272f, 1.0f,
+ -0.0446f, 0.0f, -0.8351f, 0.9485f, 1.0f,
+ -0.0369f, 0.0f, -0.8376f, 0.9653f, 1.0f,
+ -0.0292f, 0.0f, -0.8397f, 0.9781f, 1.0f,
+ -0.0214f, 0.0f, -0.8413f, 0.9876f, 1.0f,
+ -0.0136f, 0.0f, -0.8424f, 0.9942f, 1.0f,
+ -0.0057f, 0.0f, -0.843f, 0.9983f, 1.0f,
+ 0.0022f, 0.0f, -0.8431f, 0.9997f, 1.0f,
+ 0.01f, 0.0f, -0.8428f, 0.999f, 1.0f,
+ 0.0178f, 0.0f, -0.8419f, 0.9963f, 1.0f,
+ 0.0257f, 0.0f, -0.8407f, 0.9912f, 1.0f,
+ 0.0334f, 0.0f, -0.8389f, 0.9834f, 1.0f,
+ 0.0411f, 0.0f, -0.8366f, 0.9724f, 1.0f,
+ 0.0488f, 0.0f, -0.8339f, 0.9576f, 1.0f,
+ 0.0564f, 0.0f, -0.8308f, 0.9385f, 1.0f,
+ 0.0638f, 0.0f, -0.8271f, 0.9143f, 1.0f,
+ 0.0712f, 0.0f, -0.823f, 0.8841f, 1.0f,
+ 0.0785f, 0.0f, -0.8184f, 0.8461f, 1.0f,
+ 0.0856f, 0.0f, -0.8134f, 0.7979f, 1.0f,
+ 0.0925f, 0.0f, -0.8079f, 0.7359f, 1.0f,
+ 0.0994f, 0.0f, -0.8019f, 0.6541f, 1.0f,
+ 0.106f, 0.0f, -0.7954f, 0.5396f, 1.0f,
+ 0.1125f, 0.0f, -0.7885f, 0.36f, 1.0f,
+ 0.1187f, 0.0f, -0.7812f, 0.1f, 1.0f,
};
-static const float data26[41 * GP_PRIM_DATABUF_SIZE] = {
- -0.104f, 0.0f, -0.795f, 0.258f, 1.0f, -0.1f, 0.0f, -0.799f, 0.28f, 1.0f, -0.097f, 0.0f, -0.801f, 0.294f, 1.0f, -0.094f, 0.0f, -0.805f, 0.312f, 1.0f,
- -0.09f, 0.0f, -0.808f, 0.328f, 1.0f, -0.086f, 0.0f, -0.811f, 0.345f, 1.0f, -0.082f, 0.0f, -0.815f, 0.361f, 1.0f, -0.078f, 0.0f, -0.818f, 0.377f, 1.0f,
- -0.073f, 0.0f, -0.821f, 0.392f, 1.0f, -0.068f, 0.0f, -0.824f, 0.407f, 1.0f, -0.063f, 0.0f, -0.827f, 0.421f, 1.0f, -0.057f, 0.0f, -0.83f, 0.435f, 1.0f,
- -0.051f, 0.0f, -0.833f, 0.448f, 1.0f, -0.045f, 0.0f, -0.835f, 0.46f, 1.0f, -0.039f, 0.0f, -0.837f, 0.471f, 1.0f, -0.033f, 0.0f, -0.839f, 0.481f, 1.0f,
- -0.026f, 0.0f, -0.841f, 0.491f, 1.0f, -0.019f, 0.0f, -0.842f, 0.5f, 1.0f, -0.012f, 0.0f, -0.843f, 0.508f, 1.0f, -0.005f, 0.0f, -0.843f, 0.515f, 1.0f,
- 0.002f, 0.0f, -0.843f, 0.522f, 1.0f, 0.009f, 0.0f, -0.843f, 0.527f, 1.0f, 0.016f, 0.0f, -0.842f, 0.532f, 1.0f, 0.023f, 0.0f, -0.841f, 0.535f, 1.0f,
- 0.03f, 0.0f, -0.839f, 0.538f, 1.0f, 0.037f, 0.0f, -0.837f, 0.538f, 1.0f, 0.044f, 0.0f, -0.835f, 0.537f, 1.0f, 0.05f, 0.0f, -0.833f, 0.532f, 1.0f,
- 0.056f, 0.0f, -0.83f, 0.524f, 1.0f, 0.062f, 0.0f, -0.827f, 0.513f, 1.0f, 0.068f, 0.0f, -0.823f, 0.496f, 1.0f, 0.074f, 0.0f, -0.82f, 0.474f, 1.0f,
- 0.079f, 0.0f, -0.817f, 0.446f, 1.0f, 0.084f, 0.0f, -0.813f, 0.411f, 1.0f, 0.089f, 0.0f, -0.809f, 0.37f, 1.0f, 0.093f, 0.0f, -0.806f, 0.323f, 1.0f,
- 0.098f, 0.0f, -0.802f, 0.269f, 1.0f, 0.102f, 0.0f, -0.798f, 0.211f, 1.0f, 0.106f, 0.0f, -0.795f, 0.146f, 1.0f, 0.109f, 0.0f, -0.792f, 0.089f, 1.0f,
- 0.114f, 0.0f, -0.787f, 0.0f, 1.0f,
+static const float data19[34 * GP_PRIM_DATABUF_SIZE] = {
+ -0.1119f, 0.0f, -0.2655f, 0.1f, 1.0f,
+ -0.1101f, 0.0f, -0.2605f, 0.1288f, 1.0f,
+ -0.1032f, 0.0f, -0.2424f, 0.4147f, 1.0f,
+ -0.0965f, 0.0f, -0.2276f, 0.5723f, 1.0f,
+ -0.0901f, 0.0f, -0.2158f, 0.6768f, 1.0f,
+ -0.0837f, 0.0f, -0.2069f, 0.753f, 1.0f,
+ -0.0775f, 0.0f, -0.2006f, 0.8109f, 1.0f,
+ -0.0712f, 0.0f, -0.1967f, 0.8564f, 1.0f,
+ -0.065f, 0.0f, -0.1949f, 0.8922f, 1.0f,
+ -0.0587f, 0.0f, -0.195f, 0.9211f, 1.0f,
+ -0.0522f, 0.0f, -0.1968f, 0.944f, 1.0f,
+ -0.0455f, 0.0f, -0.2001f, 0.9617f, 1.0f,
+ -0.0386f, 0.0f, -0.2046f, 0.9755f, 1.0f,
+ -0.0315f, 0.0f, -0.21f, 0.9858f, 1.0f,
+ -0.0239f, 0.0f, -0.2163f, 0.993f, 1.0f,
+ -0.016f, 0.0f, -0.223f, 0.9973f, 1.0f,
+ -0.0075f, 0.0f, -0.2301f, 0.9993f, 1.0f,
+ -0.0002f, 0.0f, -0.2342f, 0.9993f, 1.0f,
+ 0.0054f, 0.0f, -0.234f, 0.9973f, 1.0f,
+ 0.0106f, 0.0f, -0.2324f, 0.993f, 1.0f,
+ 0.0155f, 0.0f, -0.2297f, 0.9858f, 1.0f,
+ 0.0202f, 0.0f, -0.2261f, 0.9755f, 1.0f,
+ 0.0249f, 0.0f, -0.2219f, 0.9617f, 1.0f,
+ 0.0296f, 0.0f, -0.2174f, 0.944f, 1.0f,
+ 0.0344f, 0.0f, -0.2128f, 0.9211f, 1.0f,
+ 0.0394f, 0.0f, -0.2084f, 0.8922f, 1.0f,
+ 0.0448f, 0.0f, -0.2044f, 0.8564f, 1.0f,
+ 0.0506f, 0.0f, -0.2012f, 0.8109f, 1.0f,
+ 0.057f, 0.0f, -0.1988f, 0.753f, 1.0f,
+ 0.064f, 0.0f, -0.1977f, 0.6768f, 1.0f,
+ 0.0717f, 0.0f, -0.198f, 0.5723f, 1.0f,
+ 0.0804f, 0.0f, -0.2001f, 0.4147f, 1.0f,
+ 0.0899f, 0.0f, -0.2042f, 0.1288f, 1.0f,
+ 0.0925f, 0.0f, -0.2055f, 0.1f, 1.0f,
};
-static const float data27[77 * GP_PRIM_DATABUF_SIZE] = {
- -0.105f, 0.0f, -0.259f, 0.214f, 1.0f, -0.103f, 0.0f, -0.253f, 0.263f, 1.0f, -0.101f, 0.0f, -0.249f, 0.291f, 1.0f, -0.099f, 0.0f, -0.244f, 0.324f, 1.0f,
- -0.098f, 0.0f, -0.24f, 0.351f, 1.0f, -0.096f, 0.0f, -0.235f, 0.376f, 1.0f, -0.094f, 0.0f, -0.231f, 0.397f, 1.0f, -0.092f, 0.0f, -0.227f, 0.416f, 1.0f,
- -0.09f, 0.0f, -0.222f, 0.432f, 1.0f, -0.088f, 0.0f, -0.218f, 0.446f, 1.0f, -0.086f, 0.0f, -0.215f, 0.458f, 1.0f, -0.084f, 0.0f, -0.211f, 0.469f, 1.0f,
- -0.082f, 0.0f, -0.208f, 0.478f, 1.0f, -0.079f, 0.0f, -0.205f, 0.486f, 1.0f, -0.077f, 0.0f, -0.203f, 0.494f, 1.0f, -0.075f, 0.0f, -0.2f, 0.501f, 1.0f,
- -0.073f, 0.0f, -0.198f, 0.508f, 1.0f, -0.071f, 0.0f, -0.197f, 0.515f, 1.0f, -0.068f, 0.0f, -0.195f, 0.521f, 1.0f, -0.066f, 0.0f, -0.194f, 0.528f, 1.0f,
- -0.064f, 0.0f, -0.194f, 0.534f, 1.0f, -0.061f, 0.0f, -0.194f, 0.54f, 1.0f, -0.059f, 0.0f, -0.194f, 0.546f, 1.0f, -0.056f, 0.0f, -0.194f, 0.551f, 1.0f,
- -0.054f, 0.0f, -0.195f, 0.555f, 1.0f, -0.051f, 0.0f, -0.196f, 0.559f, 1.0f, -0.049f, 0.0f, -0.198f, 0.562f, 1.0f, -0.046f, 0.0f, -0.2f, 0.565f, 1.0f,
- -0.044f, 0.0f, -0.201f, 0.567f, 1.0f, -0.041f, 0.0f, -0.204f, 0.568f, 1.0f, -0.039f, 0.0f, -0.206f, 0.569f, 1.0f, -0.036f, 0.0f, -0.208f, 0.57f, 1.0f,
- -0.034f, 0.0f, -0.21f, 0.571f, 1.0f, -0.032f, 0.0f, -0.213f, 0.571f, 1.0f, -0.029f, 0.0f, -0.215f, 0.571f, 1.0f, -0.027f, 0.0f, -0.217f, 0.572f, 1.0f,
- -0.024f, 0.0f, -0.219f, 0.572f, 1.0f, -0.022f, 0.0f, -0.221f, 0.572f, 1.0f, -0.019f, 0.0f, -0.222f, 0.572f, 1.0f, -0.016f, 0.0f, -0.224f, 0.572f, 1.0f,
- -0.013f, 0.0f, -0.225f, 0.572f, 1.0f, -0.01f, 0.0f, -0.226f, 0.573f, 1.0f, -0.007f, 0.0f, -0.227f, 0.573f, 1.0f, -0.004f, 0.0f, -0.227f, 0.573f, 1.0f,
- -0.001f, 0.0f, -0.227f, 0.574f, 1.0f, 0.002f, 0.0f, -0.227f, 0.575f, 1.0f, 0.005f, 0.0f, -0.227f, 0.576f, 1.0f, 0.008f, 0.0f, -0.226f, 0.577f, 1.0f,
- 0.011f, 0.0f, -0.225f, 0.578f, 1.0f, 0.015f, 0.0f, -0.224f, 0.579f, 1.0f, 0.018f, 0.0f, -0.222f, 0.58f, 1.0f, 0.021f, 0.0f, -0.221f, 0.581f, 1.0f,
- 0.024f, 0.0f, -0.219f, 0.582f, 1.0f, 0.027f, 0.0f, -0.217f, 0.582f, 1.0f, 0.03f, 0.0f, -0.215f, 0.583f, 1.0f, 0.033f, 0.0f, -0.213f, 0.583f, 1.0f,
- 0.036f, 0.0f, -0.212f, 0.583f, 1.0f, 0.039f, 0.0f, -0.21f, 0.583f, 1.0f, 0.042f, 0.0f, -0.208f, 0.583f, 1.0f, 0.045f, 0.0f, -0.207f, 0.583f, 1.0f,
- 0.048f, 0.0f, -0.205f, 0.583f, 1.0f, 0.051f, 0.0f, -0.204f, 0.583f, 1.0f, 0.054f, 0.0f, -0.203f, 0.583f, 1.0f, 0.058f, 0.0f, -0.203f, 0.583f, 1.0f,
- 0.061f, 0.0f, -0.202f, 0.583f, 1.0f, 0.064f, 0.0f, -0.202f, 0.574f, 1.0f, 0.067f, 0.0f, -0.202f, 0.565f, 1.0f, 0.07f, 0.0f, -0.203f, 0.556f, 1.0f,
- 0.073f, 0.0f, -0.203f, 0.547f, 1.0f, 0.075f, 0.0f, -0.204f, 0.515f, 1.0f, 0.078f, 0.0f, -0.204f, 0.483f, 1.0f, 0.08f, 0.0f, -0.205f, 0.451f, 1.0f,
- 0.083f, 0.0f, -0.206f, 0.419f, 1.0f, 0.085f, 0.0f, -0.207f, 0.314f, 1.0f, 0.087f, 0.0f, -0.208f, 0.21f, 1.0f, 0.089f, 0.0f, -0.209f, 0.105f, 1.0f,
- 0.091f, 0.0f, -0.21f, 0.0f, 1.0f,
+static const float data20[33 * GP_PRIM_DATABUF_SIZE] = {
+ 0.7993f, 0.0f, 0.3242f, 0.1f, 1.0f,
+ 0.8169f, 0.0f, 0.3354f, 0.2199f, 1.0f,
+ 0.8512f, 0.0f, 0.3542f, 0.4615f, 1.0f,
+ 0.884f, 0.0f, 0.3686f, 0.6019f, 1.0f,
+ 0.9153f, 0.0f, 0.3787f, 0.6981f, 1.0f,
+ 0.945f, 0.0f, 0.3848f, 0.7689f, 1.0f,
+ 0.9729f, 0.0f, 0.3871f, 0.8236f, 1.0f,
+ 0.9989f, 0.0f, 0.3857f, 0.866f, 1.0f,
+ 1.0229f, 0.0f, 0.3811f, 0.9003f, 1.0f,
+ 1.0447f, 0.0f, 0.3732f, 0.9272f, 1.0f,
+ 1.0643f, 0.0f, 0.3624f, 0.9485f, 1.0f,
+ 1.0814f, 0.0f, 0.349f, 0.9653f, 1.0f,
+ 1.096f, 0.0f, 0.333f, 0.9781f, 1.0f,
+ 1.108f, 0.0f, 0.3147f, 0.9876f, 1.0f,
+ 1.1172f, 0.0f, 0.2944f, 0.9942f, 1.0f,
+ 1.1235f, 0.0f, 0.2723f, 0.9983f, 1.0f,
+ 1.1267f, 0.0f, 0.2485f, 0.9997f, 1.0f,
+ 1.1269f, 0.0f, 0.2233f, 0.999f, 1.0f,
+ 1.1237f, 0.0f, 0.197f, 0.9963f, 1.0f,
+ 1.1172f, 0.0f, 0.1697f, 0.9912f, 1.0f,
+ 1.1071f, 0.0f, 0.1417f, 0.9834f, 1.0f,
+ 1.0934f, 0.0f, 0.1131f, 0.9724f, 1.0f,
+ 1.0759f, 0.0f, 0.0842f, 0.9576f, 1.0f,
+ 1.0545f, 0.0f, 0.0553f, 0.9385f, 1.0f,
+ 1.0291f, 0.0f, 0.0265f, 0.9143f, 1.0f,
+ 0.9995f, 0.0f, -0.0019f, 0.8841f, 1.0f,
+ 0.9657f, 0.0f, -0.0298f, 0.8461f, 1.0f,
+ 0.9275f, 0.0f, -0.0569f, 0.7979f, 1.0f,
+ 0.8847f, 0.0f, -0.0829f, 0.7359f, 1.0f,
+ 0.8373f, 0.0f, -0.1077f, 0.6541f, 1.0f,
+ 0.7852f, 0.0f, -0.1311f, 0.5396f, 1.0f,
+ 0.7281f, 0.0f, -0.1528f, 0.36f, 1.0f,
+ 0.6661f, 0.0f, -0.1725f, 0.1f, 1.0f,
};
-static const float data28[257 * GP_PRIM_DATABUF_SIZE] = {
- -0.637f, 0.0f, -0.172f, 0.0f, 1.0f, -0.641f, 0.0f, -0.172f, 0.0f, 1.0f, -0.643f, 0.0f, -0.172f, 0.0f, 1.0f, -0.646f, 0.0f, -0.172f, 0.0f, 1.0f,
- -0.65f, 0.0f, -0.172f, 0.0f, 1.0f, -0.653f, 0.0f, -0.172f, 0.0f, 1.0f, -0.657f, 0.0f, -0.172f, 0.0f, 1.0f, -0.66f, 0.0f, -0.172f, 0.0f, 1.0f,
- -0.664f, 0.0f, -0.171f, 0.0f, 1.0f, -0.668f, 0.0f, -0.171f, 0.0f, 1.0f, -0.672f, 0.0f, -0.171f, 0.0f, 1.0f, -0.677f, 0.0f, -0.171f, 0.0f, 1.0f,
- -0.681f, 0.0f, -0.171f, 0.0f, 1.0f, -0.685f, 0.0f, -0.171f, 0.0f, 1.0f, -0.69f, 0.0f, -0.17f, 0.0f, 1.0f, -0.694f, 0.0f, -0.17f, 0.0f, 1.0f,
- -0.699f, 0.0f, -0.17f, 0.0f, 1.0f, -0.704f, 0.0f, -0.169f, 0.0f, 1.0f, -0.708f, 0.0f, -0.169f, 0.0f, 1.0f, -0.713f, 0.0f, -0.168f, 0.0f, 1.0f,
- -0.717f, 0.0f, -0.168f, 0.0f, 1.0f, -0.722f, 0.0f, -0.167f, 0.0f, 1.0f, -0.727f, 0.0f, -0.167f, 0.0f, 1.0f, -0.731f, 0.0f, -0.166f, 0.0f, 1.0f,
- -0.735f, 0.0f, -0.166f, 0.0f, 1.0f, -0.74f, 0.0f, -0.165f, 0.0f, 1.0f, -0.744f, 0.0f, -0.164f, 0.0f, 1.0f, -0.749f, 0.0f, -0.163f, 0.0f, 1.0f,
- -0.753f, 0.0f, -0.163f, 0.0f, 1.0f, -0.757f, 0.0f, -0.162f, 0.0f, 1.0f, -0.761f, 0.0f, -0.161f, 0.0f, 1.0f, -0.765f, 0.0f, -0.16f, 0.0f, 1.0f,
- -0.769f, 0.0f, -0.159f, 0.0f, 1.0f, -0.773f, 0.0f, -0.158f, 0.0f, 1.0f, -0.777f, 0.0f, -0.157f, 0.0f, 1.0f, -0.781f, 0.0f, -0.156f, 0.001f, 1.0f,
- -0.785f, 0.0f, -0.155f, 0.001f, 1.0f, -0.789f, 0.0f, -0.154f, 0.002f, 1.0f, -0.793f, 0.0f, -0.153f, 0.003f, 1.0f, -0.797f, 0.0f, -0.152f, 0.004f, 1.0f,
- -0.801f, 0.0f, -0.15f, 0.005f, 1.0f, -0.805f, 0.0f, -0.149f, 0.006f, 1.0f, -0.81f, 0.0f, -0.147f, 0.008f, 1.0f, -0.814f, 0.0f, -0.146f, 0.009f, 1.0f,
- -0.818f, 0.0f, -0.144f, 0.011f, 1.0f, -0.823f, 0.0f, -0.143f, 0.014f, 1.0f, -0.827f, 0.0f, -0.141f, 0.016f, 1.0f, -0.831f, 0.0f, -0.139f, 0.019f, 1.0f,
- -0.836f, 0.0f, -0.138f, 0.022f, 1.0f, -0.84f, 0.0f, -0.136f, 0.024f, 1.0f, -0.844f, 0.0f, -0.135f, 0.026f, 1.0f, -0.849f, 0.0f, -0.133f, 0.027f, 1.0f,
- -0.853f, 0.0f, -0.131f, 0.027f, 1.0f, -0.857f, 0.0f, -0.13f, 0.027f, 1.0f, -0.861f, 0.0f, -0.128f, 0.027f, 1.0f, -0.865f, 0.0f, -0.126f, 0.027f, 1.0f,
- -0.868f, 0.0f, -0.125f, 0.026f, 1.0f, -0.872f, 0.0f, -0.123f, 0.025f, 1.0f, -0.876f, 0.0f, -0.121f, 0.025f, 1.0f, -0.879f, 0.0f, -0.119f, 0.024f, 1.0f,
- -0.883f, 0.0f, -0.118f, 0.023f, 1.0f, -0.886f, 0.0f, -0.116f, 0.022f, 1.0f, -0.89f, 0.0f, -0.114f, 0.022f, 1.0f, -0.894f, 0.0f, -0.112f, 0.021f, 1.0f,
- -0.898f, 0.0f, -0.11f, 0.022f, 1.0f, -0.901f, 0.0f, -0.107f, 0.022f, 1.0f, -0.905f, 0.0f, -0.105f, 0.024f, 1.0f, -0.909f, 0.0f, -0.103f, 0.026f, 1.0f,
- -0.913f, 0.0f, -0.1f, 0.029f, 1.0f, -0.917f, 0.0f, -0.098f, 0.032f, 1.0f, -0.921f, 0.0f, -0.095f, 0.035f, 1.0f, -0.926f, 0.0f, -0.092f, 0.039f, 1.0f,
- -0.93f, 0.0f, -0.09f, 0.043f, 1.0f, -0.934f, 0.0f, -0.087f, 0.047f, 1.0f, -0.938f, 0.0f, -0.084f, 0.051f, 1.0f, -0.942f, 0.0f, -0.081f, 0.055f, 1.0f,
- -0.946f, 0.0f, -0.078f, 0.06f, 1.0f, -0.95f, 0.0f, -0.075f, 0.065f, 1.0f, -0.954f, 0.0f, -0.073f, 0.07f, 1.0f, -0.958f, 0.0f, -0.07f, 0.075f, 1.0f,
- -0.961f, 0.0f, -0.067f, 0.081f, 1.0f, -0.965f, 0.0f, -0.064f, 0.087f, 1.0f, -0.968f, 0.0f, -0.061f, 0.092f, 1.0f, -0.972f, 0.0f, -0.058f, 0.098f, 1.0f,
- -0.975f, 0.0f, -0.055f, 0.103f, 1.0f, -0.979f, 0.0f, -0.053f, 0.108f, 1.0f, -0.982f, 0.0f, -0.05f, 0.112f, 1.0f, -0.985f, 0.0f, -0.047f, 0.116f, 1.0f,
- -0.988f, 0.0f, -0.045f, 0.12f, 1.0f, -0.991f, 0.0f, -0.042f, 0.123f, 1.0f, -0.994f, 0.0f, -0.039f, 0.126f, 1.0f, -0.997f, 0.0f, -0.037f, 0.129f, 1.0f,
- -1.0f, 0.0f, -0.034f, 0.131f, 1.0f, -1.003f, 0.0f, -0.031f, 0.133f, 1.0f, -1.005f, 0.0f, -0.029f, 0.135f, 1.0f, -1.008f, 0.0f, -0.026f, 0.137f, 1.0f,
- -1.01f, 0.0f, -0.024f, 0.139f, 1.0f, -1.013f, 0.0f, -0.021f, 0.141f, 1.0f, -1.016f, 0.0f, -0.018f, 0.143f, 1.0f, -1.018f, 0.0f, -0.016f, 0.144f, 1.0f,
- -1.02f, 0.0f, -0.013f, 0.146f, 1.0f, -1.023f, 0.0f, -0.011f, 0.148f, 1.0f, -1.025f, 0.0f, -0.008f, 0.149f, 1.0f, -1.027f, 0.0f, -0.006f, 0.151f, 1.0f,
- -1.029f, 0.0f, -0.003f, 0.152f, 1.0f, -1.032f, 0.0f, -0.001f, 0.154f, 1.0f, -1.034f, 0.0f, 0.001f, 0.154f, 1.0f, -1.036f, 0.0f, 0.004f, 0.155f, 1.0f,
- -1.038f, 0.0f, 0.006f, 0.156f, 1.0f, -1.041f, 0.0f, 0.008f, 0.156f, 1.0f, -1.043f, 0.0f, 0.01f, 0.157f, 1.0f, -1.045f, 0.0f, 0.013f, 0.157f, 1.0f,
- -1.047f, 0.0f, 0.015f, 0.157f, 1.0f, -1.049f, 0.0f, 0.018f, 0.158f, 1.0f, -1.051f, 0.0f, 0.02f, 0.158f, 1.0f, -1.053f, 0.0f, 0.023f, 0.158f, 1.0f,
- -1.055f, 0.0f, 0.025f, 0.158f, 1.0f, -1.057f, 0.0f, 0.028f, 0.158f, 1.0f, -1.059f, 0.0f, 0.03f, 0.158f, 1.0f, -1.061f, 0.0f, 0.033f, 0.158f, 1.0f,
- -1.063f, 0.0f, 0.036f, 0.158f, 1.0f, -1.065f, 0.0f, 0.038f, 0.158f, 1.0f, -1.067f, 0.0f, 0.041f, 0.158f, 1.0f, -1.069f, 0.0f, 0.044f, 0.157f, 1.0f,
- -1.071f, 0.0f, 0.047f, 0.157f, 1.0f, -1.073f, 0.0f, 0.049f, 0.156f, 1.0f, -1.074f, 0.0f, 0.052f, 0.155f, 1.0f, -1.076f, 0.0f, 0.055f, 0.154f, 1.0f,
- -1.078f, 0.0f, 0.058f, 0.153f, 1.0f, -1.08f, 0.0f, 0.061f, 0.152f, 1.0f, -1.082f, 0.0f, 0.064f, 0.15f, 1.0f, -1.083f, 0.0f, 0.067f, 0.148f, 1.0f,
- -1.085f, 0.0f, 0.07f, 0.146f, 1.0f, -1.087f, 0.0f, 0.073f, 0.144f, 1.0f, -1.089f, 0.0f, 0.076f, 0.142f, 1.0f, -1.091f, 0.0f, 0.08f, 0.14f, 1.0f,
- -1.092f, 0.0f, 0.083f, 0.138f, 1.0f, -1.094f, 0.0f, 0.086f, 0.136f, 1.0f, -1.096f, 0.0f, 0.09f, 0.135f, 1.0f, -1.097f, 0.0f, 0.093f, 0.134f, 1.0f,
- -1.099f, 0.0f, 0.096f, 0.134f, 1.0f, -1.101f, 0.0f, 0.1f, 0.134f, 1.0f, -1.103f, 0.0f, 0.103f, 0.136f, 1.0f, -1.104f, 0.0f, 0.107f, 0.139f, 1.0f,
- -1.106f, 0.0f, 0.111f, 0.144f, 1.0f, -1.107f, 0.0f, 0.114f, 0.15f, 1.0f, -1.109f, 0.0f, 0.118f, 0.158f, 1.0f, -1.11f, 0.0f, 0.122f, 0.167f, 1.0f,
- -1.111f, 0.0f, 0.126f, 0.178f, 1.0f, -1.113f, 0.0f, 0.13f, 0.191f, 1.0f, -1.114f, 0.0f, 0.134f, 0.205f, 1.0f, -1.115f, 0.0f, 0.138f, 0.22f, 1.0f,
- -1.116f, 0.0f, 0.142f, 0.237f, 1.0f, -1.117f, 0.0f, 0.146f, 0.254f, 1.0f, -1.118f, 0.0f, 0.15f, 0.272f, 1.0f, -1.119f, 0.0f, 0.155f, 0.291f, 1.0f,
- -1.119f, 0.0f, 0.159f, 0.31f, 1.0f, -1.12f, 0.0f, 0.163f, 0.329f, 1.0f, -1.121f, 0.0f, 0.167f, 0.348f, 1.0f, -1.121f, 0.0f, 0.172f, 0.367f, 1.0f,
- -1.122f, 0.0f, 0.176f, 0.386f, 1.0f, -1.122f, 0.0f, 0.18f, 0.405f, 1.0f, -1.123f, 0.0f, 0.184f, 0.423f, 1.0f, -1.123f, 0.0f, 0.189f, 0.441f, 1.0f,
- -1.124f, 0.0f, 0.193f, 0.458f, 1.0f, -1.124f, 0.0f, 0.197f, 0.475f, 1.0f, -1.124f, 0.0f, 0.202f, 0.492f, 1.0f, -1.124f, 0.0f, 0.206f, 0.508f, 1.0f,
- -1.125f, 0.0f, 0.21f, 0.524f, 1.0f, -1.125f, 0.0f, 0.214f, 0.539f, 1.0f, -1.125f, 0.0f, 0.218f, 0.554f, 1.0f, -1.124f, 0.0f, 0.223f, 0.568f, 1.0f,
- -1.124f, 0.0f, 0.227f, 0.581f, 1.0f, -1.124f, 0.0f, 0.231f, 0.593f, 1.0f, -1.124f, 0.0f, 0.235f, 0.604f, 1.0f, -1.123f, 0.0f, 0.239f, 0.614f, 1.0f,
- -1.123f, 0.0f, 0.243f, 0.624f, 1.0f, -1.122f, 0.0f, 0.247f, 0.632f, 1.0f, -1.122f, 0.0f, 0.251f, 0.64f, 1.0f, -1.121f, 0.0f, 0.255f, 0.646f, 1.0f,
- -1.121f, 0.0f, 0.258f, 0.653f, 1.0f, -1.12f, 0.0f, 0.262f, 0.658f, 1.0f, -1.119f, 0.0f, 0.266f, 0.663f, 1.0f, -1.118f, 0.0f, 0.269f, 0.668f, 1.0f,
- -1.117f, 0.0f, 0.272f, 0.673f, 1.0f, -1.117f, 0.0f, 0.276f, 0.678f, 1.0f, -1.116f, 0.0f, 0.279f, 0.682f, 1.0f, -1.115f, 0.0f, 0.282f, 0.687f, 1.0f,
- -1.113f, 0.0f, 0.285f, 0.692f, 1.0f, -1.112f, 0.0f, 0.289f, 0.697f, 1.0f, -1.111f, 0.0f, 0.292f, 0.702f, 1.0f, -1.11f, 0.0f, 0.294f, 0.708f, 1.0f,
- -1.109f, 0.0f, 0.297f, 0.713f, 1.0f, -1.108f, 0.0f, 0.3f, 0.718f, 1.0f, -1.106f, 0.0f, 0.303f, 0.724f, 1.0f, -1.105f, 0.0f, 0.306f, 0.73f, 1.0f,
- -1.104f, 0.0f, 0.309f, 0.735f, 1.0f, -1.102f, 0.0f, 0.312f, 0.741f, 1.0f, -1.101f, 0.0f, 0.315f, 0.746f, 1.0f, -1.099f, 0.0f, 0.318f, 0.751f, 1.0f,
- -1.098f, 0.0f, 0.321f, 0.756f, 1.0f, -1.096f, 0.0f, 0.323f, 0.761f, 1.0f, -1.094f, 0.0f, 0.326f, 0.766f, 1.0f, -1.093f, 0.0f, 0.329f, 0.771f, 1.0f,
- -1.091f, 0.0f, 0.332f, 0.776f, 1.0f, -1.089f, 0.0f, 0.335f, 0.781f, 1.0f, -1.087f, 0.0f, 0.338f, 0.786f, 1.0f, -1.085f, 0.0f, 0.341f, 0.791f, 1.0f,
- -1.082f, 0.0f, 0.344f, 0.797f, 1.0f, -1.08f, 0.0f, 0.347f, 0.802f, 1.0f, -1.078f, 0.0f, 0.349f, 0.808f, 1.0f, -1.075f, 0.0f, 0.352f, 0.814f, 1.0f,
- -1.072f, 0.0f, 0.355f, 0.82f, 1.0f, -1.069f, 0.0f, 0.358f, 0.826f, 1.0f, -1.066f, 0.0f, 0.36f, 0.831f, 1.0f, -1.063f, 0.0f, 0.363f, 0.837f, 1.0f,
- -1.059f, 0.0f, 0.366f, 0.842f, 1.0f, -1.055f, 0.0f, 0.368f, 0.847f, 1.0f, -1.051f, 0.0f, 0.371f, 0.851f, 1.0f, -1.047f, 0.0f, 0.373f, 0.856f, 1.0f,
- -1.042f, 0.0f, 0.375f, 0.86f, 1.0f, -1.037f, 0.0f, 0.378f, 0.863f, 1.0f, -1.031f, 0.0f, 0.38f, 0.866f, 1.0f, -1.026f, 0.0f, 0.382f, 0.869f, 1.0f,
- -1.02f, 0.0f, 0.384f, 0.871f, 1.0f, -1.014f, 0.0f, 0.386f, 0.873f, 1.0f, -1.007f, 0.0f, 0.387f, 0.875f, 1.0f, -1.0f, 0.0f, 0.389f, 0.876f, 1.0f,
- -0.994f, 0.0f, 0.39f, 0.877f, 1.0f, -0.987f, 0.0f, 0.392f, 0.878f, 1.0f, -0.979f, 0.0f, 0.393f, 0.879f, 1.0f, -0.972f, 0.0f, 0.394f, 0.88f, 1.0f,
- -0.964f, 0.0f, 0.395f, 0.881f, 1.0f, -0.956f, 0.0f, 0.395f, 0.881f, 1.0f, -0.948f, 0.0f, 0.395f, 0.882f, 1.0f, -0.94f, 0.0f, 0.395f, 0.882f, 1.0f,
- -0.932f, 0.0f, 0.395f, 0.883f, 1.0f, -0.923f, 0.0f, 0.394f, 0.883f, 1.0f, -0.915f, 0.0f, 0.393f, 0.883f, 1.0f, -0.906f, 0.0f, 0.391f, 0.883f, 1.0f,
- -0.896f, 0.0f, 0.389f, 0.881f, 1.0f, -0.887f, 0.0f, 0.386f, 0.876f, 1.0f, -0.877f, 0.0f, 0.382f, 0.866f, 1.0f, -0.867f, 0.0f, 0.378f, 0.85f, 1.0f,
- -0.857f, 0.0f, 0.373f, 0.828f, 1.0f, -0.848f, 0.0f, 0.368f, 0.799f, 1.0f, -0.838f, 0.0f, 0.363f, 0.764f, 1.0f, -0.829f, 0.0f, 0.357f, 0.723f, 1.0f,
- -0.819f, 0.0f, 0.352f, 0.679f, 1.0f, -0.811f, 0.0f, 0.347f, 0.631f, 1.0f, -0.802f, 0.0f, 0.342f, 0.579f, 1.0f, -0.794f, 0.0f, 0.338f, 0.525f, 1.0f,
- -0.786f, 0.0f, 0.333f, 0.469f, 1.0f, -0.779f, 0.0f, 0.329f, 0.412f, 1.0f, -0.772f, 0.0f, 0.325f, 0.351f, 1.0f, -0.766f, 0.0f, 0.321f, 0.3f, 1.0f,
- -0.757f, 0.0f, 0.317f, 0.219f, 1.0f,
+static const float data21[64 * GP_PRIM_DATABUF_SIZE] = {
+ -0.7428f, 0.0f, 0.2977f, 0.1f, 1.0f,
+ -0.7608f, 0.0f, 0.3138f, 0.2199f, 1.0f,
+ -0.7786f, 0.0f, 0.3284f, 0.36f, 1.0f,
+ -0.7962f, 0.0f, 0.3414f, 0.4615f, 1.0f,
+ -0.8135f, 0.0f, 0.3531f, 0.5396f, 1.0f,
+ -0.8306f, 0.0f, 0.3633f, 0.6019f, 1.0f,
+ -0.8473f, 0.0f, 0.3722f, 0.6541f, 1.0f,
+ -0.8637f, 0.0f, 0.3798f, 0.6981f, 1.0f,
+ -0.8798f, 0.0f, 0.386f, 0.7359f, 1.0f,
+ -0.8956f, 0.0f, 0.3911f, 0.7689f, 1.0f,
+ -0.9109f, 0.0f, 0.3949f, 0.7979f, 1.0f,
+ -0.9259f, 0.0f, 0.3975f, 0.8236f, 1.0f,
+ -0.9405f, 0.0f, 0.3989f, 0.8461f, 1.0f,
+ -0.9546f, 0.0f, 0.3993f, 0.866f, 1.0f,
+ -0.9682f, 0.0f, 0.3986f, 0.8841f, 1.0f,
+ -0.9814f, 0.0f, 0.3969f, 0.9003f, 1.0f,
+ -0.994f, 0.0f, 0.3941f, 0.9143f, 1.0f,
+ -1.0062f, 0.0f, 0.3904f, 0.9272f, 1.0f,
+ -1.0178f, 0.0f, 0.3858f, 0.9385f, 1.0f,
+ -1.0288f, 0.0f, 0.3803f, 0.9485f, 1.0f,
+ -1.0393f, 0.0f, 0.3739f, 0.9576f, 1.0f,
+ -1.0492f, 0.0f, 0.3668f, 0.9653f, 1.0f,
+ -1.0584f, 0.0f, 0.3588f, 0.9724f, 1.0f,
+ -1.067f, 0.0f, 0.3501f, 0.9781f, 1.0f,
+ -1.075f, 0.0f, 0.3407f, 0.9834f, 1.0f,
+ -1.0822f, 0.0f, 0.3307f, 0.9876f, 1.0f,
+ -1.0888f, 0.0f, 0.32f, 0.9912f, 1.0f,
+ -1.0946f, 0.0f, 0.3087f, 0.9942f, 1.0f,
+ -1.0997f, 0.0f, 0.2969f, 0.9963f, 1.0f,
+ -1.104f, 0.0f, 0.2845f, 0.9983f, 1.0f,
+ -1.1075f, 0.0f, 0.2717f, 0.999f, 1.0f,
+ -1.1103f, 0.0f, 0.2584f, 0.9997f, 1.0f,
+ -1.1122f, 0.0f, 0.2447f, 0.9997f, 1.0f,
+ -1.1132f, 0.0f, 0.2306f, 0.999f, 1.0f,
+ -1.1134f, 0.0f, 0.2162f, 0.9983f, 1.0f,
+ -1.1128f, 0.0f, 0.2015f, 0.9963f, 1.0f,
+ -1.1112f, 0.0f, 0.1865f, 0.9942f, 1.0f,
+ -1.1086f, 0.0f, 0.1713f, 0.9912f, 1.0f,
+ -1.1052f, 0.0f, 0.1559f, 0.9876f, 1.0f,
+ -1.1007f, 0.0f, 0.1404f, 0.9834f, 1.0f,
+ -1.0953f, 0.0f, 0.1247f, 0.9781f, 1.0f,
+ -1.0889f, 0.0f, 0.109f, 0.9724f, 1.0f,
+ -1.0814f, 0.0f, 0.0932f, 0.9653f, 1.0f,
+ -1.0729f, 0.0f, 0.0774f, 0.9576f, 1.0f,
+ -1.0633f, 0.0f, 0.0617f, 0.9485f, 1.0f,
+ -1.0527f, 0.0f, 0.046f, 0.9385f, 1.0f,
+ -1.0409f, 0.0f, 0.0304f, 0.9272f, 1.0f,
+ -1.028f, 0.0f, 0.015f, 0.9143f, 1.0f,
+ -1.0139f, 0.0f, -0.0003f, 0.9003f, 1.0f,
+ -0.9987f, 0.0f, -0.0154f, 0.8841f, 1.0f,
+ -0.9823f, 0.0f, -0.0302f, 0.866f, 1.0f,
+ -0.9646f, 0.0f, -0.0447f, 0.8461f, 1.0f,
+ -0.9458f, 0.0f, -0.0589f, 0.8236f, 1.0f,
+ -0.9257f, 0.0f, -0.0727f, 0.7979f, 1.0f,
+ -0.9043f, 0.0f, -0.0862f, 0.7689f, 1.0f,
+ -0.8816f, 0.0f, -0.0992f, 0.7359f, 1.0f,
+ -0.8576f, 0.0f, -0.1117f, 0.6981f, 1.0f,
+ -0.8323f, 0.0f, -0.1237f, 0.6541f, 1.0f,
+ -0.8056f, 0.0f, -0.1352f, 0.6019f, 1.0f,
+ -0.7775f, 0.0f, -0.1461f, 0.5396f, 1.0f,
+ -0.7481f, 0.0f, -0.1564f, 0.4615f, 1.0f,
+ -0.7172f, 0.0f, -0.166f, 0.36f, 1.0f,
+ -0.6849f, 0.0f, -0.175f, 0.2199f, 1.0f,
+ -0.6512f, 0.0f, -0.1832f, 0.1f, 1.0f,
};
-static const float data29[205 * GP_PRIM_DATABUF_SIZE] = {
- 0.816f, 0.0f, 0.326f, 0.285f, 1.0f, 0.819f, 0.0f, 0.328f, 0.287f, 1.0f, 0.821f, 0.0f, 0.33f, 0.29f, 1.0f, 0.823f, 0.0f, 0.331f, 0.295f, 1.0f,
- 0.825f, 0.0f, 0.333f, 0.304f, 1.0f, 0.828f, 0.0f, 0.335f, 0.315f, 1.0f, 0.83f, 0.0f, 0.337f, 0.328f, 1.0f, 0.833f, 0.0f, 0.339f, 0.341f, 1.0f,
- 0.836f, 0.0f, 0.341f, 0.355f, 1.0f, 0.839f, 0.0f, 0.343f, 0.368f, 1.0f, 0.842f, 0.0f, 0.345f, 0.38f, 1.0f, 0.845f, 0.0f, 0.347f, 0.392f, 1.0f,
- 0.848f, 0.0f, 0.349f, 0.402f, 1.0f, 0.851f, 0.0f, 0.351f, 0.412f, 1.0f, 0.854f, 0.0f, 0.352f, 0.421f, 1.0f, 0.857f, 0.0f, 0.354f, 0.429f, 1.0f,
- 0.861f, 0.0f, 0.356f, 0.437f, 1.0f, 0.865f, 0.0f, 0.357f, 0.444f, 1.0f, 0.869f, 0.0f, 0.359f, 0.452f, 1.0f, 0.872f, 0.0f, 0.36f, 0.46f, 1.0f,
- 0.876f, 0.0f, 0.361f, 0.47f, 1.0f, 0.881f, 0.0f, 0.363f, 0.481f, 1.0f, 0.885f, 0.0f, 0.364f, 0.491f, 1.0f, 0.889f, 0.0f, 0.365f, 0.501f, 1.0f,
- 0.893f, 0.0f, 0.366f, 0.511f, 1.0f, 0.898f, 0.0f, 0.367f, 0.52f, 1.0f, 0.902f, 0.0f, 0.368f, 0.528f, 1.0f, 0.906f, 0.0f, 0.37f, 0.535f, 1.0f,
- 0.911f, 0.0f, 0.371f, 0.542f, 1.0f, 0.915f, 0.0f, 0.372f, 0.548f, 1.0f, 0.92f, 0.0f, 0.373f, 0.554f, 1.0f, 0.924f, 0.0f, 0.374f, 0.559f, 1.0f,
- 0.929f, 0.0f, 0.375f, 0.564f, 1.0f, 0.933f, 0.0f, 0.376f, 0.567f, 1.0f, 0.938f, 0.0f, 0.377f, 0.57f, 1.0f, 0.943f, 0.0f, 0.378f, 0.572f, 1.0f,
- 0.947f, 0.0f, 0.378f, 0.574f, 1.0f, 0.952f, 0.0f, 0.379f, 0.576f, 1.0f, 0.956f, 0.0f, 0.38f, 0.577f, 1.0f, 0.961f, 0.0f, 0.38f, 0.579f, 1.0f,
- 0.966f, 0.0f, 0.381f, 0.581f, 1.0f, 0.971f, 0.0f, 0.381f, 0.585f, 1.0f, 0.975f, 0.0f, 0.382f, 0.588f, 1.0f, 0.98f, 0.0f, 0.382f, 0.591f, 1.0f,
- 0.985f, 0.0f, 0.382f, 0.595f, 1.0f, 0.989f, 0.0f, 0.382f, 0.597f, 1.0f, 0.994f, 0.0f, 0.382f, 0.6f, 1.0f, 0.999f, 0.0f, 0.382f, 0.603f, 1.0f,
- 1.003f, 0.0f, 0.382f, 0.605f, 1.0f, 1.008f, 0.0f, 0.381f, 0.607f, 1.0f, 1.013f, 0.0f, 0.381f, 0.61f, 1.0f, 1.017f, 0.0f, 0.381f, 0.611f, 1.0f,
- 1.021f, 0.0f, 0.381f, 0.613f, 1.0f, 1.025f, 0.0f, 0.38f, 0.613f, 1.0f, 1.029f, 0.0f, 0.38f, 0.614f, 1.0f, 1.033f, 0.0f, 0.379f, 0.614f, 1.0f,
- 1.037f, 0.0f, 0.379f, 0.614f, 1.0f, 1.041f, 0.0f, 0.378f, 0.614f, 1.0f, 1.044f, 0.0f, 0.378f, 0.614f, 1.0f, 1.048f, 0.0f, 0.377f, 0.614f, 1.0f,
- 1.051f, 0.0f, 0.376f, 0.613f, 1.0f, 1.054f, 0.0f, 0.375f, 0.612f, 1.0f, 1.057f, 0.0f, 0.374f, 0.611f, 1.0f, 1.06f, 0.0f, 0.373f, 0.61f, 1.0f,
- 1.063f, 0.0f, 0.372f, 0.609f, 1.0f, 1.066f, 0.0f, 0.371f, 0.609f, 1.0f, 1.068f, 0.0f, 0.37f, 0.608f, 1.0f, 1.071f, 0.0f, 0.368f, 0.608f, 1.0f,
- 1.073f, 0.0f, 0.367f, 0.608f, 1.0f, 1.076f, 0.0f, 0.365f, 0.608f, 1.0f, 1.078f, 0.0f, 0.364f, 0.607f, 1.0f, 1.081f, 0.0f, 0.362f, 0.607f, 1.0f,
- 1.083f, 0.0f, 0.36f, 0.607f, 1.0f, 1.085f, 0.0f, 0.358f, 0.606f, 1.0f, 1.087f, 0.0f, 0.356f, 0.606f, 1.0f, 1.09f, 0.0f, 0.354f, 0.606f, 1.0f,
- 1.092f, 0.0f, 0.352f, 0.606f, 1.0f, 1.094f, 0.0f, 0.35f, 0.606f, 1.0f, 1.096f, 0.0f, 0.348f, 0.606f, 1.0f, 1.097f, 0.0f, 0.346f, 0.606f, 1.0f,
- 1.099f, 0.0f, 0.344f, 0.606f, 1.0f, 1.101f, 0.0f, 0.341f, 0.606f, 1.0f, 1.103f, 0.0f, 0.339f, 0.606f, 1.0f, 1.104f, 0.0f, 0.337f, 0.607f, 1.0f,
- 1.106f, 0.0f, 0.335f, 0.607f, 1.0f, 1.108f, 0.0f, 0.332f, 0.607f, 1.0f, 1.109f, 0.0f, 0.33f, 0.608f, 1.0f, 1.111f, 0.0f, 0.327f, 0.608f, 1.0f,
- 1.113f, 0.0f, 0.324f, 0.608f, 1.0f, 1.114f, 0.0f, 0.322f, 0.609f, 1.0f, 1.116f, 0.0f, 0.319f, 0.609f, 1.0f, 1.117f, 0.0f, 0.316f, 0.609f, 1.0f,
- 1.118f, 0.0f, 0.313f, 0.609f, 1.0f, 1.12f, 0.0f, 0.31f, 0.609f, 1.0f, 1.121f, 0.0f, 0.307f, 0.609f, 1.0f, 1.123f, 0.0f, 0.304f, 0.608f, 1.0f,
- 1.124f, 0.0f, 0.301f, 0.608f, 1.0f, 1.125f, 0.0f, 0.297f, 0.607f, 1.0f, 1.126f, 0.0f, 0.294f, 0.606f, 1.0f, 1.127f, 0.0f, 0.29f, 0.605f, 1.0f,
- 1.129f, 0.0f, 0.287f, 0.603f, 1.0f, 1.13f, 0.0f, 0.283f, 0.601f, 1.0f, 1.131f, 0.0f, 0.279f, 0.599f, 1.0f, 1.132f, 0.0f, 0.276f, 0.597f, 1.0f,
- 1.132f, 0.0f, 0.272f, 0.595f, 1.0f, 1.133f, 0.0f, 0.268f, 0.593f, 1.0f, 1.134f, 0.0f, 0.264f, 0.592f, 1.0f, 1.135f, 0.0f, 0.26f, 0.591f, 1.0f,
- 1.135f, 0.0f, 0.256f, 0.59f, 1.0f, 1.136f, 0.0f, 0.252f, 0.589f, 1.0f, 1.136f, 0.0f, 0.248f, 0.588f, 1.0f, 1.137f, 0.0f, 0.244f, 0.587f, 1.0f,
- 1.137f, 0.0f, 0.24f, 0.586f, 1.0f, 1.138f, 0.0f, 0.236f, 0.585f, 1.0f, 1.138f, 0.0f, 0.232f, 0.584f, 1.0f, 1.138f, 0.0f, 0.228f, 0.582f, 1.0f,
- 1.138f, 0.0f, 0.224f, 0.581f, 1.0f, 1.138f, 0.0f, 0.22f, 0.579f, 1.0f, 1.138f, 0.0f, 0.216f, 0.578f, 1.0f, 1.138f, 0.0f, 0.212f, 0.576f, 1.0f,
- 1.138f, 0.0f, 0.208f, 0.575f, 1.0f, 1.138f, 0.0f, 0.204f, 0.573f, 1.0f, 1.137f, 0.0f, 0.2f, 0.572f, 1.0f, 1.137f, 0.0f, 0.196f, 0.571f, 1.0f,
- 1.137f, 0.0f, 0.192f, 0.569f, 1.0f, 1.136f, 0.0f, 0.188f, 0.568f, 1.0f, 1.136f, 0.0f, 0.184f, 0.567f, 1.0f, 1.135f, 0.0f, 0.18f, 0.566f, 1.0f,
- 1.134f, 0.0f, 0.176f, 0.565f, 1.0f, 1.133f, 0.0f, 0.172f, 0.563f, 1.0f, 1.132f, 0.0f, 0.168f, 0.561f, 1.0f, 1.131f, 0.0f, 0.164f, 0.559f, 1.0f,
- 1.13f, 0.0f, 0.16f, 0.556f, 1.0f, 1.129f, 0.0f, 0.156f, 0.552f, 1.0f, 1.128f, 0.0f, 0.152f, 0.548f, 1.0f, 1.127f, 0.0f, 0.148f, 0.543f, 1.0f,
- 1.126f, 0.0f, 0.144f, 0.537f, 1.0f, 1.124f, 0.0f, 0.14f, 0.53f, 1.0f, 1.123f, 0.0f, 0.136f, 0.522f, 1.0f, 1.122f, 0.0f, 0.132f, 0.514f, 1.0f,
- 1.12f, 0.0f, 0.128f, 0.505f, 1.0f, 1.118f, 0.0f, 0.123f, 0.495f, 1.0f, 1.117f, 0.0f, 0.119f, 0.486f, 1.0f, 1.115f, 0.0f, 0.115f, 0.476f, 1.0f,
- 1.113f, 0.0f, 0.111f, 0.466f, 1.0f, 1.111f, 0.0f, 0.107f, 0.456f, 1.0f, 1.11f, 0.0f, 0.102f, 0.446f, 1.0f, 1.108f, 0.0f, 0.098f, 0.436f, 1.0f,
- 1.105f, 0.0f, 0.094f, 0.425f, 1.0f, 1.103f, 0.0f, 0.09f, 0.414f, 1.0f, 1.101f, 0.0f, 0.085f, 0.402f, 1.0f, 1.099f, 0.0f, 0.081f, 0.389f, 1.0f,
- 1.096f, 0.0f, 0.077f, 0.377f, 1.0f, 1.094f, 0.0f, 0.072f, 0.364f, 1.0f, 1.091f, 0.0f, 0.068f, 0.351f, 1.0f, 1.088f, 0.0f, 0.063f, 0.338f, 1.0f,
- 1.085f, 0.0f, 0.059f, 0.325f, 1.0f, 1.082f, 0.0f, 0.054f, 0.313f, 1.0f, 1.079f, 0.0f, 0.05f, 0.301f, 1.0f, 1.075f, 0.0f, 0.045f, 0.29f, 1.0f,
- 1.071f, 0.0f, 0.04f, 0.281f, 1.0f, 1.067f, 0.0f, 0.035f, 0.272f, 1.0f, 1.063f, 0.0f, 0.031f, 0.266f, 1.0f, 1.059f, 0.0f, 0.026f, 0.261f, 1.0f,
- 1.054f, 0.0f, 0.021f, 0.258f, 1.0f, 1.049f, 0.0f, 0.016f, 0.257f, 1.0f, 1.043f, 0.0f, 0.011f, 0.259f, 1.0f, 1.037f, 0.0f, 0.006f, 0.264f, 1.0f,
- 1.031f, 0.0f, 0.0f, 0.272f, 1.0f, 1.025f, 0.0f, -0.005f, 0.283f, 1.0f, 1.018f, 0.0f, -0.01f, 0.296f, 1.0f, 1.011f, 0.0f, -0.015f, 0.313f, 1.0f,
- 1.003f, 0.0f, -0.021f, 0.33f, 1.0f, 0.996f, 0.0f, -0.026f, 0.348f, 1.0f, 0.988f, 0.0f, -0.032f, 0.365f, 1.0f, 0.979f, 0.0f, -0.038f, 0.379f, 1.0f,
- 0.971f, 0.0f, -0.044f, 0.389f, 1.0f, 0.962f, 0.0f, -0.05f, 0.394f, 1.0f, 0.953f, 0.0f, -0.057f, 0.392f, 1.0f, 0.944f, 0.0f, -0.063f, 0.384f, 1.0f,
- 0.934f, 0.0f, -0.069f, 0.368f, 1.0f, 0.924f, 0.0f, -0.075f, 0.347f, 1.0f, 0.914f, 0.0f, -0.081f, 0.32f, 1.0f, 0.903f, 0.0f, -0.087f, 0.289f, 1.0f,
- 0.893f, 0.0f, -0.092f, 0.256f, 1.0f, 0.882f, 0.0f, -0.098f, 0.223f, 1.0f, 0.871f, 0.0f, -0.103f, 0.191f, 1.0f, 0.86f, 0.0f, -0.108f, 0.162f, 1.0f,
- 0.849f, 0.0f, -0.112f, 0.136f, 1.0f, 0.838f, 0.0f, -0.117f, 0.112f, 1.0f, 0.827f, 0.0f, -0.121f, 0.091f, 1.0f, 0.815f, 0.0f, -0.125f, 0.074f, 1.0f,
- 0.804f, 0.0f, -0.128f, 0.059f, 1.0f, 0.793f, 0.0f, -0.132f, 0.046f, 1.0f, 0.782f, 0.0f, -0.135f, 0.036f, 1.0f, 0.771f, 0.0f, -0.138f, 0.028f, 1.0f,
- 0.76f, 0.0f, -0.141f, 0.021f, 1.0f, 0.749f, 0.0f, -0.144f, 0.016f, 1.0f, 0.738f, 0.0f, -0.147f, 0.012f, 1.0f, 0.728f, 0.0f, -0.149f, 0.009f, 1.0f,
- 0.718f, 0.0f, -0.152f, 0.006f, 1.0f, 0.708f, 0.0f, -0.154f, 0.004f, 1.0f, 0.699f, 0.0f, -0.157f, 0.003f, 1.0f, 0.691f, 0.0f, -0.159f, 0.002f, 1.0f,
- 0.68f, 0.0f, -0.162f, 0.0f, 1.0f,
+static const float data22[26 * GP_PRIM_DATABUF_SIZE] = {
+ 0.2721f, 0.0f, 0.2084f, 1.0f, 1.0f,
+ 0.2721f, 0.0f, 0.2112f, 1.0f, 1.0f,
+ 0.2739f, 0.0f, 0.2223f, 1.0f, 1.0f,
+ 0.2778f, 0.0f, 0.2324f, 1.0f, 1.0f,
+ 0.2836f, 0.0f, 0.2409f, 1.0f, 1.0f,
+ 0.291f, 0.0f, 0.2471f, 1.0f, 1.0f,
+ 0.2994f, 0.0f, 0.2507f, 1.0f, 1.0f,
+ 0.3082f, 0.0f, 0.2515f, 1.0f, 1.0f,
+ 0.3169f, 0.0f, 0.2493f, 1.0f, 1.0f,
+ 0.3248f, 0.0f, 0.2443f, 1.0f, 1.0f,
+ 0.3315f, 0.0f, 0.2369f, 1.0f, 1.0f,
+ 0.3364f, 0.0f, 0.2275f, 1.0f, 1.0f,
+ 0.3392f, 0.0f, 0.2168f, 1.0f, 1.0f,
+ 0.3398f, 0.0f, 0.2056f, 1.0f, 1.0f,
+ 0.3381f, 0.0f, 0.1945f, 1.0f, 1.0f,
+ 0.3342f, 0.0f, 0.1844f, 1.0f, 1.0f,
+ 0.3283f, 0.0f, 0.176f, 1.0f, 1.0f,
+ 0.321f, 0.0f, 0.1697f, 1.0f, 1.0f,
+ 0.3126f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ 0.3038f, 0.0f, 0.1653f, 1.0f, 1.0f,
+ 0.2951f, 0.0f, 0.1675f, 1.0f, 1.0f,
+ 0.2871f, 0.0f, 0.1725f, 1.0f, 1.0f,
+ 0.2805f, 0.0f, 0.1799f, 1.0f, 1.0f,
+ 0.2756f, 0.0f, 0.1893f, 1.0f, 1.0f,
+ 0.2727f, 0.0f, 0.2f, 1.0f, 1.0f,
+ 0.2721f, 0.0f, 0.2056f, 1.0f, 1.0f,
};
-static const float data30[33 * GP_PRIM_DATABUF_SIZE] = {
- -1.02f, 0.0f, 0.179f, 0.21f, 1.0f, -1.014f, 0.0f, 0.182f, 0.301f, 1.0f, -1.01f, 0.0f, 0.184f, 0.36f, 1.0f, -1.004f, 0.0f, 0.186f, 0.426f, 1.0f,
- -0.999f, 0.0f, 0.188f, 0.479f, 1.0f, -0.993f, 0.0f, 0.19f, 0.519f, 1.0f, -0.987f, 0.0f, 0.191f, 0.545f, 1.0f, -0.981f, 0.0f, 0.192f, 0.562f, 1.0f,
- -0.975f, 0.0f, 0.193f, 0.575f, 1.0f, -0.968f, 0.0f, 0.193f, 0.582f, 1.0f, -0.961f, 0.0f, 0.193f, 0.587f, 1.0f, -0.954f, 0.0f, 0.191f, 0.592f, 1.0f,
- -0.946f, 0.0f, 0.19f, 0.597f, 1.0f, -0.938f, 0.0f, 0.187f, 0.6f, 1.0f, -0.93f, 0.0f, 0.183f, 0.603f, 1.0f, -0.922f, 0.0f, 0.178f, 0.606f, 1.0f,
- -0.913f, 0.0f, 0.173f, 0.608f, 1.0f, -0.905f, 0.0f, 0.168f, 0.61f, 1.0f, -0.898f, 0.0f, 0.162f, 0.612f, 1.0f, -0.89f, 0.0f, 0.156f, 0.613f, 1.0f,
- -0.883f, 0.0f, 0.15f, 0.612f, 1.0f, -0.877f, 0.0f, 0.143f, 0.608f, 1.0f, -0.871f, 0.0f, 0.137f, 0.602f, 1.0f, -0.865f, 0.0f, 0.131f, 0.593f, 1.0f,
- -0.86f, 0.0f, 0.125f, 0.577f, 1.0f, -0.855f, 0.0f, 0.12f, 0.554f, 1.0f, -0.85f, 0.0f, 0.114f, 0.524f, 1.0f, -0.846f, 0.0f, 0.109f, 0.487f, 1.0f,
- -0.842f, 0.0f, 0.104f, 0.443f, 1.0f, -0.838f, 0.0f, 0.1f, 0.394f, 1.0f, -0.835f, 0.0f, 0.095f, 0.339f, 1.0f, -0.832f, 0.0f, 0.091f, 0.295f, 1.0f,
- -0.828f, 0.0f, 0.086f, 0.227f, 1.0f,
+static const float data23[26 * GP_PRIM_DATABUF_SIZE] = {
+ -0.3545f, 0.0f, 0.2084f, 1.0f, 1.0f,
+ -0.3544f, 0.0f, 0.2112f, 1.0f, 1.0f,
+ -0.3527f, 0.0f, 0.2223f, 1.0f, 1.0f,
+ -0.3488f, 0.0f, 0.2324f, 1.0f, 1.0f,
+ -0.343f, 0.0f, 0.2409f, 1.0f, 1.0f,
+ -0.3356f, 0.0f, 0.2471f, 1.0f, 1.0f,
+ -0.3272f, 0.0f, 0.2507f, 1.0f, 1.0f,
+ -0.3184f, 0.0f, 0.2515f, 1.0f, 1.0f,
+ -0.3097f, 0.0f, 0.2493f, 1.0f, 1.0f,
+ -0.3018f, 0.0f, 0.2443f, 1.0f, 1.0f,
+ -0.2951f, 0.0f, 0.2369f, 1.0f, 1.0f,
+ -0.2902f, 0.0f, 0.2275f, 1.0f, 1.0f,
+ -0.2874f, 0.0f, 0.2168f, 1.0f, 1.0f,
+ -0.2868f, 0.0f, 0.2056f, 1.0f, 1.0f,
+ -0.2885f, 0.0f, 0.1945f, 1.0f, 1.0f,
+ -0.2924f, 0.0f, 0.1844f, 1.0f, 1.0f,
+ -0.2983f, 0.0f, 0.176f, 1.0f, 1.0f,
+ -0.3056f, 0.0f, 0.1697f, 1.0f, 1.0f,
+ -0.314f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ -0.3228f, 0.0f, 0.1653f, 1.0f, 1.0f,
+ -0.3315f, 0.0f, 0.1675f, 1.0f, 1.0f,
+ -0.3394f, 0.0f, 0.1725f, 1.0f, 1.0f,
+ -0.3461f, 0.0f, 0.1799f, 1.0f, 1.0f,
+ -0.351f, 0.0f, 0.1893f, 1.0f, 1.0f,
+ -0.3539f, 0.0f, 0.2f, 1.0f, 1.0f,
+ -0.3544f, 0.0f, 0.2056f, 1.0f, 1.0f,
};
-static const float data31[37 * GP_PRIM_DATABUF_SIZE] = {
- 0.777f, 0.0f, 0.096f, 0.278f, 1.0f, 0.779f, 0.0f, 0.1f, 0.307f, 1.0f, 0.781f, 0.0f, 0.103f, 0.326f, 1.0f, 0.782f, 0.0f, 0.106f, 0.349f, 1.0f,
- 0.784f, 0.0f, 0.109f, 0.372f, 1.0f, 0.786f, 0.0f, 0.112f, 0.395f, 1.0f, 0.789f, 0.0f, 0.116f, 0.418f, 1.0f, 0.791f, 0.0f, 0.119f, 0.44f, 1.0f,
- 0.794f, 0.0f, 0.123f, 0.462f, 1.0f, 0.798f, 0.0f, 0.127f, 0.484f, 1.0f, 0.801f, 0.0f, 0.13f, 0.504f, 1.0f, 0.806f, 0.0f, 0.134f, 0.522f, 1.0f,
- 0.81f, 0.0f, 0.138f, 0.54f, 1.0f, 0.815f, 0.0f, 0.142f, 0.556f, 1.0f, 0.82f, 0.0f, 0.146f, 0.571f, 1.0f, 0.826f, 0.0f, 0.15f, 0.584f, 1.0f,
- 0.832f, 0.0f, 0.154f, 0.596f, 1.0f, 0.839f, 0.0f, 0.159f, 0.607f, 1.0f, 0.846f, 0.0f, 0.163f, 0.616f, 1.0f, 0.854f, 0.0f, 0.166f, 0.623f, 1.0f,
- 0.862f, 0.0f, 0.17f, 0.628f, 1.0f, 0.87f, 0.0f, 0.174f, 0.632f, 1.0f, 0.878f, 0.0f, 0.177f, 0.632f, 1.0f, 0.887f, 0.0f, 0.18f, 0.63f, 1.0f,
- 0.895f, 0.0f, 0.183f, 0.623f, 1.0f, 0.903f, 0.0f, 0.186f, 0.611f, 1.0f, 0.912f, 0.0f, 0.188f, 0.592f, 1.0f, 0.92f, 0.0f, 0.19f, 0.567f, 1.0f,
- 0.928f, 0.0f, 0.192f, 0.533f, 1.0f, 0.935f, 0.0f, 0.193f, 0.492f, 1.0f, 0.943f, 0.0f, 0.194f, 0.442f, 1.0f, 0.95f, 0.0f, 0.196f, 0.385f, 1.0f,
- 0.957f, 0.0f, 0.197f, 0.321f, 1.0f, 0.963f, 0.0f, 0.197f, 0.253f, 1.0f, 0.97f, 0.0f, 0.198f, 0.175f, 1.0f, 0.975f, 0.0f, 0.199f, 0.107f, 1.0f,
- 0.983f, 0.0f, 0.199f, 0.0f, 1.0f,
+static const float data24[33 * GP_PRIM_DATABUF_SIZE] = {
+ 0.1904f, 0.0f, 0.0983f, 0.1f, 1.0f,
+ 0.1997f, 0.0f, 0.0774f, 0.2199f, 1.0f,
+ 0.2234f, 0.0f, 0.0407f, 0.4615f, 1.0f,
+ 0.2477f, 0.0f, 0.0158f, 0.6019f, 1.0f,
+ 0.2767f, 0.0f, -0.0047f, 0.6981f, 1.0f,
+ 0.3061f, 0.0f, -0.0179f, 0.7689f, 1.0f,
+ 0.3346f, 0.0f, -0.0247f, 0.8236f, 1.0f,
+ 0.362f, 0.0f, -0.0262f, 0.866f, 1.0f,
+ 0.3881f, 0.0f, -0.0231f, 0.9003f, 1.0f,
+ 0.4128f, 0.0f, -0.0159f, 0.9272f, 1.0f,
+ 0.436f, 0.0f, -0.0049f, 0.9485f, 1.0f,
+ 0.4577f, 0.0f, 0.0099f, 0.9653f, 1.0f,
+ 0.4778f, 0.0f, 0.0289f, 0.9781f, 1.0f,
+ 0.4959f, 0.0f, 0.0524f, 0.9876f, 1.0f,
+ 0.5114f, 0.0f, 0.0806f, 0.9942f, 1.0f,
+ 0.5229f, 0.0f, 0.1134f, 0.9983f, 1.0f,
+ 0.5291f, 0.0f, 0.1498f, 0.9997f, 1.0f,
+ 0.5289f, 0.0f, 0.1884f, 0.999f, 1.0f,
+ 0.5219f, 0.0f, 0.2267f, 0.9963f, 1.0f,
+ 0.5087f, 0.0f, 0.2616f, 0.9912f, 1.0f,
+ 0.4907f, 0.0f, 0.2916f, 0.9834f, 1.0f,
+ 0.4697f, 0.0f, 0.3159f, 0.9724f, 1.0f,
+ 0.4465f, 0.0f, 0.3349f, 0.9576f, 1.0f,
+ 0.422f, 0.0f, 0.3489f, 0.9385f, 1.0f,
+ 0.3964f, 0.0f, 0.3582f, 0.9143f, 1.0f,
+ 0.3705f, 0.0f, 0.3628f, 0.8841f, 1.0f,
+ 0.3436f, 0.0f, 0.363f, 0.8461f, 1.0f,
+ 0.3166f, 0.0f, 0.3586f, 0.7979f, 1.0f,
+ 0.2897f, 0.0f, 0.3491f, 0.7359f, 1.0f,
+ 0.2635f, 0.0f, 0.3344f, 0.6541f, 1.0f,
+ 0.2382f, 0.0f, 0.3137f, 0.5396f, 1.0f,
+ 0.2162f, 0.0f, 0.2882f, 0.36f, 1.0f,
+ 0.1949f, 0.0f, 0.2516f, 0.1f, 1.0f,
};
-static const float data32[201 * GP_PRIM_DATABUF_SIZE] = {
- -0.437f, 0.0f, 0.508f, 0.0f, 1.0f, -0.435f, 0.0f, 0.51f, 0.0f, 1.0f, -0.434f, 0.0f, 0.511f, 0.0f, 1.0f, -0.432f, 0.0f, 0.512f, 0.0f, 1.0f,
- -0.43f, 0.0f, 0.513f, 0.0f, 1.0f, -0.428f, 0.0f, 0.514f, 0.001f, 1.0f, -0.426f, 0.0f, 0.515f, 0.002f, 1.0f, -0.424f, 0.0f, 0.517f, 0.004f, 1.0f,
- -0.422f, 0.0f, 0.518f, 0.007f, 1.0f, -0.42f, 0.0f, 0.519f, 0.012f, 1.0f, -0.418f, 0.0f, 0.521f, 0.018f, 1.0f, -0.416f, 0.0f, 0.522f, 0.025f, 1.0f,
- -0.414f, 0.0f, 0.523f, 0.034f, 1.0f, -0.411f, 0.0f, 0.525f, 0.043f, 1.0f, -0.409f, 0.0f, 0.526f, 0.053f, 1.0f, -0.407f, 0.0f, 0.528f, 0.063f, 1.0f,
- -0.404f, 0.0f, 0.529f, 0.073f, 1.0f, -0.402f, 0.0f, 0.531f, 0.083f, 1.0f, -0.399f, 0.0f, 0.532f, 0.092f, 1.0f, -0.396f, 0.0f, 0.534f, 0.101f, 1.0f,
- -0.394f, 0.0f, 0.535f, 0.11f, 1.0f, -0.391f, 0.0f, 0.536f, 0.118f, 1.0f, -0.388f, 0.0f, 0.538f, 0.126f, 1.0f, -0.386f, 0.0f, 0.539f, 0.133f, 1.0f,
- -0.383f, 0.0f, 0.54f, 0.14f, 1.0f, -0.38f, 0.0f, 0.542f, 0.147f, 1.0f, -0.377f, 0.0f, 0.543f, 0.153f, 1.0f, -0.374f, 0.0f, 0.544f, 0.159f, 1.0f,
- -0.37f, 0.0f, 0.545f, 0.166f, 1.0f, -0.367f, 0.0f, 0.546f, 0.172f, 1.0f, -0.364f, 0.0f, 0.547f, 0.179f, 1.0f, -0.361f, 0.0f, 0.548f, 0.186f, 1.0f,
- -0.357f, 0.0f, 0.549f, 0.193f, 1.0f, -0.354f, 0.0f, 0.55f, 0.202f, 1.0f, -0.35f, 0.0f, 0.551f, 0.211f, 1.0f, -0.347f, 0.0f, 0.552f, 0.221f, 1.0f,
- -0.343f, 0.0f, 0.552f, 0.233f, 1.0f, -0.339f, 0.0f, 0.553f, 0.245f, 1.0f, -0.336f, 0.0f, 0.553f, 0.258f, 1.0f, -0.332f, 0.0f, 0.554f, 0.272f, 1.0f,
- -0.328f, 0.0f, 0.554f, 0.286f, 1.0f, -0.324f, 0.0f, 0.554f, 0.301f, 1.0f, -0.321f, 0.0f, 0.555f, 0.317f, 1.0f, -0.317f, 0.0f, 0.555f, 0.332f, 1.0f,
- -0.313f, 0.0f, 0.555f, 0.348f, 1.0f, -0.309f, 0.0f, 0.555f, 0.364f, 1.0f, -0.305f, 0.0f, 0.555f, 0.38f, 1.0f, -0.302f, 0.0f, 0.555f, 0.396f, 1.0f,
- -0.298f, 0.0f, 0.555f, 0.411f, 1.0f, -0.294f, 0.0f, 0.555f, 0.426f, 1.0f, -0.29f, 0.0f, 0.554f, 0.44f, 1.0f, -0.287f, 0.0f, 0.554f, 0.454f, 1.0f,
- -0.283f, 0.0f, 0.554f, 0.467f, 1.0f, -0.28f, 0.0f, 0.553f, 0.479f, 1.0f, -0.276f, 0.0f, 0.553f, 0.49f, 1.0f, -0.273f, 0.0f, 0.552f, 0.5f, 1.0f,
- -0.269f, 0.0f, 0.552f, 0.51f, 1.0f, -0.266f, 0.0f, 0.551f, 0.519f, 1.0f, -0.263f, 0.0f, 0.55f, 0.527f, 1.0f, -0.26f, 0.0f, 0.549f, 0.534f, 1.0f,
- -0.256f, 0.0f, 0.549f, 0.541f, 1.0f, -0.253f, 0.0f, 0.548f, 0.547f, 1.0f, -0.25f, 0.0f, 0.547f, 0.552f, 1.0f, -0.247f, 0.0f, 0.546f, 0.557f, 1.0f,
- -0.244f, 0.0f, 0.545f, 0.561f, 1.0f, -0.241f, 0.0f, 0.544f, 0.564f, 1.0f, -0.238f, 0.0f, 0.543f, 0.567f, 1.0f, -0.235f, 0.0f, 0.542f, 0.57f, 1.0f,
- -0.233f, 0.0f, 0.541f, 0.572f, 1.0f, -0.23f, 0.0f, 0.54f, 0.574f, 1.0f, -0.227f, 0.0f, 0.539f, 0.575f, 1.0f, -0.224f, 0.0f, 0.538f, 0.576f, 1.0f,
- -0.221f, 0.0f, 0.537f, 0.577f, 1.0f, -0.219f, 0.0f, 0.535f, 0.578f, 1.0f, -0.216f, 0.0f, 0.534f, 0.578f, 1.0f, -0.213f, 0.0f, 0.533f, 0.579f, 1.0f,
- -0.211f, 0.0f, 0.532f, 0.579f, 1.0f, -0.208f, 0.0f, 0.53f, 0.579f, 1.0f, -0.206f, 0.0f, 0.529f, 0.578f, 1.0f, -0.203f, 0.0f, 0.528f, 0.578f, 1.0f,
- -0.2f, 0.0f, 0.526f, 0.577f, 1.0f, -0.198f, 0.0f, 0.525f, 0.576f, 1.0f, -0.195f, 0.0f, 0.523f, 0.575f, 1.0f, -0.193f, 0.0f, 0.522f, 0.574f, 1.0f,
- -0.19f, 0.0f, 0.52f, 0.572f, 1.0f, -0.188f, 0.0f, 0.518f, 0.571f, 1.0f, -0.185f, 0.0f, 0.517f, 0.569f, 1.0f, -0.182f, 0.0f, 0.515f, 0.568f, 1.0f,
- -0.18f, 0.0f, 0.513f, 0.567f, 1.0f, -0.177f, 0.0f, 0.512f, 0.565f, 1.0f, -0.174f, 0.0f, 0.51f, 0.564f, 1.0f, -0.172f, 0.0f, 0.508f, 0.562f, 1.0f,
- -0.169f, 0.0f, 0.506f, 0.56f, 1.0f, -0.166f, 0.0f, 0.504f, 0.559f, 1.0f, -0.164f, 0.0f, 0.502f, 0.556f, 1.0f, -0.161f, 0.0f, 0.501f, 0.554f, 1.0f,
- -0.158f, 0.0f, 0.499f, 0.552f, 1.0f, -0.155f, 0.0f, 0.497f, 0.55f, 1.0f, -0.153f, 0.0f, 0.495f, 0.547f, 1.0f, -0.15f, 0.0f, 0.493f, 0.545f, 1.0f,
- -0.147f, 0.0f, 0.491f, 0.543f, 1.0f, -0.144f, 0.0f, 0.489f, 0.54f, 1.0f, -0.142f, 0.0f, 0.487f, 0.538f, 1.0f, -0.139f, 0.0f, 0.485f, 0.536f, 1.0f,
- -0.136f, 0.0f, 0.483f, 0.533f, 1.0f, -0.133f, 0.0f, 0.481f, 0.53f, 1.0f, -0.13f, 0.0f, 0.479f, 0.527f, 1.0f, -0.127f, 0.0f, 0.477f, 0.524f, 1.0f,
- -0.124f, 0.0f, 0.475f, 0.521f, 1.0f, -0.121f, 0.0f, 0.473f, 0.519f, 1.0f, -0.118f, 0.0f, 0.471f, 0.516f, 1.0f, -0.115f, 0.0f, 0.469f, 0.514f, 1.0f,
- -0.112f, 0.0f, 0.467f, 0.511f, 1.0f, -0.109f, 0.0f, 0.465f, 0.509f, 1.0f, -0.106f, 0.0f, 0.463f, 0.506f, 1.0f, -0.103f, 0.0f, 0.461f, 0.503f, 1.0f,
- -0.099f, 0.0f, 0.458f, 0.501f, 1.0f, -0.096f, 0.0f, 0.456f, 0.5f, 1.0f, -0.093f, 0.0f, 0.454f, 0.498f, 1.0f, -0.09f, 0.0f, 0.452f, 0.497f, 1.0f,
- -0.086f, 0.0f, 0.45f, 0.496f, 1.0f, -0.083f, 0.0f, 0.448f, 0.496f, 1.0f, -0.079f, 0.0f, 0.446f, 0.495f, 1.0f, -0.076f, 0.0f, 0.444f, 0.495f, 1.0f,
- -0.072f, 0.0f, 0.442f, 0.494f, 1.0f, -0.069f, 0.0f, 0.44f, 0.494f, 1.0f, -0.065f, 0.0f, 0.438f, 0.494f, 1.0f, -0.062f, 0.0f, 0.436f, 0.494f, 1.0f,
- -0.058f, 0.0f, 0.435f, 0.494f, 1.0f, -0.054f, 0.0f, 0.433f, 0.494f, 1.0f, -0.05f, 0.0f, 0.431f, 0.494f, 1.0f, -0.046f, 0.0f, 0.43f, 0.494f, 1.0f,
- -0.042f, 0.0f, 0.428f, 0.494f, 1.0f, -0.038f, 0.0f, 0.427f, 0.494f, 1.0f, -0.033f, 0.0f, 0.426f, 0.494f, 1.0f, -0.029f, 0.0f, 0.425f, 0.494f, 1.0f,
- -0.025f, 0.0f, 0.424f, 0.494f, 1.0f, -0.02f, 0.0f, 0.423f, 0.494f, 1.0f, -0.015f, 0.0f, 0.422f, 0.494f, 1.0f, -0.011f, 0.0f, 0.422f, 0.494f, 1.0f,
- -0.006f, 0.0f, 0.421f, 0.494f, 1.0f, -0.001f, 0.0f, 0.421f, 0.495f, 1.0f, 0.004f, 0.0f, 0.421f, 0.495f, 1.0f, 0.009f, 0.0f, 0.421f, 0.495f, 1.0f,
- 0.014f, 0.0f, 0.422f, 0.495f, 1.0f, 0.019f, 0.0f, 0.422f, 0.495f, 1.0f, 0.024f, 0.0f, 0.423f, 0.495f, 1.0f, 0.029f, 0.0f, 0.424f, 0.495f, 1.0f,
- 0.034f, 0.0f, 0.426f, 0.495f, 1.0f, 0.039f, 0.0f, 0.427f, 0.495f, 1.0f, 0.044f, 0.0f, 0.429f, 0.496f, 1.0f, 0.049f, 0.0f, 0.43f, 0.497f, 1.0f,
- 0.054f, 0.0f, 0.432f, 0.498f, 1.0f, 0.059f, 0.0f, 0.435f, 0.5f, 1.0f, 0.064f, 0.0f, 0.438f, 0.502f, 1.0f, 0.069f, 0.0f, 0.44f, 0.506f, 1.0f,
- 0.074f, 0.0f, 0.443f, 0.51f, 1.0f, 0.08f, 0.0f, 0.446f, 0.516f, 1.0f, 0.085f, 0.0f, 0.45f, 0.522f, 1.0f, 0.09f, 0.0f, 0.453f, 0.528f, 1.0f,
- 0.095f, 0.0f, 0.456f, 0.533f, 1.0f, 0.101f, 0.0f, 0.46f, 0.537f, 1.0f, 0.107f, 0.0f, 0.463f, 0.539f, 1.0f, 0.112f, 0.0f, 0.467f, 0.542f, 1.0f,
- 0.118f, 0.0f, 0.471f, 0.543f, 1.0f, 0.124f, 0.0f, 0.475f, 0.545f, 1.0f, 0.13f, 0.0f, 0.478f, 0.546f, 1.0f, 0.137f, 0.0f, 0.482f, 0.546f, 1.0f,
- 0.143f, 0.0f, 0.486f, 0.547f, 1.0f, 0.149f, 0.0f, 0.49f, 0.546f, 1.0f, 0.156f, 0.0f, 0.493f, 0.544f, 1.0f, 0.163f, 0.0f, 0.497f, 0.54f, 1.0f,
- 0.17f, 0.0f, 0.5f, 0.533f, 1.0f, 0.176f, 0.0f, 0.503f, 0.525f, 1.0f, 0.183f, 0.0f, 0.507f, 0.515f, 1.0f, 0.191f, 0.0f, 0.509f, 0.503f, 1.0f,
- 0.198f, 0.0f, 0.512f, 0.491f, 1.0f, 0.205f, 0.0f, 0.515f, 0.477f, 1.0f, 0.214f, 0.0f, 0.518f, 0.462f, 1.0f, 0.222f, 0.0f, 0.521f, 0.445f, 1.0f,
- 0.23f, 0.0f, 0.524f, 0.427f, 1.0f, 0.238f, 0.0f, 0.527f, 0.409f, 1.0f, 0.245f, 0.0f, 0.529f, 0.388f, 1.0f, 0.254f, 0.0f, 0.531f, 0.366f, 1.0f,
- 0.262f, 0.0f, 0.532f, 0.343f, 1.0f, 0.272f, 0.0f, 0.533f, 0.317f, 1.0f, 0.282f, 0.0f, 0.534f, 0.289f, 1.0f, 0.292f, 0.0f, 0.535f, 0.258f, 1.0f,
- 0.301f, 0.0f, 0.535f, 0.224f, 1.0f, 0.311f, 0.0f, 0.536f, 0.189f, 1.0f, 0.32f, 0.0f, 0.536f, 0.153f, 1.0f, 0.328f, 0.0f, 0.536f, 0.117f, 1.0f,
- 0.338f, 0.0f, 0.537f, 0.084f, 1.0f, 0.346f, 0.0f, 0.537f, 0.057f, 1.0f, 0.353f, 0.0f, 0.536f, 0.037f, 1.0f, 0.361f, 0.0f, 0.536f, 0.022f, 1.0f,
- 0.37f, 0.0f, 0.537f, 0.013f, 1.0f, 0.376f, 0.0f, 0.536f, 0.007f, 1.0f, 0.384f, 0.0f, 0.536f, 0.004f, 1.0f, 0.39f, 0.0f, 0.536f, 0.002f, 1.0f,
- 0.399f, 0.0f, 0.535f, 0.0f, 1.0f,
+static const float data25[18 * GP_PRIM_DATABUF_SIZE] = {
+ -1.0361f, 0.0f, 0.1745f, 0.1f, 1.0f,
+ -1.0319f, 0.0f, 0.177f, 0.2199f, 1.0f,
+ -1.0153f, 0.0f, 0.1852f, 0.6019f, 1.0f,
+ -0.999f, 0.0f, 0.1907f, 0.7689f, 1.0f,
+ -0.983f, 0.0f, 0.1936f, 0.866f, 1.0f,
+ -0.9673f, 0.0f, 0.1941f, 0.9272f, 1.0f,
+ -0.9522f, 0.0f, 0.1923f, 0.9653f, 1.0f,
+ -0.9376f, 0.0f, 0.1885f, 0.9876f, 1.0f,
+ -0.9236f, 0.0f, 0.1827f, 0.9983f, 1.0f,
+ -0.9103f, 0.0f, 0.1752f, 0.999f, 1.0f,
+ -0.8978f, 0.0f, 0.1662f, 0.9912f, 1.0f,
+ -0.8862f, 0.0f, 0.1558f, 0.9724f, 1.0f,
+ -0.8756f, 0.0f, 0.1441f, 0.9385f, 1.0f,
+ -0.866f, 0.0f, 0.1314f, 0.8841f, 1.0f,
+ -0.8575f, 0.0f, 0.1179f, 0.7979f, 1.0f,
+ -0.8501f, 0.0f, 0.1036f, 0.6541f, 1.0f,
+ -0.8441f, 0.0f, 0.0889f, 0.36f, 1.0f,
+ -0.8416f, 0.0f, 0.0813f, 0.1f, 1.0f,
};
-static const float data33[69 * GP_PRIM_DATABUF_SIZE] = {
- -0.308f, 0.0f, 0.151f, 0.363f, 1.0f, -0.31f, 0.0f, 0.15f, 0.377f, 1.0f, -0.311f, 0.0f, 0.149f, 0.386f, 1.0f, -0.313f, 0.0f, 0.149f, 0.397f, 1.0f,
- -0.314f, 0.0f, 0.149f, 0.408f, 1.0f, -0.316f, 0.0f, 0.148f, 0.42f, 1.0f, -0.318f, 0.0f, 0.148f, 0.431f, 1.0f, -0.32f, 0.0f, 0.148f, 0.443f, 1.0f,
- -0.322f, 0.0f, 0.148f, 0.455f, 1.0f, -0.325f, 0.0f, 0.149f, 0.467f, 1.0f, -0.327f, 0.0f, 0.149f, 0.478f, 1.0f, -0.33f, 0.0f, 0.151f, 0.49f, 1.0f,
- -0.333f, 0.0f, 0.152f, 0.501f, 1.0f, -0.336f, 0.0f, 0.154f, 0.512f, 1.0f, -0.34f, 0.0f, 0.157f, 0.522f, 1.0f, -0.343f, 0.0f, 0.161f, 0.533f, 1.0f,
- -0.346f, 0.0f, 0.166f, 0.543f, 1.0f, -0.349f, 0.0f, 0.171f, 0.553f, 1.0f, -0.351f, 0.0f, 0.178f, 0.563f, 1.0f, -0.352f, 0.0f, 0.186f, 0.572f, 1.0f,
- -0.353f, 0.0f, 0.193f, 0.582f, 1.0f, -0.352f, 0.0f, 0.2f, 0.591f, 1.0f, -0.351f, 0.0f, 0.206f, 0.6f, 1.0f, -0.349f, 0.0f, 0.211f, 0.608f, 1.0f,
- -0.347f, 0.0f, 0.215f, 0.616f, 1.0f, -0.345f, 0.0f, 0.219f, 0.623f, 1.0f, -0.343f, 0.0f, 0.222f, 0.63f, 1.0f, -0.341f, 0.0f, 0.224f, 0.637f, 1.0f,
- -0.339f, 0.0f, 0.226f, 0.642f, 1.0f, -0.337f, 0.0f, 0.228f, 0.647f, 1.0f, -0.335f, 0.0f, 0.229f, 0.652f, 1.0f, -0.333f, 0.0f, 0.23f, 0.656f, 1.0f,
- -0.332f, 0.0f, 0.231f, 0.66f, 1.0f, -0.33f, 0.0f, 0.232f, 0.663f, 1.0f, -0.328f, 0.0f, 0.232f, 0.666f, 1.0f, -0.327f, 0.0f, 0.233f, 0.669f, 1.0f,
- -0.325f, 0.0f, 0.233f, 0.672f, 1.0f, -0.324f, 0.0f, 0.234f, 0.676f, 1.0f, -0.322f, 0.0f, 0.234f, 0.679f, 1.0f, -0.321f, 0.0f, 0.234f, 0.682f, 1.0f,
- -0.319f, 0.0f, 0.234f, 0.686f, 1.0f, -0.317f, 0.0f, 0.234f, 0.689f, 1.0f, -0.316f, 0.0f, 0.234f, 0.693f, 1.0f, -0.314f, 0.0f, 0.234f, 0.697f, 1.0f,
- -0.312f, 0.0f, 0.233f, 0.701f, 1.0f, -0.31f, 0.0f, 0.232f, 0.705f, 1.0f, -0.307f, 0.0f, 0.231f, 0.709f, 1.0f, -0.305f, 0.0f, 0.23f, 0.713f, 1.0f,
- -0.302f, 0.0f, 0.228f, 0.716f, 1.0f, -0.299f, 0.0f, 0.225f, 0.719f, 1.0f, -0.295f, 0.0f, 0.222f, 0.722f, 1.0f, -0.292f, 0.0f, 0.217f, 0.725f, 1.0f,
- -0.289f, 0.0f, 0.21f, 0.727f, 1.0f, -0.287f, 0.0f, 0.202f, 0.728f, 1.0f, -0.285f, 0.0f, 0.194f, 0.729f, 1.0f, -0.286f, 0.0f, 0.185f, 0.729f, 1.0f,
- -0.287f, 0.0f, 0.178f, 0.728f, 1.0f, -0.289f, 0.0f, 0.171f, 0.726f, 1.0f, -0.292f, 0.0f, 0.166f, 0.723f, 1.0f, -0.294f, 0.0f, 0.162f, 0.717f, 1.0f,
- -0.297f, 0.0f, 0.159f, 0.71f, 1.0f, -0.299f, 0.0f, 0.157f, 0.701f, 1.0f, -0.301f, 0.0f, 0.155f, 0.689f, 1.0f, -0.303f, 0.0f, 0.154f, 0.675f, 1.0f,
- -0.305f, 0.0f, 0.152f, 0.659f, 1.0f, -0.306f, 0.0f, 0.151f, 0.641f, 1.0f, -0.308f, 0.0f, 0.151f, 0.62f, 1.0f, -0.309f, 0.0f, 0.15f, 0.602f, 1.0f,
- -0.31f, 0.0f, 0.15f, 0.572f, 1.0f,
+static const float data26[18 * GP_PRIM_DATABUF_SIZE] = {
+ 0.9747f, 0.0f, 0.1745f, 0.1f, 1.0f,
+ 0.9706f, 0.0f, 0.177f, 0.2199f, 1.0f,
+ 0.954f, 0.0f, 0.1852f, 0.6019f, 1.0f,
+ 0.9377f, 0.0f, 0.1907f, 0.7689f, 1.0f,
+ 0.9216f, 0.0f, 0.1936f, 0.866f, 1.0f,
+ 0.906f, 0.0f, 0.1941f, 0.9272f, 1.0f,
+ 0.8908f, 0.0f, 0.1923f, 0.9653f, 1.0f,
+ 0.8762f, 0.0f, 0.1885f, 0.9876f, 1.0f,
+ 0.8622f, 0.0f, 0.1827f, 0.9983f, 1.0f,
+ 0.849f, 0.0f, 0.1752f, 0.999f, 1.0f,
+ 0.8365f, 0.0f, 0.1662f, 0.9912f, 1.0f,
+ 0.8249f, 0.0f, 0.1558f, 0.9724f, 1.0f,
+ 0.8143f, 0.0f, 0.1441f, 0.9385f, 1.0f,
+ 0.8046f, 0.0f, 0.1314f, 0.8841f, 1.0f,
+ 0.7961f, 0.0f, 0.1179f, 0.7979f, 1.0f,
+ 0.7888f, 0.0f, 0.1036f, 0.6541f, 1.0f,
+ 0.7828f, 0.0f, 0.0889f, 0.36f, 1.0f,
+ 0.7802f, 0.0f, 0.0813f, 0.1f, 1.0f,
};
-static const float data34[57 * GP_PRIM_DATABUF_SIZE] = {
- 0.302f, 0.0f, 0.166f, 0.25f, 1.0f, 0.301f, 0.0f, 0.167f, 0.319f, 1.0f, 0.3f, 0.0f, 0.167f, 0.363f, 1.0f, 0.299f, 0.0f, 0.167f, 0.414f, 1.0f,
- 0.298f, 0.0f, 0.167f, 0.459f, 1.0f, 0.296f, 0.0f, 0.168f, 0.501f, 1.0f, 0.295f, 0.0f, 0.168f, 0.539f, 1.0f, 0.293f, 0.0f, 0.169f, 0.573f, 1.0f,
- 0.291f, 0.0f, 0.17f, 0.603f, 1.0f, 0.289f, 0.0f, 0.171f, 0.629f, 1.0f, 0.286f, 0.0f, 0.173f, 0.652f, 1.0f, 0.283f, 0.0f, 0.176f, 0.672f, 1.0f,
- 0.279f, 0.0f, 0.18f, 0.69f, 1.0f, 0.276f, 0.0f, 0.186f, 0.705f, 1.0f, 0.272f, 0.0f, 0.195f, 0.719f, 1.0f, 0.271f, 0.0f, 0.205f, 0.73f, 1.0f,
- 0.272f, 0.0f, 0.217f, 0.741f, 1.0f, 0.275f, 0.0f, 0.227f, 0.75f, 1.0f, 0.279f, 0.0f, 0.234f, 0.758f, 1.0f, 0.283f, 0.0f, 0.24f, 0.765f, 1.0f,
- 0.287f, 0.0f, 0.243f, 0.771f, 1.0f, 0.291f, 0.0f, 0.245f, 0.776f, 1.0f, 0.294f, 0.0f, 0.247f, 0.781f, 1.0f, 0.296f, 0.0f, 0.248f, 0.785f, 1.0f,
- 0.299f, 0.0f, 0.249f, 0.789f, 1.0f, 0.301f, 0.0f, 0.249f, 0.793f, 1.0f, 0.303f, 0.0f, 0.249f, 0.796f, 1.0f, 0.305f, 0.0f, 0.25f, 0.799f, 1.0f,
- 0.306f, 0.0f, 0.25f, 0.802f, 1.0f, 0.308f, 0.0f, 0.249f, 0.805f, 1.0f, 0.31f, 0.0f, 0.249f, 0.808f, 1.0f, 0.311f, 0.0f, 0.249f, 0.81f, 1.0f,
- 0.313f, 0.0f, 0.249f, 0.813f, 1.0f, 0.314f, 0.0f, 0.248f, 0.816f, 1.0f, 0.316f, 0.0f, 0.248f, 0.819f, 1.0f, 0.317f, 0.0f, 0.247f, 0.822f, 1.0f,
- 0.319f, 0.0f, 0.246f, 0.825f, 1.0f, 0.321f, 0.0f, 0.245f, 0.828f, 1.0f, 0.323f, 0.0f, 0.244f, 0.832f, 1.0f, 0.325f, 0.0f, 0.243f, 0.835f, 1.0f,
- 0.328f, 0.0f, 0.24f, 0.838f, 1.0f, 0.33f, 0.0f, 0.237f, 0.841f, 1.0f, 0.333f, 0.0f, 0.233f, 0.844f, 1.0f, 0.337f, 0.0f, 0.228f, 0.847f, 1.0f,
- 0.339f, 0.0f, 0.219f, 0.849f, 1.0f, 0.341f, 0.0f, 0.209f, 0.852f, 1.0f, 0.34f, 0.0f, 0.197f, 0.854f, 1.0f, 0.336f, 0.0f, 0.186f, 0.856f, 1.0f,
- 0.331f, 0.0f, 0.178f, 0.858f, 1.0f, 0.325f, 0.0f, 0.173f, 0.86f, 1.0f, 0.321f, 0.0f, 0.17f, 0.861f, 1.0f, 0.318f, 0.0f, 0.169f, 0.862f, 1.0f,
- 0.315f, 0.0f, 0.168f, 0.864f, 1.0f, 0.312f, 0.0f, 0.167f, 0.865f, 1.0f, 0.311f, 0.0f, 0.167f, 0.866f, 1.0f, 0.309f, 0.0f, 0.166f, 0.867f, 1.0f,
- 0.308f, 0.0f, 0.166f, 0.868f, 1.0f,
+static const float data27[33 * GP_PRIM_DATABUF_SIZE] = {
+ -0.186f, 0.0f, 0.0983f, 0.1f, 1.0f,
+ -0.1954f, 0.0f, 0.0774f, 0.2199f, 1.0f,
+ -0.2191f, 0.0f, 0.0407f, 0.4615f, 1.0f,
+ -0.2434f, 0.0f, 0.0158f, 0.6019f, 1.0f,
+ -0.2723f, 0.0f, -0.0047f, 0.6981f, 1.0f,
+ -0.3017f, 0.0f, -0.0179f, 0.7689f, 1.0f,
+ -0.3302f, 0.0f, -0.0247f, 0.8236f, 1.0f,
+ -0.3576f, 0.0f, -0.0262f, 0.866f, 1.0f,
+ -0.3837f, 0.0f, -0.0231f, 0.9003f, 1.0f,
+ -0.4085f, 0.0f, -0.0159f, 0.9272f, 1.0f,
+ -0.4317f, 0.0f, -0.0049f, 0.9485f, 1.0f,
+ -0.4533f, 0.0f, 0.0099f, 0.9653f, 1.0f,
+ -0.4734f, 0.0f, 0.0289f, 0.9781f, 1.0f,
+ -0.4916f, 0.0f, 0.0524f, 0.9876f, 1.0f,
+ -0.507f, 0.0f, 0.0806f, 0.9942f, 1.0f,
+ -0.5185f, 0.0f, 0.1134f, 0.9983f, 1.0f,
+ -0.5247f, 0.0f, 0.1498f, 0.9997f, 1.0f,
+ -0.5246f, 0.0f, 0.1884f, 0.999f, 1.0f,
+ -0.5175f, 0.0f, 0.2267f, 0.9963f, 1.0f,
+ -0.5043f, 0.0f, 0.2616f, 0.9912f, 1.0f,
+ -0.4864f, 0.0f, 0.2916f, 0.9834f, 1.0f,
+ -0.4653f, 0.0f, 0.3159f, 0.9724f, 1.0f,
+ -0.4422f, 0.0f, 0.3349f, 0.9576f, 1.0f,
+ -0.4177f, 0.0f, 0.3489f, 0.9385f, 1.0f,
+ -0.3921f, 0.0f, 0.3582f, 0.9143f, 1.0f,
+ -0.3661f, 0.0f, 0.3628f, 0.8841f, 1.0f,
+ -0.3392f, 0.0f, 0.363f, 0.8461f, 1.0f,
+ -0.3123f, 0.0f, 0.3586f, 0.7979f, 1.0f,
+ -0.2853f, 0.0f, 0.3491f, 0.7359f, 1.0f,
+ -0.2591f, 0.0f, 0.3344f, 0.6541f, 1.0f,
+ -0.2339f, 0.0f, 0.3137f, 0.5396f, 1.0f,
+ -0.2118f, 0.0f, 0.2882f, 0.36f, 1.0f,
+ -0.1906f, 0.0f, 0.2516f, 0.1f, 1.0f,
};
-static const float data35[261 * GP_PRIM_DATABUF_SIZE] = {
- -0.685f, 0.0f, 0.408f, 0.0f, 1.0f, -0.683f, 0.0f, 0.41f, 0.023f, 1.0f, -0.681f, 0.0f, 0.412f, 0.051f, 1.0f, -0.679f, 0.0f, 0.414f, 0.092f, 1.0f,
- -0.678f, 0.0f, 0.415f, 0.125f, 1.0f, -0.676f, 0.0f, 0.417f, 0.149f, 1.0f, -0.674f, 0.0f, 0.419f, 0.167f, 1.0f, -0.672f, 0.0f, 0.42f, 0.183f, 1.0f,
- -0.67f, 0.0f, 0.422f, 0.199f, 1.0f, -0.668f, 0.0f, 0.424f, 0.218f, 1.0f, -0.666f, 0.0f, 0.426f, 0.237f, 1.0f, -0.664f, 0.0f, 0.429f, 0.257f, 1.0f,
- -0.661f, 0.0f, 0.431f, 0.275f, 1.0f, -0.659f, 0.0f, 0.434f, 0.291f, 1.0f, -0.657f, 0.0f, 0.436f, 0.305f, 1.0f, -0.655f, 0.0f, 0.439f, 0.315f, 1.0f,
- -0.653f, 0.0f, 0.442f, 0.322f, 1.0f, -0.65f, 0.0f, 0.444f, 0.327f, 1.0f, -0.648f, 0.0f, 0.447f, 0.331f, 1.0f, -0.646f, 0.0f, 0.45f, 0.334f, 1.0f,
- -0.643f, 0.0f, 0.453f, 0.334f, 1.0f, -0.641f, 0.0f, 0.456f, 0.334f, 1.0f, -0.639f, 0.0f, 0.459f, 0.334f, 1.0f, -0.636f, 0.0f, 0.462f, 0.333f, 1.0f,
- -0.634f, 0.0f, 0.466f, 0.332f, 1.0f, -0.631f, 0.0f, 0.469f, 0.332f, 1.0f, -0.628f, 0.0f, 0.473f, 0.332f, 1.0f, -0.625f, 0.0f, 0.476f, 0.333f, 1.0f,
- -0.622f, 0.0f, 0.48f, 0.335f, 1.0f, -0.618f, 0.0f, 0.483f, 0.338f, 1.0f, -0.615f, 0.0f, 0.488f, 0.342f, 1.0f, -0.611f, 0.0f, 0.492f, 0.347f, 1.0f,
- -0.608f, 0.0f, 0.495f, 0.352f, 1.0f, -0.605f, 0.0f, 0.5f, 0.358f, 1.0f, -0.601f, 0.0f, 0.505f, 0.363f, 1.0f, -0.597f, 0.0f, 0.509f, 0.366f, 1.0f,
- -0.593f, 0.0f, 0.514f, 0.367f, 1.0f, -0.589f, 0.0f, 0.518f, 0.367f, 1.0f, -0.585f, 0.0f, 0.522f, 0.369f, 1.0f, -0.582f, 0.0f, 0.526f, 0.372f, 1.0f,
- -0.578f, 0.0f, 0.531f, 0.376f, 1.0f, -0.575f, 0.0f, 0.535f, 0.382f, 1.0f, -0.571f, 0.0f, 0.539f, 0.388f, 1.0f, -0.567f, 0.0f, 0.543f, 0.394f, 1.0f,
- -0.563f, 0.0f, 0.547f, 0.4f, 1.0f, -0.56f, 0.0f, 0.551f, 0.406f, 1.0f, -0.556f, 0.0f, 0.555f, 0.411f, 1.0f, -0.552f, 0.0f, 0.559f, 0.415f, 1.0f,
- -0.548f, 0.0f, 0.563f, 0.418f, 1.0f, -0.544f, 0.0f, 0.566f, 0.419f, 1.0f, -0.54f, 0.0f, 0.569f, 0.42f, 1.0f, -0.537f, 0.0f, 0.572f, 0.421f, 1.0f,
- -0.533f, 0.0f, 0.576f, 0.421f, 1.0f, -0.529f, 0.0f, 0.579f, 0.421f, 1.0f, -0.526f, 0.0f, 0.582f, 0.422f, 1.0f, -0.523f, 0.0f, 0.585f, 0.422f, 1.0f,
- -0.52f, 0.0f, 0.588f, 0.423f, 1.0f, -0.516f, 0.0f, 0.591f, 0.426f, 1.0f, -0.513f, 0.0f, 0.594f, 0.43f, 1.0f, -0.51f, 0.0f, 0.597f, 0.435f, 1.0f,
- -0.507f, 0.0f, 0.6f, 0.441f, 1.0f, -0.504f, 0.0f, 0.603f, 0.447f, 1.0f, -0.501f, 0.0f, 0.606f, 0.453f, 1.0f, -0.498f, 0.0f, 0.609f, 0.458f, 1.0f,
- -0.496f, 0.0f, 0.611f, 0.461f, 1.0f, -0.493f, 0.0f, 0.614f, 0.465f, 1.0f, -0.49f, 0.0f, 0.616f, 0.468f, 1.0f, -0.487f, 0.0f, 0.619f, 0.472f, 1.0f,
- -0.484f, 0.0f, 0.621f, 0.476f, 1.0f, -0.482f, 0.0f, 0.624f, 0.48f, 1.0f, -0.479f, 0.0f, 0.627f, 0.484f, 1.0f, -0.476f, 0.0f, 0.629f, 0.487f, 1.0f,
- -0.473f, 0.0f, 0.632f, 0.491f, 1.0f, -0.471f, 0.0f, 0.634f, 0.495f, 1.0f, -0.468f, 0.0f, 0.637f, 0.499f, 1.0f, -0.465f, 0.0f, 0.639f, 0.504f, 1.0f,
- -0.462f, 0.0f, 0.641f, 0.508f, 1.0f, -0.459f, 0.0f, 0.643f, 0.513f, 1.0f, -0.456f, 0.0f, 0.646f, 0.519f, 1.0f, -0.453f, 0.0f, 0.648f, 0.525f, 1.0f,
- -0.45f, 0.0f, 0.65f, 0.533f, 1.0f, -0.447f, 0.0f, 0.652f, 0.54f, 1.0f, -0.444f, 0.0f, 0.655f, 0.546f, 1.0f, -0.441f, 0.0f, 0.657f, 0.553f, 1.0f,
- -0.438f, 0.0f, 0.659f, 0.56f, 1.0f, -0.435f, 0.0f, 0.662f, 0.567f, 1.0f, -0.432f, 0.0f, 0.664f, 0.574f, 1.0f, -0.429f, 0.0f, 0.666f, 0.58f, 1.0f,
- -0.426f, 0.0f, 0.669f, 0.585f, 1.0f, -0.423f, 0.0f, 0.671f, 0.591f, 1.0f, -0.419f, 0.0f, 0.673f, 0.595f, 1.0f, -0.416f, 0.0f, 0.675f, 0.6f, 1.0f,
- -0.412f, 0.0f, 0.678f, 0.604f, 1.0f, -0.409f, 0.0f, 0.68f, 0.609f, 1.0f, -0.405f, 0.0f, 0.682f, 0.613f, 1.0f, -0.401f, 0.0f, 0.684f, 0.618f, 1.0f,
- -0.398f, 0.0f, 0.687f, 0.622f, 1.0f, -0.394f, 0.0f, 0.689f, 0.627f, 1.0f, -0.39f, 0.0f, 0.692f, 0.632f, 1.0f, -0.386f, 0.0f, 0.694f, 0.638f, 1.0f,
- -0.381f, 0.0f, 0.697f, 0.643f, 1.0f, -0.377f, 0.0f, 0.7f, 0.649f, 1.0f, -0.373f, 0.0f, 0.702f, 0.654f, 1.0f, -0.368f, 0.0f, 0.705f, 0.659f, 1.0f,
- -0.363f, 0.0f, 0.707f, 0.663f, 1.0f, -0.359f, 0.0f, 0.71f, 0.667f, 1.0f, -0.354f, 0.0f, 0.712f, 0.671f, 1.0f, -0.349f, 0.0f, 0.715f, 0.674f, 1.0f,
- -0.345f, 0.0f, 0.717f, 0.677f, 1.0f, -0.34f, 0.0f, 0.72f, 0.68f, 1.0f, -0.335f, 0.0f, 0.722f, 0.683f, 1.0f, -0.33f, 0.0f, 0.725f, 0.685f, 1.0f,
- -0.326f, 0.0f, 0.727f, 0.687f, 1.0f, -0.321f, 0.0f, 0.73f, 0.689f, 1.0f, -0.316f, 0.0f, 0.732f, 0.691f, 1.0f, -0.312f, 0.0f, 0.734f, 0.693f, 1.0f,
- -0.307f, 0.0f, 0.736f, 0.694f, 1.0f, -0.302f, 0.0f, 0.738f, 0.696f, 1.0f, -0.298f, 0.0f, 0.74f, 0.697f, 1.0f, -0.293f, 0.0f, 0.741f, 0.698f, 1.0f,
- -0.288f, 0.0f, 0.743f, 0.699f, 1.0f, -0.284f, 0.0f, 0.745f, 0.699f, 1.0f, -0.279f, 0.0f, 0.746f, 0.7f, 1.0f, -0.275f, 0.0f, 0.748f, 0.701f, 1.0f,
- -0.27f, 0.0f, 0.749f, 0.702f, 1.0f, -0.265f, 0.0f, 0.751f, 0.702f, 1.0f, -0.261f, 0.0f, 0.752f, 0.704f, 1.0f, -0.256f, 0.0f, 0.753f, 0.705f, 1.0f,
- -0.252f, 0.0f, 0.755f, 0.706f, 1.0f, -0.247f, 0.0f, 0.756f, 0.707f, 1.0f, -0.242f, 0.0f, 0.757f, 0.709f, 1.0f, -0.237f, 0.0f, 0.758f, 0.711f, 1.0f,
- -0.233f, 0.0f, 0.759f, 0.713f, 1.0f, -0.228f, 0.0f, 0.761f, 0.715f, 1.0f, -0.223f, 0.0f, 0.762f, 0.717f, 1.0f, -0.218f, 0.0f, 0.763f, 0.719f, 1.0f,
- -0.213f, 0.0f, 0.764f, 0.721f, 1.0f, -0.209f, 0.0f, 0.765f, 0.723f, 1.0f, -0.204f, 0.0f, 0.765f, 0.726f, 1.0f, -0.199f, 0.0f, 0.766f, 0.728f, 1.0f,
- -0.194f, 0.0f, 0.767f, 0.73f, 1.0f, -0.189f, 0.0f, 0.768f, 0.731f, 1.0f, -0.183f, 0.0f, 0.769f, 0.733f, 1.0f, -0.178f, 0.0f, 0.77f, 0.735f, 1.0f,
- -0.173f, 0.0f, 0.77f, 0.736f, 1.0f, -0.168f, 0.0f, 0.771f, 0.738f, 1.0f, -0.163f, 0.0f, 0.772f, 0.739f, 1.0f, -0.158f, 0.0f, 0.772f, 0.741f, 1.0f,
- -0.152f, 0.0f, 0.773f, 0.742f, 1.0f, -0.147f, 0.0f, 0.774f, 0.744f, 1.0f, -0.142f, 0.0f, 0.774f, 0.746f, 1.0f, -0.137f, 0.0f, 0.775f, 0.748f, 1.0f,
- -0.132f, 0.0f, 0.775f, 0.749f, 1.0f, -0.127f, 0.0f, 0.776f, 0.751f, 1.0f, -0.122f, 0.0f, 0.776f, 0.752f, 1.0f, -0.117f, 0.0f, 0.776f, 0.753f, 1.0f,
- -0.112f, 0.0f, 0.777f, 0.754f, 1.0f, -0.108f, 0.0f, 0.777f, 0.755f, 1.0f, -0.103f, 0.0f, 0.777f, 0.755f, 1.0f, -0.099f, 0.0f, 0.777f, 0.756f, 1.0f,
- -0.095f, 0.0f, 0.778f, 0.757f, 1.0f, -0.09f, 0.0f, 0.778f, 0.758f, 1.0f, -0.086f, 0.0f, 0.778f, 0.759f, 1.0f, -0.082f, 0.0f, 0.778f, 0.759f, 1.0f,
- -0.077f, 0.0f, 0.778f, 0.76f, 1.0f, -0.073f, 0.0f, 0.779f, 0.76f, 1.0f, -0.069f, 0.0f, 0.779f, 0.761f, 1.0f, -0.064f, 0.0f, 0.779f, 0.761f, 1.0f,
- -0.06f, 0.0f, 0.779f, 0.761f, 1.0f, -0.055f, 0.0f, 0.78f, 0.762f, 1.0f, -0.051f, 0.0f, 0.78f, 0.762f, 1.0f, -0.046f, 0.0f, 0.78f, 0.762f, 1.0f,
- -0.041f, 0.0f, 0.78f, 0.762f, 1.0f, -0.037f, 0.0f, 0.781f, 0.762f, 1.0f, -0.032f, 0.0f, 0.781f, 0.763f, 1.0f, -0.027f, 0.0f, 0.781f, 0.763f, 1.0f,
- -0.022f, 0.0f, 0.781f, 0.763f, 1.0f, -0.017f, 0.0f, 0.781f, 0.764f, 1.0f, -0.012f, 0.0f, 0.782f, 0.764f, 1.0f, -0.006f, 0.0f, 0.782f, 0.764f, 1.0f,
- -0.001f, 0.0f, 0.782f, 0.765f, 1.0f, 0.004f, 0.0f, 0.782f, 0.766f, 1.0f, 0.009f, 0.0f, 0.782f, 0.766f, 1.0f, 0.015f, 0.0f, 0.782f, 0.767f, 1.0f,
- 0.02f, 0.0f, 0.782f, 0.768f, 1.0f, 0.025f, 0.0f, 0.782f, 0.769f, 1.0f, 0.031f, 0.0f, 0.782f, 0.77f, 1.0f, 0.036f, 0.0f, 0.782f, 0.771f, 1.0f,
- 0.042f, 0.0f, 0.782f, 0.772f, 1.0f, 0.048f, 0.0f, 0.782f, 0.773f, 1.0f, 0.053f, 0.0f, 0.782f, 0.774f, 1.0f, 0.059f, 0.0f, 0.782f, 0.775f, 1.0f,
- 0.065f, 0.0f, 0.782f, 0.775f, 1.0f, 0.07f, 0.0f, 0.782f, 0.776f, 1.0f, 0.076f, 0.0f, 0.782f, 0.776f, 1.0f, 0.082f, 0.0f, 0.782f, 0.776f, 1.0f,
- 0.088f, 0.0f, 0.782f, 0.776f, 1.0f, 0.094f, 0.0f, 0.782f, 0.777f, 1.0f, 0.1f, 0.0f, 0.781f, 0.777f, 1.0f, 0.106f, 0.0f, 0.781f, 0.778f, 1.0f,
- 0.111f, 0.0f, 0.781f, 0.779f, 1.0f, 0.117f, 0.0f, 0.781f, 0.779f, 1.0f, 0.123f, 0.0f, 0.781f, 0.78f, 1.0f, 0.129f, 0.0f, 0.78f, 0.78f, 1.0f,
- 0.135f, 0.0f, 0.78f, 0.781f, 1.0f, 0.141f, 0.0f, 0.779f, 0.781f, 1.0f, 0.147f, 0.0f, 0.779f, 0.782f, 1.0f, 0.153f, 0.0f, 0.778f, 0.783f, 1.0f,
- 0.159f, 0.0f, 0.777f, 0.784f, 1.0f, 0.165f, 0.0f, 0.776f, 0.785f, 1.0f, 0.171f, 0.0f, 0.775f, 0.786f, 1.0f, 0.178f, 0.0f, 0.774f, 0.787f, 1.0f,
- 0.185f, 0.0f, 0.773f, 0.788f, 1.0f, 0.192f, 0.0f, 0.772f, 0.789f, 1.0f, 0.2f, 0.0f, 0.771f, 0.79f, 1.0f, 0.208f, 0.0f, 0.77f, 0.791f, 1.0f,
- 0.218f, 0.0f, 0.768f, 0.793f, 1.0f, 0.228f, 0.0f, 0.766f, 0.796f, 1.0f, 0.239f, 0.0f, 0.764f, 0.799f, 1.0f, 0.25f, 0.0f, 0.762f, 0.802f, 1.0f,
- 0.261f, 0.0f, 0.759f, 0.806f, 1.0f, 0.271f, 0.0f, 0.755f, 0.81f, 1.0f, 0.282f, 0.0f, 0.752f, 0.815f, 1.0f, 0.293f, 0.0f, 0.748f, 0.819f, 1.0f,
- 0.304f, 0.0f, 0.744f, 0.825f, 1.0f, 0.315f, 0.0f, 0.74f, 0.83f, 1.0f, 0.326f, 0.0f, 0.736f, 0.836f, 1.0f, 0.337f, 0.0f, 0.731f, 0.843f, 1.0f,
- 0.349f, 0.0f, 0.727f, 0.85f, 1.0f, 0.361f, 0.0f, 0.722f, 0.858f, 1.0f, 0.372f, 0.0f, 0.718f, 0.866f, 1.0f, 0.384f, 0.0f, 0.712f, 0.874f, 1.0f,
- 0.395f, 0.0f, 0.706f, 0.882f, 1.0f, 0.407f, 0.0f, 0.7f, 0.89f, 1.0f, 0.418f, 0.0f, 0.693f, 0.898f, 1.0f, 0.43f, 0.0f, 0.685f, 0.905f, 1.0f,
- 0.442f, 0.0f, 0.677f, 0.912f, 1.0f, 0.458f, 0.0f, 0.666f, 0.918f, 1.0f, 0.473f, 0.0f, 0.654f, 0.924f, 1.0f, 0.49f, 0.0f, 0.64f, 0.93f, 1.0f,
- 0.506f, 0.0f, 0.625f, 0.935f, 1.0f, 0.522f, 0.0f, 0.611f, 0.939f, 1.0f, 0.538f, 0.0f, 0.596f, 0.941f, 1.0f, 0.554f, 0.0f, 0.58f, 0.942f, 1.0f,
- 0.569f, 0.0f, 0.564f, 0.941f, 1.0f, 0.584f, 0.0f, 0.548f, 0.935f, 1.0f, 0.598f, 0.0f, 0.533f, 0.925f, 1.0f, 0.612f, 0.0f, 0.517f, 0.91f, 1.0f,
- 0.625f, 0.0f, 0.501f, 0.891f, 1.0f, 0.638f, 0.0f, 0.484f, 0.868f, 1.0f, 0.65f, 0.0f, 0.468f, 0.839f, 1.0f, 0.662f, 0.0f, 0.452f, 0.806f, 1.0f,
- 0.671f, 0.0f, 0.437f, 0.766f, 1.0f, 0.679f, 0.0f, 0.423f, 0.718f, 1.0f, 0.685f, 0.0f, 0.412f, 0.661f, 1.0f, 0.691f, 0.0f, 0.403f, 0.595f, 1.0f,
- 0.697f, 0.0f, 0.396f, 0.519f, 1.0f, 0.701f, 0.0f, 0.391f, 0.44f, 1.0f, 0.704f, 0.0f, 0.387f, 0.344f, 1.0f, 0.707f, 0.0f, 0.384f, 0.264f, 1.0f,
- 0.711f, 0.0f, 0.38f, 0.133f, 1.0f,
-};
/* ***************************************************************** */
/* Monkey Color Data */
@@ -1390,54 +1395,53 @@ static const ColorTemplate gp_monkey_pct_black = {
static const ColorTemplate gp_monkey_pct_skin = {
"Skin",
- {0.553f, 0.39f, 0.266f, 0.0f},
- {0.733f, 0.567f, 0.359f, 1.0f},
+ {0.733f, 0.569f, 0.361f, 1.0f},
+ {0.745f, 0.502f, 0.278f, 1.0f},
};
static const ColorTemplate gp_monkey_pct_skin_light = {
"Skin_Light",
- {0.553f, 0.39f, 0.266f, 0.0f},
- {0.913f, 0.828f, 0.637f, 1.0f},
+ {0.914f, 0.827f, 0.635f, 1.0f},
+ {0.913f, 0.828f, 0.637f, 0.0f},
};
static const ColorTemplate gp_monkey_pct_skin_shadow = {
"Skin_Shadow",
- {0.553f, 0.39f, 0.266f, 0.0f},
- {0.32f, 0.29f, 0.223f, 1.0f},
+ {0.322f, 0.29f, 0.224f, 0.5f},
+ {0.32f, 0.29f, 0.223f, 0.3f},
};
static const ColorTemplate gp_monkey_pct_eyes = {
"Eyes",
{0.553f, 0.39f, 0.266f, 0.0f},
- {0.773f, 0.762f, 0.73f, 1.0f},
+ {0.847f, 0.723f, 0.599f, 1.0f},
};
static const ColorTemplate gp_monkey_pct_pupils = {
"Pupils",
- {0.107f, 0.075f, 0.051f, 0.0f},
- {0.153f, 0.057f, 0.063f, 1.0f},
+ {0.0f, 0.0f, 0.0f, 0.0f},
+ {0.0f, 0.0f, 0.0f, 1.0f},
};
/* ***************************************************************** */
/* Monkey API */
/* add a 2D Suzanne (original model created by Matias Mendiola) */
-void ED_gpencil_create_monkey(bContext *C, float mat[4][4])
+void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4])
{
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
int cfra_eval = (int)DEG_get_ctime(depsgraph);
bGPdata *gpd = (bGPdata *)ob->data;
bGPDstroke *gps;
/* create colors */
- int color_Black = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_black);
- int color_Skin = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin);
- int color_Skin_Light = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin_light);
- int color_Skin_Shadow = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin_shadow);
- int color_Eyes = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_eyes);
- int color_Pupils = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_pupils);
+ int color_Black = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_black, true, false);
+ int color_Skin = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin, false, true);
+ int color_Skin_Light = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin_light, true, false);
+ int color_Skin_Shadow = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_skin_shadow, true, false);
+ int color_Eyes = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_eyes, false, true);
+ int color_Pupils = gpencil_monkey_color(bmain, ob, &gp_monkey_pct_pupils, false, true);
/* set first color as active */
ob->actcol = color_Black + 1;
@@ -1448,122 +1452,98 @@ void ED_gpencil_create_monkey(bContext *C, float mat[4][4])
/* layers */
/* NOTE: For now, we just add new layers, to make it easier to separate out old/new instances */
- bGPDlayer *Colors = BKE_gpencil_layer_addnew(gpd, "Colors", false);
+ bGPDlayer *Fills = BKE_gpencil_layer_addnew(gpd, "Fills", false);
bGPDlayer *Lines = BKE_gpencil_layer_addnew(gpd, "Lines", true);
/* frames */
/* NOTE: No need to check for existing, as this will take care of it for us */
- bGPDframe *frameColor = BKE_gpencil_frame_addnew(Colors, cfra_eval);
+ bGPDframe *frameFills = BKE_gpencil_frame_addnew(Fills, cfra_eval);
bGPDframe *frameLines = BKE_gpencil_frame_addnew(Lines, cfra_eval);
/* generate strokes */
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin, 538, 75);
- BKE_gpencil_stroke_add_points(gps, data0, 538, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Eyes, 136, 75);
- BKE_gpencil_stroke_add_points(gps, data1, 136, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin, 2, 75);
- BKE_gpencil_stroke_add_points(gps, data2, 2, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 1, 75);
- BKE_gpencil_stroke_add_points(gps, data3, 1, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 1, 75);
- BKE_gpencil_stroke_add_points(gps, data4, 1, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 48, 75);
- BKE_gpencil_stroke_add_points(gps, data5, 48, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 47, 75);
- BKE_gpencil_stroke_add_points(gps, data6, 47, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 162, 75);
- BKE_gpencil_stroke_add_points(gps, data7, 162, mat);
-
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 55, 75);
- BKE_gpencil_stroke_add_points(gps, data8, 55, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin, 270, 75);
+ BKE_gpencil_stroke_add_points(gps, data0, 270, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 70, 75);
- BKE_gpencil_stroke_add_points(gps, data9, 70, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Shadow, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data1, 33, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Light, 227, 75);
- BKE_gpencil_stroke_add_points(gps, data10, 227, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Shadow, 18, 60);
+ BKE_gpencil_stroke_add_points(gps, data2, 18, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 1, 75);
- BKE_gpencil_stroke_add_points(gps, data11, 1, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Light, 64, 60);
+ BKE_gpencil_stroke_add_points(gps, data3, 64, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 123, 75);
- BKE_gpencil_stroke_add_points(gps, data12, 123, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Light, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data4, 33, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 125, 75);
- BKE_gpencil_stroke_add_points(gps, data13, 125, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Light, 64, 60);
+ BKE_gpencil_stroke_add_points(gps, data5, 64, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 45, 75);
- BKE_gpencil_stroke_add_points(gps, data14, 45, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Light, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data6, 33, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 44, 75);
- BKE_gpencil_stroke_add_points(gps, data15, 44, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Light, 18, 40);
+ BKE_gpencil_stroke_add_points(gps, data7, 18, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 84, 75);
- BKE_gpencil_stroke_add_points(gps, data16, 84, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Eyes, 49, 60);
+ BKE_gpencil_stroke_add_points(gps, data8, 49, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 56, 75);
- BKE_gpencil_stroke_add_points(gps, data17, 56, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Shadow, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data9, 33, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 59, 75);
- BKE_gpencil_stroke_add_points(gps, data18, 59, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Eyes, 49, 60);
+ BKE_gpencil_stroke_add_points(gps, data10, 49, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Skin_Shadow, 100, 75);
- BKE_gpencil_stroke_add_points(gps, data19, 100, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Shadow, 18, 40);
+ BKE_gpencil_stroke_add_points(gps, data11, 18, mat);
- gps = BKE_gpencil_add_stroke(frameColor, color_Eyes, 136, 75);
- BKE_gpencil_stroke_add_points(gps, data20, 136, mat);
+ gps = BKE_gpencil_add_stroke(frameFills, color_Skin_Shadow, 18, 40);
+ BKE_gpencil_stroke_add_points(gps, data12, 18, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 353, 75);
- BKE_gpencil_stroke_add_points(gps, data21, 353, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data13, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 309, 75);
- BKE_gpencil_stroke_add_points(gps, data22, 309, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data14, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 209, 75);
- BKE_gpencil_stroke_add_points(gps, data23, 209, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 65, 60);
+ BKE_gpencil_stroke_add_points(gps, data15, 65, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 133, 75);
- BKE_gpencil_stroke_add_points(gps, data24, 133, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 34, 60);
+ BKE_gpencil_stroke_add_points(gps, data16, 34, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 389, 75);
- BKE_gpencil_stroke_add_points(gps, data25, 389, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data17, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 41, 75);
- BKE_gpencil_stroke_add_points(gps, data26, 41, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 40);
+ BKE_gpencil_stroke_add_points(gps, data18, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 77, 75);
- BKE_gpencil_stroke_add_points(gps, data27, 77, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 34, 40);
+ BKE_gpencil_stroke_add_points(gps, data19, 34, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 257, 75);
- BKE_gpencil_stroke_add_points(gps, data28, 257, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data20, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 205, 75);
- BKE_gpencil_stroke_add_points(gps, data29, 205, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 64, 60);
+ BKE_gpencil_stroke_add_points(gps, data21, 64, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 75);
- BKE_gpencil_stroke_add_points(gps, data30, 33, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Pupils, 26, 60);
+ BKE_gpencil_stroke_add_points(gps, data22, 26, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 37, 75);
- BKE_gpencil_stroke_add_points(gps, data31, 37, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Pupils, 26, 60);
+ BKE_gpencil_stroke_add_points(gps, data23, 26, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 201, 75);
- BKE_gpencil_stroke_add_points(gps, data32, 201, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data24, 33, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Pupils, 69, 75);
- BKE_gpencil_stroke_add_points(gps, data33, 69, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 18, 40);
+ BKE_gpencil_stroke_add_points(gps, data25, 18, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Pupils, 57, 75);
- BKE_gpencil_stroke_add_points(gps, data34, 57, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 18, 40);
+ BKE_gpencil_stroke_add_points(gps, data26, 18, mat);
- gps = BKE_gpencil_add_stroke(frameLines, color_Black, 261, 75);
- BKE_gpencil_stroke_add_points(gps, data35, 261, mat);
+ gps = BKE_gpencil_add_stroke(frameLines, color_Black, 33, 60);
+ BKE_gpencil_stroke_add_points(gps, data27, 33, mat);
/* update depsgraph */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index 330f7a69e09..e02fc4bf801 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Matias Mendiola
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_add_stroke.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -73,6 +66,10 @@ static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct)
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
+ if (pct->fill) {
+ ma->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ }
+
return BKE_gpencil_get_material_index(ob, ma) - 1;
}
@@ -213,10 +210,9 @@ static const ColorTemplate gp_stroke_material_grey = {
/* Stroke API */
/* add a Simple stroke with colors (original design created by Daniel M. Lara and Matias Mendiola) */
-void ED_gpencil_create_stroke(bContext *C, float mat[4][4])
+void ED_gpencil_create_stroke(bContext *C, Object *ob, float mat[4][4])
{
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
int cfra_eval = (int)DEG_get_ctime(depsgraph);
bGPdata *gpd = (bGPdata *)ob->data;
diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c
index 21715d7ba93..97f5db96a89 100644
--- a/source/blender/editors/gpencil/gpencil_armature.c
+++ b/source/blender/editors/gpencil/gpencil_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for dealing with armatures and GP datablocks
*/
-/** \file blender/editors/gpencil/gpencil_armature.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -40,9 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
#include "BLI_math.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -79,7 +70,7 @@
enum {
GP_ARMATURE_NAME = 0,
- GP_ARMATURE_AUTO = 1
+ GP_ARMATURE_AUTO = 1,
};
#define DEFAULT_RATIO 0.10f
@@ -655,7 +646,7 @@ void GPENCIL_OT_generate_weights(wmOperatorType *ot)
static const EnumPropertyItem mode_type[] = {
{GP_ARMATURE_NAME, "NAME", 0, "Empty Groups", ""},
{GP_ARMATURE_AUTO, "AUTO", 0, "Automatic Weights", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 5ec55d1e98e..ee1838af22a 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2015, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Brush based operators for editing Grease Pencil strokes
*/
-/** \file blender/editors/gpencil/gpencil_brush.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -63,7 +56,6 @@
#include "BKE_material.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
@@ -224,13 +216,13 @@ static GP_Sculpt_Data *gpsculpt_get_brush(Scene *scene, bool is_weight_mode)
/* Brush Operations ------------------------------- */
-/* Invert behaviour of brush? */
+/* Invert behavior of brush? */
static bool gp_brush_invert_check(tGP_BrushEditData *gso)
{
/* The basic setting is the brush's setting (from the panel) */
bool invert = ((gso->gp_brush->flag & GP_SCULPT_FLAG_INVERT) != 0);
- /* During runtime, the user can hold down the Ctrl key to invert the basic behaviour */
+ /* During runtime, the user can hold down the Ctrl key to invert the basic behavior */
if (gso->flag & GP_SCULPT_FLAG_INVERT) {
invert ^= true;
}
@@ -319,7 +311,7 @@ static bool gp_brush_smooth_apply(
BKE_gpencil_smooth_stroke_uv(gps, pt_index, inf);
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
return true;
}
@@ -535,7 +527,7 @@ static void gp_brush_grab_apply_cached(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* free customdata used for handling this stroke */
@@ -575,7 +567,7 @@ static bool gp_brush_push_apply(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@@ -661,7 +653,7 @@ static bool gp_brush_pinch_apply(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@@ -707,7 +699,8 @@ static bool gp_brush_twist_apply(
axis_angle_normalized_to_mat3(rmat, axis, angle);
/* Rotate point (no matrix-space transforms needed, as GP points are in world space) */
- sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center (center is stored in dvec) */
+ sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center
+ * (center is stored in dvec) */
mul_m3_v3(rmat, vec);
add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */
@@ -743,7 +736,7 @@ static bool gp_brush_twist_apply(
}
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@@ -867,7 +860,7 @@ static bool gp_brush_randomize_apply(
CLAMP(pt->uv_rot, -M_PI_2, M_PI_2);
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@@ -914,7 +907,7 @@ static bool gp_brush_weight_apply(
}
/* verify target weight */
- CLAMP_MAX(curweight, gso->gp_brush->target_weight);
+ CLAMP_MAX(curweight, gso->gp_brush->weight);
CLAMP(curweight, 0.0f, 1.0f);
if (dw) {
@@ -1252,9 +1245,8 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
gso->is_multiframe = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gso->gpd);
gso->use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0;
- /* init multiedit falloff curve data before doing anything,
- * so we won't have to do it again later
- */
+ /* Init multi-edit falloff curve data before doing anything,
+ * so we won't have to do it again later. */
if (gso->is_multiframe) {
curvemapping_initialize(ts->gp_sculpt.cur_falloff);
}
@@ -1609,7 +1601,7 @@ static bool gpsculpt_brush_do_frame(
}
/* Triangulation must be calculated if changed */
if (changed) {
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 49ce18753b1..af2c68d6c68 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- * Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operator for converting Grease Pencil data to geometry
*/
-/** \file blender/editors/gpencil/gpencil_convert.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -68,7 +60,6 @@
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_tracking.h"
#include "DEG_depsgraph.h"
@@ -115,7 +106,7 @@ static const EnumPropertyItem prop_gpencil_convertmodes[] = {
{GP_STROKECONVERT_PATH, "PATH", ICON_CURVE_PATH, "Path", "Animation path"},
{GP_STROKECONVERT_CURVE, "CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", "Smooth Bezier curve"},
{GP_STROKECONVERT_POLY, "POLY", ICON_MESH_DATA, "Polygon Curve", "Bezier curve with straight-line segments (vector handles)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = {
@@ -1129,7 +1120,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true); /* no shift */
+ ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true);
return 1;
}
}
@@ -1137,7 +1128,8 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
return 0;
}
-/* convert a given grease-pencil layer to a 3d-curve representation (using current view if appropriate) */
+/* convert a given grease-pencil layer to a 3d-curve representation
+ * (using current view if appropriate) */
static void gp_layer_to_curve(
bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, const int mode,
const bool norm_weights, const float rad_fac, const bool link_strokes, tGpTimingData *gtd)
@@ -1179,6 +1171,7 @@ static void gp_layer_to_curve(
cu = ob->data = BKE_curve_add(bmain, gpl->info, OB_CURVE);
BKE_collection_object_add(bmain, collection, ob);
base_new = BKE_view_layer_base_find(view_layer, ob);
+ DEG_relations_tag_update(bmain); /* added object */
cu->flag |= CU_3D;
@@ -1189,7 +1182,8 @@ static void gp_layer_to_curve(
const bool add_start_point = (link_strokes && !(prev_gps));
const bool add_end_point = (link_strokes && !(gps->next));
- /* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached, and stitch them to previous one. */
+ /* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached,
+ * and stitch them to previous one. */
bool stitch = false;
if (prev_gps) {
bGPDspoint *pt1 = &prev_gps->points[prev_gps->totpoints - 1];
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 51046726e19..cfcfc49b081 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,18 +13,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for dealing with GP datablocks and layers
*/
-/** \file blender/editors/gpencil/gpencil_data.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -62,7 +55,6 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_library.h"
@@ -73,7 +65,6 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -112,7 +103,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
}
else {
/* decrement user count and add new datablock */
- /* TODO: if a datablock exists, we should make a copy of it instead of starting fresh (as in other areas) */
+ /* TODO: if a datablock exists,
+ * we should make a copy of it instead of starting fresh (as in other areas) */
Main *bmain = CTX_data_main(C);
/* decrement user count of old GP datablock */
@@ -137,7 +129,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
- ED_gpencil_add_defaults(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_gpencil_add_defaults(C, ob);
/* add new layer */
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
@@ -245,7 +238,8 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
- ED_gpencil_add_defaults(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_gpencil_add_defaults(C, ob);
}
}
@@ -332,7 +326,7 @@ void GPENCIL_OT_layer_remove(wmOperatorType *ot)
enum {
GP_LAYER_MOVE_UP = -1,
- GP_LAYER_MOVE_DOWN = 1
+ GP_LAYER_MOVE_DOWN = 1,
};
static int gp_layer_move_exec(bContext *C, wmOperator *op)
@@ -360,7 +354,7 @@ void GPENCIL_OT_layer_move(wmOperatorType *ot)
static const EnumPropertyItem slot_move[] = {
{GP_LAYER_MOVE_UP, "UP", 0, "Up", ""},
{GP_LAYER_MOVE_DOWN, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -423,7 +417,7 @@ void GPENCIL_OT_layer_duplicate(wmOperatorType *ot)
/* ********************* Duplicate Layer in a new object ************************** */
enum {
GP_LAYER_COPY_OBJECT_ALL_FRAME = 0,
- GP_LAYER_COPY_OBJECT_ACT_FRAME = 1
+ GP_LAYER_COPY_OBJECT_ACT_FRAME = 1,
};
static bool gp_layer_duplicate_object_poll(bContext *C)
@@ -536,7 +530,7 @@ void GPENCIL_OT_layer_duplicate_object(wmOperatorType *ot)
static const EnumPropertyItem copy_mode[] = {
{GP_LAYER_COPY_OBJECT_ALL_FRAME, "ALL", 0, "All Frames", ""},
{GP_LAYER_COPY_OBJECT_ACT_FRAME, "ACTIVE", 0, "Active Frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -560,7 +554,7 @@ void GPENCIL_OT_layer_duplicate_object(wmOperatorType *ot)
/* ********************* Duplicate Frame ************************** */
enum {
GP_FRAME_DUP_ACTIVE = 0,
- GP_FRAME_DUP_ALL = 1
+ GP_FRAME_DUP_ALL = 1,
};
static int gp_frame_duplicate_exec(bContext *C, wmOperator *op)
@@ -599,7 +593,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot)
static const EnumPropertyItem duplicate_mode[] = {
{GP_FRAME_DUP_ACTIVE, "ACTIVE", 0, "Active", "Duplicate frame in active layer only"},
{GP_FRAME_DUP_ALL, "ALL", 0, "All", "Duplicate active frames in all layers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -620,7 +614,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot)
/* ********************* Clean Fill Boundaries on Frame ************************** */
enum {
GP_FRAME_CLEAN_FILL_ACTIVE = 0,
- GP_FRAME_CLEAN_FILL_ALL = 1
+ GP_FRAME_CLEAN_FILL_ALL = 1,
};
static int gp_frame_clean_fill_exec(bContext *C, wmOperator *op)
@@ -686,7 +680,7 @@ void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot)
static const EnumPropertyItem duplicate_mode[] = {
{GP_FRAME_CLEAN_FILL_ACTIVE, "ACTIVE", 0, "Active Frame Only", "Clean active frame only"},
{GP_FRAME_CLEAN_FILL_ALL, "ALL", 0, "All Frames", "Clean all frames in all layers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1215,7 +1209,7 @@ enum {
GP_STROKE_MOVE_UP = -1,
GP_STROKE_MOVE_DOWN = 1,
GP_STROKE_MOVE_TOP = 2,
- GP_STROKE_MOVE_BOTTOM = 3
+ GP_STROKE_MOVE_BOTTOM = 3,
};
static int gp_stroke_arrange_exec(bContext *C, wmOperator *op)
@@ -1794,6 +1788,10 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
+ if (gps->dvert == NULL) {
+ continue;
+ }
+
for (int s = 0; s < repeat; s++) {
for (int i = 0; i < gps->totpoints; i++) {
/* previous point */
@@ -1828,6 +1826,7 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op)
MDeformWeight *dw = defvert_verify_index(dvertb, def_nr);
if (dw) {
dw->weight = interpf(wb, optimal, fac);
+ CLAMP(dw->weight, 0.0, 1.0f);
}
}
}
@@ -1885,7 +1884,8 @@ static void joined_gpencil_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data)
const char *old_name = BLI_ghashIterator_getKey(&gh_iter);
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
- /* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
+ /* only remap if changed;
+ * this still means there will be some waste if there aren't many drivers/keys */
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(
id, fcu->rna_path, "layers",
@@ -2140,6 +2140,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
BKE_animdata_merge_copy(bmain, &gpd_dst->id, &gpd_src->id, ADT_MERGECOPY_KEEP_DST, false);
}
}
+ DEG_id_tag_update(&gpd_src->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
}
/* Free the old object */
@@ -2148,6 +2149,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ DEG_id_tag_update(&gpd_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain); /* because we removed object(s) */
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 5cfc35d122a..4ba74582774 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,20 +13,14 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for editing Grease Pencil strokes
*/
- /** \file blender/editors/gpencil/gpencil_edit.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <string.h>
@@ -40,9 +32,9 @@
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
+#include "BLI_lasso_2d.h"
#include "BLI_math.h"
#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -65,7 +57,6 @@
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "UI_interface.h"
@@ -86,6 +77,7 @@
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_select_utils.h"
#include "ED_space_api.h"
#include "DEG_depsgraph.h"
@@ -260,7 +252,7 @@ void GPENCIL_OT_selectmode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
/* properties */
- prop = RNA_def_int(ot->srna, "mode", 0, 0, 1, "Select mode", "Select mode", 0, 1);
+ prop = RNA_def_int(ot->srna, "mode", 0, 0, 2, "Select mode", "Select mode", 0, 2);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
@@ -627,11 +619,13 @@ static void gp_duplicate_points(const bGPDstroke *gps, ListBase *new_strokes, co
/* make a stupid copy first of the entire stroke (to get the flags too) */
gpsd = MEM_dupallocN(gps);
- BLI_strncpy(gpsd->runtime.tmp_layerinfo, layername, sizeof(gpsd->runtime.tmp_layerinfo)); /* saves original layer name */
+
+ /* saves original layer name */
+ BLI_strncpy(gpsd->runtime.tmp_layerinfo, layername, sizeof(gpsd->runtime.tmp_layerinfo));
/* initialize triangle memory - will be calculated on next redraw */
gpsd->triangles = NULL;
- gpsd->flag |= GP_STROKE_RECALC_CACHES;
+ gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->tot_triangles = 0;
/* now, make a new points array, and copy of the relevant parts */
@@ -713,7 +707,7 @@ static int gp_duplicate_exec(bContext *C, wmOperator *op)
}
/* triangle information - will be calculated on next redraw */
- gpsd->flag |= GP_STROKE_RECALC_CACHES;
+ gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->triangles = NULL;
/* add to temp buffer */
@@ -928,7 +922,8 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op)
/* make direct copies of the stroke and its points */
gpsd = MEM_dupallocN(gps);
- BLI_strncpy(gpsd->runtime.tmp_layerinfo, gpl->info, sizeof(gpsd->runtime.tmp_layerinfo)); /* saves original layer name */
+ /* saves original layer name */
+ BLI_strncpy(gpsd->runtime.tmp_layerinfo, gpl->info, sizeof(gpsd->runtime.tmp_layerinfo));
gpsd->points = MEM_dupallocN(gps->points);
if (gps->dvert != NULL) {
gpsd->dvert = MEM_dupallocN(gps->dvert);
@@ -936,7 +931,7 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op)
}
/* triangles cache - will be recalculated on next redraw */
- gpsd->flag |= GP_STROKE_RECALC_CACHES;
+ gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->tot_triangles = 0;
gpsd->triangles = NULL;
@@ -1007,7 +1002,7 @@ static bool gp_strokes_paste_poll(bContext *C)
typedef enum eGP_PasteMode {
GP_COPY_ONLY = -1,
- GP_COPY_MERGE = 1
+ GP_COPY_MERGE = 1,
} eGP_PasteMode;
static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
@@ -1113,7 +1108,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
new_stroke->dvert = MEM_dupallocN(gps->dvert);
BKE_gpencil_stroke_weights_duplicate(gps, new_stroke);
}
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
new_stroke->triangles = NULL;
new_stroke->next = new_stroke->prev = NULL;
@@ -1148,7 +1143,7 @@ void GPENCIL_OT_paste(wmOperatorType *ot)
static const EnumPropertyItem copy_type[] = {
{GP_COPY_ONLY, "COPY", 0, "Copy", ""},
{GP_COPY_MERGE, "MERGE", 0, "Merge", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1192,12 +1187,18 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
bGPDlayer *target_layer = NULL;
ListBase strokes = {NULL, NULL};
int layer_num = RNA_enum_get(op->ptr, "layer");
+ const bool use_autolock = (bool)(gpd->flag & GP_DATA_AUTOLOCK_LAYERS);
if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
return OPERATOR_CANCELLED;
}
+ /* if autolock enabled, disabled now */
+ if (use_autolock) {
+ gpd->flag &= ~GP_DATA_AUTOLOCK_LAYERS;
+ }
+
/* Get layer or create new one */
if (layer_num == -1) {
/* Create layer */
@@ -1208,6 +1209,10 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
target_layer = BLI_findlink(&gpd->layers, layer_num);
if (target_layer == NULL) {
+ /* back autolock status */
+ if (use_autolock) {
+ gpd->flag |= GP_DATA_AUTOLOCK_LAYERS;
+ }
BKE_reportf(op->reports, RPT_ERROR, "There is no layer number %d", layer_num);
return OPERATOR_CANCELLED;
}
@@ -1240,6 +1245,11 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
BLI_addtail(&strokes, gps);
}
}
+
+ /* if new layer and autolock, lock old layer */
+ if ((layer_num == -1) && (use_autolock)) {
+ gpl->flag |= GP_LAYER_LOCKED;
+ }
}
CTX_DATA_END;
@@ -1251,6 +1261,11 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
BLI_assert((strokes.first == strokes.last) && (strokes.first == NULL));
}
+ /* back autolock status */
+ if (use_autolock) {
+ gpd->flag |= GP_DATA_AUTOLOCK_LAYERS;
+ }
+
/* updates */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -1777,7 +1792,7 @@ static int gp_dissolve_selected_points(bContext *C, eGP_DissolveMode mode)
gps->totpoints = tot;
/* triangles cache needs to be recalculated */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
/* deselect the stroke, since none of its selected points will still be selected */
@@ -1816,6 +1831,89 @@ typedef struct tGPDeleteIsland {
int end_idx;
} tGPDeleteIsland;
+static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last)
+{
+ bGPDspoint *pt = NULL;
+ bGPDspoint *pt_final = NULL;
+ const int totpoints = gps_first->totpoints + gps_last->totpoints;
+
+ /* create new stroke */
+ bGPDstroke *join_stroke = MEM_dupallocN(gps_first);
+
+ join_stroke->points = MEM_callocN(sizeof(bGPDspoint) * totpoints, __func__);
+ join_stroke->totpoints = totpoints;
+ join_stroke->flag &= ~GP_STROKE_CYCLIC;
+
+ /* copy points (last before) */
+ int e1 = 0;
+ int e2 = 0;
+ float delta = 0.0f;
+
+ for (int i = 0; i < totpoints; i++) {
+ pt_final = &join_stroke->points[i];
+ if (i < gps_last->totpoints) {
+ pt = &gps_last->points[e1];
+ e1++;
+ }
+ else {
+ pt = &gps_first->points[e2];
+ e2++;
+ }
+
+ /* copy current point */
+ copy_v3_v3(&pt_final->x, &pt->x);
+ pt_final->pressure = pt->pressure;
+ pt_final->strength = pt->strength;
+ pt_final->time = delta;
+ pt_final->flag = pt->flag;
+
+ /* retiming with fixed time interval (we cannot determine real time) */
+ delta += 0.01f;
+ }
+
+ /* Copy over vertex weight data (if available) */
+ if ((gps_first->dvert != NULL) || (gps_last->dvert != NULL)) {
+ join_stroke->dvert = MEM_callocN(sizeof(MDeformVert) * totpoints, __func__);
+ MDeformVert *dvert_src = NULL;
+ MDeformVert *dvert_dst = NULL;
+
+ /* Copy weights (last before)*/
+ e1 = 0;
+ e2 = 0;
+ for (int i = 0; i < totpoints; i++) {
+ dvert_dst = &join_stroke->dvert[i];
+ dvert_src = NULL;
+ if (i < gps_last->totpoints) {
+ if (gps_last->dvert) {
+ dvert_src = &gps_last->dvert[e1];
+ e1++;
+ }
+ }
+ else {
+ if (gps_first->dvert) {
+ dvert_src = &gps_first->dvert[e2];
+ e2++;
+ }
+ }
+
+ if ((dvert_src) && (dvert_src->dw)) {
+ dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ }
+ }
+ }
+
+ /* add new stroke at head */
+ BLI_addhead(&gpf->strokes, join_stroke);
+
+ /* remove first stroke */
+ BLI_remlink(&gpf->strokes, gps_first);
+ BKE_gpencil_free_stroke(gps_first);
+
+ /* remove last stroke */
+ BLI_remlink(&gpf->strokes, gps_last);
+ BKE_gpencil_free_stroke(gps_last);
+}
+
/* Split the given stroke into several new strokes, partitioning
* it based on whether the stroke points have a particular flag
@@ -1829,14 +1927,17 @@ typedef struct tGPDeleteIsland {
* - Once we start having larger islands than that, the number required
* becomes much less
* 2) Each island gets converted to a new stroke
+ * If the number of points is <= limit, the stroke is deleted
*/
void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke,
- int tag_flags, bool select)
+ int tag_flags, bool select, int limit)
{
tGPDeleteIsland *islands = MEM_callocN(sizeof(tGPDeleteIsland) * (gps->totpoints + 1) / 2, "gp_point_islands");
bool in_island = false;
int num_islands = 0;
+ bGPDstroke *gps_first = NULL;
+ const bool is_cyclic = (bool)(gps->flag & GP_STROKE_CYCLIC);
/* First Pass: Identify start/end of islands */
bGPDspoint *pt = gps->points;
@@ -1869,15 +1970,22 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
if (num_islands) {
/* there are islands, so create a series of new strokes, adding them before the "next" stroke */
int idx;
+ bGPDstroke *new_stroke = NULL;
/* Create each new stroke... */
for (idx = 0; idx < num_islands; idx++) {
tGPDeleteIsland *island = &islands[idx];
- bGPDstroke *new_stroke = MEM_dupallocN(gps);
+ new_stroke = MEM_dupallocN(gps);
+
+ /* if cyclic and first stroke, save to join later */
+ if ((is_cyclic) && (gps_first == NULL)) {
+ gps_first = new_stroke;
+ }
/* initialize triangle memory - to be calculated on next redraw */
new_stroke->triangles = NULL;
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
+ new_stroke->flag &= ~GP_STROKE_CYCLIC;
new_stroke->tot_triangles = 0;
/* Compute new buffer size (+ 1 needed as the endpoint index is "inclusive") */
@@ -1888,7 +1996,7 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
memcpy(new_stroke->points, gps->points + island->start_idx, sizeof(bGPDspoint) * new_stroke->totpoints);
/* Copy over vertex weight data (if available) */
- if (new_stroke->dvert != NULL) {
+ if (gps->dvert != NULL) {
/* Copy over the relevant vertex-weight points */
new_stroke->dvert = MEM_callocN(sizeof(MDeformVert) * new_stroke->totpoints, "gp delete stroke fragment weight");
memcpy(new_stroke->dvert, gps->dvert + island->start_idx, sizeof(MDeformVert) * new_stroke->totpoints);
@@ -1896,13 +2004,14 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
/* Copy weights */
int e = island->start_idx;
for (int i = 0; i < new_stroke->totpoints; i++) {
- MDeformVert *dvert_dst = &gps->dvert[e];
- MDeformVert *dvert_src = &new_stroke->dvert[i];
- dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ MDeformVert *dvert_src = &gps->dvert[e];
+ MDeformVert *dvert_dst = &new_stroke->dvert[i];
+ if (dvert_src->dw) {
+ dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ }
e++;
}
}
-
/* Each island corresponds to a new stroke. We must adjust the
* timings of these new strokes:
*
@@ -1929,31 +2038,32 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
}
}
- /* Add new stroke to the frame */
- if (next_stroke) {
- BLI_insertlinkbefore(&gpf->strokes, next_stroke, new_stroke);
+ /* Add new stroke to the frame or delete if below limit */
+ if ((limit > 0) && (new_stroke->totpoints <= limit)) {
+ BKE_gpencil_free_stroke(new_stroke);
}
else {
- BLI_addtail(&gpf->strokes, new_stroke);
+ if (next_stroke) {
+ BLI_insertlinkbefore(&gpf->strokes, next_stroke, new_stroke);
+ }
+ else {
+ BLI_addtail(&gpf->strokes, new_stroke);
+ }
}
}
+ /* if cyclic, need to join last stroke with first stroke */
+ if ((is_cyclic) && (gps_first != NULL) && (gps_first != new_stroke)) {
+ gp_stroke_join_islands(gpf, gps_first, new_stroke);
+ }
+
}
/* free islands */
MEM_freeN(islands);
/* Delete the old stroke */
- if (gps->points) {
- MEM_freeN(gps->points);
- }
- if (gps->dvert) {
- BKE_gpencil_free_stroke_weights(gps);
- MEM_freeN(gps->dvert);
- }
- if (gps->triangles) {
- MEM_freeN(gps->triangles);
- }
- BLI_freelinkN(&gpf->strokes, gps);
+ BLI_remlink(&gpf->strokes, gps);
+ BKE_gpencil_free_stroke(gps);
}
/* Split selected strokes into segments, splitting on selected points */
@@ -1995,7 +2105,7 @@ static int gp_delete_selected_points(bContext *C)
gps->flag &= ~GP_STROKE_SELECT;
/* delete unwanted points by splitting stroke into several smaller ones */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
changed = true;
}
@@ -2051,7 +2161,7 @@ void GPENCIL_OT_delete(wmOperatorType *ot)
{GP_DELETEOP_POINTS, "POINTS", 0, "Points", "Delete selected points and split strokes into segments"},
{GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"},
{GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2084,7 +2194,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot)
{GP_DISSOLVE_POINTS, "POINTS", 0, "Dissolve", "Dissolve selected points"},
{GP_DISSOLVE_BETWEEN, "BETWEEN", 0, "Dissolve Between", "Dissolve points between selected points"},
{GP_DISSOLVE_UNSELECT, "UNSELECT", 0, "Dissolve Unselect", "Dissolve all unselected points"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2101,7 +2211,8 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
/* props */
- ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_dissolve_types, 0, "Type", "Method used for disolving Stroke points");
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_dissolve_types, 0,
+ "Type", "Method used for dissolving Stroke points");
}
/* ****************** Snapping - Strokes <-> Cursor ************************ */
@@ -2123,11 +2234,12 @@ static bool gp_snap_poll(bContext *C)
static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
+ RegionView3D *rv3d = CTX_wm_region_data(C);
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = CTX_data_active_object(C);
- const float gridf = ED_view3d_grid_scale(scene, v3d, NULL);
+ const float gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL);
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */
@@ -2418,7 +2530,7 @@ void GPENCIL_OT_stroke_apply_thickness(wmOperatorType *ot)
enum {
GP_STROKE_CYCLIC_CLOSE = 1,
GP_STROKE_CYCLIC_OPEN = 2,
- GP_STROKE_CYCLIC_TOGGLE = 3
+ GP_STROKE_CYCLIC_TOGGLE = 3,
};
static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op)
@@ -2486,7 +2598,7 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot)
{GP_STROKE_CYCLIC_CLOSE, "CLOSE", 0, "Close all", ""},
{GP_STROKE_CYCLIC_OPEN, "OPEN", 0, "Open all", ""},
{GP_STROKE_CYCLIC_TOGGLE, "TOGGLE", 0, "Toggle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2505,6 +2617,109 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", cyclic_type, GP_STROKE_CYCLIC_TOGGLE, "Type", "");
}
+/* ******************* Flat Stroke Caps ************************** */
+
+enum {
+ GP_STROKE_CAPS_TOGGLE_BOTH = 0,
+ GP_STROKE_CAPS_TOGGLE_START = 1,
+ GP_STROKE_CAPS_TOGGLE_END = 2,
+ GP_STROKE_CAPS_TOGGLE_DEFAULT = 3,
+};
+
+static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+ Object *ob = CTX_data_active_object(C);
+
+ const int type = RNA_enum_get(op->ptr, "type");
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd))
+ return OPERATOR_CANCELLED;
+
+ /* loop all selected strokes */
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ if (gpl->actframe == NULL)
+ continue;
+
+ for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
+ MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
+
+ /* skip strokes that are not selected or invalid for current view */
+ if (((gps->flag & GP_STROKE_SELECT) == 0) ||
+ (ED_gpencil_stroke_can_use(C, gps) == false))
+ {
+ continue;
+ }
+ /* skip hidden or locked colors */
+ if (!gp_style ||
+ (gp_style->flag & GP_STYLE_COLOR_HIDE) ||
+ (gp_style->flag & GP_STYLE_COLOR_LOCKED))
+ {
+ continue;
+ }
+
+ if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
+ (type == GP_STROKE_CAPS_TOGGLE_START))
+ {
+ ++gps->caps[0];
+ if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
+ gps->caps[0] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
+ (type == GP_STROKE_CAPS_TOGGLE_END))
+ {
+ ++gps->caps[1];
+ if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
+ gps->caps[1] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ if (type == GP_STROKE_CAPS_TOGGLE_DEFAULT) {
+ gps->caps[0] = GP_STROKE_CAP_ROUND;
+ gps->caps[1] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+/**
+ * Change Stroke caps mode Rounded or Flat
+ */
+void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot)
+{
+ static const EnumPropertyItem toggle_type[] = {
+ {GP_STROKE_CAPS_TOGGLE_BOTH, "TOGGLE", 0, "Both", ""},
+ {GP_STROKE_CAPS_TOGGLE_START, "START", 0, "Start", ""},
+ {GP_STROKE_CAPS_TOGGLE_END, "END", 0, "End", ""},
+ {GP_STROKE_CAPS_TOGGLE_DEFAULT, "TOGGLE", 0, "Default", "Set as default rounded"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* identifiers */
+ ot->name = "Set Caps Mode";
+ ot->idname = "GPENCIL_OT_stroke_caps_set";
+ ot->description = "Change Stroke caps mode (rounded or flat)";
+
+ /* api callbacks */
+ ot->exec = gp_stroke_caps_set_exec;
+ ot->poll = gp_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_enum(ot->srna, "type", toggle_type, GP_STROKE_CAPS_TOGGLE_BOTH, "Type", "");
+}
+
/* ******************* Stroke join ************************** */
/* Helper: flip stroke */
@@ -2706,7 +2921,7 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op)
}
new_stroke->triangles = NULL;
new_stroke->tot_triangles = 0;
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
/* if new, set current color */
if (type == GP_STROKE_JOINCOPY) {
@@ -2760,7 +2975,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot)
static const EnumPropertyItem join_type[] = {
{GP_STROKE_JOIN, "JOIN", 0, "Join", ""},
{GP_STROKE_JOINCOPY, "JOINCOPY", 0, "Join and Copy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2948,13 +3163,15 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
}
else {
/* Geometry - Snap to surfaces of visible geometry */
- /* XXX: There will be precision loss (possible stairstep artifacts) from this conversion to satisfy the API's */
+ /* XXX: There will be precision loss (possible stairstep artifacts)
+ * from this conversion to satisfy the API's */
const int screen_co[2] = {(int)xy[0], (int)xy[1]};
int depth_margin = 0; // XXX: 4 for strokes, 0 for normal
float depth;
- /* XXX: The proper procedure computes the depths into an array, to have smooth transitions when all else fails... */
+ /* XXX: The proper procedure computes the depths into an array,
+ * to have smooth transitions when all else fails... */
if (ED_view3d_autodist_depth(gsc.ar, screen_co, depth_margin, &depth)) {
ED_view3d_autodist_simple(gsc.ar, screen_co, &pt->x, 0, &depth);
}
@@ -2992,7 +3209,7 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
"using 'Cursor' Stroke Placement"},
{GP_REPROJECT_SURFACE, "SURFACE", 0, "Surface",
"Reproject the strokes on to the scene geometry, as if drawn using 'Surface' placement"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3123,7 +3340,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
if (gps->dvert != NULL) {
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* loop and interpolate */
i2 = 0;
@@ -3194,7 +3411,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
}
/* triangles cache needs to be recalculated */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}
}
@@ -3345,6 +3562,74 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot)
}
+/* ******************* Stroke trim ************************** */
+static int gp_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd))
+ return OPERATOR_CANCELLED;
+
+ /* Go through each editable + selected stroke */
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *init_gpf = gpl->actframe;
+ if (is_multiedit) {
+ init_gpf = gpl->frames.first;
+ }
+
+ for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+ if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
+ bGPDstroke *gps, *gpsn;
+
+ if (gpf == NULL)
+ continue;
+
+ for (gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
+
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false)
+ continue;
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ BKE_gpencil_trim_stroke(gps);
+ }
+ }
+ /* if not multiedit, exit loop*/
+ if (!is_multiedit) {
+ break;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_trim(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Trim Stroke";
+ ot->idname = "GPENCIL_OT_stroke_trim";
+ ot->description = "Trim selected stroke to first loop or intersection";
+
+ /* api callbacks */
+ ot->exec = gp_stroke_trim_exec;
+ ot->poll = gp_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ***************** Separate Strokes ********************** */
typedef enum eGP_SeparateModes {
/* Points */
@@ -3379,6 +3664,12 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
if (ELEM(NULL, gpd_src)) {
return OPERATOR_CANCELLED;
}
+
+ if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_count(&gpd_src->layers) == 1)) {
+ BKE_report(op->reports, RPT_ERROR, "Cannot separate an object with one layer only");
+ return OPERATOR_CANCELLED;
+ }
+
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src);
/* create a new object */
@@ -3386,7 +3677,6 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
ob_dst = base_new->object;
ob_dst->mode = OB_MODE_OBJECT;
/* create new grease pencil datablock */
- // XXX: check usercounts
gpd_dst = BKE_gpencil_data_addnew(bmain, gpd_src->id.name + 2);
ob_dst->data = (bGPdata *)gpd_dst;
@@ -3470,10 +3760,10 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
}
/* delete selected points from destination stroke */
- gp_stroke_delete_tagged_points(gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false, 0);
/* delete selected points from origin stroke */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
}
/* selected strokes mode */
else if (mode == GP_SEPARATE_STROKE) {
@@ -3514,8 +3804,35 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
gpl->prev = gpl->next = NULL;
/* relink to destination datablock */
BLI_addtail(&gpd_dst->layers, gpl);
+
+ /* add duplicate materials */
+ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false) {
+ continue;
+ }
+ ma = give_current_material(ob, gps->mat_nr + 1);
+ idx = BKE_gpencil_get_material_index(ob_dst, ma);
+ if (idx == 0) {
+ totadd++;
+ ob_dst->actcol = totadd;
+ ob_dst->totcol = totadd;
+
+ if (totadd > totslots) {
+ BKE_object_material_slot_add(bmain, ob_dst);
+ }
+
+ assign_material(bmain, ob_dst, ma, ob_dst->totcol, BKE_MAT_ASSIGN_USERPREF);
+ idx = totadd;
+ }
+ /* reasign material */
+ gps->mat_nr = idx - 1;
+ }
+ }
}
}
+
DEG_id_tag_update(&gpd_src->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
DEG_id_tag_update(&gpd_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
@@ -3532,7 +3849,7 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot)
{GP_SEPARATE_POINT, "POINT", 0, "Selected Points", "Separate the selected points"},
{GP_SEPARATE_STROKE, "STROKE", 0, "Selected Strokes", "Separate the selected strokes"},
{GP_SEPARATE_LAYER, "LAYER", 0, "Active Layer", "Separate the strokes of the current layer"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3607,10 +3924,10 @@ static int gp_stroke_split_exec(bContext *C, wmOperator *UNUSED(op))
}
/* delete selected points from destination stroke */
- gp_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true);
+ gp_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true, 0);
/* delete selected points from origin stroke */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
}
}
/* select again tagged points */
@@ -3700,3 +4017,241 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "smooth_strength", false, "Strength", "");
RNA_def_boolean(ot->srna, "smooth_uv", false, "UV", "");
}
+
+/* smart stroke cutter for trimming stroke ends */
+struct GP_SelectLassoUserData {
+ rcti rect;
+ const int(*mcords)[2];
+ int mcords_len;
+};
+
+static bool gpencil_test_lasso(
+ bGPDstroke *gps, bGPDspoint *pt,
+ const GP_SpaceConversion *gsc, const float diff_mat[4][4],
+ void *user_data)
+{
+ const struct GP_SelectLassoUserData *data = user_data;
+ bGPDspoint pt2;
+ int x0, y0;
+ gp_point_to_parent_space(pt, diff_mat, &pt2);
+ gp_point_to_xy(gsc, gps, &pt2, &x0, &y0);
+ /* test if in lasso */
+ return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) &&
+ BLI_rcti_isect_pt(&data->rect, x0, y0) &&
+ BLI_lasso_is_point_inside(data->mcords, data->mcords_len, x0, y0, INT_MAX));
+}
+
+typedef bool(*GPencilTestFn)(
+ bGPDstroke *gps, bGPDspoint *pt,
+ const GP_SpaceConversion *gsc, const float diff_mat[4][4], void *user_data);
+
+static void gpencil_cutter_dissolve(bGPDlayer *hit_layer, bGPDstroke *hit_stroke)
+{
+ bGPDspoint *pt = NULL;
+ bGPDspoint *pt1 = NULL;
+ int i;
+
+ bGPDstroke *gpsn = hit_stroke->next;
+
+ int totselect = 0;
+ for (i = 0, pt = hit_stroke->points; i < hit_stroke->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ totselect++;
+ }
+ }
+
+ /* if all points selected delete or only 2 points and 1 selected */
+ if (((totselect == 1) && (hit_stroke->totpoints == 2)) ||
+ (hit_stroke->totpoints == totselect))
+ {
+ BLI_remlink(&hit_layer->actframe->strokes, hit_stroke);
+ BKE_gpencil_free_stroke(hit_stroke);
+ hit_stroke = NULL;
+ }
+
+ /* if very small distance delete */
+ if ((hit_stroke) && (hit_stroke->totpoints == 2)) {
+ pt = &hit_stroke->points[0];
+ pt1 = &hit_stroke->points[1];
+ if (len_v3v3(&pt->x, &pt1->x) < 0.001f) {
+ BLI_remlink(&hit_layer->actframe->strokes, hit_stroke);
+ BKE_gpencil_free_stroke(hit_stroke);
+ hit_stroke = NULL;
+ }
+ }
+
+ if (hit_stroke) {
+ /* tag and dissolve (untag new points) */
+ for (i = 0, pt = hit_stroke->points; i < hit_stroke->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ pt->flag |= GP_SPOINT_TAG;
+ }
+ else if (pt->flag & GP_SPOINT_TAG) {
+ pt->flag &= ~GP_SPOINT_TAG;
+ }
+ }
+ gp_stroke_delete_tagged_points(
+ hit_layer->actframe, hit_stroke, gpsn, GP_SPOINT_TAG, false, 1);
+ }
+}
+
+static int gpencil_cutter_lasso_select(
+ bContext *C, wmOperator *op,
+ GPencilTestFn is_inside_fn, void *user_data)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+ ScrArea *sa = CTX_wm_area(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ const float scale = ts->gp_sculpt.isect_threshold;
+
+ bGPDspoint *pt;
+ int i;
+ GP_SpaceConversion gsc = { NULL };
+
+ bool changed = false;
+
+ /* sanity checks */
+ if (sa == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active area");
+ return OPERATOR_CANCELLED;
+ }
+
+ /* init space conversion stuff */
+ gp_point_conversion_init(C, &gsc);
+
+ /* deselect all strokes first */
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+ CTX_DATA_END;
+
+ /* select points */
+ GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
+ {
+ int tot_inside = 0;
+ const int oldtot = gps->totpoints;
+ for (i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ if ((pt->flag & GP_SPOINT_SELECT) || (pt->flag & GP_SPOINT_TAG)) {
+ continue;
+ }
+ /* convert point coords to screenspace */
+ const bool is_inside = is_inside_fn(gps, pt, &gsc, gpstroke_iter.diff_mat, user_data);
+ if (is_inside) {
+ tot_inside++;
+ changed = true;
+ pt->flag |= GP_SPOINT_SELECT;
+ gps->flag |= GP_STROKE_SELECT;
+ float r_hita[3], r_hitb[3];
+ if (gps->totpoints > 1) {
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt, true, true, scale, r_hita, r_hitb);
+ }
+ /* avoid infinite loops */
+ if (gps->totpoints > oldtot) {
+ break;
+ }
+ }
+ }
+ /* if mark all points inside lasso set to remove all stroke */
+ if ((tot_inside == oldtot) ||
+ ((tot_inside == 1) && (oldtot == 2)))
+ {
+ for (i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ pt->flag |= GP_SPOINT_SELECT;
+ }
+ }
+ }
+ GP_EDITABLE_STROKES_END(gpstroke_iter);
+
+ /* dissolve selected points */
+ bGPDstroke *gpsn;
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ continue;
+ }
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
+ if (gps->flag & GP_STROKE_SELECT) {
+ gpencil_cutter_dissolve(gpl, gps);
+ }
+ }
+ }
+
+ /* updates */
+ if (changed) {
+ DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+static bool gpencil_cutter_poll(bContext *C)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ if (GPENCIL_PAINT_MODE(gpd)) {
+ if (gpd->layers.first)
+ return true;
+ }
+
+ return false;
+}
+
+static int gpencil_cutter_exec(bContext *C, wmOperator *op)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ /* sanity checks */
+ if (sa == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active area");
+ return OPERATOR_CANCELLED;
+ }
+
+ struct GP_SelectLassoUserData data = { 0 };
+ data.mcords = WM_gesture_lasso_path_to_array(C, op, &data.mcords_len);
+
+ /* Sanity check. */
+ if (data.mcords == NULL) {
+ return OPERATOR_PASS_THROUGH;
+ }
+
+ /* Compute boundbox of lasso (for faster testing later). */
+ BLI_lasso_boundbox(&data.rect, data.mcords, data.mcords_len);
+
+ gpencil_cutter_lasso_select(C, op, gpencil_test_lasso, &data);
+
+ MEM_freeN((void *)data.mcords);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_cutter(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Stroke Cutter";
+ ot->description = "Select section and cut";
+ ot->idname = "GPENCIL_OT_stroke_cutter";
+
+ /* callbacks */
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = gpencil_cutter_exec;
+ ot->poll = gpencil_cutter_poll;
+ ot->cancel = WM_gesture_lasso_cancel;
+
+ /* flag */
+ ot->flag = OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+
+ /* properties */
+ WM_operator_properties_gesture_lasso(ot);
+}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index e4e71339560..e26acb76a51 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,17 +13,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2017, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file blender/editors/gpencil/gpencil_fill.c
- * \ingroup edgpencil
- */
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
@@ -91,39 +85,67 @@ typedef struct tGPDfill {
bContext *C;
struct Main *bmain;
struct Depsgraph *depsgraph;
- struct wmWindow *win; /* window where painting originated */
- struct Scene *scene; /* current scene from context */
- struct Object *ob; /* current active gp object */
- struct ScrArea *sa; /* area where painting originated */
- struct RegionView3D *rv3d; /* region where painting originated */
- struct View3D *v3d; /* view3 where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *gpf; /* frame */
-
- short flag; /* flags */
- short oldkey; /* avoid too fast events */
- bool on_back; /* send to back stroke */
-
- int center[2]; /* mouse fill center position */
- int sizex; /* windows width */
- int sizey; /* window height */
- int lock_axis; /* lock to viewport axis */
-
- short fill_leak; /* number of pixel to consider the leak is too small (x 2) */
- float fill_threshold; /* factor for transparency */
- int fill_simplylvl; /* number of simplify steps */
- int fill_draw_mode; /* boundary limits drawing mode */
-
- short sbuffer_size; /* number of elements currently in cache */
- void *sbuffer; /* temporary points */
- float *depth_arr; /* depth array for reproject */
-
- Image *ima; /* temp image */
- BLI_Stack *stack; /* temp points data */
- void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
+ /** window where painting originated */
+ struct wmWindow *win;
+ /** current scene from context */
+ struct Scene *scene;
+ /** current active gp object */
+ struct Object *ob;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct RegionView3D *rv3d;
+ /** view3 where painting originated */
+ struct View3D *v3d;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame */
+ struct bGPDframe *gpf;
+
+ /** flags */
+ short flag;
+ /** avoid too fast events */
+ short oldkey;
+ /** send to back stroke */
+ bool on_back;
+
+ /** mouse fill center position */
+ int center[2];
+ /** windows width */
+ int sizex;
+ /** window height */
+ int sizey;
+ /** lock to viewport axis */
+ int lock_axis;
+
+ /** number of pixel to consider the leak is too small (x 2) */
+ short fill_leak;
+ /** factor for transparency */
+ float fill_threshold;
+ /** number of simplify steps */
+ int fill_simplylvl;
+ /** boundary limits drawing mode */
+ int fill_draw_mode;
+
+ /** number of elements currently in cache */
+ short sbuffer_size;
+ /** temporary points */
+ void *sbuffer;
+ /** depth array for reproject */
+ float *depth_arr;
+
+ /** temp image */
+ Image *ima;
+ /** temp points data */
+ BLI_Stack *stack;
+ /** handle for drawing strokes while operator is running 3d stuff */
+ void *draw_handle_3d;
} tGPDfill;
@@ -220,6 +242,13 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
if (gpl->flag & GP_LAYER_HIDE)
continue;
+ /* if active layer and no keyframe, create a new one */
+ if (gpl == tgpf->gpl) {
+ if ((gpl->actframe == NULL) || (gpl->actframe->framenum != cfra_eval)) {
+ BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_ADD_NEW);
+ }
+ }
+
/* get frame to draw */
bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV);
if (gpf == NULL)
@@ -287,14 +316,16 @@ static void gp_render_offscreen(tGPDfill *tgpf)
ImBuf *ibuf = IMB_allocImBuf(tgpf->sizex, tgpf->sizey, 32, flag);
rctf viewplane;
- float clipsta, clipend;
+ float clip_start, clip_end;
- is_ortho = ED_view3d_viewplane_get(tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey, &viewplane, &clipsta, &clipend, NULL);
+ is_ortho = ED_view3d_viewplane_get(
+ tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey,
+ &viewplane, &clip_start, &clip_end, NULL);
if (is_ortho) {
- orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
+ orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clip_end, clip_end);
}
else {
- perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+ perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clip_end);
}
/* set temporary new size */
@@ -647,7 +678,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf)
{1, 1},
{0, 1},
{-1, 1},
- {-1, 0}
+ {-1, 0},
};
tgpf->stack = BLI_stack_new(sizeof(int[2]), __func__);
@@ -863,7 +894,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* initialize triangle memory to dummy data */
gps->tot_triangles = 0;
gps->triangles = NULL;
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* add stroke to frame */
if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) || (tgpf->on_back == true)) {
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 668fc076b2e..9341133d520 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_intern.h
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#ifndef __GPENCIL_INTERN_H__
@@ -38,27 +31,27 @@
/* internal exports only */
-struct bGPdata;
-struct bGPDstroke;
+struct Material;
struct bGPDspoint;
+struct bGPDstroke;
+struct bGPdata;
struct tGPspoint;
-struct Material;
struct GHash;
struct RNG;
+struct ARegion;
struct Brush;
struct Scene;
-struct ARegion;
-struct View3D;
struct View2D;
+struct View3D;
struct wmOperatorType;
struct Depsgraph;
+struct EnumPropertyItem;
struct PointerRNA;
struct PropertyRNA;
-struct EnumPropertyItem;
/* ***************************************************** */
@@ -107,77 +100,138 @@ typedef struct tGPDdraw {
typedef struct tGPDinterpolate_layer {
struct tGPDinterpolate_layer *next, *prev;
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *prevFrame; /* frame before current frame (interpolate-from) */
- struct bGPDframe *nextFrame; /* frame after current frame (interpolate-to) */
- struct bGPDframe *interFrame; /* interpolated frame */
- float factor; /* interpolate factor */
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame before current frame (interpolate-from) */
+ struct bGPDframe *prevFrame;
+ /** frame after current frame (interpolate-to) */
+ struct bGPDframe *nextFrame;
+ /** interpolated frame */
+ struct bGPDframe *interFrame;
+ /** interpolate factor */
+ float factor;
} tGPDinterpolate_layer;
typedef struct tGPDinterpolate {
- struct Scene *scene; /* current scene from context */
- struct ScrArea *sa; /* area where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
-
- int cframe; /* current frame number */
- ListBase ilayers; /* (tGPDinterpolate_layer) layers to be interpolated */
- float shift; /* value for determining the displacement influence */
- float init_factor; /* initial interpolation factor for active layer */
- float low_limit; /* shift low limit (-100%) */
- float high_limit; /* shift upper limit (200%) */
- int flag; /* flag from toolsettings */
+ /** current scene from context */
+ struct Scene *scene;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+
+ /** current frame number */
+ int cframe;
+ /** (tGPDinterpolate_layer) layers to be interpolated */
+ ListBase ilayers;
+ /** value for determining the displacement influence */
+ float shift;
+ /** initial interpolation factor for active layer */
+ float init_factor;
+ /** shift low limit (-100%) */
+ float low_limit;
+ /** shift upper limit (200%) */
+ float high_limit;
+ /** flag from toolsettings */
+ int flag;
NumInput num; /* numeric input */
- void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
- void *draw_handle_screen; /* handle for drawing strokes while operator is running screen stuff */
+ /** handle for drawing strokes while operator is running 3d stuff */
+ void *draw_handle_3d;
+ /** handle for drawing strokes while operator is running screen stuff */
+ void *draw_handle_screen;
} tGPDinterpolate;
/* Temporary primitive operation data */
typedef struct tGPDprimitive {
- struct Main *bmain; /* main database pointer */
+ /** main database pointer */
+ struct Main *bmain;
struct Depsgraph *depsgraph;
- struct wmWindow *win; /* window where painting originated */
- struct Scene *scene; /* current scene from context */
- struct Object *ob; /* current active gp object */
- struct ScrArea *sa; /* area where painting originated */
- struct RegionView3D *rv3d; /* region where painting originated */
- struct View3D *v3d; /* view3d where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
- struct Brush *brush; /* current brush */
-
- int cframe; /* current frame number */
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *gpf; /* frame */
- int type; /* type of primitive */
- int orign_type; /* original type of primitive */
- bool curve; /* type of primitive is a curve */
- short flip; /* flip option */
- tGPspoint *points; /* array of data-points for stroke */
- int point_count; /* number of edges allocated */
- int tot_stored_edges; /* stored number of polygon edges */
- int tot_edges; /* number of polygon edges */
- float move[2]; /* move distance */
- float origin[2]; /* initial box corner */
- float start[2]; /* first box corner */
- float end[2]; /* last box corner */
- float midpoint[2]; /* midpoint box corner */
- float cp1[2]; /* first control point */
- float cp2[2]; /* second control point */
- int sel_cp; /* flag to determine control point is selected */
- int flag; /* flag to determine operations in progress */
- float mval[2]; /* recorded mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- int lock_axis; /* lock to viewport axis */
+ /** window where painting originated */
+ struct wmWindow *win;
+ /** current scene from context */
+ struct Scene *scene;
+ /** current active gp object */
+ struct Object *ob;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct RegionView3D *rv3d;
+ /** view3d where painting originated */
+ struct View3D *v3d;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+ /** current brush */
+ struct Brush *brush;
+
+ /** current frame number */
+ int cframe;
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame */
+ struct bGPDframe *gpf;
+ /** type of primitive */
+ int type;
+ /** original type of primitive */
+ int orign_type;
+ /** type of primitive is a curve */
+ bool curve;
+ /** brush size */
+ int brush_size;
+ /** brush strength */
+ float brush_strength;
+ /** flip option */
+ short flip;
+ /** array of data-points for stroke */
+ tGPspoint *points;
+ /** number of edges allocated */
+ int point_count;
+ /** stored number of polygon edges */
+ int tot_stored_edges;
+ /** number of polygon edges */
+ int tot_edges;
+ /** move distance */
+ float move[2];
+ /** initial box corner */
+ float origin[2];
+ /** first box corner */
+ float start[2];
+ /** last box corner */
+ float end[2];
+ /** midpoint box corner */
+ float midpoint[2];
+ /** first control point */
+ float cp1[2];
+ /** second control point */
+ float cp2[2];
+ /** flag to determine control point is selected */
+ int sel_cp;
+ /** flag to determine operations in progress */
+ int flag;
+ /** recorded mouse-position */
+ float mval[2];
+ /** previous recorded mouse-position */
+ float mvalo[2];
+
+ /** lock to viewport axis */
+ int lock_axis;
struct RNG *rng;
- NumInput num; /* numeric input */
+ /** numeric input */
+ NumInput num;
+
+ /** size in pixels for uv calculation */
+ float totpixlen;
} tGPDprimitive;
@@ -232,7 +286,9 @@ void gp_apply_parent(struct Depsgraph *depsgraph, struct Object *obact, bGPdata
*/
void gp_apply_parent_point(struct Depsgraph *depsgraph, struct Object *obact, bGPdata *gpd, bGPDlayer *gpl, bGPDspoint *pt);
-bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]);
+void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], float xy[2]);
+
+bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]);
/* helper to convert 2d to 3d */
void gp_stroke_convertcoords_tpoint(
@@ -261,7 +317,7 @@ struct GHash *gp_copybuf_validate_colormap(struct bContext *C);
void gp_stroke_delete_tagged_points(
bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke,
- int tag_flags, bool select);
+ int tag_flags, bool select, int limit);
int gp_delete_selected_point_wrap(bContext *C);
void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide);
@@ -289,12 +345,17 @@ void GPENCIL_OT_annotate(struct wmOperatorType *ot);
void GPENCIL_OT_draw(struct wmOperatorType *ot);
void GPENCIL_OT_fill(struct wmOperatorType *ot);
+/* Guides ----------------------- */
+
+void GPENCIL_OT_guide_rotate(struct wmOperatorType *ot);
+
/* Paint Modes for operator */
typedef enum eGPencil_PaintModes {
GP_PAINTMODE_DRAW = 0,
GP_PAINTMODE_ERASER,
GP_PAINTMODE_DRAW_STRAIGHT,
- GP_PAINTMODE_DRAW_POLY
+ GP_PAINTMODE_DRAW_POLY,
+ GP_PAINTMODE_SET_CP
} eGPencil_PaintModes;
/* maximum sizes of gp-session buffer */
@@ -335,7 +396,6 @@ void GPENCIL_OT_layer_change(struct wmOperatorType *ot);
void GPENCIL_OT_snap_to_grid(struct wmOperatorType *ot);
void GPENCIL_OT_snap_to_cursor(struct wmOperatorType *ot);
void GPENCIL_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
-void GPENCIL_OT_snap_cursor_to_center(struct wmOperatorType *ot);
void GPENCIL_OT_reproject(struct wmOperatorType *ot);
@@ -375,7 +435,7 @@ void GPENCIL_OT_convert(struct wmOperatorType *ot);
enum {
GP_STROKE_JOIN = -1,
- GP_STROKE_JOINCOPY = 1
+ GP_STROKE_JOINCOPY = 1,
};
enum {
@@ -383,15 +443,20 @@ enum {
GP_STROKE_LINE = 1,
GP_STROKE_CIRCLE = 2,
GP_STROKE_ARC = 3,
- GP_STROKE_CURVE = 4
+ GP_STROKE_CURVE = 4,
};
+enum {
+ GP_MERGE_STROKE = -1,
+ GP_MERGE_POINT = 1,
+};
void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_lock_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_join(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot);
@@ -400,6 +465,9 @@ void GPENCIL_OT_stroke_simplify_fixed(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_separate(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_split(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_smooth(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_merge(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_cutter(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_trim(struct wmOperatorType *ot);
void GPENCIL_OT_brush_presets_create(struct wmOperatorType *ot);
@@ -506,7 +574,7 @@ struct GP_EditableStrokes_Iter {
*/
#define GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps) \
{ \
- struct GP_EditableStrokes_Iter gpstroke_iter = {0}; \
+ struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
Depsgraph *depsgraph_ = CTX_data_depsgraph(C); \
Object *obact_ = CTX_data_active_object(C); \
bGPdata *gpd_ = CTX_data_gpencil_data(C); \
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 06659a69b82..7be157b5d84 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2016, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for interpolating new Grease Pencil frames from existing strokes
*/
-/** \file blender/editors/gpencil/gpencil_interpolate.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -57,10 +50,8 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -306,7 +297,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
}
new_stroke->totpoints = gps_to->totpoints;
new_stroke->tot_triangles = 0;
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* update points position */
gp_interpolate_update_points(gps_from, gps_to, new_stroke, tgpil->factor);
@@ -320,7 +311,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
}
new_stroke->tot_triangles = 0;
new_stroke->triangles = MEM_recallocN(new_stroke->triangles, sizeof(*new_stroke->triangles));
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* add to strokes */
@@ -596,7 +587,7 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
BKE_gpencil_stroke_weights_duplicate(gps_src, gps_dst);
}
gps_dst->triangles = MEM_dupallocN(gps_src->triangles);
- gps_dst->flag |= GP_STROKE_RECALC_CACHES;
+ gps_dst->flag |= GP_STROKE_RECALC_GEOMETRY;
BLI_addtail(&gpf_dst->strokes, gps_dst);
}
}
@@ -1033,7 +1024,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
}
new_stroke->totpoints = gps_to->totpoints;
new_stroke->tot_triangles = 0;
- new_stroke->flag |= GP_STROKE_RECALC_CACHES;
+ new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* update points position */
@@ -1112,7 +1103,8 @@ static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
gpf = gpf->prev;
}
else {
- /* Not a breakdown (may be a key, or an extreme, or something else that wasn't generated)... stop */
+ /* Not a breakdown (may be a key, or an extreme,
+ * or something else that wasn't generated)... stop */
break;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c
new file mode 100644
index 00000000000..80b26a366fe
--- /dev/null
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -0,0 +1,565 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2019, Blender Foundation.
+ * This is a new part of Blender
+ * Operators for merge Grease Pencil strokes
+ */
+
+/** \file
+ * \ingroup edgpencil
+ */
+
+#include <stdio.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
+#include "BLI_math.h"
+
+#include "DNA_gpencil_types.h"
+
+#include "BKE_brush.h"
+#include "BKE_context.h"
+#include "BKE_gpencil.h"
+#include "BKE_material.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "ED_gpencil.h"
+#include "ED_object.h"
+#include "ED_screen.h"
+#include "ED_view3d.h"
+
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
+#include "gpencil_intern.h"
+
+typedef struct tGPencilPointCache {
+ float factor; /* value to sort */
+ bGPDstroke *gps;
+ float x, y, z;
+ float pressure;
+ float strength;
+} tGPencilPointCache;
+
+/* helper function to sort points */
+static int gpencil_sort_points(const void *a1, const void *a2)
+{
+ const tGPencilPointCache *ps1 = a1, *ps2 = a2;
+
+ if (ps1->factor < ps2->factor) return -1;
+ else if (ps1->factor > ps2->factor) return 1;
+
+ return 0;
+}
+
+static void gpencil_insert_points_to_stroke(
+ bGPDstroke *gps, tGPencilPointCache *points_array, int totpoints)
+{
+ tGPencilPointCache *point_elem = NULL;
+
+ for (int i = 0; i < totpoints; i++) {
+ point_elem = &points_array[i];
+ bGPDspoint *pt_dst = &gps->points[i];
+
+ copy_v3_v3(&pt_dst->x, &point_elem->x);
+ pt_dst->pressure = point_elem->pressure;
+ pt_dst->strength = point_elem->strength;
+ pt_dst->uv_fac = 1.0f;
+ pt_dst->uv_rot = 0;
+ pt_dst->flag |= GP_SPOINT_SELECT;
+ }
+
+}
+
+static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpoints)
+{
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Object *ob = CTX_data_active_object(C);
+ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+
+ int cfra_eval = (int)DEG_get_ctime(depsgraph);
+
+ const bool back = RNA_boolean_get(op->ptr, "back");
+ const bool additive = RNA_boolean_get(op->ptr, "additive");
+ const bool cyclic = RNA_boolean_get(op->ptr, "cyclic");
+
+ Paint *paint = &ts->gp_paint->paint;
+ /* if not exist, create a new one */
+ if (paint->brush == NULL) {
+ /* create new brushes */
+ BKE_brush_gpencil_presets(C);
+ }
+ Brush *brush = paint->brush;
+
+ /* frame */
+ short add_frame_mode;
+ if (additive) {
+ add_frame_mode = GP_GETFRAME_ADD_COPY;
+ }
+ else {
+ add_frame_mode = GP_GETFRAME_ADD_NEW;
+ }
+ bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, add_frame_mode);
+
+ /* stroke */
+ bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
+ gps->totpoints = totpoints;
+ gps->inittime = 0.0f;
+ gps->thickness = brush->size;
+ gps->flag |= GP_STROKE_SELECT;
+ gps->flag |= GP_STROKE_3DSPACE;
+ gps->mat_nr = ob->actcol - 1;
+
+ /* allocate memory for points */
+ gps->points = MEM_callocN(sizeof(bGPDspoint) * totpoints, "gp_stroke_points");
+ /* initialize triangle memory to dummy data */
+ gps->tot_triangles = 0;
+ gps->triangles = NULL;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ if (cyclic) {
+ gps->flag |= GP_STROKE_CYCLIC;
+ }
+
+ /* add new stroke to frame */
+ if (back) {
+ BLI_addhead(&gpf->strokes, gps);
+ }
+ else {
+ BLI_addtail(&gpf->strokes, gps);
+ }
+
+ return gps;
+}
+
+static void gpencil_get_elements_len(bContext *C, int *totstrokes, int *totpoints)
+{
+ bGPDspoint *pt;
+ int i;
+
+ /* count number of strokes and selected points */
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ if (gps->flag & GP_STROKE_SELECT) {
+ *totstrokes += 1;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ *totpoints += 1;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+}
+
+static void gpencil_dissolve_points(bContext *C)
+{
+ bGPDstroke *gps, *gpsn;
+
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ continue;
+ }
+
+ for (gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_TAG, false, 0);
+ }
+ }
+ CTX_DATA_END;
+}
+
+/* Calc a factor of each selected point and fill an array with all the data.
+ *
+ * The factor is calculated using an imaginary circle, using the angle relative
+ * to this circle and the distance to the calculated center of the selected points.
+ *
+ * All the data is saved to be sorted and used later.
+ */
+static void gpencil_calc_points_factor(
+ bContext *C, const int mode, int totpoints,
+ const bool clear_point, const bool clear_stroke,
+ tGPencilPointCache *src_array)
+{
+ bGPDspoint *pt;
+ int i;
+ int idx = 0;
+
+ /* create selected point array an fill it */
+ bGPDstroke **gps_array = MEM_callocN(sizeof(bGPDstroke *) * totpoints, __func__);
+ bGPDspoint *pt_array = MEM_callocN(sizeof(bGPDspoint) * totpoints, __func__);
+
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ continue;
+ }
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ if (gps->flag & GP_STROKE_SELECT) {
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (clear_stroke) {
+ pt->flag |= GP_SPOINT_TAG;
+ }
+ else {
+ pt->flag &= ~GP_SPOINT_TAG;
+ }
+
+ if (pt->flag & GP_SPOINT_SELECT) {
+ bGPDspoint *pt2 = &pt_array[idx];
+ copy_v3_v3(&pt2->x, &pt->x);
+ pt2->pressure = pt->pressure;
+ pt2->strength = pt->strength;
+ pt->flag &= ~GP_SPOINT_SELECT;
+ if (clear_point) {
+ pt->flag |= GP_SPOINT_TAG;
+ }
+
+ /* save stroke */
+ gps_array[idx] = gps;
+
+ idx++;
+ }
+ }
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* project in 2d plane */
+ int direction = 0;
+ float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * totpoints, "GP Stroke temp 2d points");
+ BKE_gpencil_stroke_2d_flat(pt_array, totpoints, points2d, &direction);
+
+ /* calc center */
+ float center[2] = { 0.0f, 0.0f };
+ for (i = 0; i < totpoints; i++) {
+ center[0] += points2d[i][0];
+ center[1] += points2d[i][1];
+ }
+ mul_v2_fl(center, 1.0f / totpoints);
+
+ /* calc angle and distance to center for each point */
+ const float axis[2] = { 1.0f, 0.0f };
+ float v1[3];
+ for (i = 0; i < totpoints; i++) {
+ float ln = len_v2v2(center, points2d[i]);
+ sub_v2_v2v2(v1, points2d[i], center);
+ float angle = angle_signed_v2v2(axis, v1);
+ if (angle < 0.0f) {
+ angle = fabsf(angle);
+ }
+ else {
+ angle = (M_PI * 2.0) - angle;
+ }
+ tGPencilPointCache *sort_pt = &src_array[i];
+ bGPDspoint *pt2 = &pt_array[i];
+
+ copy_v3_v3(&sort_pt->x, &pt2->x);
+ sort_pt->pressure = pt2->pressure;
+ sort_pt->strength = pt2->strength;
+
+ sort_pt->gps = gps_array[i];
+
+ if (mode == GP_MERGE_STROKE) {
+ sort_pt->factor = angle;
+ }
+ else {
+ sort_pt->factor = (angle * 100000.0f) + ln;
+ }
+ }
+ MEM_SAFE_FREE(points2d);
+ MEM_SAFE_FREE(gps_array);
+ MEM_SAFE_FREE(pt_array);
+}
+
+/* insert a group of points in destination array */
+static int gpencil_insert_to_array(
+ tGPencilPointCache *src_array, tGPencilPointCache *dst_array, int totpoints,
+ bGPDstroke *gps_filter, bool reverse, int last)
+{
+ tGPencilPointCache *src_elem = NULL;
+ tGPencilPointCache *dst_elem = NULL;
+ int idx = 0;
+
+ for (int i = 0; i < totpoints; i++) {
+ if (!reverse) {
+ idx = i;
+ }
+ else {
+ idx = totpoints - i - 1;
+ }
+ src_elem = &src_array[idx];
+ /* check if all points or only a stroke */
+ if ((gps_filter != NULL) && (gps_filter != src_elem->gps)) {
+ continue;
+ }
+
+ dst_elem = &dst_array[last];
+ last++;
+
+ copy_v3_v3(&dst_elem->x, &src_elem->x);
+ dst_elem->gps = src_elem->gps;
+ dst_elem->pressure = src_elem->pressure;
+ dst_elem->strength = src_elem->strength;
+ dst_elem->factor = src_elem->factor;
+ }
+
+ return last;
+}
+
+/* get first and last point location */
+static void gpencil_get_extremes(
+ tGPencilPointCache *src_array, int totpoints,
+ bGPDstroke *gps_filter, float *start, float *end)
+{
+ tGPencilPointCache *array_pt = NULL;
+ int i;
+
+ /* find first point */
+ for (i = 0; i < totpoints; i++) {
+ array_pt = &src_array[i];
+ if (gps_filter == array_pt->gps) {
+ copy_v3_v3(start, &array_pt->x);
+ break;
+ }
+ }
+ /* find last point */
+ for (i = totpoints - 1; i >= 0; i--) {
+ array_pt = &src_array[i];
+ if (gps_filter == array_pt->gps) {
+ copy_v3_v3(end, &array_pt->x);
+ break;
+ }
+ }
+}
+
+static int gpencil_analyze_strokes(
+ tGPencilPointCache *src_array, int totstrokes, int totpoints,
+ tGPencilPointCache *dst_array)
+{
+ int i;
+ int last = 0;
+ GHash *all_strokes = BLI_ghash_ptr_new(__func__);
+ /* add first stroke to array */
+ tGPencilPointCache *sort_pt = &src_array[0];
+ bGPDstroke *gps = sort_pt->gps;
+ last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps, false, last);
+ float start[3];
+ float end[3];
+ float end_prv[3];
+ gpencil_get_extremes(src_array, totpoints, gps, start, end);
+ copy_v3_v3(end_prv, end);
+ BLI_ghash_insert(all_strokes, sort_pt->gps, sort_pt->gps);
+
+ /* look for near stroke */
+ bool loop = (bool)(totstrokes > 1);
+ while (loop) {
+ bGPDstroke *gps_next = NULL;
+ GHash *strokes = BLI_ghash_ptr_new(__func__);
+ float dist_start = 0.0f;
+ float dist_end = 0.0f;
+ float dist = FLT_MAX;
+ bool reverse = false;
+
+ for (i = 0; i < totpoints; i++) {
+ sort_pt = &src_array[i];
+ /* avoid dups */
+ if (BLI_ghash_haskey(all_strokes, sort_pt->gps)) {
+ continue;
+ }
+ if (!BLI_ghash_haskey(strokes, sort_pt->gps)) {
+ gpencil_get_extremes(src_array, totpoints, sort_pt->gps, start, end);
+ /* distances to previous end */
+ dist_start = len_v3v3(end_prv, start);
+ dist_end = len_v3v3(end_prv, end);
+
+ if (dist > dist_start) {
+ gps_next = sort_pt->gps;
+ dist = dist_start;
+ reverse = false;
+ }
+ if (dist > dist_end) {
+ gps_next = sort_pt->gps;
+ dist = dist_end;
+ reverse = true;
+ }
+ BLI_ghash_insert(strokes, sort_pt->gps, sort_pt->gps);
+ }
+ }
+ BLI_ghash_free(strokes, NULL, NULL);
+
+ /* add the stroke to array */
+ if (gps->next != NULL) {
+ BLI_ghash_insert(all_strokes, gps_next, gps_next);
+ last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps_next, reverse, last);
+ /* replace last end */
+ sort_pt = &dst_array[last - 1];
+ copy_v3_v3(end_prv, &sort_pt->x);
+ }
+
+ /* loop exit */
+ if (last >= totpoints) {
+ loop = false;
+ }
+ }
+
+ BLI_ghash_free(all_strokes, NULL, NULL);
+ return last;
+}
+
+static bool gp_strokes_merge_poll(bContext *C)
+{
+ /* only supported with grease pencil objects */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
+ /* check material */
+ Material *ma = NULL;
+ ma = give_current_material(ob, ob->actcol);
+ if ((ma == NULL) || (ma->gp_style == NULL)) {
+ return false;
+ }
+
+ /* check hidden or locked materials */
+ MaterialGPencilStyle *gp_style = ma->gp_style;
+ if ((gp_style->flag & GP_STYLE_COLOR_HIDE) ||
+ (gp_style->flag & GP_STYLE_COLOR_LOCKED))
+ {
+ return false;
+ }
+
+ /* check layer */
+ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+ if ((gpl == NULL) ||
+ (gpl->flag & GP_LAYER_LOCKED) ||
+ (gpl->flag & GP_LAYER_HIDE))
+ {
+ return false;
+ }
+
+ /* NOTE: this is a bit slower, but is the most accurate... */
+ return (CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0) && ED_operator_view3d_active(C);
+}
+
+static int gp_stroke_merge_exec(bContext *C, wmOperator *op)
+{
+ const int mode = RNA_enum_get(op->ptr, "mode");
+ const bool clear_point = RNA_boolean_get(op->ptr, "clear_point");
+ const bool clear_stroke = RNA_boolean_get(op->ptr, "clear_stroke");
+
+ Object *ob = CTX_data_active_object(C);
+ /* sanity checks */
+ if (!ob || ob->type != OB_GPENCIL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ bGPdata *gpd = (bGPdata *)ob->data;
+ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+ if (gpl == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ int totstrokes = 0;
+ int totpoints = 0;
+
+ /* count number of strokes and selected points */
+ gpencil_get_elements_len(C, &totstrokes, &totpoints);
+
+ if (totpoints == 0) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* calc factor of each point and fill an array with all data */
+ tGPencilPointCache *sorted_array = NULL;
+ tGPencilPointCache *original_array = MEM_callocN(sizeof(tGPencilPointCache) * totpoints, __func__);
+ gpencil_calc_points_factor(C, mode, totpoints, clear_point, clear_stroke, original_array);
+
+ /* for strokes analyze strokes and load sorted array */
+ if (mode == GP_MERGE_STROKE) {
+ sorted_array = MEM_callocN(sizeof(tGPencilPointCache) * totpoints, __func__);
+ totpoints = gpencil_analyze_strokes(original_array, totstrokes, totpoints, sorted_array);
+ }
+ else {
+ /* make a copy to sort */
+ sorted_array = MEM_dupallocN(original_array);
+ /* sort by factor around center */
+ qsort(sorted_array, totpoints, sizeof(tGPencilPointCache), gpencil_sort_points);
+ }
+
+ /* prepare the new stroke */
+ bGPDstroke *gps = gpencil_prepare_stroke(C, op, totpoints);
+
+ /* copy original points to final stroke */
+ gpencil_insert_points_to_stroke(gps, sorted_array, totpoints);
+
+ /* dissolve all tagged points */
+ if ((clear_point) || (clear_stroke)) {
+ gpencil_dissolve_points(C);
+ }
+
+ /* free memory */
+ MEM_SAFE_FREE(original_array);
+ MEM_SAFE_FREE(sorted_array);
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_merge(wmOperatorType *ot)
+{
+ static const EnumPropertyItem mode_type[] = {
+ {GP_MERGE_STROKE, "STROKE", 0, "Stroke", ""},
+ {GP_MERGE_POINT, "POINT", 0, "Point", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* identifiers */
+ ot->name = "Merge Strokes";
+ ot->idname = "GPENCIL_OT_stroke_merge";
+ ot->description = "Create a new stroke with the selected stroke points";
+
+ /* api callbacks */
+ ot->exec = gp_stroke_merge_exec;
+ ot->poll = gp_strokes_merge_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_enum(ot->srna, "mode", mode_type, GP_MERGE_STROKE, "Mode", "");
+ RNA_def_boolean(ot->srna, "back", 0, "Draw on Back", "Draw new stroke below all previous strokes");
+ RNA_def_boolean(ot->srna, "additive", 0, "Additive Drawing", "Add to previous drawing");
+ RNA_def_boolean(ot->srna, "cyclic", 0, "Cyclic", "Close new stroke");
+ RNA_def_boolean(ot->srna, "clear_point", 0, "Dissolve Points", "Dissolve old selected points");
+ RNA_def_boolean(ot->srna, "clear_stroke", 0, "Delete Strokes", "Delete old selected strokes");
+}
diff --git a/source/blender/editors/gpencil/gpencil_old.c b/source/blender/editors/gpencil/gpencil_old.c
index a2012be223d..6f3a9bba4e2 100644
--- a/source/blender/editors/gpencil/gpencil_old.c
+++ b/source/blender/editors/gpencil/gpencil_old.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation,
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Use deprecated data to convert old 2.7x files
*/
-/** \file blender/editors/gpencil/gpencil_old.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
/* allow to use deprecated functionality */
@@ -127,7 +120,18 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
MaterialGPencilStyle *gp_style = ma->gp_style;
copy_v4_v4(gp_style->stroke_rgba, palcolor->color);
copy_v4_v4(gp_style->fill_rgba, palcolor->fill);
- gp_style->flag = palcolor->flag;
+
+ /* set basic settings */
+ gp_style->pattern_gridsize = 0.1f;
+ gp_style->gradient_radius = 0.5f;
+ ARRAY_SET_ITEMS(gp_style->mix_rgba, 1.0f, 1.0f, 1.0f, 0.2f);
+ ARRAY_SET_ITEMS(gp_style->gradient_scale, 1.0f, 1.0f);
+ ARRAY_SET_ITEMS(gp_style->texture_scale, 1.0f, 1.0f);
+ gp_style->texture_opacity = 1.0f;
+ gp_style->texture_pixsize = 100.0f;
+
+ gp_style->flag |= GP_STYLE_STROKE_SHOW;
+ gp_style->flag |= GP_STYLE_FILL_SHOW;
/* fix strokes */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 3eaf72121a8..60b2fb5d64e 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,16 +13,12 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2009, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_ops.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -228,6 +222,10 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_draw);
WM_operatortype_append(GPENCIL_OT_fill);
+ /* Guides ----------------------- */
+
+ WM_operatortype_append(GPENCIL_OT_guide_rotate);
+
/* Editing (Strokes) ------------ */
WM_operatortype_append(GPENCIL_OT_editmode_toggle);
@@ -301,6 +299,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_lock_color);
WM_operatortype_append(GPENCIL_OT_stroke_apply_thickness);
WM_operatortype_append(GPENCIL_OT_stroke_cyclical_set);
+ WM_operatortype_append(GPENCIL_OT_stroke_caps_set);
WM_operatortype_append(GPENCIL_OT_stroke_join);
WM_operatortype_append(GPENCIL_OT_stroke_flip);
WM_operatortype_append(GPENCIL_OT_stroke_subdivide);
@@ -309,6 +308,9 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_separate);
WM_operatortype_append(GPENCIL_OT_stroke_split);
WM_operatortype_append(GPENCIL_OT_stroke_smooth);
+ WM_operatortype_append(GPENCIL_OT_stroke_merge);
+ WM_operatortype_append(GPENCIL_OT_stroke_cutter);
+ WM_operatortype_append(GPENCIL_OT_stroke_trim);
WM_operatortype_append(GPENCIL_OT_brush_presets_create);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6e79afc747e..817d10d4b2f 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,18 +13,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file blender/editors/gpencil/gpencil_paint.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <stddef.h>
@@ -76,7 +69,6 @@
#include "ED_view3d.h"
#include "ED_clip.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -119,85 +111,134 @@ typedef enum eGPencil_PaintFlags {
GP_PAINTFLAG_SELECTMASK = (1 << 3),
GP_PAINTFLAG_HARD_ERASER = (1 << 4),
GP_PAINTFLAG_STROKE_ERASER = (1 << 5),
+ GP_PAINTFLAG_REQ_VECTOR = (1 << 6),
} eGPencil_PaintFlags;
-
/* Temporary 'Stroke' Operation data
* "p" = op->customdata
*/
typedef struct tGPsdata {
bContext *C;
- Main *bmain; /* main database pointer */
- Scene *scene; /* current scene from context */
+ /** main database pointer. */
+ Main *bmain;
+ /** current scene from context. */
+ Scene *scene;
struct Depsgraph *depsgraph;
- Object *ob; /* current object */
- wmWindow *win; /* window where painting originated */
- ScrArea *sa; /* area where painting originated */
- ARegion *ar; /* region where painting originated */
- View2D *v2d; /* needed for GP_STROKE_2DSPACE */
- rctf *subrect; /* for using the camera rect within the 3d view */
+ /** current object. */
+ Object *ob;
+ /** window where painting originated. */
+ wmWindow *win;
+ /** area where painting originated. */
+ ScrArea *sa;
+ /** region where painting originated. */
+ ARegion *ar;
+ /** needed for GP_STROKE_2DSPACE. */
+ View2D *v2d;
+ /** for using the camera rect within the 3d view. */
+ rctf *subrect;
rctf subrect_data;
- GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */
-
- PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
- bGPdata *gpd; /* gp-datablock layer comes from */
- bGPDlayer *gpl; /* layer we're working on */
- bGPDframe *gpf; /* frame we're working on */
-
- char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
-
- eGPencil_PaintStatus status; /* current status of painting */
- eGPencil_PaintModes paintmode; /* mode for painting */
- eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */
+ /** settings to pass to gp_points_to_xy(). */
+ GP_SpaceConversion gsc;
- short radius; /* radius of influence for eraser */
-
- float mval[2]; /* current mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- float pressure; /* current stylus pressure */
- float opressure; /* previous stylus pressure */
+ /** pointer to owner of gp-datablock. */
+ PointerRNA ownerPtr;
+ /** gp-datablock layer comes from. */
+ bGPdata *gpd;
+ /** layer we're working on. */
+ bGPDlayer *gpl;
+ /** frame we're working on. */
+ bGPDframe *gpf;
+
+ /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+ char *align_flag;
+
+ /** current status of painting. */
+ eGPencil_PaintStatus status;
+ /** mode for painting. */
+ eGPencil_PaintModes paintmode;
+ /** flags that can get set during runtime (eGPencil_PaintFlags) */
+ eGPencil_PaintFlags flags;
+
+ /** radius of influence for eraser. */
+ short radius;
+
+ /** current mouse-position. */
+ float mval[2];
+ /** previous recorded mouse-position. */
+ float mvalo[2];
+ /** initial recorded mouse-position */
+ float mvali[2];
+
+ /** current stylus pressure. */
+ float pressure;
+ /** previous stylus pressure. */
+ float opressure;
/* These need to be doubles, as (at least under unix) they are in seconds since epoch,
* float (and its 7 digits precision) is definitively not enough here!
* double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least.
*/
- double inittime; /* Used when converting to path */
- double curtime; /* Used when converting to path */
- double ocurtime; /* Used when converting to path */
-
- float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space
- * to region space */
+ /** Used when converting to path. */
+ double inittime;
+ /** Used when converting to path. */
+ double curtime;
+ /** Used when converting to path. */
+ double ocurtime;
+
+ /** Inverted transformation matrix applying when converting coords from screen-space
+ * to region space. */
+ float imat[4][4];
float mat[4][4];
- float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */
+ /** custom color - hack for enforcing a particular color for track/mask editing. */
+ float custom_color[4];
- void *erasercursor; /* radial cursor data for drawing eraser */
+ /** radial cursor data for drawing eraser. */
+ void *erasercursor;
/* mat settings are only used for 3D view */
- Material *material; /* current material */
-
- Brush *brush; /* current drawing brush */
- Brush *eraser; /* default eraser brush */
- short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */
- int lock_axis; /* lock drawing to one axis */
- bool disable_fill; /* the stroke is no fill mode */
+ /** current material */
+ Material *material;
+ /** current drawing brush */
+ Brush *brush;
+ /** default eraser brush */
+ Brush *eraser;
+
+ /** 1: line horizontal, 2: line vertical, other: not defined */
+ short straight;
+ /** lock drawing to one axis */
+ int lock_axis;
+ /** the stroke is no fill mode */
+ bool disable_fill;
RNG *rng;
- short keymodifier; /* key used for invoking the operator */
- short shift; /* shift modifier flag */
-
- float totpixlen; /* size in pixels for uv calculation */
+ /** key used for invoking the operator */
+ short keymodifier;
+ /** shift modifier flag */
+ short shift;
+ /** size in pixels for uv calculation */
+ float totpixlen;
+
+ /* guide */
+ /** guide spacing */
+ float guide_spacing;
+ /** half guide spacing */
+ float half_spacing;
+ /** origin */
+ float origin[2];
ReportList *reports;
} tGPsdata;
/* ------ */
+#define STROKE_HORIZONTAL 1
+#define STROKE_VERTICAL 2
+
/* Macros for accessing sensitivity thresholds... */
/* minimum number of pixels mouse should move before new point created */
#define MIN_MANHATTEN_PX (U.gp_manhattendist)
@@ -239,33 +280,33 @@ static bool gpencil_draw_poll(bContext *C)
{
if (ED_operator_regionactive(C)) {
ScrArea *sa = CTX_wm_area(C);
- if (!ELEM(sa->spacetype, SPACE_VIEW3D)) {
- /* check if current context can support GPencil data */
- if (ED_gpencil_data_get_pointers(C, NULL) != NULL) {
- /* check if Grease Pencil isn't already running */
- if (ED_gpencil_session_active() == 0)
- return 1;
- else
- CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
- }
- else {
- CTX_wm_operator_poll_msg_set(C, "Failed to find Grease Pencil data to draw into");
- }
- return 0;
- }
/* 3D Viewport */
- else {
- if (ED_gpencil_session_active() == 0) {
- return 1;
- }
- else {
- return 0;
- }
+ if (sa->spacetype != SPACE_VIEW3D) {
+ return false;
+ }
+
+ /* check if Grease Pencil isn't already running */
+ if (ED_gpencil_session_active() != 0) {
+ CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
+ return false;
}
+
+ /* only grease pencil object type */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
+ bGPdata *gpd = (bGPdata *)ob->data;
+ if (!GPENCIL_PAINT_MODE(gpd)) {
+ return false;
+ }
+
+ return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
- return 0;
+ return false;
}
}
@@ -293,11 +334,11 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3])
/* Stroke Editing ---------------------------- */
/* check if the current mouse position is suitable for adding a new point */
-static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2])
+static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2])
{
Brush *brush = p->brush;
- int dx = (int)fabsf(mval[0] - pmval[0]);
- int dy = (int)fabsf(mval[1] - pmval[1]);
+ int dx = (int)fabsf(mval[0] - mvalo[0]);
+ int dy = (int)fabsf(mval[1] - mvalo[1]);
brush->gpencil_settings->flag &= ~GP_BRUSH_STABILIZE_MOUSE_TEMP;
/* if buffer is empty, just let this go through (i.e. so that dots will work) */
@@ -370,7 +411,10 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
/* add small offset to keep stroke over the surface */
- if ((depth) && (gpd->zdepth_offset > 0.0f)) {
+ if ((depth) &&
+ (gpd->zdepth_offset > 0.0f) &&
+ (*p->align_flag & GP_PROJECT_DEPTH_VIEW))
+ {
*depth *= (1.0f - gpd->zdepth_offset);
}
@@ -382,7 +426,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
- /* verify valid zdepth, if it's wrong, the default darwing mode is used
+ /* verify valid zdepth, if it's wrong, the default drawing mode is used
* and the function doesn't return now */
if ((depth == NULL) || (*depth <= 1.0f)) {
return;
@@ -396,12 +440,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
- * works OK, but it could of course be improved.
- *
- * TODO:
- * - investigate using nearest point(s) on a previous stroke as
- * reference point instead or as offset, for easier stroke matching
- */
+ * works OK, but it could of course be improved. */
gp_get_3d_reference(p, rvec);
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
@@ -427,7 +466,8 @@ static void gp_brush_jitter(
float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, pressure);
tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity;
}
- const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f); /* exponential value */
+ /* exponential value */
+ const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f);
const float fac = BLI_rng_get_float(rng) * exfactor * tmp_pressure;
/* Jitter is applied perpendicular to the mouse movement vector (2D space) */
float mvec[2], svec[2];
@@ -465,8 +505,10 @@ static void gp_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const floa
float fac;
float mpressure;
- float angle = brush->gpencil_settings->draw_angle; /* default angle of brush in radians */;
- float v0[2] = { cos(angle), sin(angle) }; /* angle vector of the brush with full thickness */
+ /* default angle of brush in radians */;
+ float angle = brush->gpencil_settings->draw_angle;
+ /* angle vector of the brush with full thickness */
+ float v0[2] = { cos(angle), sin(angle) };
/* Apply to first point (only if there are 2 points because before no data to do it ) */
if (gpd->runtime.sbuffer_size == 1) {
@@ -579,7 +621,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -594,7 +637,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -698,9 +742,9 @@ static short gp_stroke_addpoint(
pt->time = (float)(curtime - p->inittime);
/* point uv (only 3d view) */
- if ((p->sa->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_size > 1)) {
+ if ((p->sa->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_size > 0)) {
float pixsize = gp_style->texture_pixsize / 1000000.0f;
- tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 2;
+ tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 1;
bGPDspoint spt, spt2;
/* get origin to reproject point */
@@ -751,7 +795,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -816,7 +861,7 @@ static short gp_stroke_addpoint(
}
/* force fill recalc */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* drawing batch cache is dirty now */
gp_update_cache(p->gpd);
}
@@ -895,7 +940,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->inittime = p->inittime;
/* enable recalculation flag by default (only used if hq fill) */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* allocate enough memory for a continuous array for storage points */
const int subdivide = brush->gpencil_settings->draw_subdivide;
@@ -904,7 +949,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* initialize triangle memory to dummy data */
gps->triangles = MEM_callocN(sizeof(bGPDtriangle), "GP Stroke triangulation");
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
/* drawing batch cache is dirty now */
gp_update_cache(p->gpd);
@@ -1197,6 +1242,13 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
}
}
+ /* post process stroke */
+ if ((p->brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) &&
+ p->brush->gpencil_settings->flag & GP_BRUSH_TRIM_STROKE)
+ {
+ BKE_gpencil_trim_stroke(gps);
+ }
+
gp_stroke_added_enable(p);
}
@@ -1561,7 +1613,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
gp_stroke_soft_refine(gps, cull_thresh);
}
- gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
}
gp_update_cache(p->gpd);
}
@@ -1714,6 +1766,25 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
}
}
+/* helper to set default eraser and disable others */
+static void gp_set_default_eraser(Main *bmain, Brush *brush_dft)
+{
+ if (brush_dft == NULL) {
+ return;
+ }
+
+ for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ if ((brush->gpencil_settings) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
+ if (brush == brush_dft) {
+ brush->gpencil_settings->flag |= GP_BRUSH_DEFAULT_ERASER;
+ }
+ else if (brush->gpencil_settings->flag & GP_BRUSH_DEFAULT_ERASER) {
+ brush->gpencil_settings->flag &= ~GP_BRUSH_DEFAULT_ERASER;
+ }
+ }
+ }
+}
+
/* initialize a drawing brush */
static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
{
@@ -1740,6 +1811,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
else {
p->eraser = paint->brush;
}
+ /* set new eraser as default */
+ gp_set_default_eraser(p->bmain, p->eraser);
+
/* use radius of eraser */
p->radius = (short)p->eraser->size;
@@ -1788,7 +1862,13 @@ static void gp_init_colors(tGPsdata *p)
if (gp_style) {
/* set colors */
- copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ if (gp_style->flag & GP_STYLE_STROKE_SHOW) {
+ copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ }
+ else {
+ /* if no stroke, use fill */
+ copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
+ }
copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
/* add some alpha to make easy the filling without hide strokes */
if (gpd->runtime.sfill[3] > 0.8f) {
@@ -1973,7 +2053,7 @@ static void gp_session_cleanup(tGPsdata *p)
/* free stroke buffer */
if (gpd->runtime.sbuffer) {
/* printf("\t\tGP - free sbuffer\n"); */
- MEM_freeN(gpd->runtime.sbuffer);
+ MEM_SAFE_FREE(gpd->runtime.sbuffer);
gpd->runtime.sbuffer = NULL;
}
@@ -1988,10 +2068,10 @@ static void gp_session_free(tGPsdata *p)
if (p->rng != NULL) {
BLI_rng_free(p->rng);
}
+
MEM_freeN(p);
}
-
/* init new stroke */
static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph)
{
@@ -2004,10 +2084,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if (p->gpl == NULL) {
p->gpl = BKE_gpencil_layer_addnew(p->gpd, DATA_("GP_Layer"), true);
- if (p->custom_color[3])
+ if (p->custom_color[3]) {
copy_v3_v3(p->gpl->color, p->custom_color);
+ }
}
- if (p->gpl->flag & GP_LAYER_LOCKED) {
+ if ((paintmode != GP_PAINTMODE_ERASER) &&
+ (p->gpl->flag & GP_LAYER_LOCKED))
+ {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
printf("Error: Cannot paint on locked layer\n");
@@ -2060,8 +2143,6 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if (has_layer_to_erase == false) {
p->status = GP_STATUS_ERROR;
- //if (G.debug & G_DEBUG)
- printf("Error: Eraser will not be affecting anything (gpencil_paint_init)\n");
return;
}
}
@@ -2118,7 +2199,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */
+ /* no shift */
+ ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -2415,35 +2497,60 @@ static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
#endif
case GP_STATUS_IDLING:
+ {
/* print status info */
switch (p->paintmode) {
case GP_PAINTMODE_ERASER:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
"ESC/Enter to end (or click outside this area)"));
break;
+ }
case GP_PAINTMODE_DRAW_STRAIGHT:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
"ESC/Enter to end (or click outside this area)"));
break;
+ }
+ case GP_PAINTMODE_SET_CP:
+ {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Guides: LMB click and release to place reference point | "
+ "Esc/RMB to cancel"));
+ break;
+ }
case GP_PAINTMODE_DRAW:
- ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw"));
+ {
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ if (guide->use_guide) {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
+ "M key to flip guide | O key to move reference point"));
+ }
+ else {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw"));
+ }
break;
+ }
case GP_PAINTMODE_DRAW_POLY:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
"Release Shift/ESC/Enter to end (or click outside this area)"));
break;
-
+ }
default: /* unhandled future cases */
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Session: ESC/Enter to end (or click outside this area)"));
break;
+ }
}
break;
-
+ }
case GP_STATUS_ERROR:
case GP_STATUS_DONE:
+ {
/* clear status string */
ED_workspace_status_text(C, NULL);
break;
+ }
case GP_STATUS_PAINTING:
break;
}
@@ -2463,8 +2570,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
gp_stroke_doeraser(p);
/* store used values */
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
}
/* only add current point to buffer if mouse moved (even though we got an event, it might be just noise) */
@@ -2513,8 +2619,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
}
/* store used values */
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
p->ocurtime = p->curtime;
@@ -2533,45 +2638,102 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
}
}
+/* Helper to rotate point around origin */
+static void gp_rotate_v2_v2v2fl(float v[2], const float p[2], const float origin[2], const float angle)
+{
+ float pt[2];
+ float r[2];
+ sub_v2_v2v2(pt, p, origin);
+ rotate_v2_v2fl(r, pt, angle);
+ add_v2_v2v2(v, r, origin);
+}
+
+/* Helper to snap value to grid */
+static float gp_snap_to_grid_fl(float v, const float offset, const float spacing)
+{
+ if (spacing > 0.0f) {
+ return roundf(v / spacing) * spacing + fmodf(offset, spacing);
+ }
+ else {
+ return v;
+ }
+}
+
+static void UNUSED_FUNCTION(gp_snap_to_grid_v2)(float v[2], const float offset[2], const float spacing)
+{
+ v[0] = gp_snap_to_grid_fl(v[0], offset[0], spacing);
+ v[1] = gp_snap_to_grid_fl(v[1], offset[1], spacing);
+}
+
+/* get reference point - screen coords to buffer coords */
+static void gp_origin_set(wmOperator *op, const int mval[2])
+{
+ tGPsdata *p = op->customdata;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ float origin[2];
+ float point[3];
+ copy_v2fl_v2i(origin, mval);
+ gp_stroke_convertcoords(p, origin, point, NULL);
+ if (guide->reference_point == GP_GUIDE_REF_CUSTOM) {
+ copy_v3_v3(guide->location, point);
+ }
+ else if (guide->reference_point == GP_GUIDE_REF_CURSOR) {
+ copy_v3_v3(p->scene->cursor.location, point);
+ }
+}
+
+/* get reference point - buffer coords to screen coords */
+static void gp_origin_get(tGPsdata *p, float origin[2])
+{
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ float location[3];
+ if (guide->reference_point == GP_GUIDE_REF_CUSTOM) {
+ copy_v3_v3(location, guide->location);
+ }
+ else if (guide->reference_point == GP_GUIDE_REF_OBJECT &&
+ guide->reference_object != NULL)
+ {
+ copy_v3_v3(location, guide->reference_object->loc);
+ }
+ else {
+ copy_v3_v3(location, p->scene->cursor.location);
+ }
+ GP_SpaceConversion *gsc = &p->gsc;
+ gp_point_3d_to_xy(gsc, p->gpd->runtime.sbuffer_sflag, location, origin);
+}
+
/* handle draw event */
static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent *event, Depsgraph *depsgraph, float x, float y)
{
tGPsdata *p = op->customdata;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
PointerRNA itemptr;
float mousef[2];
int tablet = 0;
/* convert from window-space to area-space mouse coordinates
* add any x,y override position for fake events
- * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
*/
- p->mval[0] = event->mval[0] + 1.0f - x;
- p->mval[1] = event->mval[1] + 1.0f - y;
+ p->mval[0] = (float)event->mval[0] - x;
+ p->mval[1] = (float)event->mval[1] - y;
p->shift = event->shift;
- /* verify key status for straight lines */
- if ((event->alt > 0) && (RNA_boolean_get(op->ptr, "disable_straight") == false)) {
- if (p->straight[0] == 0) {
- int dx = (int)fabsf(p->mval[0] - p->mvalo[0]);
- int dy = (int)fabsf(p->mval[1] - p->mvalo[1]);
+ /* verify direction for straight lines */
+ if ((guide->use_guide) || ((event->alt > 0) && (RNA_boolean_get(op->ptr, "disable_straight") == false))) {
+ if (p->straight == 0) {
+ int dx = (int)fabsf(p->mval[0] - p->mvali[0]);
+ int dy = (int)fabsf(p->mval[1] - p->mvali[1]);
if ((dx > 0) || (dy > 0)) {
- /* check mouse direction to replace the other coordinate with previous values */
- if (dx >= dy) {
- /* horizontal */
- p->straight[0] = 1;
- p->straight[1] = (short)p->mval[1]; /* save y */
+ /* store mouse direction */
+ if (dx > dy) {
+ p->straight = STROKE_HORIZONTAL;
}
- else {
- /* vertical */
- p->straight[0] = 2;
- p->straight[1] = (short)p->mval[0]; /* save x */
+ else if (dx < dy) {
+ p->straight = STROKE_VERTICAL;
}
}
}
}
- else {
- p->straight[0] = 0;
- }
p->curtime = PIL_check_seconds_timer();
@@ -2619,29 +2781,161 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
p->flags &= ~GP_PAINTFLAG_FIRSTRUN;
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ /* set values */
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
p->inittime = p->ocurtime = p->curtime;
- p->straight[0] = 0;
- p->straight[1] = 0;
+ p->straight = 0;
+
+ /* save initial mouse */
+ copy_v2_v2(p->mvali, p->mval);
+
+ /* calculate once and store snapping distance and origin */
+ RegionView3D * rv3d = p->ar->regiondata;
+ float scale = 1.0f;
+ if (rv3d->is_persp) {
+ float vec[3];
+ gp_get_3d_reference(p, vec);
+ mul_m4_v3(rv3d->persmat, vec);
+ scale = vec[2] * rv3d->pixsize;
+ }
+ else {
+ scale = rv3d->pixsize;
+ }
+ p->guide_spacing = guide->spacing / scale;
+ p->half_spacing = p->guide_spacing * 0.5f;
+ gp_origin_get(p, p->origin);
/* special exception here for too high pressure values on first touch in
* windows for some tablets, then we just skip first touch...
*/
- if (tablet && (p->pressure >= 0.99f))
+ if (tablet && (p->pressure >= 0.99f)) {
+ return;
+ }
+
+ /* special exception for grid snapping
+ * it requires direction which needs at least two points
+ */
+ if (!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP) &&
+ guide->use_guide &&
+ guide->use_snapping &&
+ (guide->type == GP_GUIDE_GRID))
+ {
+ p->flags |= GP_PAINTFLAG_REQ_VECTOR;
+ }
+ }
+
+ /* wait for vector then add initial point */
+ if (p->flags & GP_PAINTFLAG_REQ_VECTOR) {
+ if (p->straight == 0) {
return;
+ }
+
+ p->flags &= ~GP_PAINTFLAG_REQ_VECTOR;
+
+ /* create fake events */
+ float tmp[2];
+ float pt[2];
+ copy_v2_v2(tmp, p->mval);
+ sub_v2_v2v2(pt, p->mval, p->mvali);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), pt[0], pt[1]);
+ if (len_v2v2(p->mval, p->mvalo)) {
+ sub_v2_v2v2(pt, p->mval, p->mvalo);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), pt[0], pt[1]);
+ }
+ copy_v2_v2(p->mval, tmp);
}
- /* check if alt key is pressed and limit to straight lines */
- if ((p->paintmode != GP_PAINTMODE_ERASER) && (p->straight[0] != 0)) {
- if (p->straight[0] == 1) {
- /* horizontal */
- p->mval[1] = p->straight[1]; /* replace y */
+ /* check if stroke is straight or guided */
+ if ((p->paintmode != GP_PAINTMODE_ERASER) &&
+ ((p->straight) || (guide->use_guide)))
+ {
+ /* guided stroke */
+ if (guide->use_guide) {
+ switch (guide->type) {
+ default:
+ case GP_GUIDE_CIRCULAR:
+ {
+ float distance;
+ distance = len_v2v2(p->mvali, p->origin);
+
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ distance = gp_snap_to_grid_fl(distance, 0.0f, p->guide_spacing);
+ }
+
+ dist_ensure_v2_v2fl(p->mval, p->origin, distance);
+ break;
+ }
+ case GP_GUIDE_RADIAL:
+ {
+ if (guide->use_snapping && (guide->angle_snap > 0.0f)) {
+ float point[2];
+ float xy[2];
+ float angle;
+ float half_angle = guide->angle_snap * 0.5f;
+ sub_v2_v2v2(xy, p->mvali, p->origin);
+ angle = atan2f(xy[1], xy[0]);
+ angle += (M_PI * 2.0f);
+ angle = fmodf(angle + half_angle, guide->angle_snap);
+ angle -= half_angle;
+ gp_rotate_v2_v2v2fl(point, p->mvali, p->origin, -angle);
+ closest_to_line_v2(p->mval, p->mval, point, p->origin);
+ }
+ else {
+ closest_to_line_v2(p->mval, p->mval, p->mvali, p->origin);
+ }
+ break;
+ }
+ case GP_GUIDE_PARALLEL:
+ {
+ float point[2];
+ float unit[2];
+ copy_v2_v2(unit, p->mvali);
+ unit[0] += 1.0f; /* start from horizontal */
+ gp_rotate_v2_v2v2fl(point, unit, p->mvali, guide->angle);
+ closest_to_line_v2(p->mval, p->mval, p->mvali, point);
+
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, -guide->angle);
+ p->mval[1] = gp_snap_to_grid_fl(p->mval[1] - p->half_spacing, p->origin[1], p->guide_spacing);
+ gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, guide->angle);
+ }
+ break;
+ }
+ case GP_GUIDE_GRID:
+ {
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ float point[2];
+ float unit[2];
+ float angle;
+ copy_v2_v2(unit, p->mvali);
+ unit[0] += 1.0f; /* start from horizontal */
+ angle = (p->straight == STROKE_VERTICAL) ? M_PI_2 : 0.0f;
+ gp_rotate_v2_v2v2fl(point, unit, p->mvali, angle);
+ closest_to_line_v2(p->mval, p->mval, p->mvali, point);
+
+ if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = gp_snap_to_grid_fl(p->mval[1] - p->half_spacing, p->origin[1], p->guide_spacing);
+ }
+ else {
+ p->mval[0] = gp_snap_to_grid_fl(p->mval[0] - p->half_spacing, p->origin[0], p->guide_spacing);
+ }
+ }
+ else if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = p->mvali[1]; /* replace y */
+ }
+ else {
+ p->mval[0] = p->mvali[0]; /* replace x */
+ }
+ break;
+ }
+ }
+ }
+ else if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = p->mvali[1]; /* replace y */
}
else {
- /* vertical */
- p->mval[0] = p->straight[1]; /* replace x */
+ p->mval[0] = p->mvali[0]; /* replace x */
}
}
@@ -2660,7 +2954,8 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
gpencil_draw_apply(C, op, p, depsgraph);
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
}
/* ------------------------------- */
@@ -2695,8 +2990,8 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
/* get relevant data for this point from stroke */
RNA_float_get_array(&itemptr, "mouse", mousef);
- p->mval[0] = (int)mousef[0];
- p->mval[1] = (int)mousef[1];
+ p->mval[0] = mousef[0];
+ p->mval[1] = mousef[1];
p->pressure = RNA_float_get(&itemptr, "pressure");
p->curtime = (double)RNA_float_get(&itemptr, "time") + p->inittime;
@@ -2740,10 +3035,102 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
/* ------------------------------- */
+/* handle events for guides */
+static void gpencil_guide_event_handling(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
+{
+ bool add_notifier = false;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+
+ /* Enter or exit set center point mode */
+ if ((event->type == OKEY) && (event->val == KM_RELEASE)) {
+ if (p->paintmode == GP_PAINTMODE_DRAW && guide->reference_point != GP_GUIDE_REF_OBJECT) {
+ add_notifier = true;
+ p->paintmode = GP_PAINTMODE_SET_CP;
+ ED_gpencil_toggle_brush_cursor(C, false, NULL);
+ }
+ }
+ /* Freehand mode, turn off speed guide */
+ else if ((event->type == VKEY) && (event->val == KM_RELEASE)) {
+ guide->use_guide = false;
+ add_notifier = true;
+ }
+ /* Alternate or flip direction */
+ else if ((event->type == MKEY) && (event->val == KM_RELEASE)) {
+ if (guide->type == GP_GUIDE_CIRCULAR) {
+ add_notifier = true;
+ guide->type = GP_GUIDE_RADIAL;
+ }
+ else if (guide->type == GP_GUIDE_RADIAL) {
+ add_notifier = true;
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else if (guide->type == GP_GUIDE_PARALLEL) {
+ add_notifier = true;
+ guide->angle += M_PI_2;
+ guide->angle = angle_compat_rad(guide->angle, M_PI);
+ }
+ else {
+ add_notifier = false;
+ }
+ }
+ /* Line guides */
+ else if ((event->type == LKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ guide->use_guide = true;
+ if (event->ctrl) {
+ guide->angle = 0.0f;
+ guide->type = GP_GUIDE_PARALLEL;
+ }
+ else if (event->alt) {
+ guide->type = GP_GUIDE_PARALLEL;
+ guide->angle = RNA_float_get(op->ptr, "guide_last_angle");
+ }
+ else {
+ guide->type = GP_GUIDE_PARALLEL;
+ }
+ }
+ /* Point guide */
+ else if ((event->type == CKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ if (!guide->use_guide) {
+ guide->use_guide = true;
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else if (guide->type == GP_GUIDE_CIRCULAR) {
+ guide->type = GP_GUIDE_RADIAL;
+ }
+ else if (guide->type == GP_GUIDE_RADIAL) {
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else {
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ }
+ /* Change line angle */
+ else if (ELEM(event->type, JKEY, KKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ float angle = guide->angle;
+ float adjust = (float)M_PI / 180.0f;
+ if (event->alt)
+ adjust *= 45.0f;
+ else if (!event->shift)
+ adjust *= 15.0f;
+ angle += (event->type == JKEY) ? adjust : -adjust;
+ angle = angle_compat_rad(angle, M_PI);
+ guide->angle = angle;
+ }
+
+ if (add_notifier) {
+ WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS | NC_GPENCIL | NA_EDITED, NULL);
+ }
+}
+
/* start of interactive drawing part of operator */
static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = NULL;
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
if (G.debug & G_DEBUG)
printf("GPencil - Starting Drawing\n");
@@ -2753,6 +3140,33 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
RNA_enum_set(op->ptr, "mode", GP_PAINTMODE_ERASER);
}
+ /* do not draw in locked or invisible layers */
+ eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode");
+ if (paintmode != GP_PAINTMODE_ERASER) {
+ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+ if ((gpl) && ((gpl->flag & GP_LAYER_LOCKED) || (gpl->flag & GP_LAYER_HIDE))) {
+ BKE_report(op->reports, RPT_ERROR, "Active layer is locked or hide");
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else {
+ /* don't erase empty frames */
+ bool has_layer_to_erase = false;
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* Skip if layer not editable */
+ if (gpencil_layer_is_editable(gpl)) {
+ if (gpl->actframe && gpl->actframe->strokes.first) {
+ has_layer_to_erase = true;
+ break;
+ }
+ }
+ }
+ if (!has_layer_to_erase) {
+ BKE_report(op->reports, RPT_ERROR, "Nothing to erase or all layers locked");
+ return OPERATOR_FINISHED;
+ }
+ }
+
/* try to initialize context data needed while drawing */
if (!gpencil_draw_init(C, op, event)) {
if (op->customdata)
@@ -2789,7 +3203,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
p->status = GP_STATUS_PAINTING;
/* handle the initial drawing - i.e. for just doing a simple dot */
- gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0, 0);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
op->flag |= OP_IS_MODAL_CURSOR_REGION;
}
else {
@@ -2799,22 +3213,24 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
}
/* enable paint mode */
- if (p->sa->spacetype == SPACE_VIEW3D) {
- Object *ob = CTX_data_active_object(C);
- if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
- /* FIXME: use the mode switching operator, this misses notifiers, messages. */
- /* Just set paintmode flag... */
- p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
- /* disable other GP modes */
- p->gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
- p->gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
- p->gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
- /* set workspace mode */
- ob->restore_mode = ob->mode;
- ob->mode = OB_MODE_PAINT_GPENCIL;
- /* redraw mode on screen */
- WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
- }
+ /* handle speed guide events before drawing inside view3d */
+ if (!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP)) {
+ gpencil_guide_event_handling(C, op, event, p);
+ }
+
+ if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
+ /* FIXME: use the mode switching operator, this misses notifiers, messages. */
+ /* Just set paintmode flag... */
+ p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
+ /* disable other GP modes */
+ p->gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
+ p->gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
+ p->gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
+ /* set workspace mode */
+ ob->restore_mode = ob->mode;
+ ob->mode = OB_MODE_PAINT_GPENCIL;
+ /* redraw mode on screen */
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
}
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
@@ -2905,12 +3321,21 @@ static void gpencil_move_last_stroke_to_back(bContext *C)
static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
{
Brush *brush = p->brush;
- if (brush->gpencil_settings->input_samples == 0) {
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ int input_samples = brush->gpencil_settings->input_samples;
+
+ /* ensure sampling when using circular guide */
+ if (guide->use_guide && (guide->type == GP_GUIDE_CIRCULAR)) {
+ input_samples = GP_MAX_INPUT_SAMPLES;
+ }
+
+ if (input_samples == 0) {
return;
}
+
RegionView3D *rv3d = p->ar->regiondata;
float defaultpixsize = rv3d->pixsize * 1000.0f;
- int samples = (GP_MAX_INPUT_SAMPLES - brush->gpencil_settings->input_samples + 1);
+ int samples = (GP_MAX_INPUT_SAMPLES - input_samples + 1);
float thickness = (float)brush->size;
float pt[2], a[2], b[2];
@@ -2944,8 +3369,8 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
float factor = ((thickness * dot_factor) / scale) * samples;
copy_v2_v2(a, p->mvalo);
- b[0] = event->mval[0] + 1;
- b[1] = event->mval[1] + 1;
+ b[0] = (float)event->mval[0] + 1.0f;
+ b[1] = (float)event->mval[1] + 1.0f;
/* get distance in pixels */
float dist = len_v2v2(a, b);
@@ -2956,7 +3381,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ pt[0], pt[1]);
}
else if (dist >= factor) {
int slices = 2 + (int)((dist - 1.0) / factor);
@@ -2966,7 +3391,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ pt[0], pt[1]);
}
}
}
@@ -2976,7 +3401,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = op->customdata;
ToolSettings *ts = CTX_data_tool_settings(C);
- int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ /* default exit state - pass through to support MMB view nav, etc. */
+ int estate = OPERATOR_PASS_THROUGH;
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
@@ -2996,6 +3423,43 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
p->ar = ar;
}
+ /* special mode for editing control points */
+ if (p->paintmode == GP_PAINTMODE_SET_CP) {
+ wmWindow *win = p->win;
+ WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
+ bool drawmode = false;
+
+ switch (event->type) {
+ /* cancel */
+ case ESCKEY:
+ case RIGHTMOUSE:
+ {
+ if (ELEM(event->val, KM_RELEASE)) {
+ drawmode = true;
+ }
+ break;
+ }
+ /* set */
+ case LEFTMOUSE:
+ {
+ if (ELEM(event->val, KM_RELEASE)) {
+ gp_origin_set(op, event->mval);
+ drawmode = true;
+ }
+ break;
+ }
+ }
+ if (drawmode) {
+ p->status = GP_STATUS_IDLING;
+ p->paintmode = GP_PAINTMODE_DRAW;
+ ED_gpencil_toggle_brush_cursor(C, true, NULL);
+ DEG_id_tag_update(&p->scene->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ else {
+ return OPERATOR_RUNNING_MODAL;
+ }
+ }
+
/* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */
if (ISKEYBOARD(event->type)) {
if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY, ZKEY)) {
@@ -3019,6 +3483,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_operator_name_call(C, "GPENCIL_OT_blank_frame_add", WM_OP_EXEC_DEFAULT, NULL);
estate = OPERATOR_RUNNING_MODAL;
}
+ else if ((!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP))) {
+ gpencil_guide_event_handling(C, op, event, p);
+ estate = OPERATOR_RUNNING_MODAL;
+ }
else {
estate = OPERATOR_RUNNING_MODAL;
}
@@ -3043,6 +3511,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
}
+
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -3203,6 +3672,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else if (event->val == KM_RELEASE) {
p->status = GP_STATUS_IDLING;
op->flag |= OP_IS_MODAL_CURSOR_REGION;
+ ED_region_tag_redraw(p->ar);
}
}
@@ -3212,9 +3682,12 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) {
/* handle drawing event */
/* printf("\t\tGP - add point\n"); */
- gpencil_add_missing_events(C, op, event, p);
- gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0, 0);
+ if ((!(p->flags & GP_PAINTFLAG_FIRSTRUN)) && guide->use_guide) {
+ gpencil_add_missing_events(C, op, event, p);
+ }
+
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
/* finish painting operation if anything went wrong just now */
if (p->status == GP_STATUS_ERROR) {
@@ -3251,7 +3724,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
@@ -3277,6 +3751,13 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* process last operations before exiting */
switch (estate) {
case OPERATOR_FINISHED:
+ /* store stroke angle for parallel guide */
+ if ((p->straight == 0) || (guide->use_guide && (guide->type == GP_GUIDE_CIRCULAR))) {
+ float xy[2];
+ sub_v2_v2v2(xy, p->mval, p->mvali);
+ float angle = atan2f(xy[1], xy[0]);
+ RNA_float_set(op->ptr, "guide_last_angle", angle);
+ }
/* one last flush before we're done */
gpencil_draw_exit(C, op);
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
@@ -3306,7 +3787,7 @@ static const EnumPropertyItem prop_gpencil_drawmodes[] = {
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"},
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"},
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", "Erase Grease Pencil strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void GPENCIL_OT_draw(wmOperatorType *ot)
@@ -3334,7 +3815,8 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
+ /* NOTE: wait for input is enabled by default,
+ * so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
@@ -3343,4 +3825,48 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
prop = RNA_def_boolean(ot->srna, "disable_fill", false, "No Fill Areas", "Disable fill to use stroke as fill boundary");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ /* guides */
+ prop = RNA_def_float(ot->srna, "guide_last_angle", 0.0f, -10000.0f, 10000.0f, "Angle", "Speed guide angle", -10000.0f, 10000.0f);
+}
+
+/* additional OPs */
+
+static int gpencil_guide_rotate(bContext *C, wmOperator *op)
+{
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ GP_Sculpt_Guide *guide = &ts->gp_sculpt.guide;
+ float angle = RNA_float_get(op->ptr, "angle");
+ bool increment = RNA_boolean_get(op->ptr, "increment");
+ if (increment) {
+ float oldangle = guide->angle;
+ oldangle += angle;
+ guide->angle = angle_compat_rad(oldangle, M_PI);
+ }
+ else {
+ guide->angle = angle_compat_rad(angle, M_PI);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_guide_rotate(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Rotate Guide Angle";
+ ot->idname = "GPENCIL_OT_guide_rotate";
+ ot->description = "Rotate guide angle";
+
+ /* api callbacks */
+ ot->exec = gpencil_guide_rotate;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_boolean(ot->srna, "increment", true, "Increment", "Increment angle");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ prop = RNA_def_float(ot->srna, "angle", 0.0f, -10000.0f, 10000.0f, "Angle", "Guide angle", -10000.0f, 10000.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index a6c6c31a9ad..f03b2b4aca1 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for creating new Grease Pencil primitives (boxes, circles, ...)
*/
- /** \file blender/editors/gpencil/gpencil_primitive.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <string.h>
@@ -96,6 +88,8 @@
#define IN_PROGRESS 1
#define IN_CURVE_EDIT 2
#define IN_MOVE 3
+#define IN_BRUSH_SIZE 4
+#define IN_BRUSH_STRENGTH 5
#define SELECT_NONE 0
#define SELECT_START 1
@@ -172,7 +166,14 @@ static void gp_init_colors(tGPDprimitive *p)
if (gp_style) {
/* set colors */
- copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ if (gp_style->flag & GP_STYLE_STROKE_SHOW) {
+ copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ }
+ else {
+ /* if no stroke, use fill */
+ copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
+ }
+
copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
/* add some alpha to make easy the filling without hide strokes */
if (gpd->runtime.sfill[3] > 0.8f) {
@@ -246,6 +247,16 @@ static void gp_primitive_update_cps(tGPDprimitive *tgpi)
}
}
+/* Helper to reflect point */
+static void UNUSED_FUNCTION(gp_reflect_point_v2_v2v2v2)(
+ float va[2], const float p[2], const float a[2], const float b[2])
+{
+ float point[2];
+ closest_to_line_v2(point, p, a, b);
+ va[0] = point[0] - (p[0] - point[0]);
+ va[1] = point[1] - (p[1] - point[1]);
+}
+
/* Poll callback for primitive operators */
static bool gpencil_primitive_add_poll(bContext *C)
{
@@ -330,7 +341,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
gps->inittime = 0.0f;
/* enable recalculation flag by default */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->flag &= ~GP_STROKE_SELECT;
/* the polygon must be closed, so enabled cyclic */
if (ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) {
@@ -347,7 +358,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
/* initialize triangle memory to dummy data */
gps->tot_triangles = 0;
gps->triangles = NULL;
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* add to strokes */
BLI_addtail(&tgpi->gpf->strokes, gps);
@@ -375,6 +386,10 @@ static void gpencil_primitive_add_segment(tGPDprimitive *tgpi)
/* Helper: set control point */
static void gp_primitive_set_cp(tGPDprimitive *tgpi, float p[2], float color[4], int size)
{
+ if (tgpi->flag == IN_PROGRESS) {
+ return;
+ }
+
bGPDcontrolpoint *cp_points = tgpi->gpd->runtime.cp_points;
if (tgpi->gpd->runtime.tot_cp_points < MAX_CP) {
@@ -396,19 +411,33 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
char msg_str[UI_MAX_DRAW_STR];
if (tgpi->type == GP_STROKE_LINE) {
- BLI_strncpy(msg_str, IFACE_("Line: ESC to cancel, LMB set origin, Enter/RMB to confirm, WHEEL/+- to adjust subdivision number, Shift to align, Alt to center"), UI_MAX_DRAW_STR);
+ BLI_strncpy(
+ msg_str,
+ IFACE_("Line: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- to adjust subdivision number, Shift to align, Alt to center, E: extrude"),
+ UI_MAX_DRAW_STR);
}
else if (tgpi->type == GP_STROKE_BOX) {
- BLI_strncpy(msg_str, IFACE_("Rectangle: ESC to cancel, LMB set origin, Enter/RMB to confirm, WHEEL/+- to adjust subdivision number, Shift to square, Alt to center"), UI_MAX_DRAW_STR);
+ BLI_strncpy(
+ msg_str,
+ IFACE_("Rectangle: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- to adjust subdivision number, Shift to square, Alt to center"),
+ UI_MAX_DRAW_STR);
}
else if (tgpi->type == GP_STROKE_CIRCLE) {
- BLI_strncpy(msg_str, IFACE_("Circle: ESC to cancel, Enter/RMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center"), UI_MAX_DRAW_STR);
+ BLI_strncpy(
+ msg_str,
+ IFACE_("Circle: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center"),
+ UI_MAX_DRAW_STR);
}
else if (tgpi->type == GP_STROKE_ARC) {
- BLI_strncpy(msg_str, IFACE_("Arc: ESC to cancel, Enter/RMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, M: Flip"), UI_MAX_DRAW_STR);
+ BLI_strncpy(msg_str,
+ IFACE_("Arc: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, M: Flip, E: extrude"),
+ UI_MAX_DRAW_STR);
}
else if (tgpi->type == GP_STROKE_CURVE) {
- BLI_strncpy(msg_str, IFACE_("Curve: ESC to cancel, Enter/RMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, E: extrude"), UI_MAX_DRAW_STR);
+ BLI_strncpy(
+ msg_str,
+ IFACE_("Curve: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, E: extrude"),
+ UI_MAX_DRAW_STR);
}
if (ELEM(tgpi->type, GP_STROKE_CIRCLE, GP_STROKE_ARC, GP_STROKE_LINE, GP_STROKE_BOX)) {
@@ -657,23 +686,25 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
/* compute screen-space coordinates for points */
tGPspoint *points2D = tgpi->points;
- switch (tgpi->type) {
- case GP_STROKE_BOX:
- gp_primitive_rectangle(tgpi, points2D);
- break;
- case GP_STROKE_LINE:
- gp_primitive_line(tgpi, points2D);
- break;
- case GP_STROKE_CIRCLE:
- gp_primitive_circle(tgpi, points2D);
- break;
- case GP_STROKE_ARC:
- gp_primitive_arc(tgpi, points2D);
- break;
- case GP_STROKE_CURVE:
- gp_primitive_bezier(tgpi, points2D);
- default:
- break;
+ if (tgpi->tot_edges > 1) {
+ switch (tgpi->type) {
+ case GP_STROKE_BOX:
+ gp_primitive_rectangle(tgpi, points2D);
+ break;
+ case GP_STROKE_LINE:
+ gp_primitive_line(tgpi, points2D);
+ break;
+ case GP_STROKE_CIRCLE:
+ gp_primitive_circle(tgpi, points2D);
+ break;
+ case GP_STROKE_ARC:
+ gp_primitive_arc(tgpi, points2D);
+ break;
+ case GP_STROKE_CURVE:
+ gp_primitive_bezier(tgpi, points2D);
+ default:
+ break;
+ }
}
/* convert screen-coordinates to 3D coordinates */
@@ -786,9 +817,10 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tGPspoint *p2d = &points2D[i];
/* set rnd value for reuse */
- if (p2d->rnd_dirty != true) {
+ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) && (p2d->rnd_dirty != true)) {
p2d->rnd[0] = BLI_rng_get_float(tgpi->rng);
p2d->rnd[1] = BLI_rng_get_float(tgpi->rng);
+ p2d->rnd[2] = BLI_rng_get_float(tgpi->rng);
p2d->rnd_dirty = true;
}
@@ -842,7 +874,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
svec[0] = -mvec[1];
svec[1] = mvec[0];
- if (p2d->rnd[0] > 0.5f) {
+ if (p2d->rnd[1] > 0.5f) {
mul_v2_fl(svec, -fac);
}
else {
@@ -856,10 +888,10 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
(brush->gpencil_settings->draw_random_press > 0.0f))
{
if (p2d->rnd[0] > 0.5f) {
- pressure -= brush->gpencil_settings->draw_random_press * p2d->rnd[0];
+ pressure -= brush->gpencil_settings->draw_random_press * p2d->rnd[1];
}
else {
- pressure += brush->gpencil_settings->draw_random_press * p2d->rnd[0];
+ pressure += brush->gpencil_settings->draw_random_press * p2d->rnd[2];
}
}
@@ -876,8 +908,8 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) &&
(brush->gpencil_settings->draw_random_strength > 0.0f))
{
- if (p2d->rnd[1] > 0.5f) {
- strength -= strength * brush->gpencil_settings->draw_random_strength * p2d->rnd[1];
+ if (p2d->rnd[2] > 0.5f) {
+ strength -= strength * brush->gpencil_settings->draw_random_strength * p2d->rnd[0];
}
else {
strength += strength * brush->gpencil_settings->draw_random_strength * p2d->rnd[1];
@@ -892,7 +924,36 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tpt->pressure = pressure;
tpt->strength = strength;
tpt->time = p2d->time;
- tpt->uv_fac = 1.0f;
+
+ /* point uv */
+ if (gpd->runtime.sbuffer_size > 0) {
+ MaterialGPencilStyle *gp_style = tgpi->mat->gp_style;
+ const float pixsize = gp_style->texture_pixsize / 1000000.0f;
+ tGPspoint *tptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 1;
+ bGPDspoint spt, spt2;
+
+ /* get origin to reproject point */
+ float origin[3];
+ ED_gp_get_drawing_reference(tgpi->scene, tgpi->ob, tgpi->gpl,
+ ts->gpencil_v3d_align, origin);
+ /* reproject current */
+ ED_gpencil_tpoint_to_point(tgpi->ar, origin, tpt, &spt);
+ ED_gp_project_point_to_plane(tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt);
+
+ /* reproject previous */
+ ED_gpencil_tpoint_to_point(tgpi->ar, origin, tptb, &spt2);
+ ED_gp_project_point_to_plane(tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2);
+ tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
+ tpt->uv_fac = tgpi->totpixlen;
+ if ((gp_style) && (gp_style->sima)) {
+ tpt->uv_fac /= gp_style->sima->gen_x;
+ }
+ }
+ else {
+ tgpi->totpixlen = 0.0f;
+ tpt->uv_fac = 0.0f;
+ }
+
tpt->uv_rot = p2d->uv_rot;
gpd->runtime.sbuffer_size++;
@@ -912,7 +973,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
pt->strength = strength;
pt->time = 0.0f;
pt->flag = 0;
- pt->uv_fac = 1.0f;
+ pt->uv_fac = tpt->uv_fac;
if (gps->dvert != NULL) {
MDeformVert *dvert = &gps->dvert[i];
@@ -954,7 +1015,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
}
/* force fill recalc */
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
MEM_SAFE_FREE(depth_arr);
@@ -1182,8 +1243,11 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
gps = tgpi->gpf->strokes.first;
if (gps) {
gps->thickness = tgpi->brush->size;
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
+
+ /* calculate UVs along the stroke */
+ ED_gpencil_calc_stroke_uv(tgpi->ob, gps);
}
/* transfer stroke from temporary buffer to the actual frame */
@@ -1300,7 +1364,7 @@ static void gpencil_primitive_edit_event_handling(bContext *C, wmOperator *op, w
{
if ((event->val == KM_PRESS) &&
(tgpi->curve) &&
- (tgpi->orign_type == GP_STROKE_ARC))
+ (ELEM(tgpi->orign_type, GP_STROKE_ARC) ))
{
tgpi->flip ^= 1;
gp_primitive_update_cps(tgpi);
@@ -1323,6 +1387,52 @@ static void gpencil_primitive_edit_event_handling(bContext *C, wmOperator *op, w
}
}
+/* brush strength */
+static void gpencil_primitive_strength(tGPDprimitive *tgpi, bool reset)
+{
+ Brush *brush = tgpi->brush;
+ if (brush) {
+ if (reset) {
+ brush->gpencil_settings->draw_strength = tgpi->brush_strength;
+ tgpi->brush_strength = 0.0f;
+ }
+ else {
+ if (tgpi->brush_strength == 0.0f) {
+ tgpi->brush_strength = brush->gpencil_settings->draw_strength;
+ }
+ float move[2];
+ sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
+ float adjust = (move[1] > 0.0f) ? 0.01f : -0.01f;
+ brush->gpencil_settings->draw_strength += adjust * fabsf(len_manhattan_v2(move));
+ }
+
+ /* limit low limit because below 0.2f the stroke is invisible */
+ CLAMP(brush->gpencil_settings->draw_strength, 0.2f, 1.0f);
+ }
+}
+
+/* brush size */
+static void gpencil_primitive_size(tGPDprimitive *tgpi, bool reset)
+{
+ Brush *brush = tgpi->brush;
+ if (brush) {
+ if (reset) {
+ brush->size = tgpi->brush_size;
+ tgpi->brush_size = 0;
+ }
+ else {
+ if (tgpi->brush_size == 0) {
+ tgpi->brush_size = brush->size;
+ }
+ float move[2];
+ sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
+ int adjust = (move[1] > 0.0f) ? 1 : -1;
+ brush->size += adjust * (int)fabsf(len_manhattan_v2(move));
+ }
+ CLAMP_MIN(brush->size, 1);
+ }
+}
+
/* move */
static void gpencil_primitive_move(tGPDprimitive *tgpi, bool reset)
{
@@ -1366,21 +1476,73 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
switch (event->type) {
case MOUSEMOVE:
+ {
gpencil_primitive_move(tgpi, false);
gpencil_primitive_update(C, op, tgpi);
break;
+ }
case ESCKEY:
case LEFTMOUSE:
+ {
zero_v2(tgpi->move);
tgpi->flag = IN_CURVE_EDIT;
break;
+ }
case RIGHTMOUSE:
+ {
if (event->val == KM_RELEASE) {
tgpi->flag = IN_CURVE_EDIT;
gpencil_primitive_move(tgpi, true);
gpencil_primitive_update(C, op, tgpi);
}
break;
+ }
+ }
+ copy_v2_v2(tgpi->mvalo, tgpi->mval);
+ return OPERATOR_RUNNING_MODAL;
+ }
+ else if (tgpi->flag == IN_BRUSH_SIZE) {
+ switch (event->type) {
+ case MOUSEMOVE:
+ gpencil_primitive_size(tgpi, false);
+ gpencil_primitive_update(C, op, tgpi);
+ break;
+ case ESCKEY:
+ case MIDDLEMOUSE:
+ case LEFTMOUSE:
+ tgpi->brush_size = 0;
+ tgpi->flag = IN_CURVE_EDIT;
+ break;
+ case RIGHTMOUSE:
+ if (event->val == KM_RELEASE) {
+ tgpi->flag = IN_CURVE_EDIT;
+ gpencil_primitive_size(tgpi, true);
+ gpencil_primitive_update(C, op, tgpi);
+ }
+ break;
+ }
+ copy_v2_v2(tgpi->mvalo, tgpi->mval);
+ return OPERATOR_RUNNING_MODAL;
+ }
+ else if (tgpi->flag == IN_BRUSH_STRENGTH) {
+ switch (event->type) {
+ case MOUSEMOVE:
+ gpencil_primitive_strength(tgpi, false);
+ gpencil_primitive_update(C, op, tgpi);
+ break;
+ case ESCKEY:
+ case MIDDLEMOUSE:
+ case LEFTMOUSE:
+ tgpi->brush_strength = 0.0f;
+ tgpi->flag = IN_CURVE_EDIT;
+ break;
+ case RIGHTMOUSE:
+ if (event->val == KM_RELEASE) {
+ tgpi->flag = IN_CURVE_EDIT;
+ gpencil_primitive_strength(tgpi, true);
+ gpencil_primitive_update(C, op, tgpi);
+ }
+ break;
}
copy_v2_v2(tgpi->mvalo, tgpi->mval);
return OPERATOR_RUNNING_MODAL;
@@ -1430,7 +1592,19 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
/* done! */
return OPERATOR_FINISHED;
}
- case RIGHTMOUSE: /* cancel */
+ case RIGHTMOUSE:
+ {
+ /* exception to cancel current stroke when we have previous strokes in buffer */
+ if (tgpi->tot_stored_edges > 0) {
+ tgpi->flag = IDLE;
+ tgpi->tot_edges = 0;
+ gp_primitive_update_strokes(C, tgpi);
+ gpencil_primitive_interaction_end(C, op, win, tgpi);
+ /* done! */
+ return OPERATOR_FINISHED;
+ }
+ ATTR_FALLTHROUGH;
+ }
case ESCKEY:
{
/* return to normal cursor and header status */
@@ -1477,6 +1651,19 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
}
break;
}
+ case FKEY: /* brush thickness/ brush strength */
+ {
+ if ((event->val == KM_PRESS)) {
+ if (event->shift) {
+ tgpi->flag = IN_BRUSH_STRENGTH;
+ }
+ else {
+ tgpi->flag = IN_BRUSH_SIZE;
+ }
+ WM_cursor_modal_set(win, BC_NS_SCROLLCURSOR);
+ }
+ break;
+ }
case CKEY: /* curve mode */
{
if ((event->val == KM_PRESS) &&
@@ -1597,7 +1784,7 @@ void GPENCIL_OT_primitive(wmOperatorType *ot)
{GP_STROKE_CIRCLE, "CIRCLE", 0, "Circle", ""},
{GP_STROKE_ARC, "ARC", 0, "Arc", ""},
{GP_STROKE_CURVE, "CURVE", 0, "Curve", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index 8b1f652f7c5..720e3656b0c 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_select.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#include <stdio.h>
@@ -509,7 +503,7 @@ void GPENCIL_OT_select_grouped(wmOperatorType *ot)
static const EnumPropertyItem prop_select_grouped_types[] = {
{GP_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"},
{GP_SEL_SAME_MATERIAL, "MATERIAL", 0, "Material", "Shared materials"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -861,11 +855,14 @@ void GPENCIL_OT_select_less(wmOperatorType *ot)
* It would be great to de-duplicate the logic here sometime, but that can wait...
*/
static bool gp_stroke_do_circle_sel(
+ bGPDlayer *gpl,
bGPDstroke *gps, GP_SpaceConversion *gsc,
const int mx, const int my, const int radius,
- const bool select, rcti *rect, float diff_mat[4][4], const int selectmode)
+ const bool select, rcti *rect, float diff_mat[4][4], const int selectmode,
+ const float scale)
{
- bGPDspoint *pt1, *pt2;
+ bGPDspoint *pt1 = NULL;
+ bGPDspoint *pt2 = NULL;
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
int i;
bool changed = false;
@@ -958,6 +955,14 @@ static bool gp_stroke_do_circle_sel(
}
}
+ /* expand selection to segment */
+ if ((hit) && (selectmode == GP_SELECTMODE_SEGMENT) && (select)) {
+ float r_hita[3], r_hitb[3];
+ bool hit_select = (bool)(pt1->flag & GP_SPOINT_SELECT);
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt1, hit_select, false, scale, r_hita, r_hitb);
+ }
+
/* Ensure that stroke selection is in sync with its points */
BKE_gpencil_stroke_sync_selection(gps);
}
@@ -971,6 +976,7 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
bGPdata *gpd = ED_gpencil_data_get_active(C);
ToolSettings *ts = CTX_data_tool_settings(C);
const int selectmode = ts->gpencil_selectmode;
+ const float scale = ts->gp_sculpt.isect_threshold;
/* if not edit/sculpt mode, the event is catched but not processed */
if (GPENCIL_NONE_EDIT_MODE(gpd)) {
@@ -986,7 +992,8 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
bool select = !RNA_boolean_get(op->ptr, "deselect");
GP_SpaceConversion gsc = {NULL};
- rcti rect = {0}; /* for bounding rect around circle (for quicky intersection testing) */
+ /* for bounding rect around circle (for quicky intersection testing) */
+ rcti rect = {0};
bool changed = false;
@@ -1012,7 +1019,8 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
{
changed |= gp_stroke_do_circle_sel(
- gps, &gsc, mx, my, radius, select, &rect, gpstroke_iter.diff_mat, selectmode);
+ gpl, gps, &gsc, mx, my, radius, select, &rect,
+ gpstroke_iter.diff_mat, selectmode, scale);
}
GP_EDITABLE_STROKES_END(gpstroke_iter);
@@ -1074,7 +1082,11 @@ static int gpencil_generic_select_exec(
const bool strokemode = (
(ts->gpencil_selectmode == GP_SELECTMODE_STROKE) &&
((gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0));
+ const bool segmentmode = (
+ (ts->gpencil_selectmode == GP_SELECTMODE_SEGMENT) &&
+ ((gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0));
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const float scale = ts->gp_sculpt.isect_threshold;
GP_SpaceConversion gsc = {NULL};
@@ -1124,6 +1136,15 @@ static int gpencil_generic_select_exec(
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(pt->flag, sel_op_result, GP_SPOINT_SELECT);
changed = true;
+
+ /* expand selection to segment */
+ if ((sel_op_result != -1) && (segmentmode)) {
+ bool hit_select = (bool)(pt->flag & GP_SPOINT_SELECT);
+ float r_hita[3], r_hitb[3];
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt, hit_select, false, scale, r_hita, r_hitb);
+ }
+
}
}
else {
@@ -1336,6 +1357,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
ToolSettings *ts = CTX_data_tool_settings(C);
+ const float scale = ts->gp_sculpt.isect_threshold;
/* "radius" is simply a threshold (screen space) to make it easier to test with a tolerance */
const float radius = 0.50f * U.widget_unit;
@@ -1350,6 +1372,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
GP_SpaceConversion gsc = {NULL};
+ bGPDlayer *hit_layer = NULL;
bGPDstroke *hit_stroke = NULL;
bGPDspoint *hit_point = NULL;
int hit_distance = radius_squared;
@@ -1394,6 +1417,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
if (pt_distance <= radius_squared) {
/* only use this point if it is a better match than the current hit - T44685 */
if (pt_distance < hit_distance) {
+ hit_layer = gpl;
hit_stroke = gps;
hit_point = pt;
hit_distance = pt_distance;
@@ -1419,7 +1443,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* adjust selection behaviour - for toggle option */
+ /* adjust selection behavior - for toggle option */
if (toggle) {
deselect = (hit_point->flag & GP_SPOINT_SELECT) != 0;
}
@@ -1454,6 +1478,15 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
/* we're adding selection, so selection must be true */
hit_point->flag |= GP_SPOINT_SELECT;
hit_stroke->flag |= GP_STROKE_SELECT;
+
+ /* expand selection to segment */
+ if (ts->gpencil_selectmode == GP_SELECTMODE_SEGMENT) {
+ float r_hita[3], r_hitb[3];
+ bool hit_select = (bool)(hit_point->flag & GP_SPOINT_SELECT);
+ ED_gpencil_select_stroke_segment(
+ hit_layer, hit_stroke, hit_point, hit_select,
+ false, scale, r_hita, r_hitb);
+ }
}
else {
/* deselect point */
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index 212a119facb..7ed794a0a32 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_undo.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -44,7 +36,6 @@
#include "BKE_blender_undo.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "ED_gpencil.h"
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index ee0d80b7c26..a727e2cc5de 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2014, Blender Foundation
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_utils.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#include <stdio.h>
@@ -36,6 +30,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BLI_rand.h"
@@ -101,7 +96,7 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID *screen_id, ScrArea *sa, Scene
switch (sa->spacetype) {
/* XXX: Should we reduce reliance on context.gpencil_data for these cases? */
- case SPACE_BUTS: /* properties */
+ case SPACE_PROPERTIES: /* properties */
case SPACE_INFO: /* header info (needed after workspaces merge) */
{
if (ob && (ob->type == OB_GPENCIL)) {
@@ -139,7 +134,8 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID *screen_id, ScrArea *sa, Scene
/* return the GP data for the active node block/node */
if (snode && snode->nodetree) {
- /* for now, as long as there's an active node tree, default to using that in the Nodes Editor */
+ /* for now, as long as there's an active node tree,
+ * default to using that in the Nodes Editor */
if (r_ptr) RNA_id_pointer_create(&snode->nodetree->id, r_ptr);
return &snode->nodetree->gpd;
}
@@ -273,7 +269,7 @@ bGPdata *ED_gpencil_data_get_active_v3d(ViewLayer *view_layer, View3D *v3d)
/* We have to make sure active object is actually visible and selected, else we must use default scene gpd,
* to be consistent with ED_gpencil_data_get_active's behavior.
*/
- if (base && TESTBASE(v3d, base)) {
+ if (base && BASE_SELECTED(v3d, base)) {
if (base->object->type == OB_GPENCIL)
gpd = base->object->data;
}
@@ -465,7 +461,7 @@ bool ED_gpencil_stroke_can_use_direct(const ScrArea *sa, const bGPDstroke *gps)
/* filter stroke types by flags + spacetype */
if (gps->flag & GP_STROKE_3DSPACE) {
/* 3D strokes - only in 3D view */
- return ((sa->spacetype == SPACE_VIEW3D) || (sa->spacetype == SPACE_BUTS));
+ return ((sa->spacetype == SPACE_VIEW3D) || (sa->spacetype == SPACE_PROPERTIES));
}
else if (gps->flag & GP_STROKE_2DIMAGE) {
/* Special "image" strokes - only in Image Editor */
@@ -545,7 +541,7 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, CTX_data_depsgraph(C), ar, v3d, rv3d, &r_gsc->subrect_data, true); /* no shift */
+ ED_view3d_calc_camera_border(scene, CTX_data_depsgraph(C), ar, v3d, rv3d, &r_gsc->subrect_data, true);
r_gsc->subrect = &r_gsc->subrect_data;
}
}
@@ -723,6 +719,62 @@ void gp_point_to_xy_fl(
}
}
+
+/**
+ * generic based on gp_point_to_xy_fl
+ */
+void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], float xy[2])
+{
+ const ARegion *ar = gsc->ar;
+ const View2D *v2d = gsc->v2d;
+ const rctf *subrect = gsc->subrect;
+ float xyval[2];
+
+ /* sanity checks */
+ BLI_assert((gsc->sa->spacetype == SPACE_VIEW3D));
+
+ if (flag & GP_STROKE_3DSPACE) {
+ if (ED_view3d_project_float_global(ar, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ xy[0] = xyval[0];
+ xy[1] = xyval[1];
+ }
+ else {
+ xy[0] = 0.0f;
+ xy[1] = 0.0f;
+ }
+ }
+ else if (flag & GP_STROKE_2DSPACE) {
+ float vec[3] = { pt[0], pt[1], 0.0f };
+ int t_x, t_y;
+
+ mul_m4_v3(gsc->mat, vec);
+ UI_view2d_view_to_region_clip(v2d, vec[0], vec[1], &t_x, &t_y);
+
+ if ((t_x == t_y) && (t_x == V2D_IS_CLIPPED)) {
+ /* XXX: Or should we just always use the values as-is? */
+ xy[0] = 0.0f;
+ xy[1] = 0.0f;
+ }
+ else {
+ xy[0] = (float)t_x;
+ xy[1] = (float)t_y;
+ }
+ }
+ else {
+ if (subrect == NULL) {
+ /* normal 3D view (or view space) */
+ xy[0] = (pt[0] / 100.0f * ar->winx);
+ xy[1] = (pt[1] / 100.0f * ar->winy);
+ }
+ else {
+ /* camera view, use subrect */
+ xy[0] = ((pt[0] / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin;
+ xy[1] = ((pt[1] / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;
+ }
+ }
+}
+
+
/**
* Project screenspace coordinates to 3D-space
*
@@ -738,7 +790,7 @@ void gp_point_to_xy_fl(
*
* \warning Assumes that it is getting called in a 3D view only.
*/
-bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, Scene *scene, const float screen_co[2], float r_out[3])
+bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, Scene *scene, const float screen_co[2], float r_out[3])
{
const RegionView3D *rv3d = gsc->ar->regiondata;
float rvec[3];
@@ -997,7 +1049,7 @@ void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
if (gps->dvert != NULL) {
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
}
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* move points from last to first to new place */
i2 = gps->totpoints - 1;
@@ -1158,7 +1210,8 @@ void ED_gpencil_parent_location(
mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);
}
else {
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse); /* if bone not found use object (armature) */
+ /* if bone not found use object (armature) */
+ mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
}
return;
}
@@ -1218,19 +1271,16 @@ Object *ED_gpencil_add_object(bContext *C, Scene *UNUSED(scene), const float loc
Object *ob = ED_object_add_type(C, OB_GPENCIL, NULL, loc, rot, false, local_view_bits);
- /* define size */
- BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE);
/* create default brushes and colors */
- ED_gpencil_add_defaults(C);
+ ED_gpencil_add_defaults(C, ob);
return ob;
}
/* Helper function to create default colors and drawing brushes */
-void ED_gpencil_add_defaults(bContext *C)
+void ED_gpencil_add_defaults(bContext *C, Object *ob)
{
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
ToolSettings *ts = CTX_data_tool_settings(C);
/* first try to reuse default material */
@@ -1597,54 +1647,53 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
/* for paint use paint brush size and color */
if (gpd->flag & GP_DATA_STROKE_PAINTMODE) {
brush = scene->toolsettings->gp_paint->paint.brush;
+ if ((brush == NULL) || (brush->gpencil_settings == NULL)) {
+ return;
+ }
+
/* while drawing hide */
if ((gpd->runtime.sbuffer_size > 0) &&
- (brush) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0))
{
return;
}
- if (brush) {
- if ((brush->gpencil_settings->flag & GP_BRUSH_ENABLE_CURSOR) == 0) {
- return;
- }
+ if ((brush->gpencil_settings->flag & GP_BRUSH_ENABLE_CURSOR) == 0) {
+ return;
+ }
- /* eraser has special shape and use a different shader program */
- if (brush->gpencil_tool == GPAINT_TOOL_ERASE) {
- ED_gpencil_brush_draw_eraser(brush, x, y);
- return;
- }
+ /* eraser has special shape and use a different shader program */
+ if (brush->gpencil_tool == GPAINT_TOOL_ERASE) {
+ ED_gpencil_brush_draw_eraser(brush, x, y);
+ return;
+ }
- /* get current drawing color */
- ma = BKE_gpencil_get_material_from_brush(brush);
- if (ma == NULL) {
- BKE_gpencil_material_ensure(bmain, ob);
- /* assign the first material to the brush */
- ma = give_current_material(ob, 1);
- brush->gpencil_settings->material = ma;
- }
- gp_style = ma->gp_style;
-
- /* after some testing, display the size of the brush is not practical because
- * is too disruptive and the size of cursor does not change with zoom factor.
- * The decision was to use a fix size, instead of brush->thickness value.
- */
- if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) &&
- ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
- ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
- (brush->gpencil_tool == GPAINT_TOOL_DRAW))
- {
- radius = 2.0f;
- copy_v3_v3(color, gp_style->stroke_rgba);
- }
- else {
- radius = 5.0f;
- copy_v3_v3(color, brush->add_col);
- }
+ /* get current drawing color */
+ ma = BKE_gpencil_get_material_from_brush(brush);
+ if (ma == NULL) {
+ BKE_gpencil_material_ensure(bmain, ob);
+ /* assign the first material to the brush */
+ ma = give_current_material(ob, 1);
+ brush->gpencil_settings->material = ma;
+ }
+ gp_style = ma->gp_style;
+
+ /* after some testing, display the size of the brush is not practical because
+ * is too disruptive and the size of cursor does not change with zoom factor.
+ * The decision was to use a fix size, instead of brush->thickness value.
+ */
+ if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
+ (brush->gpencil_tool == GPAINT_TOOL_DRAW))
+ {
+ radius = 2.0f;
+ copy_v3_v3(color, gp_style->stroke_rgba);
}
else {
- return;
+ radius = 5.0f;
+ copy_v3_v3(color, brush->add_col);
}
}
@@ -1947,4 +1996,358 @@ void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
}
}
}
-/* ******************************************************** */
+
+static bool gpencil_check_collision(
+ bGPDstroke *gps, bGPDstroke **gps_array, GHash *all_2d,
+ int totstrokes, float p2d_a1[2], float p2d_a2[2], float r_hit[2])
+{
+ bool hit = false;
+ /* check segment with all segments of all strokes */
+ for (int s = 0; s < totstrokes; s++) {
+ bGPDstroke *gps_iter = gps_array[s];
+ if (gps_iter->totpoints < 2) {
+ continue;
+ }
+ /* get stroke 2d version */
+ float(*points2d)[2] = BLI_ghash_lookup(all_2d, gps_iter);
+
+ for (int i2 = 0; i2 < gps_iter->totpoints - 1; i2++) {
+ float p2d_b1[2], p2d_b2[2];
+ copy_v2_v2(p2d_b1, points2d[i2]);
+ copy_v2_v2(p2d_b2, points2d[i2 + 1]);
+
+ /* don't self check */
+ if (gps == gps_iter) {
+ if (equals_v2v2(p2d_a1, p2d_b1) || equals_v2v2(p2d_a1, p2d_b2)) {
+ continue;
+ }
+ if (equals_v2v2(p2d_a2, p2d_b1) || equals_v2v2(p2d_a2, p2d_b2)) {
+ continue;
+ }
+ }
+ /* check collision */
+ int check = isect_seg_seg_v2_point(p2d_a1, p2d_a2, p2d_b1, p2d_b2, r_hit);
+ if (check > 0) {
+ hit = true;
+ break;
+ }
+ }
+
+ if (hit) {
+ break;
+ }
+ }
+
+ if (!hit) {
+ zero_v2(r_hit);
+ }
+
+ return hit;
+}
+
+static void gp_copy_points(
+ bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final, int i, int i2)
+{
+ /* don't copy same point */
+ if (i == i2) {
+ return;
+ }
+
+ copy_v3_v3(&pt_final->x, &pt->x);
+ pt_final->pressure = pt->pressure;
+ pt_final->strength = pt->strength;
+ pt_final->time = pt->time;
+ pt_final->flag = pt->flag;
+ pt_final->uv_fac = pt->uv_fac;
+ pt_final->uv_rot = pt->uv_rot;
+
+ if (gps->dvert != NULL) {
+ MDeformVert *dvert = &gps->dvert[i];
+ MDeformVert *dvert_final = &gps->dvert[i2];
+ MEM_SAFE_FREE(dvert_final->dw);
+
+ dvert_final->totweight = dvert->totweight;
+ if (dvert->dw == NULL) {
+ dvert_final->dw = NULL;
+ dvert_final->totweight = 0;
+ }
+ else {
+ dvert_final->dw = MEM_dupallocN(dvert->dw);
+ }
+ }
+
+}
+
+static void gp_insert_point(
+ bGPDstroke *gps,
+ bGPDspoint *a_pt, bGPDspoint *b_pt,
+ float co_a[3], float co_b[3])
+{
+ bGPDspoint *temp_points;
+ int totnewpoints, oldtotpoints;
+
+ totnewpoints = gps->totpoints;
+ if (a_pt) {
+ totnewpoints++;
+ }
+ if (b_pt) {
+ totnewpoints++;
+ }
+
+ /* duplicate points in a temp area */
+ temp_points = MEM_dupallocN(gps->points);
+ oldtotpoints = gps->totpoints;
+
+ /* look index of base points because memory is changed when resize points array */
+ int a_idx = -1;
+ int b_idx = -1;
+ for (int i = 0; i < oldtotpoints; i++) {
+ bGPDspoint *pt = &gps->points[i];
+ if (pt == a_pt) {
+ a_idx = i;
+ }
+ if (pt == b_pt) {
+ b_idx = i;
+ }
+ }
+
+ /* resize the points arrays */
+ gps->totpoints = totnewpoints;
+ gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * gps->totpoints);
+ if (gps->dvert != NULL) {
+ gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
+ }
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ /* copy all points */
+ int i2 = 0;
+ for (int i = 0; i < oldtotpoints; i++) {
+ bGPDspoint *pt = &temp_points[i];
+ bGPDspoint *pt_final = &gps->points[i2];
+ gp_copy_points(gps, pt, pt_final, i, i2);
+
+ /* create new point duplicating point and copy location */
+ if ((i == a_idx) || (i == b_idx)) {
+ i2++;
+ pt_final = &gps->points[i2];
+ gp_copy_points(gps, pt, pt_final, i, i2);
+ copy_v3_v3(&pt_final->x, (i == a_idx) ? co_a : co_b);
+
+ /* unselect */
+ pt_final->flag &= ~GP_SPOINT_SELECT;
+ /* tag to avoid more checking with this point */
+ pt_final->flag |= GP_SPOINT_TAG;
+ }
+
+ i2++;
+ }
+
+ MEM_SAFE_FREE(temp_points);
+}
+
+static float gp_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2])
+{
+ float dist1 = len_squared_v2v2(p2d_a1, p2d_a2);
+ float dist2 = len_squared_v2v2(p2d_a1, r_hit2d);
+ float f = dist1 > 0.0f ? dist2 / dist1 : 0.0f;
+
+ /* apply a correction factor */
+ float v1[2];
+ interp_v2_v2v2(v1, p2d_a1, p2d_a2, f);
+ float dist3 = len_squared_v2v2(p2d_a1, v1);
+ float f1 = dist1 > 0.0f ? dist3 / dist1 : 0.0f;
+ f = f + (f - f1);
+
+ return f;
+}
+
+/* extend selection to stroke intersections */
+int ED_gpencil_select_stroke_segment(
+ bGPDlayer *gpl, bGPDstroke *gps, bGPDspoint *pt,
+ bool select, bool insert, const float scale,
+ float r_hita[3], float r_hitb[3])
+{
+ const float min_factor = 0.0015f;
+ bGPDspoint *pta1 = NULL;
+ bGPDspoint *pta2 = NULL;
+ float f = 0.0f;
+ int i2 = 0;
+
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ return 0;
+ }
+
+ int memsize = BLI_listbase_count(&gpf->strokes);
+ bGPDstroke **gps_array = MEM_callocN(sizeof(bGPDstroke *) * memsize, __func__);
+
+ /* save points */
+ bGPDspoint *oldpoints = MEM_dupallocN(gps->points);
+
+ /* Save list of strokes to check */
+ int totstrokes = 0;
+ for (bGPDstroke *gps_iter = gpf->strokes.first; gps_iter; gps_iter = gps_iter->next) {
+ if (gps_iter->totpoints < 2) {
+ continue;
+ }
+ gps_array[totstrokes] = gps_iter;
+ totstrokes++;
+ }
+
+ if (totstrokes == 0) {
+ return 0;
+ }
+
+ /* look for index of the current point */
+ int cur_idx = -1;
+ for (int i = 0; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ if (pta1 == pt) {
+ cur_idx = i;
+ break;
+ }
+ }
+ if (cur_idx < 0) {
+ return 0;
+ }
+
+ /* convert all gps points to 2d and save in a hash to avoid recalculation */
+ int direction = 0;
+ float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * gps->totpoints, "GP Stroke temp 2d points");
+ BKE_gpencil_stroke_2d_flat_ref(
+ gps->points, gps->totpoints,
+ gps->points, gps->totpoints, points2d, scale, &direction);
+
+ GHash *all_2d = BLI_ghash_ptr_new(__func__);
+
+ for (int s = 0; s < totstrokes; s++) {
+ bGPDstroke *gps_iter = gps_array[s];
+ float(*points2d_iter)[2] = MEM_mallocN(sizeof(*points2d_iter) * gps_iter->totpoints, __func__);
+
+ /* the extremes of the stroke are scaled to improve collision detection
+ * for near lines */
+ BKE_gpencil_stroke_2d_flat_ref(
+ gps->points, gps->totpoints,
+ gps_iter->points, gps_iter->totpoints, points2d_iter,
+ scale, &direction);
+ BLI_ghash_insert(all_2d, gps_iter, points2d_iter);
+ }
+
+ bool hit_a = false;
+ bool hit_b = false;
+ float p2d_a1[2] = {0.0f, 0.0f};
+ float p2d_a2[2] = {0.0f, 0.0f};
+ float r_hit2d[2];
+ bGPDspoint *hit_pointa = NULL;
+ bGPDspoint *hit_pointb = NULL;
+
+ /* analyze points before current */
+ if (cur_idx > 0) {
+ for (int i = cur_idx; i >= 0; i--) {
+ pta1 = &gps->points[i];
+ copy_v2_v2(p2d_a1, points2d[i]);
+
+ i2 = i - 1;
+ CLAMP_MIN(i2, 0);
+ pta2 = &gps->points[i2];
+ copy_v2_v2(p2d_a2, points2d[i2]);
+
+ hit_a = gpencil_check_collision(
+ gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+
+ if (select) {
+ pta1->flag |= GP_SPOINT_SELECT;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ if (hit_a) {
+ f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
+ interp_v3_v3v3(r_hita, &pta1->x, &pta2->x, f);
+ if (f > min_factor) {
+ hit_pointa = pta2; /* first point is second (inverted loop) */
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+ break;
+ }
+ }
+ }
+
+ /* analyze points after current */
+ for (int i = cur_idx; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ copy_v2_v2(p2d_a1, points2d[i]);
+
+ i2 = i + 1;
+ CLAMP_MAX(i2, gps->totpoints - 1);
+ pta2 = &gps->points[i2];
+ copy_v2_v2(p2d_a2, points2d[i2]);
+
+ hit_b = gpencil_check_collision(
+ gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+
+ if (select) {
+ pta1->flag |= GP_SPOINT_SELECT;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ if (hit_b) {
+ f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
+ interp_v3_v3v3(r_hitb, &pta1->x, &pta2->x, f);
+ if (f > min_factor) {
+ hit_pointb = pta1;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+ break;
+ }
+ }
+
+ /* insert new point in the collision points */
+ if (insert) {
+ gp_insert_point(gps, hit_pointa, hit_pointb, r_hita, r_hitb);
+ }
+
+ /* free memory */
+ if (all_2d) {
+ GHashIterator gh_iter;
+ GHASH_ITER(gh_iter, all_2d) {
+ float(*p2d)[2] = BLI_ghashIterator_getValue(&gh_iter);
+ MEM_SAFE_FREE(p2d);
+ }
+ BLI_ghash_free(all_2d, NULL, NULL);
+ }
+
+ /* if no hit, reset selection flag */
+ if ((!hit_a) && (!hit_b)) {
+ for (int i = 0; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ pta2 = &oldpoints[i];
+ pta1->flag = pta2->flag;
+ }
+ }
+
+ MEM_SAFE_FREE(points2d);
+ MEM_SAFE_FREE(gps_array);
+ MEM_SAFE_FREE(oldpoints);
+
+ /* return type of hit */
+ if ((hit_a) && (hit_b)) {
+ return 3;
+ }
+ else if (hit_a) {
+ return 1;
+ }
+ else if (hit_b) {
+ return 2;
+ }
+ else {
+ return 0;
+ }
+}
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index e2e110ffc31..4a1cdce2ead 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* os dependent include locations of gl.h
*/
-/** \file BIF_gl.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __BIF_GL_H__
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 863d817d19a..35e04106f31 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,26 +15,22 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BIF_glutil.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __BIF_GLUTIL_H__
#define __BIF_GLUTIL_H__
-struct rcti;
struct rctf;
+struct rcti;
+struct ColorManagedDisplaySettings;
+struct ColorManagedViewSettings;
struct ImBuf;
struct bContext;
-struct ColorManagedViewSettings;
-struct ColorManagedDisplaySettings;
/* A few functions defined here are being DEPRECATED for Blender 2.8
*
@@ -112,6 +106,7 @@ void set_inverted_drawing(int enable);
void setlinestyle(int nr);
/* own working polygon offset */
+float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist);
void bglPolygonOffset(float viewdist, float dist);
/* **** Color management helper functions for GLSL display/transform ***** */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 6e3f0889370..bef7f0f05ff 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,41 +15,36 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_anim_api.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_ANIM_API_H__
#define __ED_ANIM_API_H__
+struct AnimData;
struct ID;
struct ListBase;
-struct AnimData;
-struct bContext;
+struct ARegion;
struct Main;
-struct wmKeyConfig;
struct ReportList;
struct ScrArea;
struct SpaceLink;
-struct ARegion;
struct View2D;
+struct bContext;
+struct wmKeyConfig;
-struct Scene;
struct Object;
+struct Scene;
struct bDopeSheet;
-struct bAction;
struct FCurve;
struct FModifier;
+struct bAction;
struct uiBlock;
struct uiLayout;
@@ -69,29 +62,46 @@ struct PropertyRNA;
* 'context' information
*/
typedef struct bAnimContext {
- void *data; /* data to be filtered for use in animation editor */
- short datatype; /* type of data eAnimCont_Types */
-
- short mode; /* editor->mode */
- short spacetype; /* sa->spacetype */
- short regiontype; /* active region -> type (channels or main) */
-
- struct ScrArea *sa; /* editor host */
- struct SpaceLink *sl; /* editor data */
- struct ARegion *ar; /* region within editor */
-
- struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */
-
- struct Depsgraph *depsgraph; /* active dependency graph */
- struct Main *bmain; /* Current Main */
- struct Scene *scene; /* active scene */
- struct ViewLayer *view_layer; /* active scene layer */
- struct Object *obact; /* active object */
- ListBase *markers; /* active set of markers */
-
- struct ReportList *reports; /* pointer to current reports list */
-
- float yscale_fac; /* scale factor for height of channels (i.e. based on the size of keyframes) */
+ /** data to be filtered for use in animation editor */
+ void *data;
+ /** type of data eAnimCont_Types */
+ short datatype;
+
+ /** editor->mode */
+ short mode;
+ /** sa->spacetype */
+ short spacetype;
+ /** active region -> type (channels or main) */
+ short regiontype;
+
+ /** editor host */
+ struct ScrArea *sa;
+ /** editor data */
+ struct SpaceLink *sl;
+ /** region within editor */
+ struct ARegion *ar;
+
+ /** dopesheet data for editor (or which is being used) */
+ struct bDopeSheet *ads;
+
+ /** active dependency graph */
+ struct Depsgraph *depsgraph;
+ /** Current Main */
+ struct Main *bmain;
+ /** active scene */
+ struct Scene *scene;
+ /** active scene layer */
+ struct ViewLayer *view_layer;
+ /** active object */
+ struct Object *obact;
+ /** active set of markers */
+ ListBase *markers;
+
+ /** pointer to current reports list */
+ struct ReportList *reports;
+
+ /** Scale factor for height of channels (i.e. based on the size of keyframes). */
+ float yscale_fac;
} bAnimContext;
/* Main Data container types */
@@ -117,37 +127,67 @@ typedef enum eAnimCont_Types {
typedef struct bAnimListElem {
struct bAnimListElem *next, *prev;
- void *data; /* source data this elem represents */
- int type; /* (eAnim_ChannelType) one of the ANIMTYPE_* values */
- int flag; /* copy of elem's flags for quick access */
- int index; /* for un-named data, the index of the data in its collection */
-
- char update; /* (eAnim_Update_Flags) tag the element for updating */
- char tag; /* tag the included data. Temporary always */
-
- short datatype; /* (eAnim_KeyType) type of motion data to expect */
- void *key_data; /* motion data - mostly F-Curves, but can be other types too */
-
-
- /* NOTE: id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
- * from which evaluation of the RNA-paths takes place. It's used to figure out how deep
- * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
- * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
- * bAction or something similar, none of this would be possible: although it's trivial
- * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
- * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
- * it's impossible to go the other way (i.e. one action may be used in multiple places).
+ /** source data this elem represents */
+ void *data;
+ /** (eAnim_ChannelType) one of the ANIMTYPE_* values */
+ int type;
+ /** copy of elem's flags for quick access */
+ int flag;
+ /** for un-named data, the index of the data in its collection */
+ int index;
+
+ /** (eAnim_Update_Flags) tag the element for updating */
+ char update;
+ /** tag the included data. Temporary always */
+ char tag;
+
+ /** (eAnim_KeyType) type of motion data to expect */
+ short datatype;
+ /** motion data - mostly F-Curves, but can be other types too */
+ void *key_data;
+
+
+ /**
+ * \note
+ * id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
+ * from which evaluation of the RNA-paths takes place. It's used to figure out how deep
+ * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
+ * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
+ * bAction or something similar, none of this would be possible: although it's trivial
+ * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
+ * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
+ * it's impossible to go the other way (i.e. one action may be used in multiple places).
*/
- struct ID *id; /* ID block that channel is attached to */
- struct AnimData *adt; /* source of the animation data attached to ID block (for convenience) */
-
- void *owner; /* for per-element F-Curves (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
+ /** ID block that channel is attached to */
+ struct ID *id;
+ /** source of the animation data attached to ID block (for convenience) */
+ struct AnimData *adt;
+
+ /**
+ * For list element which corresponds to a f-curve, this is an ID which
+ * owns the f-curve.
+ *
+ * For example, if the f-curve is coming from Action, this id will be set to
+ * action's ID. But if this is a f-curve which is a driver, then the owner
+ * is set to, for example, object.
+ *
+ * Note, that this is different from id above. The id above will be set to
+ * an object if the f-curve is coming from action associated with that
+ * object. */
+ struct ID *fcurve_owner_id;
+
+ /**
+ * for per-element F-Curves
+ * (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
+ void *owner;
} bAnimListElem;
-/* Some types for easier type-testing
- * NOTE: need to keep the order of these synchronized with the channels define code
- * which is used for drawing and handling channel lists for
+/**
+ * Some types for easier type-testing
+ *
+ * \note need to keep the order of these synchronized with the channels define code
+ * which is used for drawing and handling channel lists for.
*/
typedef enum eAnim_ChannelType {
ANIMTYPE_NONE = 0,
@@ -236,43 +276,47 @@ typedef enum eAnim_Update_Flags {
/* filtering flags - under what circumstances should a channel be returned */
typedef enum eAnimFilter_Flags {
- /* data which channel represents is fits the dopesheet filters (i.e. scene visibility criteria) */
+ /** data which channel represents is fits the dopesheet filters
+ * (i.e. scene visibility criteria) */
// XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit?
ANIMFILTER_DATA_VISIBLE = (1 << 0),
- /* channel is visible within the channel-list hierarchy (i.e. F-Curves within Groups in ActEdit) */
+ /** channel is visible within the channel-list hierarchy
+ * (i.e. F-Curves within Groups in ActEdit) */
ANIMFILTER_LIST_VISIBLE = (1 << 1),
- /* channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
+ /** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
ANIMFILTER_CURVE_VISIBLE = (1 << 2),
- /* include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
+ /** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
ANIMFILTER_LIST_CHANNELS = (1 << 3),
- /* for its type, channel should be "active" one */
+ /** for its type, channel should be "active" one */
ANIMFILTER_ACTIVE = (1 << 4),
- /* channel is a child of the active group (* Actions speciality) */
+ /** channel is a child of the active group (* Actions speciality) */
ANIMFILTER_ACTGROUPED = (1 << 5),
- /* channel must be selected/not-selected, but both must not be set together */
+ /** channel must be selected/not-selected, but both must not be set together */
ANIMFILTER_SEL = (1 << 6),
ANIMFILTER_UNSEL = (1 << 7),
- /* editability status - must be editable to be included */
+ /** editability status - must be editable to be included */
ANIMFILTER_FOREDIT = (1 << 8),
- /* only selected animchannels should be considerable as editable - mainly for Graph Editor's option for keys on select curves only */
+ /** only selected animchannels should be considerable as editable - mainly
+ * for Graph Editor's option for keys on select curves only */
ANIMFILTER_SELEDIT = (1 << 9),
- /* flags used to enforce certain data types */
- // NOTE: the ones for curves and NLA tracks were redundant and have been removed for now...
+ /** flags used to enforce certain data types
+ * \node the ones for curves and NLA tracks were redundant and have been removed for now...
+ */
ANIMFILTER_ANIMDATA = (1 << 10),
- /* duplicate entries for animation data attached to multi-user blocks must not occur */
+ /** duplicate entries for animation data attached to multi-user blocks must not occur */
ANIMFILTER_NODUPLIS = (1 << 11),
- /* for checking if we should keep some collapsed channel around (internal use only!) */
+ /** for checking if we should keep some collapsed channel around (internal use only!) */
ANIMFILTER_TMP_PEEK = (1 << 30),
- /* ignore ONLYSEL flag from filterflag, (internal use only!) */
- ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31)
+ /** ignore ONLYSEL flag from filterflag, (internal use only!) */
+ ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31),
} eAnimFilter_Flags;
/* ---------- Flag Checking Macros ------------ */
@@ -291,7 +335,7 @@ typedef enum eAnimFilter_Flags {
/* 'Sub-object' channels (flags stored in Data block) */
#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND)))
#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND)))
-#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Lamp *), ((la->flag & LA_DS_EXPAND)))
+#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND)))
#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND)))
#define FILTER_CACHEFILE_OBJD(cf) (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND)))
#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND)))
@@ -316,8 +360,8 @@ typedef enum eAnimFilter_Flags {
/* Action Channel Group */
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED) == 0)
#define EXPANDED_AGRP(ac, agrp) \
- ( ((!(ac) || ((ac)->spacetype != SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED)) || \
- (( (ac) && ((ac)->spacetype == SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED_G)) )
+ ( ((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED)) || \
+ (( (ac) && ((ac)->spacetype == SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED_G)) )
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
/* F-Curve Channels */
#define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED) == 0)
@@ -417,30 +461,42 @@ void ANIM_animdata_freelist(ListBase *anim_data);
/* role or level of animchannel in the hierarchy */
typedef enum eAnimChannel_Role {
- ACHANNEL_ROLE_EXPANDER = -1, /* datablock expander - a "composite" channel type */
- ACHANNEL_ROLE_SPECIAL = 0, /* special purposes - not generally for hierarchy processing */
- ACHANNEL_ROLE_CHANNEL = 1 /* data channel - a channel representing one of the actual building blocks of channels */
+ /** datablock expander - a "composite" channel type */
+ ACHANNEL_ROLE_EXPANDER = -1,
+ /** special purposes - not generally for hierarchy processing */
+ ACHANNEL_ROLE_SPECIAL = 0,
+ /** data channel - a channel representing one of the actual building blocks of channels */
+ ACHANNEL_ROLE_CHANNEL = 1,
} eAnimChannel_Role;
/* flag-setting behavior */
typedef enum eAnimChannels_SetFlag {
- ACHANNEL_SETFLAG_CLEAR = 0, /* turn off */
- ACHANNEL_SETFLAG_ADD = 1, /* turn on */
- ACHANNEL_SETFLAG_INVERT = 2, /* on->off, off->on */
- ACHANNEL_SETFLAG_TOGGLE = 3 /* some on -> all off // all on */
+ /** turn off */
+ ACHANNEL_SETFLAG_CLEAR = 0,
+ /** turn on */
+ ACHANNEL_SETFLAG_ADD = 1,
+ /** on->off, off->on */
+ ACHANNEL_SETFLAG_INVERT = 2,
+ /** some on -> all off // all on */
+ ACHANNEL_SETFLAG_TOGGLE = 3,
} eAnimChannels_SetFlag;
/* types of settings for AnimChannels */
typedef enum eAnimChannel_Settings {
ACHANNEL_SETTING_SELECT = 0,
- ACHANNEL_SETTING_PROTECT = 1, /* warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
+ /** warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
+ ACHANNEL_SETTING_PROTECT = 1,
ACHANNEL_SETTING_MUTE = 2,
ACHANNEL_SETTING_EXPAND = 3,
- ACHANNEL_SETTING_VISIBLE = 4, /* only for Graph Editor */
- ACHANNEL_SETTING_SOLO = 5, /* only for NLA Tracks */
- ACHANNEL_SETTING_PINNED = 6, /* only for NLA Actions */
+ /** only for Graph Editor */
+ ACHANNEL_SETTING_VISIBLE = 4,
+ /** only for NLA Tracks */
+ ACHANNEL_SETTING_SOLO = 5,
+ /** only for NLA Actions */
+ ACHANNEL_SETTING_PINNED = 6,
ACHANNEL_SETTING_MOD_OFF = 7,
- ACHANNEL_SETTING_ALWAYS_VISIBLE = 8, /* channel is pinned and always visible */
+ /** channel is pinned and always visible */
+ ACHANNEL_SETTING_ALWAYS_VISIBLE = 8,
} eAnimChannel_Settings;
@@ -530,7 +586,8 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type);
-/* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */
+/* Delete the F-Curve from the given AnimData block (if possible),
+ * as appropriate according to animation context */
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
/* ************************************************ */
@@ -546,7 +603,7 @@ enum eAnimEditDraw_CurrentFrame {
/* time indication in seconds or frames */
DRAWCFRA_UNIT_SECONDS = (1 << 0),
/* draw indicator extra wide (for timeline) */
- DRAWCFRA_WIDE = (1 << 1)
+ DRAWCFRA_WIDE = (1 << 1),
};
/* main call to draw current-frame indicator in an Animation Editor */
@@ -572,7 +629,8 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d);
/* ------------- UI Panel Drawing -------------- */
/* draw a given F-Modifier for some layout/UI-Block */
-void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
+void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *fcurve_owner_id,
+ ListBase *modifiers, struct FModifier *fcm);
/* ------------- Copy/Paste Buffer -------------- */
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 3306fa09f12..3d4ca7bf3be 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_armature.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_ARMATURE_H__
@@ -34,50 +28,56 @@
extern "C" {
#endif
-struct bArmature;
struct Base;
-struct bContext;
struct Bone;
-struct bPoseChannel;
struct Depsgraph;
struct IDProperty;
struct ListBase;
struct Main;
-struct MeshDeformModifierData;
+struct Main;
struct Mesh;
+struct MeshDeformModifierData;
struct Object;
struct ReportList;
struct Scene;
+struct UndoType;
struct View3D;
-struct ViewLayer;
struct ViewContext;
+struct ViewLayer;
+struct bArmature;
+struct bContext;
+struct bPoseChannel;
struct wmKeyConfig;
struct wmOperator;
-struct Main;
-struct UndoType;
typedef struct EditBone {
struct EditBone *next, *prev;
- struct IDProperty *prop; /* User-Defined Properties on this Bone */
- struct EditBone *parent; /* Editbones have a one-way link (i.e. children refer
- * to parents. This is converted to a two-way link for
- * normal bones when leaving editmode. */
- char name[64]; /* MAXBONENAME */
- float roll; /* Roll along axis. We'll ultimately use the axis/angle method
- * for determining the transformation matrix of the bone. The axis
- * is tail-head while roll provides the angle. Refer to Graphics
- * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
-
- float head[3]; /* Orientation and length is implicit during editing */
+ /** User-Defined Properties on this Bone */
+ struct IDProperty *prop;
+ /** Editbones have a one-way link (i.e. children refer
+ * to parents. This is converted to a two-way link for
+ * normal bones when leaving editmode. */
+ struct EditBone *parent;
+ /** (64 == MAXBONENAME) */
+ char name[64];
+ /** Roll along axis. We'll ultimately use the axis/angle method
+ * for determining the transformation matrix of the bone. The axis
+ * is tail-head while roll provides the angle. Refer to Graphics
+ * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
+ float roll;
+
+ /** Orientation and length is implicit during editing */
+ float head[3];
float tail[3];
- /* All joints are considered to have zero rotation with respect to
+ /** All joints are considered to have zero rotation with respect to
* their parents. Therefore any rotations specified during the
* animation are automatically relative to the bones' rest positions*/
int flag;
int layer;
float dist, weight;
- float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
+ /** put them in order! transform uses this as scale */
+ float xwidth, length, zwidth;
float rad_head, rad_tail;
/* Bendy-Bone parameters */
@@ -87,22 +87,28 @@ typedef struct EditBone {
float ease1, ease2;
float scaleIn, scaleOut;
- float oldlength; /* for envelope scaling */
+ /** for envelope scaling */
+ float oldlength;
short segments;
- char bbone_prev_type; /* Type of next/prev bone handles */
+ /** Type of next/prev bone handles */
+ char bbone_prev_type;
char bbone_next_type;
- struct EditBone *bbone_prev; /* Next/prev bones to use as handle references when calculating bbones (optional) */
+ /** Next/prev bones to use as handle references when calculating bbones (optional) */
+ struct EditBone *bbone_prev;
struct EditBone *bbone_next;
/* Used for display */
- float disp_mat[4][4]; /* in Armature space, rest pos matrix */
- float disp_tail_mat[4][4]; /* in Armature space, rest pos matrix */
- /* 32 == MAX_BBONE_SUBDIV */
- float disp_bbone_mat[32][4][4]; /* in Armature space, rest pos matrix */
+ /** in Armature space, rest pos matrix */
+ float disp_mat[4][4];
+ /** in Armature space, rest pos matrix */
+ float disp_tail_mat[4][4];
+ /** in Armature space, rest pos matrix (32 == MAX_BBONE_SUBDIV) */
+ float disp_bbone_mat[32][4][4];
- struct EditBone *bbone_child; /* connected child temporary during drawing */
+ /** connected child temporary during drawing */
+ struct EditBone *bbone_child;
/* Used to store temporary data */
union {
@@ -194,7 +200,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
void ED_armature_edit_transform_mirror_update(struct Object *obedit);
-void ED_armature_origin_set(struct Main *bmain, struct Object *ob, float cursor[3], int centermode, int around);
+void ED_armature_origin_set(struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
void ED_armature_transform_apply(struct Main *bmain, struct Object *ob, float mat[4][4], const bool do_props);
diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h
index 5cc695b6ce8..9ff2678b53e 100644
--- a/source/blender/editors/include/ED_buttons.h
+++ b/source/blender/editors/include/ED_buttons.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2013, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_buttons.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_BUTTONS_H__
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 4844d96e6e8..eb4d979e5e8 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,29 +15,24 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_clip.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_CLIP_H__
#define __ED_CLIP_H__
struct ARegion;
-struct bContext;
-struct bScreen;
struct ImBuf;
struct Main;
struct Mask;
struct MovieClip;
-struct SpaceClip;
struct Scene;
+struct SpaceClip;
+struct bContext;
+struct bScreen;
/* ** clip_editor.c ** */
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index e4eea9921db..b585dc766d7 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,33 +15,28 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_curve.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_CURVE_H__
#define __ED_CURVE_H__
-struct bContext;
-struct BezTriple;
struct BPoint;
+struct BezTriple;
struct Curve;
struct EditNurb;
struct Main;
struct Nurb;
struct Object;
struct Text;
-struct wmOperator;
-struct wmKeyConfig;
struct UndoType;
struct View3D;
+struct bContext;
+struct wmKeyConfig;
+struct wmOperator;
/* curve_ops.c */
void ED_operatortypes_curve(void);
@@ -89,7 +82,7 @@ void ED_text_to_object(struct bContext *C, struct Text *text, const bool spli
void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count);
void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count);
-int ED_curve_updateAnimPaths(struct Curve *cu);
+int ED_curve_updateAnimPaths(struct Main *bmain, struct Curve *cu);
bool ED_curve_active_center(struct Curve *cu, float center[3]);
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index c21ef288aeb..fa082e71bf6 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_datafiles.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_DATAFILES_H__
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index 64739d968b8..000af75a9cb 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_fileselect.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_FILESELECT_H__
@@ -134,8 +127,10 @@ typedef enum FSMenuCategory {
typedef enum FSMenuInsert {
FS_INSERT_SORTED = (1 << 0),
FS_INSERT_SAVE = (1 << 1),
- FS_INSERT_FIRST = (1 << 2), /* moves the item to the front of the list when its not already there */
- FS_INSERT_LAST = (1 << 3), /* just append to preseve delivered order */
+ /** moves the item to the front of the list when its not already there */
+ FS_INSERT_FIRST = (1 << 2),
+ /** just append to preseve delivered order */
+ FS_INSERT_LAST = (1 << 3),
} FSMenuInsert;
struct FSMenu;
diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h
index be772a6af98..53b65292b6a 100644
--- a/source/blender/editors/include/ED_gizmo_library.h
+++ b/source/blender/editors/include/ED_gizmo_library.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gizmo_library.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Generic Gizmos.
*
@@ -47,9 +43,9 @@ void ED_gizmotypes_value_2d(void);
/* gizmo group types */
void ED_gizmogrouptypes_value_2d(void);
-struct bContext;
struct Object;
struct Scene;
+struct bContext;
struct wmGizmo;
struct wmGizmoGroup;
diff --git a/source/blender/editors/include/ED_gizmo_utils.h b/source/blender/editors/include/ED_gizmo_utils.h
index 77956b9ca0d..e81dcb34cd2 100644
--- a/source/blender/editors/include/ED_gizmo_utils.h
+++ b/source/blender/editors/include/ED_gizmo_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gizmo_utils.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*
* \name Generic Gizmo Utilities.
*/
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 4b419263a37..666cf55cac3 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gpencil.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_GPENCIL_H__
@@ -35,31 +29,31 @@ struct ListBase;
struct PointerRNA;
struct rcti;
-struct bGPdata;
-struct bGPDlayer;
+struct Brush;
struct bGPDframe;
-struct bGPDstroke;
+struct bGPDlayer;
struct bGPDspoint;
-struct Brush;
+struct bGPDstroke;
+struct bGPdata;
-struct Main;
-struct bContext;
-struct EvaluationContext;
-struct Depsgraph;
-struct ScrArea;
struct ARegion;
+struct Depsgraph;
+struct EvaluationContext;
+struct Main;
struct RegionView3D;
struct ReportList;
struct Scene;
+struct ScrArea;
struct ToolSettings;
-struct ViewLayer;
struct View3D;
+struct ViewLayer;
+struct bContext;
-struct Object;
struct Material;
+struct Object;
-struct bAnimContext;
struct KeyframeEditData;
+struct bAnimContext;
struct wmKeyConfig;
struct wmOperator;
@@ -79,7 +73,7 @@ typedef struct tGPspoint {
float time; /* Time relative to stroke start (used when converting to path) */
float uv_fac; /* factor of uv along the stroke */
float uv_rot; /* uv rotation for dor mode */
- float rnd[2]; /* rnd value */
+ float rnd[3]; /* rnd value */
bool rnd_dirty; /* rnd flag */
} tGPspoint;
@@ -220,13 +214,13 @@ void ED_gpencil_brush_draw_eraser(struct Brush *brush, int x, int y);
/* ----------- Add Primitive Utilities -------------- */
-void ED_gpencil_create_monkey(struct bContext *C, float mat[4][4]);
-void ED_gpencil_create_stroke(struct bContext *C, float mat[4][4]);
+void ED_gpencil_create_monkey(struct bContext *C, struct Object *ob, float mat[4][4]);
+void ED_gpencil_create_stroke(struct bContext *C, struct Object *ob, float mat[4][4]);
/* ------------ Object Utilities ------------ */
struct Object *ED_gpencil_add_object(
struct bContext *C, struct Scene *scene, const float loc[3], unsigned short local_view_bits);
-void ED_gpencil_add_defaults(struct bContext *C);
+void ED_gpencil_add_defaults(struct bContext *C, struct Object *ob);
/* set object modes */
void ED_gpencil_setup_modes(struct bContext *C, struct bGPdata *gpd, int newmode);
@@ -259,4 +253,17 @@ void ED_gpencil_tpoint_to_point(struct ARegion *ar, float origin[3], const struc
void ED_gpencil_calc_stroke_uv(struct Object *ob, struct bGPDstroke *gps);
void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat);
+/* extend selection to stroke intersections
+ * returns:
+ * 0 - No hit
+ * 1 - Hit in point A
+ * 2 - Hit in point B
+ * 3 - Hit in point A and B
+*/
+int ED_gpencil_select_stroke_segment(
+ struct bGPDlayer *gpl,
+ struct bGPDstroke *gps, struct bGPDspoint *pt,
+ bool select, bool insert, const float scale,
+ float r_hita[3], float r_hitb[3]);
+
#endif /* __ED_GPENCIL_H__ */
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index f8af67b55ff..e6d67f339ce 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,29 +15,25 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_image.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_IMAGE_H__
#define __ED_IMAGE_H__
-struct SpaceImage;
-struct bContext;
+struct ARegion;
+struct ImBuf;
struct Image;
struct ImageUser;
-struct ImBuf;
-struct ToolSettings;
-struct wmWindowManager;
-struct ARegion;
struct Scene;
+struct SpaceImage;
+struct ToolSettings;
struct ViewLayer;
+struct bContext;
+struct wmWindowManager;
/* image_edit.c, exported for transform */
struct Image *ED_space_image(struct SpaceImage *sima);
diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h
index 072b1a135a3..118295a80e0 100644
--- a/source/blender/editors/include/ED_info.h
+++ b/source/blender/editors/include/ED_info.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,19 +14,19 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_info.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_INFO_H__
#define __ED_INFO_H__
+struct Main;
+
/* info_stats.c */
void ED_info_stats_clear(struct ViewLayer *view_layer);
-const char *ED_info_stats_string(struct Scene *scene, struct ViewLayer *view_layer);
+const char *ED_info_stats_string(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer);
#endif /* __ED_INFO_H__ */
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 6421c5817b0..475484104a1 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,36 +15,30 @@
*
* The Original Code is Copyright (C) (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframes_draw.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMES_DRAW_H__
#define __ED_KEYFRAMES_DRAW_H__
-struct bAnimContext;
struct AnimData;
struct CacheFile;
+struct DLRBT_Tree;
struct FCurve;
-struct bDopeSheet;
-struct bAction;
-struct bActionGroup;
-struct Object;
struct ListBase;
-struct bGPDlayer;
-struct Palette;
struct MaskLayer;
+struct Object;
+struct Palette;
struct Scene;
struct View2D;
-struct DLRBT_Tree;
+struct bAction;
+struct bActionGroup;
+struct bAnimContext;
+struct bDopeSheet;
+struct bGPDlayer;
/* ****************************** Base Structs ****************************** */
@@ -67,14 +59,20 @@ typedef struct ActKeyColumn {
struct ActKeyColumn *next, *prev;
/* sorting-tree linkage */
- struct ActKeyColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
- struct ActKeyColumn *parent; /* parent of this node in the tree */
- char tree_col; /* DLRB_BLACK or DLRB_RED */
+ /** 'children' of this node, less than and greater than it (respectively) */
+ struct ActKeyColumn *left, *right;
+ /** parent of this node in the tree */
+ struct ActKeyColumn *parent;
+ /** DLRB_BLACK or DLRB_RED */
+ char tree_col;
/* keyframe info */
- char key_type; /* eBezTripe_KeyframeType */
- char handle_type; /* eKeyframeHandleDrawOpts */
- char extreme_type; /* eKeyframeExtremeDrawOpts */
+ /** eBezTripe_KeyframeType */
+ char key_type;
+ /** eKeyframeHandleDrawOpts */
+ char handle_type;
+ /** eKeyframeExtremeDrawOpts */
+ char extreme_type;
short sel;
float cfra;
@@ -134,7 +132,8 @@ typedef enum eKeyframeExtremeDrawOpts {
} eKeyframeExtremeDrawOpts;
/* draw simple diamond-shape keyframe */
-/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GPU_PRIM_POINTS, n), then call this n times */
+/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND,
+ * immBegin(GPU_PRIM_POINTS, n), then call this n times */
void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha,
unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id,
unsigned int linemask_id, short ipo_type, short extreme_type);
@@ -180,8 +179,6 @@ void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, int sa
void gpencil_to_keylist(struct bDopeSheet *ads, struct bGPdata *gpd, struct DLRBT_Tree *keys, const bool active);
/* Grease Pencil Layer */
void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
-/* Palette */
-void palette_to_keylist(struct bDopeSheet *ads, struct Palette *palette, struct DLRBT_Tree *keys);
/* Mask */
void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskLayer *masklay, struct DLRBT_Tree *keys);
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index e7ea5cf159e..402dc3e67bc 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,26 +15,21 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframes_edit.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMES_EDIT_H__
#define __ED_KEYFRAMES_EDIT_H__
+struct BezTriple;
+struct FCurve;
+struct Scene;
struct bAnimContext;
struct bAnimListElem;
struct bDopeSheet;
-struct FCurve;
-struct BezTriple;
-struct Scene;
/* ************************************************ */
/* Common Macros and Defines */
@@ -73,7 +66,7 @@ typedef enum eEditKeyframes_Select {
/* remove ok keyframes from selection */
SELECT_SUBTRACT = (1 << 2),
/* flip ok status of keyframes based on key status */
- SELECT_INVERT = (1 << 3)
+ SELECT_INVERT = (1 << 3),
} eEditKeyframes_Select;
/* "selection map" building modes */
@@ -134,7 +127,7 @@ typedef enum eKeyframeVertOk {
/* 'handle 2' is ok */
KEYFRAME_OK_H2 = (1 << 2),
/* all flags */
- KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2)
+ KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2),
} eKeyframeVertOk;
/* Flags for use during iteration */
@@ -155,20 +148,30 @@ typedef enum eKeyframeIterFlags {
typedef struct KeyframeEditData {
/* generic properties/data access */
- ListBase list; /* temp list for storing custom list of data to check */
- struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */
- void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
- float f1, f2; /* storage of times/values as 'decimals' */
- int i1, i2; /* storage of times/values/flags as 'whole' numbers */
+ /** temp list for storing custom list of data to check */
+ ListBase list;
+ /** pointer to current scene - many tools need access to cfra/etc. */
+ struct Scene *scene;
+ /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
+ void *data;
+ /** storage of times/values as 'decimals' */
+ float f1, f2;
+ /** storage of times/values/flags as 'whole' numbers */
+ int i1, i2;
/* current iteration data */
- struct FCurve *fcu; /* F-Curve that is being iterated over */
- int curIndex; /* index of current keyframe being iterated over */
- float channel_y; /* y-position of midpoint of the channel (for the dopesheet) */
+ /** F-Curve that is being iterated over */
+ struct FCurve *fcu;
+ /** index of current keyframe being iterated over */
+ int curIndex;
+ /** y-position of midpoint of the channel (for the dopesheet) */
+ float channel_y;
/* flags */
- eKeyframeVertOk curflags; /* current flags for the keyframe we're reached in the iteration process */
- eKeyframeIterFlags iterflags; /* settings for iteration process */
+ /** current flags for the keyframe we're reached in the iteration process */
+ eKeyframeVertOk curflags;
+ /** settings for iteration process */
+ eKeyframeIterFlags iterflags;
} KeyframeEditData;
/* ------- Function Pointer Typedefs ---------------- */
@@ -213,7 +216,8 @@ typedef enum eKeyMergeMode {
/* ---------------- Looping API --------------------- */
/* functions for looping over keyframes */
-/* function for working with F-Curve data only (i.e. when filters have been chosen to explicitly use this) */
+/* function for working with F-Curve data only
+ * (i.e. when filters have been chosen to explicitly use this) */
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
/* function for working with any type (i.e. one of the known types) of animation channel
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
@@ -267,7 +271,8 @@ short bezt_to_cfraelem(KeyframeEditData *ked, struct BezTriple *bezt);
void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt);
/* ------ 1.5-D Region Testing Uitls (Lasso/Circle Select) ------- */
-/* XXX: These are temporary, until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
+/* XXX: These are temporary,
+ * until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
bool keyframe_region_lasso_test(
const KeyframeEdit_LassoData *data_lasso,
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index aba381f7989..78a9f13e64f 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender (with some old code)
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframing.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMING_H__
@@ -34,27 +28,27 @@
extern "C" {
#endif
-struct Main;
-struct ListBase;
struct ID;
+struct ListBase;
+struct Main;
struct Scene;
struct KeyingSet;
-struct bAction;
-struct FCurve;
struct BezTriple;
+struct FCurve;
+struct bAction;
struct bPoseChannel;
-struct bContext;
struct ReportList;
+struct bContext;
struct Depsgraph;
+struct EnumPropertyItem;
struct PointerRNA;
struct PropertyRNA;
-struct EnumPropertyItem;
struct NlaKeyframingContext;
@@ -133,8 +127,8 @@ short delete_keyframe(
/* ************ Keying Sets ********************** */
/* forward decl. for this struct which is declared a bit later... */
-struct KeyingSetInfo;
struct ExtensionRNA;
+struct KeyingSetInfo;
/* Polling Callback for KeyingSets */
typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C);
@@ -195,7 +189,8 @@ typedef enum eModifyKey_Returns {
MODIFYKEY_MISSING_TYPEINFO = -2,
} eModifyKey_Returns;
-/* poll the current KeyingSet, updating it's set of paths (if "builtin"/"relative") for context changes */
+/* poll the current KeyingSet, updating it's set of paths
+ * (if "builtin"/"relative") for context changes */
short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks);
/* use the specified KeyingSet to add/remove various Keyframes on the specified frame */
@@ -203,7 +198,8 @@ int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction
/* -------- */
-/* Get the first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given) */
+/* Get the first builtin KeyingSet with the given name, which occurs after the given one
+ * (or start of list if none given) */
struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]);
/* Find KeyingSet type info given a name */
@@ -240,18 +236,27 @@ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
/* Flags for use by driver creation calls */
typedef enum eCreateDriverFlags {
- CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0), /* create drivers with a default variable for nicer UI */
- CREATEDRIVER_WITH_FMODIFIER = (1 << 1), /* create drivers with Generator FModifier (for backwards compat) */
+ /** create drivers with a default variable for nicer UI */
+ CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0),
+ /** create drivers with Generator FModifier (for backwards compat) */
+ CREATEDRIVER_WITH_FMODIFIER = (1 << 1),
} eCreateDriverFlags;
/* Heuristic to use for connecting target properties to driven ones */
typedef enum eCreateDriver_MappingTypes {
- CREATEDRIVER_MAPPING_1_N = 0, /* 1 to Many - Use the specified index, and drive all elements with it */
- CREATEDRIVER_MAPPING_1_1 = 1, /* 1 to 1 - Only for the specified index on each side */
- CREATEDRIVER_MAPPING_N_N = 2, /* Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
-
- CREATEDRIVER_MAPPING_NONE = 3, /* None (Single Prop) - Do not create driver with any targets; these will get added later instead */
- CREATEDRIVER_MAPPING_NONE_ALL = 4, /* None (All Properties) - Do not create driver with any targets; these will get added later instead */
+ /** 1 to Many - Use the specified index, and drive all elements with it */
+ CREATEDRIVER_MAPPING_1_N = 0,
+ /** 1 to 1 - Only for the specified index on each side */
+ CREATEDRIVER_MAPPING_1_1 = 1,
+ /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
+ CREATEDRIVER_MAPPING_N_N = 2,
+
+ /** None (Single Prop):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE = 3,
+ /** None (All Properties):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE_ALL = 4,
} eCreateDriver_MappingTypes;
/* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */
diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h
index b30929f5307..98a091861d1 100644
--- a/source/blender/editors/include/ED_lattice.h
+++ b/source/blender/editors/include/ED_lattice.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,22 +15,18 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_lattice.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_LATTICE_H__
#define __ED_LATTICE_H__
-struct wmKeyConfig;
-struct UndoType;
struct Object;
+struct UndoType;
+struct wmKeyConfig;
/* lattice_ops.c */
void ED_operatortypes_lattice(void);
diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/editors/include/ED_logic.h
index 71a5552ae26..8158bee15f3 100644
--- a/source/blender/editors/include/ED_logic.h
+++ b/source/blender/editors/include/ED_logic.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_logic.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_LOGIC_H__
diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h
index fa907010870..3716708e994 100644
--- a/source/blender/editors/include/ED_markers.h
+++ b/source/blender/editors/include/ED_markers.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,26 +15,21 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_markers.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MARKERS_H__
#define __ED_MARKERS_H__
-struct wmKeyConfig;
-struct wmKeyMap;
-struct bContext;
-struct bAnimContext;
struct Scene;
struct TimeMarker;
+struct bAnimContext;
+struct bContext;
+struct wmKeyConfig;
+struct wmKeyMap;
/* Drawing API ------------------------------ */
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index af9d87b8e0e..d555a17c0b1 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mask.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MASK_H__
#define __ED_MASK_H__
-struct bContext;
-struct wmKeyConfig;
+struct KeyframeEditData;
struct MaskLayer;
struct MaskLayerShape;
-struct KeyframeEditData;
+struct bContext;
+struct wmKeyConfig;
/* mask_edit.c */
void ED_mask_get_size(struct ScrArea *sa, int *width, int *height);
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 47ea3929883..e1033866193 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,24 +15,19 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mball.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MBALL_H__
#define __ED_MBALL_H__
-struct bContext;
struct Object;
-struct wmKeyConfig;
struct UndoType;
+struct bContext;
+struct wmKeyConfig;
void ED_operatortypes_metaball(void);
void ED_operatormacros_metaball(void);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index a2f034589f6..ae851febf2c 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mesh.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MESH_H__
@@ -35,36 +28,36 @@
extern "C" {
#endif
-struct Base;
-struct ID;
-struct View3D;
struct ARegion;
-struct bContext;
+struct BMBVHTree;
+struct BMEdge;
+struct BMEditMesh;
+struct BMElem;
+struct BMFace;
+struct BMLoop;
+struct BMVert;
+struct BMesh;
+struct Base;
struct Depsgraph;
-struct wmOperator;
-struct wmKeyConfig;
-struct ReportList;
-struct ViewContext;
-struct bDeformGroup;
+struct ID;
struct MDeformVert;
-struct Scene;
struct Mesh;
-struct UvVertMap;
+struct Object;
+struct ReportList;
+struct Scene;
+struct ToolSettings;
+struct UndoType;
struct UvMapVert;
-struct BMEditMesh;
-struct BMElem;
-struct BMesh;
-struct BMVert;
-struct BMLoop;
-struct BMBVHTree;
-struct BMEdge;
-struct BMFace;
-struct UvVertMap;
struct UvMapVert;
-struct ToolSettings;
-struct Object;
+struct UvVertMap;
+struct UvVertMap;
+struct View3D;
+struct ViewContext;
+struct bContext;
+struct bDeformGroup;
struct rcti;
-struct UndoType;
+struct wmKeyConfig;
+struct wmOperator;
/* editmesh_utils.c */
void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis,
@@ -102,8 +95,8 @@ void EDBM_select_flush(struct BMEditMesh *em);
bool EDBM_vert_color_check(struct BMEditMesh *em);
-void EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
-void EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
+bool EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
+bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 8d652609fbc..5498ad8252d 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_node.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_NODE_H__
@@ -34,23 +27,23 @@
struct ID;
struct Main;
struct Scene;
+struct Scene;
+struct ScrArea;
struct Tex;
+struct View2D;
struct bContext;
-struct bNodeTree;
struct bNode;
-struct bNodeType;
struct bNodeSocketType;
struct bNodeTree;
+struct bNodeTree;
struct bNodeTreeType;
-struct ScrArea;
-struct Scene;
-struct View2D;
+struct bNodeType;
typedef enum {
NODE_TOP = 1,
NODE_BOTTOM = 2,
NODE_LEFT = 4,
- NODE_RIGHT = 8
+ NODE_RIGHT = 8,
} NodeBorder;
#define NODE_GRID_STEPS 5
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index f674a0d87f9..5f90996988a 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_numinput.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_NUMINPUT_H__
@@ -33,20 +27,30 @@
struct wmEvent;
typedef struct NumInput {
- short idx_max; /* idx_max < NUM_MAX_ELEMENTS */
+ /** idx_max < NUM_MAX_ELEMENTS */
+ short idx_max;
int unit_sys;
- int unit_type[NUM_MAX_ELEMENTS]; /* Each value can have a different type */
+ /** Each value can have a different type */
+ int unit_type[NUM_MAX_ELEMENTS];
bool unit_use_radians;
- short flag; /* Flags affecting all values' behavior */
- short val_flag[NUM_MAX_ELEMENTS]; /* Per-value flags */
- float val[NUM_MAX_ELEMENTS]; /* Direct value of the input */
- float val_org[NUM_MAX_ELEMENTS]; /* Original value of the input, for reset */
- float val_inc[NUM_MAX_ELEMENTS]; /* Increment steps */
-
- short idx; /* Active element/value */
- char str[NUM_STR_REP_LEN]; /* String as typed by user for edited value (we assume ASCII world!) */
- /* Current position of cursor in edited value str (first byte of "current" letter, so 0 for an empty str) */
+ /** Flags affecting all values' behavior */
+ short flag;
+ /** Per-value flags */
+ short val_flag[NUM_MAX_ELEMENTS];
+ /** Direct value of the input */
+ float val[NUM_MAX_ELEMENTS];
+ /** Original value of the input, for reset */
+ float val_org[NUM_MAX_ELEMENTS];
+ /** Increment steps */
+ float val_inc[NUM_MAX_ELEMENTS];
+
+ /** Active element/value */
+ short idx;
+ /** String as typed by user for edited value (we assume ASCII world!) */
+ char str[NUM_STR_REP_LEN];
+ /** Current position of cursor in edited value str
+ * (first byte of "current" letter, so 0 for an empty str) */
int str_cur;
} NumInput;
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index fd0635e31ef..cb0a390cbc2 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_object.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_OBJECT_H__
@@ -35,40 +28,42 @@
extern "C" {
#endif
-struct bFaceMap;
struct Base;
+struct Depsgraph;
+struct EnumPropertyItem;
struct EnumPropertyItem;
struct ID;
struct Main;
struct Menu;
struct ModifierData;
-struct ShaderFxData;
struct Object;
+struct PointerRNA;
+struct PropertyRNA;
struct ReportList;
struct Scene;
+struct ShaderFxData;
struct View3D;
struct ViewLayer;
struct bConstraint;
struct bContext;
+struct bFaceMap;
struct bPoseChannel;
+struct uiLayout;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperator;
struct wmOperatorType;
struct wmWindow;
struct wmWindowManager;
-struct PointerRNA;
-struct PropertyRNA;
-struct EnumPropertyItem;
-struct Depsgraph;
-struct uiLayout;
#include "DNA_object_enums.h"
#include "BLI_compiler_attrs.h"
/* object_edit.c */
-struct Object *ED_object_context(struct bContext *C); /* context.object */
-struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */
+/* context.object */
+struct Object *ED_object_context(struct bContext *C);
+/* context.object or context.active_object */
+struct Object *ED_object_active_context(struct bContext *C);
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout);
/* object_utils.c */
@@ -131,9 +126,7 @@ void ED_object_parent(struct Object *ob, struct Object *parent, const int type,
/* bitflags for enter/exit editmode */
enum {
EM_FREEDATA = (1 << 0),
- EM_WAITCURSOR = (1 << 1),
- EM_IGNORE_LAYER = (1 << 3),
- EM_NO_CONTEXT = (1 << 4),
+ EM_NO_CONTEXT = (1 << 1),
};
bool ED_object_editmode_exit_ex(
struct Main *bmain, struct Scene *scene, struct Object *obedit, int flag);
@@ -159,7 +152,7 @@ void ED_object_wpaintmode_exit(struct bContext *C);
void ED_object_sculptmode_enter_ex(
struct Main *bmain, struct Depsgraph *depsgraph,
- struct Scene *scene, struct Object *ob,
+ struct Scene *scene, struct Object *ob, const bool force_dyntopo,
struct ReportList *reports);
void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
void ED_object_sculptmode_exit_ex(
@@ -176,7 +169,8 @@ float ED_object_new_primitive_matrix(
const float loc[3], const float rot[3], float primmat[4][4]);
-/* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). */
+/* Avoid allowing too much insane values even by typing
+ * (typos can hang/crash Blender otherwise). */
#define OBJECT_ADD_SIZE_MAXF 1.0e12f
void ED_object_add_unit_props_size(struct wmOperatorType *ot);
@@ -236,7 +230,7 @@ bool ED_object_mode_generic_has_data(
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA = 1,
- MODIFIER_APPLY_SHAPE
+ MODIFIER_APPLY_SHAPE,
};
struct ModifierData *ED_object_modifier_add(
@@ -248,7 +242,7 @@ void ED_object_modifier_clear(struct Main *bmain, struct Object *ob);
int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_convert(
- struct ReportList *reports, struct Main *bmain, struct Scene *scene,
+ struct ReportList *reports, struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene,
struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_apply(
struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene,
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index 52fdeb2045c..e94aedc2b2b 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,19 +14,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_outliner.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_OUTLINER_H__
#define __ED_OUTLINER_H__
-struct bContext;
struct ListBase;
+struct bContext;
bool ED_outliner_collections_editor_poll(struct bContext *C);
diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h
index 246419d64aa..c59f1b9e927 100644
--- a/source/blender/editors/include/ED_paint.h
+++ b/source/blender/editors/include/ED_paint.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,24 +12,22 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_paint.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PAINT_H__
#define __ED_PAINT_H__
-struct bContext;
-struct wmKeyConfig;
-struct wmOperator;
struct ImBuf;
struct Image;
struct UndoStep;
struct UndoType;
+struct bContext;
+struct wmKeyConfig;
+struct wmOperator;
/* paint_ops.c */
void ED_operatortypes_paint(void);
@@ -44,7 +40,7 @@ void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int
void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
/* paint_image_undo.c */
-void ED_image_undo_push_begin(const char *name);
+void ED_image_undo_push_begin(const char *name, int paint_mode);
void ED_image_undo_push_end(void);
void ED_image_undo_restore(struct UndoStep *us);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 7e7198a8ace..bbecffee9c0 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,30 +15,24 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_particle.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PARTICLE_H__
#define __ED_PARTICLE_H__
-struct bContext;
struct Object;
-struct ParticleSystem;
-struct ParticleEditSettings;
-struct rcti;
struct PTCacheEdit;
+struct ParticleEditSettings;
+struct ParticleSystem;
struct Scene;
-struct ViewLayer;
struct UndoType;
+struct ViewLayer;
+struct bContext;
+struct rcti;
/* particle edit mode */
void PE_free_ptcache_edit(struct PTCacheEdit *edit);
@@ -63,7 +55,7 @@ void PE_update_object(
/* selection tools */
int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
int PE_box_select(struct bContext *C, const struct rcti *rect, const int sel_op);
-int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad);
+bool PE_circle_select(struct bContext *C, int sel_op, const int mval[2], float rad);
int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, const int sel_op);
void PE_deselect_all_visible(struct PTCacheEdit *edit);
diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h
index c827ed24954..fffcb1e34a1 100644
--- a/source/blender/editors/include/ED_physics.h
+++ b/source/blender/editors/include/ED_physics.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,27 +15,21 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_physics.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PHYSICS_H__
#define __ED_PHYSICS_H__
-struct bContext;
struct ReportList;
+struct bContext;
struct wmKeyConfig;
-struct Scene;
struct Object;
+struct Scene;
/* particle_edit.c */
bool PE_poll(struct bContext *C);
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 2615847e90a..d0deefbe7b0 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_render.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_RENDER_H__
@@ -30,14 +26,14 @@
#include "DNA_vec_types.h"
-struct bContext;
struct DEGEditorUpdateContext;
struct ID;
-struct Main;
struct MTex;
+struct Main;
struct Render;
struct Scene;
struct ScrArea;
+struct bContext;
struct wmWindowManager;
/* render_ops.c */
diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h
index 116d9bd24fc..08ead58fce6 100644
--- a/source/blender/editors/include/ED_scene.h
+++ b/source/blender/editors/include/ED_scene.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_scene.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCENE_H__
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index ce0c9468d1e..5d4f0919c44 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_screen.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCREEN_H__
@@ -41,29 +34,30 @@
#include "BLI_compiler_attrs.h"
+struct ARegion;
struct Depsgraph;
-struct wmWindowManager;
-struct wmWindow;
-struct wmNotifier;
-struct wmEvent;
-struct wmKeyConfig;
+struct IDProperty;
+struct Main;
+struct MenuType;
+struct PropertyRNA;
+struct Scene;
+struct ViewLayer;
struct WorkSpace;
struct WorkSpaceInstanceHook;
struct bContext;
-struct Scene;
-struct ViewLayer;
struct bScreen;
-struct ARegion;
-struct uiBlock;
struct rcti;
-struct Main;
+struct uiBlock;
+struct uiLayout;
+struct wmEvent;
+struct wmKeyConfig;
struct wmMsgBus;
struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
+struct wmNotifier;
struct wmOperatorType;
-struct IDProperty;
-struct MenuType;
-struct PropertyRNA;
+struct wmWindow;
+struct wmWindowManager;
/* regions */
void ED_region_do_listen(
@@ -106,6 +100,7 @@ void ED_region_visibility_change_update(struct bContext *C, struct ARegion *a
void ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], const bool full_redraw);
void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float fill_color[4], const bool full_redraw);
void ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy);
+void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout);
void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
float ED_region_blend_alpha(struct ARegion *ar);
void ED_region_visible_rect(struct ARegion *ar, struct rcti *rect);
@@ -143,7 +138,7 @@ void ED_area_tag_redraw_no_rebuild(ScrArea *sa);
void ED_area_tag_redraw_regiontype(ScrArea *sa, int type);
void ED_area_tag_refresh(ScrArea *sa);
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
-void ED_area_azones_update(ScrArea *sa, const int mouse_xy[]);
+struct AZone *ED_area_azones_update(ScrArea *sa, const int mouse_xy[]);
void ED_area_status_text(ScrArea *sa, const char *str);
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool skip_ar_exit);
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
@@ -310,7 +305,7 @@ bool ED_operator_camera(struct bContext *C);
/* screen_user_menu.c */
-struct bUserMenu *ED_screen_user_menu_find(struct bContext *C);
+bUserMenu **ED_screen_user_menus_find(const struct bContext *C, uint *r_len);
struct bUserMenu *ED_screen_user_menu_ensure(struct bContext *C);
@@ -361,12 +356,13 @@ void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *sa);
enum {
ED_KEYMAP_UI = (1 << 1),
ED_KEYMAP_GIZMO = (1 << 2),
- ED_KEYMAP_VIEW2D = (1 << 3),
- ED_KEYMAP_MARKERS = (1 << 4),
- ED_KEYMAP_ANIMATION = (1 << 5),
- ED_KEYMAP_FRAMES = (1 << 6),
- ED_KEYMAP_HEADER = (1 << 7),
- ED_KEYMAP_GPENCIL = (1 << 8),
+ ED_KEYMAP_TOOL = (1 << 3),
+ ED_KEYMAP_VIEW2D = (1 << 4),
+ ED_KEYMAP_MARKERS = (1 << 5),
+ ED_KEYMAP_ANIMATION = (1 << 6),
+ ED_KEYMAP_FRAMES = (1 << 7),
+ ED_KEYMAP_HEADER = (1 << 8),
+ ED_KEYMAP_GPENCIL = (1 << 9),
};
/* SCREEN_OT_space_context_cycle direction */
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 8ef7fee0f32..762fba29947 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_screen_types.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCREEN_TYPES_H__
@@ -56,7 +49,7 @@ enum {
/* don't drop frames (and ignore SCE_FRAME_DROP flag) */
ANIMPLAY_FLAG_NO_SYNC = (1 << 3),
/* use nextfra at next timer update */
- ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4)
+ ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4),
};
/* ----------------------------------------------------- */
@@ -77,10 +70,18 @@ typedef struct ScreenFrameRateInfo {
/* Enum for Action Zone Edges. Which edge of area is action zone. */
typedef enum {
- AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */
- AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */
- AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */
- AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */
+ /** Region located on the left, _right_ edge is action zone.
+ * Region minimized to the top left */
+ AE_RIGHT_TO_TOPLEFT,
+ /** Region located on the right, _left_ edge is action zone.
+ * Region minimized to the top right */
+ AE_LEFT_TO_TOPRIGHT,
+ /** Region located at the bottom, _top_ edge is action zone.
+ * Region minimized to the bottom right */
+ AE_TOP_TO_BOTTOMRIGHT,
+ /** Region located at the top, _bottom_ edge is action zone.
+ * Region minimized to the top left */
+ AE_BOTTOM_TO_TOPLEFT
} AZEdge;
typedef enum {
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 94508a98dcb..ce234b5fb12 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,28 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sculpt.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCULPT_H__
#define __ED_SCULPT_H__
struct ARegion;
-struct bContext;
+struct ListBase;
struct Object;
struct RegionView3D;
-struct ViewContext;
-struct rcti;
struct UndoStep;
struct UndoType;
-struct ListBase;
+struct ViewContext;
+struct bContext;
+struct rcti;
/* sculpt.c */
void ED_operatortypes_sculpt(void);
diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h
index d7f55e2a2d6..72cc7ef01cb 100644
--- a/source/blender/editors/include/ED_select_utils.h
+++ b/source/blender/editors/include/ED_select_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_select_utils.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SELECT_UTILS_H__
@@ -47,7 +43,7 @@ typedef enum {
enum {
SIM_CMP_EQ = 0,
SIM_CMP_GT,
- SIM_CMP_LT
+ SIM_CMP_LT,
};
#define SEL_OP_USE_OUTSIDE(sel_op) (ELEM(sel_op, SEL_OP_AND))
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h
index 18446966c4f..38f07e83572 100644
--- a/source/blender/editors/include/ED_sequencer.h
+++ b/source/blender/editors/include/ED_sequencer.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,21 +14,19 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sequencer.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SEQUENCER_H__
#define __ED_SEQUENCER_H__
-struct bContext;
struct Scene;
struct Sequence;
struct SpaceSeq;
+struct bContext;
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all);
void ED_sequencer_deselect_all(struct Scene *scene);
diff --git a/source/blender/editors/include/ED_sound.h b/source/blender/editors/include/ED_sound.h
index b4b424b0318..44b3c5a6b79 100644
--- a/source/blender/editors/include/ED_sound.h
+++ b/source/blender/editors/include/ED_sound.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sound.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SOUND_H__
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 709af6e8b09..8495af9b36a 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_space_api.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SPACE_API_H__
diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h
index 858902eeec1..1260c531f54 100644
--- a/source/blender/editors/include/ED_text.h
+++ b/source/blender/editors/include/ED_text.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,23 +15,19 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_text.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TEXT_H__
#define __ED_TEXT_H__
-struct SpaceText;
struct ARegion;
-struct UndoType;
+struct SpaceText;
struct TextUndoBuf;
+struct UndoType;
bool ED_text_region_location_from_cursor(struct SpaceText *st, struct ARegion *ar, const int cursor_co[2], int r_pixel_co[2]);
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index ad39c1ccc8a..1bd8782bb12 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transform.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSFORM_H__
@@ -36,17 +28,17 @@
struct ARegion;
struct ListBase;
+struct Main;
struct Object;
+struct SnapObjectContext;
+struct SnapObjectParams;
struct View3D;
+struct WorkSpace;
struct bContext;
struct wmEvent;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperatorType;
-struct WorkSpace;
-struct Main;
-struct SnapObjectContext;
-struct SnapObjectParams;
void ED_keymap_transform(struct wmKeyConfig *keyconf);
void transform_operatortypes(void);
@@ -111,9 +103,9 @@ enum TfmMode {
* */
bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
-struct TransInfo;
-struct Scene;
struct Object;
+struct Scene;
+struct TransInfo;
struct wmGizmoGroup;
struct wmGizmoGroupType;
struct wmOperator;
@@ -121,9 +113,9 @@ struct wmOperator;
/* UNUSED */
// int BIF_snappingSupported(struct Object *obedit);
+struct ReportList;
struct TransformOrientation;
struct bContext;
-struct ReportList;
void BIF_clearTransformOrientation(struct bContext *C);
void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
@@ -142,8 +134,9 @@ int BIF_countTransformOrientation(const struct bContext *C);
#define P_MIRROR (1 << 0)
#define P_MIRROR_DUMMY (P_MIRROR | (1 << 9))
#define P_PROPORTIONAL (1 << 1)
-#define P_AXIS (1 << 2)
-#define P_AXIS_ORTHO (1 << 16)
+#define P_ORIENT_AXIS (1 << 2)
+#define P_ORIENT_AXIS_ORTHO (1 << 16)
+#define P_ORIENT_MATRIX (1 << 17)
#define P_SNAP (1 << 3)
#define P_GEO_SNAP (P_SNAP | (1 << 4))
#define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5))
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index 8ac7dfcf9d8..688d01f7846 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,29 +12,27 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transform_snap_object_context.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__
#define __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__
-struct BMVert;
struct BMEdge;
struct BMFace;
+struct BMVert;
+struct ARegion;
struct Depsgraph;
struct ListBase;
-struct Scene;
-struct ViewLayer;
struct Main;
struct Object;
-struct ARegion;
+struct Scene;
struct View3D;
+struct ViewLayer;
struct bContext;
/* transform_snap_object.c */
@@ -74,7 +70,6 @@ struct SnapObjectParams {
unsigned int use_object_edit_cage : 1;
/* snap to the closest element, use when using more than one snap type */
unsigned int use_occlusion_test : 1;
-
};
typedef struct SnapObjectContext SnapObjectContext;
diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h
index 363bb31c3dc..95b74a2108f 100644
--- a/source/blender/editors/include/ED_transverts.h
+++ b/source/blender/editors/include/ED_transverts.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transverts.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSVERTS_H__
@@ -61,9 +54,12 @@ enum {
/* mode flags: */
enum {
- TM_ALL_JOINTS = (1 << 0), /* all joints (for bones only) */
- TM_SKIP_HANDLES = (1 << 1), /* skip handles when control point is selected (for curves only) */
- TM_CALC_NORMALS = (1 << 2), /* fill in normals when available */
+ /** all joints (for bones only) */
+ TM_ALL_JOINTS = (1 << 0),
+ /** skip handles when control point is selected (for curves only) */
+ TM_SKIP_HANDLES = (1 << 1),
+ /** fill in normals when available */
+ TM_CALC_NORMALS = (1 << 2),
};
enum {
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 9188fca2422..7040a2ef6c1 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_types.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TYPES_H__
diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h
index 7995644f39e..12839e36a12 100644
--- a/source/blender/editors/include/ED_undo.h
+++ b/source/blender/editors/include/ED_undo.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_undo.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UNDO_H__
@@ -27,11 +23,13 @@
#include "BLI_compiler_attrs.h"
-struct bContext;
struct CLG_LogRef;
+struct Object;
+struct UndoStack;
+struct ViewLayer;
+struct bContext;
struct wmOperator;
struct wmOperatorType;
-struct UndoStack;
/* undo.c */
void ED_undo_push(struct bContext *C, const char *str);
@@ -54,6 +52,12 @@ void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg
bool ED_undo_is_valid(const struct bContext *C, const char *undoname);
+bool ED_undo_is_memfile_compatible(const struct bContext *C);
+
+void ED_undo_object_editmode_restore_helper(
+ struct bContext *C,
+ struct Object **object_array, uint object_array_len, uint object_array_stride);
+
struct UndoStack *ED_undo_stack_get(void);
/* helpers */
diff --git a/source/blender/editors/include/ED_userpref.h b/source/blender/editors/include/ED_userpref.h
new file mode 100644
index 00000000000..29470608933
--- /dev/null
+++ b/source/blender/editors/include/ED_userpref.h
@@ -0,0 +1,26 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup editors
+ */
+
+#ifndef __ED_USERPREF_H__
+#define __ED_USERPREF_H__
+
+void ED_operatortypes_userpref(void);
+
+#endif /* __ED_USERPREF_H__ */
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 7e91b5b88c1..b275b776ddd 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_util.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UTIL_H__
@@ -33,19 +26,19 @@
#include "BLI_compiler_attrs.h"
+struct Main;
struct bContext;
struct wmOperatorType;
/* ed_util.c */
+void ED_editors_init_for_undo(struct Main *bmain);
+void ED_editors_init(struct bContext *C);
+void ED_editors_exit(struct Main *bmain, bool do_undo_system);
+bool ED_editors_flush_edits(struct Main *bmain, bool for_render);
-void ED_editors_init(struct bContext *C);
-void ED_editors_exit(struct bContext *C);
-
-bool ED_editors_flush_edits(const struct bContext *C, bool for_render);
-
-void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
+void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
-void ED_OT_flush_edits(struct wmOperatorType *ot);
+void ED_OT_flush_edits(struct wmOperatorType *ot);
/* ************** XXX OLD CRUFT WARNING ************* */
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 2fc15f72fca..b0d1f7a014a 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,33 +15,30 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_uvedit.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UVEDIT_H__
#define __ED_UVEDIT_H__
struct ARegionType;
-struct BMesh;
struct BMEditMesh;
struct BMFace;
struct BMLoop;
+struct BMesh;
struct Depsgraph;
struct Image;
struct ImageUser;
struct Main;
struct Object;
struct Scene;
+struct SpaceImage;
+struct ToolSettings;
struct View3D;
struct ViewLayer;
-struct SpaceImage;
struct bNode;
struct wmKeyConfig;
@@ -68,6 +63,22 @@ void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int ma
bool ED_uvedit_test(struct Object *obedit);
/* visibility and selection */
+bool uvedit_face_visible_nolocal_ex(
+ const struct ToolSettings *ts, struct BMFace *efa);
+bool uvedit_face_visible_test_ex(
+ const struct ToolSettings *ts, struct Object *obedit, struct Image *ima, struct BMFace *efa);
+bool uvedit_face_select_test_ex(
+ const struct ToolSettings *ts, struct BMFace *efa,
+ const int cd_loop_uv_offset);
+bool uvedit_edge_select_test_ex(
+ const struct ToolSettings *ts, struct BMLoop *l,
+ const int cd_loop_uv_offset);
+bool uvedit_uv_select_test_ex(
+ const struct ToolSettings *ts, struct BMLoop *l,
+ const int cd_loop_uv_offset);
+
+bool uvedit_face_visible_nolocal(
+ struct Scene *scene, struct BMFace *efa);
bool uvedit_face_visible_test(
struct Scene *scene, struct Object *obedit, struct Image *ima, struct BMFace *efa);
bool uvedit_face_select_test(
@@ -125,18 +136,8 @@ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
void ED_uvedit_live_unwrap_re_solve(void);
void ED_uvedit_live_unwrap_end(short cancel);
-void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit);
-void ED_uvedit_pack_islands(
- struct Scene *scene, struct Object *ob, struct BMesh *bm,
- bool selected, bool correct_aspect, bool do_rotate);
-void ED_uvedit_pack_islands_multi(
- struct Scene *scene, struct Object **objects, const uint objects_len,
- bool selected, bool correct_aspect, bool do_rotate, bool implicit);
-void ED_uvedit_unwrap_cube_project(
- struct BMesh *bm, float cube_size, bool use_select, const float center[3]);
-
-/* single call up unwrap using scene settings, used for edge tag unwrapping */
-void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel, const bool pack);
+void ED_uvedit_live_unwrap(struct Scene *scene, struct Object **objects, int objects_len);
+void ED_uvedit_add_simple_uvs(struct Main *bmain, struct Scene *scene, struct Object *ob);
/* uvedit_draw.c */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 4989d4e9ab9..d6f0d99b2b9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_view3d.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_VIEW3D_H__
@@ -43,6 +36,10 @@ struct BoundBox;
struct Camera;
struct Depsgraph;
struct EditBone;
+struct GPUFX;
+struct GPUFXSettings;
+struct GPUOffScreen;
+struct GPUViewport;
struct ImBuf;
struct MVert;
struct Main;
@@ -53,10 +50,11 @@ struct RV3DMatrixStore;
struct RegionView3D;
struct RenderEngineType;
struct Scene;
-struct ViewLayer;
struct ScrArea;
struct View3D;
struct ViewContext;
+struct ViewLayer;
+struct WorkSpace;
struct bContext;
struct bPoseChannel;
struct bScreen;
@@ -66,11 +64,6 @@ struct wmOperator;
struct wmOperatorType;
struct wmWindow;
struct wmWindowManager;
-struct GPUFX;
-struct GPUOffScreen;
-struct GPUFXSettings;
-struct GPUViewport;
-struct WorkSpace;
enum eGPUFXFlags;
/* for derivedmesh drawing callbacks, for view3d_select, .... */
@@ -155,11 +148,16 @@ void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
/* return values for ED_view3d_project_...() */
typedef enum {
V3D_PROJ_RET_OK = 0,
- V3D_PROJ_RET_CLIP_NEAR = 1, /* can't avoid this when in perspective mode, (can't avoid) */
- V3D_PROJ_RET_CLIP_ZERO = 2, /* so close to zero we can't apply a perspective matrix usefully */
- V3D_PROJ_RET_CLIP_BB = 3, /* bounding box clip - RV3D_CLIPPING */
- V3D_PROJ_RET_CLIP_WIN = 4, /* outside window bounds */
- V3D_PROJ_RET_OVERFLOW = 5 /* outside range (mainly for short), (can't avoid) */
+ /** can't avoid this when in perspective mode, (can't avoid) */
+ V3D_PROJ_RET_CLIP_NEAR = 1,
+ /** so close to zero we can't apply a perspective matrix usefully */
+ V3D_PROJ_RET_CLIP_ZERO = 2,
+ /** bounding box clip - RV3D_CLIPPING */
+ V3D_PROJ_RET_CLIP_BB = 3,
+ /** outside window bounds */
+ V3D_PROJ_RET_CLIP_WIN = 4,
+ /** outside range (mainly for short), (can't avoid) */
+ V3D_PROJ_RET_OVERFLOW = 5,
} eV3DProjStatus;
/* some clipping tests are optional */
@@ -168,7 +166,7 @@ typedef enum {
V3D_PROJ_TEST_CLIP_BB = (1 << 0),
V3D_PROJ_TEST_CLIP_WIN = (1 << 1),
V3D_PROJ_TEST_CLIP_NEAR = (1 << 2),
- V3D_PROJ_TEST_CLIP_ZERO = (1 << 3)
+ V3D_PROJ_TEST_CLIP_ZERO = (1 << 3),
} eV3DProjTest;
#define V3D_PROJ_TEST_CLIP_DEFAULT \
@@ -485,8 +483,8 @@ char ED_view3d_lock_view_from_index(int index);
char ED_view3d_axis_view_opposite(char view);
bool ED_view3d_lock(struct RegionView3D *rv3d);
-uint64_t ED_view3d_datamask(const struct Scene *scene, const struct View3D *v3d);
-uint64_t ED_view3d_screen_datamask(const struct Scene *scene, const struct bScreen *screen);
+uint64_t ED_view3d_datamask(const struct bContext *C, const struct Scene *scene, const struct View3D *v3d);
+uint64_t ED_view3d_screen_datamask(const struct bContext *C, const struct Scene *scene, const struct bScreen *screen);
bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
void ED_view3d_persp_switch_from_camera(
@@ -546,8 +544,6 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
#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)
-void ED_view3d_id_remap(struct View3D *v3d, const struct ID *old_id, struct ID *new_id);
-
/* view3d_draw_legacy.c */
/* Try avoid using these more move out of legacy. */
void ED_view3d_draw_bgpic_test(
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 9b4ee0c8264..59658b0fcdb 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_icons.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
/* Note: this is included multiple times with different #defines for DEF_ICON. */
@@ -72,7 +65,7 @@ DEF_ICON(DOT)
DEF_ICON(COLLAPSEMENU)
DEF_ICON(X)
DEF_ICON(DUPLICATE)
-DEF_ICON_BLANK(75)
+DEF_ICON(TRASH)
DEF_ICON_BLANK(76)
DEF_ICON_BLANK(77)
DEF_ICON(NODE)
@@ -151,7 +144,7 @@ DEF_ICON(SPEAKER)
DEF_ICON_BLANK(151)
DEF_ICON(TOOL_SETTINGS)
DEF_ICON(SHADERFX)
-DEF_ICON_BLANK(154)
+DEF_ICON(MODIFIER)
DEF_ICON_BLANK(155)
DEF_ICON_BLANK(156)
DEF_ICON_BLANK(157)
@@ -181,18 +174,18 @@ DEF_ICON(NODETREE)
DEF_ICON_BLANK(181)
DEF_ICON(CONSOLE)
DEF_ICON_BLANK(183)
-DEF_ICON(CLIP)
+DEF_ICON(TRACKER)
DEF_ICON(ASSET_MANAGER)
DEF_ICON(NODE_COMPOSITING)
DEF_ICON(NODE_TEXTURE)
DEF_ICON(NODE_MATERIAL)
-DEF_ICON_BLANK(189)
+DEF_ICON(UV)
DEF_ICON_BLANK(190)
/* MODES */
DEF_ICON(OBJECT_DATAMODE) // XXX fix this up
DEF_ICON(EDITMODE_HLT)
-DEF_ICON(UV)
+DEF_ICON(UV_DATA)
DEF_ICON(VPAINT_HLT)
DEF_ICON(TPAINT_HLT)
DEF_ICON(WPAINT_HLT)
@@ -294,7 +287,7 @@ DEF_ICON(DECORATE_UNLOCKED)
DEF_ICON(DECORATE_LOCKED)
DEF_ICON(DECORATE_OVERRIDE)
DEF_ICON_BLANK(111)
-DEF_ICON(SEALED)
+DEF_ICON(TRACKER_DATA)
DEF_ICON(HEART)
DEF_ICON(ORPHAN_DATA)
DEF_ICON(USER)
@@ -348,7 +341,7 @@ DEF_ICON(GP_SELECT_POINTS)
DEF_ICON(GP_SELECT_STROKES)
DEF_ICON(GP_MULTIFRAME_EDITING)
DEF_ICON(GP_ONLY_SELECTED)
-DEF_ICON_BLANK(351)
+DEF_ICON(GP_SELECT_BETWEEN_STROKES)
DEF_ICON(MODIFIER_OFF)
DEF_ICON(MODIFIER_ON)
DEF_ICON(ONIONSKIN_OFF)
@@ -526,7 +519,7 @@ DEF_ICON_BLANK(525)
DEF_ICON_BLANK(526)
/* MODIFIERS */
-DEF_ICON_MODIFIER(MODIFIER)
+DEF_ICON_MODIFIER(MODIFIER_DATA)
DEF_ICON_MODIFIER(MOD_WAVE)
DEF_ICON_MODIFIER(MOD_BUILD)
DEF_ICON_MODIFIER(MOD_DECIM)
@@ -589,7 +582,7 @@ DEF_ICON(REW)
DEF_ICON(PAUSE)
DEF_ICON(PREV_KEYFRAME)
DEF_ICON(NEXT_KEYFRAME)
-DEF_ICON_BLANK(185)
+DEF_ICON(PLAY_SOUND)
DEF_ICON(PLAY_REVERSE)
DEF_ICON(PREVIEW_RANGE)
DEF_ICON(ACTION_TWEAK)
@@ -649,10 +642,10 @@ DEF_ICON(PIVOT_INDIVIDUAL)
DEF_ICON(PIVOT_MEDIAN)
DEF_ICON(PIVOT_ACTIVE)
DEF_ICON(CENTER_ONLY)
-DEF_ICON_BLANK(652)
+DEF_ICON(ROOTCURVE)
DEF_ICON(SMOOTHCURVE)
DEF_ICON(SPHERECURVE)
-DEF_ICON(ROOTCURVE)
+DEF_ICON(INVERSESQUARECURVE)
DEF_ICON(SHARPCURVE)
DEF_ICON(LINCURVE)
DEF_ICON(NOCURVE)
@@ -660,7 +653,7 @@ DEF_ICON(RNDCURVE)
DEF_ICON(PROP_OFF)
DEF_ICON(PROP_ON)
DEF_ICON(PROP_CON)
-DEF_ICON(SCULPT_DYNTOPO) /* XXX Empty icon! */
+DEF_ICON(PROP_PROJECTED)
DEF_ICON(PARTICLE_POINT)
DEF_ICON(PARTICLE_TIP)
DEF_ICON(PARTICLE_PATH)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 31956877d1b..d9b2b09a117 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_interface.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_INTERFACE_H__
@@ -38,50 +30,50 @@
/* Struct Declarations */
-struct ID;
-struct IDProperty;
-struct ListBase;
struct ARegion;
struct ARegionType;
-struct ScrArea;
-struct bScreen;
-struct wmEvent;
-struct wmWindow;
-struct wmOperator;
struct AutoComplete;
-struct bContext;
-struct bContextStore;
+struct ID;
+struct IDProperty;
+struct ImBuf;
+struct Image;
+struct ImageUser;
+struct ListBase;
+struct MTex;
struct Panel;
struct PanelType;
struct PointerRNA;
struct PropertyRNA;
struct ReportList;
+struct ScrArea;
+struct bContext;
+struct bContextStore;
+struct bNode;
+struct bNodeSocket;
+struct bNodeTree;
+struct bScreen;
struct rcti;
+struct uiFontStyle;
struct uiList;
struct uiStyle;
-struct uiFontStyle;
struct uiWidgetColors;
-struct Image;
-struct ImageUser;
-struct wmKeyConfig;
-struct wmOperatorType;
-struct MTex;
-struct ImBuf;
-struct bNodeTree;
-struct bNode;
-struct bNodeSocket;
-struct wmDropBox;
struct wmDrag;
+struct wmDropBox;
+struct wmEvent;
struct wmEvent;
struct wmGizmo;
-struct wmMsgBus;
+struct wmKeyConfig;
struct wmKeyMap;
struct wmKeyMapItem;
+struct wmMsgBus;
+struct wmOperator;
+struct wmOperatorType;
+struct wmWindow;
-typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
-typedef struct uiPopupBlockHandle uiPopupBlockHandle;
+typedef struct uiBut uiBut;
typedef struct uiLayout uiLayout;
+typedef struct uiPopupBlockHandle uiPopupBlockHandle;
/* Defines */
@@ -109,14 +101,14 @@ enum {
/* uiBlock->direction */
enum {
- UI_DIR_UP = (1 << 0),
- UI_DIR_DOWN = (1 << 1),
- UI_DIR_LEFT = (1 << 2),
- UI_DIR_RIGHT = (1 << 3),
- UI_DIR_CENTER_X = (1 << 4),
- UI_DIR_CENTER_Y = (1 << 5),
-
- UI_DIR_ALL = (UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT),
+ UI_DIR_UP = 1 << 0,
+ UI_DIR_DOWN = 1 << 1,
+ UI_DIR_LEFT = 1 << 2,
+ UI_DIR_RIGHT = 1 << 3,
+ UI_DIR_CENTER_X = 1 << 4,
+ UI_DIR_CENTER_Y = 1 << 5,
+
+ UI_DIR_ALL = UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT,
};
#if 0
@@ -125,82 +117,108 @@ enum {
#define UI_BLOCK_ROWS 2
#endif
-/* uiBlock->flag (controls) */
-#define UI_BLOCK_LOOP (1 << 0)
-#define UI_BLOCK_IS_FLIP (1 << 1)
-#define UI_BLOCK_NO_FLIP (1 << 2)
-#define UI_BLOCK_NUMSELECT (1 << 3)
-#define UI_BLOCK_NO_WIN_CLIP (1 << 4) /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */
-#define UI_BLOCK_CLIPBOTTOM (1 << 5)
-#define UI_BLOCK_CLIPTOP (1 << 6)
-#define UI_BLOCK_MOVEMOUSE_QUIT (1 << 7)
-#define UI_BLOCK_KEEP_OPEN (1 << 8)
-#define UI_BLOCK_POPUP (1 << 9)
-#define UI_BLOCK_OUT_1 (1 << 10)
-#define UI_BLOCK_SEARCH_MENU (1 << 11)
-#define UI_BLOCK_POPUP_MEMORY (1 << 12)
-#define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */
-
-/* block->flag bits 14-17 are identical to but->drawflag bits */
-
-#define UI_BLOCK_POPUP_HOLD (1 << 18)
-#define UI_BLOCK_LIST_ITEM (1 << 19)
-#define UI_BLOCK_RADIAL (1 << 20)
-#define UI_BLOCK_POPOVER (1 << 21)
-#define UI_BLOCK_POPOVER_ONCE (1 << 22)
-/** Always show keymaps, even for non-menus. */
-#define UI_BLOCK_SHOW_SHORTCUT_ALWAYS (1 << 23)
-
-/* uiPopupBlockHandle->menuretval */
-#define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */
-#define UI_RETURN_OK (1 << 1) /* choice made */
-#define UI_RETURN_OUT (1 << 2) /* left the menu */
-#define UI_RETURN_OUT_PARENT (1 << 3) /* let the parent handle this event */
-#define UI_RETURN_UPDATE (1 << 4) /* update the button that opened */
-#define UI_RETURN_POPUP_OK (1 << 5) /* popup is ok to be handled */
+/** #uiBlock.flag (controls) */
+enum {
+ UI_BLOCK_LOOP = 1 << 0,
+ UI_BLOCK_IS_FLIP = 1 << 1,
+ UI_BLOCK_NO_FLIP = 1 << 2,
+ UI_BLOCK_NUMSELECT = 1 << 3,
+ /** Don't apply window clipping. */
+ UI_BLOCK_NO_WIN_CLIP = 1 << 4,
+ UI_BLOCK_CLIPBOTTOM = 1 << 5,
+ UI_BLOCK_CLIPTOP = 1 << 6,
+ UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7,
+ UI_BLOCK_KEEP_OPEN = 1 << 8,
+ UI_BLOCK_POPUP = 1 << 9,
+ UI_BLOCK_OUT_1 = 1 << 10,
+ UI_BLOCK_SEARCH_MENU = 1 << 11,
+ UI_BLOCK_POPUP_MEMORY = 1 << 12,
+ /* Stop handling mouse events. */
+ UI_BLOCK_CLIP_EVENTS = 1 << 13,
+
+ /* block->flag bits 14-17 are identical to but->drawflag bits */
+
+ UI_BLOCK_POPUP_HOLD = 1 << 18,
+ UI_BLOCK_LIST_ITEM = 1 << 19,
+ UI_BLOCK_RADIAL = 1 << 20,
+ UI_BLOCK_POPOVER = 1 << 21,
+ UI_BLOCK_POPOVER_ONCE = 1 << 22,
+ /** Always show keymaps, even for non-menus. */
+ UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23,
+};
+
+/** #uiPopupBlockHandle.menuretval */
+enum {
+ /** Cancel all menus cascading. */
+ UI_RETURN_CANCEL = 1 << 0,
+ /** Choice made. */
+ UI_RETURN_OK = 1 << 1,
+ /** Left the menu. */
+ UI_RETURN_OUT = 1 << 2,
+ /** Let the parent handle this event. */
+ UI_RETURN_OUT_PARENT = 1 << 3,
+ /** Update the button that opened. */
+ UI_RETURN_UPDATE = 1 << 4,
+ /** Popup is ok to be handled. */
+ UI_RETURN_POPUP_OK = 1 << 5,
+};
/* panel controls */
-#define UI_PNL_SOLID (1 << 1)
-#define UI_PNL_CLOSE (1 << 5)
-#define UI_PNL_SCALE (1 << 9)
+enum {
+ UI_PNL_SOLID = 1 << 1,
+ UI_PNL_CLOSE = 1 << 5,
+ UI_PNL_SCALE = 1 << 9,
+};
/* but->flag - general state flags. */
enum {
- /* 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),
- UI_BUT_DISABLED = (1 << 11), /* grayed out and uneditable */
- UI_BUT_COLOR_LOCK = (1 << 12),
- UI_BUT_ANIMATED = (1 << 13),
- UI_BUT_ANIMATED_KEY = (1 << 14),
- UI_BUT_DRIVEN = (1 << 15),
- UI_BUT_REDALERT = (1 << 16),
- UI_BUT_INACTIVE = (1 << 17), /* grayed out but still editable */
- UI_BUT_LAST_ACTIVE = (1 << 18),
- UI_BUT_UNDO = (1 << 19),
- UI_BUT_IMMEDIATE = (1 << 20),
- UI_BUT_NO_UTF8 = (1 << 21),
-
- UI_BUT_VEC_SIZE_LOCK = (1 << 22), /* used to flag if color hsv-circle should keep luminance */
- UI_BUT_COLOR_CUBIC = (1 << 23), /* cubic saturation for the color wheel */
- UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */
- UI_BUT_DRAG_MULTI = (1 << 25), /* edit this button as well as the active button (not just dragging) */
-
- UI_BUT_HAS_SEP_CHAR = (1 << 27), /* but->str contains UI_SEP_CHAR, used for key shortcuts */
- UI_BUT_UPDATE_DELAY = (1 << 28), /* don't run updates while dragging (needed in rare cases). */
- UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
- UI_BUT_VALUE_CLEAR = (1 << 30), /* show 'x' icon to clear/unlink value of text or search button */
-
- UI_BUT_OVERRIDEN = (1u << 31u), /* RNA property of the button is overridden from linked reference data. */
+ /** 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 */
+ UI_BUT_DISABLED = 1 << 11,
+ UI_BUT_COLOR_LOCK = 1 << 12,
+ 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 */
+ UI_BUT_INACTIVE = 1 << 17,
+ UI_BUT_LAST_ACTIVE = 1 << 18,
+ UI_BUT_UNDO = 1 << 19,
+ UI_BUT_IMMEDIATE = 1 << 20,
+ UI_BUT_NO_UTF8 = 1 << 21,
+
+ /** used to flag if color hsv-circle should keep luminance */
+ UI_BUT_VEC_SIZE_LOCK = 1 << 22,
+ /** cubic saturation for the color wheel */
+ UI_BUT_COLOR_CUBIC = 1 << 23,
+ /** This but is "inside" a list item (currently used to change theme colors). */
+ UI_BUT_LIST_ITEM = 1 << 24,
+ /** edit this button as well as the active button (not just dragging) */
+ UI_BUT_DRAG_MULTI = 1 << 25,
+
+ /** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */
+ UI_BUT_HAS_SEP_CHAR = 1 << 27,
+ /** Don't run updates while dragging (needed in rare cases). */
+ UI_BUT_UPDATE_DELAY = 1 << 28,
+ /** When widget is in textedit mode, update value on each char stroke */
+ UI_BUT_TEXTEDIT_UPDATE = 1 << 29,
+ /** Show 'x' icon to clear/unlink value of text or search button. */
+ UI_BUT_VALUE_CLEAR = 1 << 30,
+
+ /** RNA property of the button is overridden from linked reference data. */
+ UI_BUT_OVERRIDEN = 1u << 31u,
};
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
#define UI_NAVIGATION_REGION_WIDTH UI_COMPACT_PANEL_WIDTH
+#define UI_NARROW_NAVIGATION_REGION_WIDTH 100
#define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
@@ -209,39 +227,48 @@ enum {
* (except for the 'align' ones)!
*/
enum {
- /* Text and icon alignment (by default, they are centered). */
- UI_BUT_TEXT_LEFT = (1 << 1),
- UI_BUT_ICON_LEFT = (1 << 2),
- UI_BUT_TEXT_RIGHT = (1 << 3),
- /* Prevent the button to show any tooltip. */
- UI_BUT_NO_TOOLTIP = (1 << 4),
+ /** Text and icon alignment (by default, they are centered). */
+ UI_BUT_TEXT_LEFT = 1 << 1,
+ UI_BUT_ICON_LEFT = 1 << 2,
+ UI_BUT_TEXT_RIGHT = 1 << 3,
+ /** Prevent the button to show any tooltip. */
+ UI_BUT_NO_TOOLTIP = 1 << 4,
/* Button align flag, for drawing groups together.
* Used in 'uiBlock.flag', take care! */
- UI_BUT_ALIGN_TOP = (1 << 14),
- UI_BUT_ALIGN_LEFT = (1 << 15),
- UI_BUT_ALIGN_RIGHT = (1 << 16),
- UI_BUT_ALIGN_DOWN = (1 << 17),
- UI_BUT_ALIGN = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN),
+ UI_BUT_ALIGN_TOP = 1 << 14,
+ UI_BUT_ALIGN_LEFT = 1 << 15,
+ UI_BUT_ALIGN_RIGHT = 1 << 16,
+ UI_BUT_ALIGN_DOWN = 1 << 17,
+ UI_BUT_ALIGN = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN,
/* end bits shared with 'uiBlock.flag' */
- /* Warning - HACK! Needed for buttons which are not TOP/LEFT aligned, but have some top/left corner stitched to some
- * other TOP/LEFT-aligned button, because of 'corrective' hack in widget_roundbox_set()... */
- UI_BUT_ALIGN_STITCH_TOP = (1 << 18),
- UI_BUT_ALIGN_STITCH_LEFT = (1 << 19),
- UI_BUT_ALIGN_ALL = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT),
+ /**
+ * Warning - HACK!
+ * Needed for buttons which are not TOP/LEFT aligned,
+ * but have some top/left corner stitched to some other TOP/LEFT-aligned button,
+ * because of 'corrective' hack in widget_roundbox_set()... */
+ UI_BUT_ALIGN_STITCH_TOP = 1 << 18,
+ UI_BUT_ALIGN_STITCH_LEFT = 1 << 19,
+ UI_BUT_ALIGN_ALL = UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT,
- UI_BUT_BOX_ITEM = (1 << 20), /* This but is "inside" a box item (currently used to change theme colors). */
+ /** This but is "inside" a box item (currently used to change theme colors). */
+ UI_BUT_BOX_ITEM = 1 << 20,
- UI_BUT_ACTIVE_LEFT = (1 << 21), /* Active left part of number button */
- UI_BUT_ACTIVE_RIGHT = (1 << 22), /* Active right part of number button */
+ /** Active left part of number button */
+ UI_BUT_ACTIVE_LEFT = 1 << 21,
+ /** Active right part of number button */
+ UI_BUT_ACTIVE_RIGHT = 1 << 22,
/* (also used by search buttons to enforce shortcut display for their items). */
- UI_BUT_HAS_SHORTCUT = (1 << 23), /* Button has shortcut text. */
+ /** Button has shortcut text. */
+ UI_BUT_HAS_SHORTCUT = 1 << 23,
- UI_BUT_ICON_REVERSE = (1 << 24), /* Reverse order of consecutive off/on icons */
+ /** Reverse order of consecutive off/on icons */
+ UI_BUT_ICON_REVERSE = 1 << 24,
- UI_BUT_ANIMATED_CHANGED = (1 << 25), /* Value is animated, but the current value differs from the animated one. */
+ /** Value is animated, but the current value differs from the animated one. */
+ UI_BUT_ANIMATED_CHANGED = 1 << 25,
};
/* scale fixed button widths by this to account for DPI */
@@ -270,66 +297,78 @@ typedef enum {
/* assigned to but->type, OR'd with the flags above when passing args */
typedef enum {
- UI_BTYPE_BUT = (1 << 9),
- UI_BTYPE_ROW = (2 << 9),
- UI_BTYPE_TEXT = (3 << 9),
- UI_BTYPE_MENU = (4 << 9), /* dropdown list */
- UI_BTYPE_BUT_MENU = (5 << 9),
- UI_BTYPE_NUM = (6 << 9), /* number button */
- UI_BTYPE_NUM_SLIDER = (7 << 9), /* number slider */
- UI_BTYPE_TOGGLE = (8 << 9),
- UI_BTYPE_TOGGLE_N = (9 << 9),
- UI_BTYPE_ICON_TOGGLE = (10 << 9),
- UI_BTYPE_ICON_TOGGLE_N = (11 << 9),
- UI_BTYPE_BUT_TOGGLE = (12 << 9), /* same as regular toggle, but no on/off state displayed */
- UI_BTYPE_CHECKBOX = (13 << 9), /* similar to toggle, display a 'tick' */
- UI_BTYPE_CHECKBOX_N = (14 << 9),
- UI_BTYPE_COLOR = (15 << 9),
- UI_BTYPE_TAB = (16 << 9),
- UI_BTYPE_POPOVER = (17 << 9),
- UI_BTYPE_SCROLL = (18 << 9),
- UI_BTYPE_BLOCK = (19 << 9),
- UI_BTYPE_LABEL = (20 << 9),
- UI_BTYPE_KEY_EVENT = (24 << 9),
- UI_BTYPE_HSVCUBE = (26 << 9),
- UI_BTYPE_PULLDOWN = (27 << 9), /* menu (often used in headers), **_MENU /w different draw-type */
- UI_BTYPE_ROUNDBOX = (28 << 9),
- UI_BTYPE_COLORBAND = (30 << 9),
- UI_BTYPE_UNITVEC = (31 << 9), /* sphere widget (used to input a unit-vector, aka normal) */
- UI_BTYPE_CURVE = (32 << 9),
- UI_BTYPE_LISTBOX = (36 << 9),
- UI_BTYPE_LISTROW = (37 << 9),
- UI_BTYPE_HSVCIRCLE = (38 << 9),
- UI_BTYPE_TRACK_PREVIEW = (40 << 9),
-
- /* buttons with value >= UI_BTYPE_SEARCH_MENU don't get undo pushes */
- UI_BTYPE_SEARCH_MENU = (41 << 9),
- UI_BTYPE_EXTRA = (42 << 9),
- UI_BTYPE_HOTKEY_EVENT = (46 << 9),
- UI_BTYPE_IMAGE = (47 << 9), /* non-interactive image, used for splash screen */
- UI_BTYPE_HISTOGRAM = (48 << 9),
- UI_BTYPE_WAVEFORM = (49 << 9),
- UI_BTYPE_VECTORSCOPE = (50 << 9),
- UI_BTYPE_PROGRESS_BAR = (51 << 9),
- UI_BTYPE_NODE_SOCKET = (53 << 9),
- UI_BTYPE_SEPR = (54 << 9),
- UI_BTYPE_SEPR_LINE = (55 << 9),
- UI_BTYPE_SEPR_SPACER = (56 << 9), /* Dynamically fill available space. */
- UI_BTYPE_GRIP = (57 << 9), /* resize handle (resize uilist) */
+ UI_BTYPE_BUT = 1 << 9,
+ UI_BTYPE_ROW = 2 << 9,
+ UI_BTYPE_TEXT = 3 << 9,
+ /** dropdown list */
+ UI_BTYPE_MENU = 4 << 9,
+ UI_BTYPE_BUT_MENU = 5 << 9,
+ /** number button */
+ UI_BTYPE_NUM = 6 << 9,
+ /** number slider */
+ UI_BTYPE_NUM_SLIDER = 7 << 9,
+ UI_BTYPE_TOGGLE = 8 << 9,
+ UI_BTYPE_TOGGLE_N = 9 << 9,
+ UI_BTYPE_ICON_TOGGLE = 10 << 9,
+ UI_BTYPE_ICON_TOGGLE_N = 11 << 9,
+ /** same as regular toggle, but no on/off state displayed */
+ UI_BTYPE_BUT_TOGGLE = 12 << 9,
+ /** similar to toggle, display a 'tick' */
+ UI_BTYPE_CHECKBOX = 13 << 9,
+ UI_BTYPE_CHECKBOX_N = 14 << 9,
+ UI_BTYPE_COLOR = 15 << 9,
+ UI_BTYPE_TAB = 16 << 9,
+ UI_BTYPE_POPOVER = 17 << 9,
+ UI_BTYPE_SCROLL = 18 << 9,
+ UI_BTYPE_BLOCK = 19 << 9,
+ UI_BTYPE_LABEL = 20 << 9,
+ UI_BTYPE_KEY_EVENT = 24 << 9,
+ UI_BTYPE_HSVCUBE = 26 << 9,
+ /** menu (often used in headers), **_MENU /w different draw-type */
+ UI_BTYPE_PULLDOWN = 27 << 9,
+ UI_BTYPE_ROUNDBOX = 28 << 9,
+ UI_BTYPE_COLORBAND = 30 << 9,
+ /** sphere widget (used to input a unit-vector, aka normal) */
+ UI_BTYPE_UNITVEC = 31 << 9,
+ UI_BTYPE_CURVE = 32 << 9,
+ UI_BTYPE_LISTBOX = 36 << 9,
+ UI_BTYPE_LISTROW = 37 << 9,
+ UI_BTYPE_HSVCIRCLE = 38 << 9,
+ UI_BTYPE_TRACK_PREVIEW = 40 << 9,
+
+ /** Buttons with value >= #UI_BTYPE_SEARCH_MENU don't get undo pushes. */
+ UI_BTYPE_SEARCH_MENU = 41 << 9,
+ UI_BTYPE_EXTRA = 42 << 9,
+ UI_BTYPE_HOTKEY_EVENT = 46 << 9,
+ /** Non-interactive image, used for splash screen */
+ UI_BTYPE_IMAGE = 47 << 9,
+ UI_BTYPE_HISTOGRAM = 48 << 9,
+ UI_BTYPE_WAVEFORM = 49 << 9,
+ UI_BTYPE_VECTORSCOPE = 50 << 9,
+ UI_BTYPE_PROGRESS_BAR = 51 << 9,
+ UI_BTYPE_NODE_SOCKET = 53 << 9,
+ UI_BTYPE_SEPR = 54 << 9,
+ UI_BTYPE_SEPR_LINE = 55 << 9,
+ /** Dynamically fill available space. */
+ UI_BTYPE_SEPR_SPACER = 56 << 9,
+ /** Resize handle (resize uilist). */
+ UI_BTYPE_GRIP = 57 << 9,
} eButType;
#define BUTTYPE (63 << 9)
-/* gradient types, for color picker UI_BTYPE_HSVCUBE etc */
-#define UI_GRAD_SV 0
-#define UI_GRAD_HV 1
-#define UI_GRAD_HS 2
-#define UI_GRAD_H 3
-#define UI_GRAD_S 4
-#define UI_GRAD_V 5
-
-#define UI_GRAD_V_ALT 9
-#define UI_GRAD_L_ALT 10
+/** Gradient types, for color picker #UI_BTYPE_HSVCUBE etc. */
+enum {
+ UI_GRAD_SV = 0,
+ UI_GRAD_HV = 1,
+ UI_GRAD_HS = 2,
+ UI_GRAD_H = 3,
+ UI_GRAD_S = 4,
+ UI_GRAD_V = 5,
+
+ UI_GRAD_V_ALT = 9,
+ UI_GRAD_L_ALT = 10,
+};
#define UI_PALETTE_COLOR 20
@@ -359,31 +398,34 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
void UI_draw_safe_areas(uint pos, float x1, float x2, float y1, float y2,
const float title_aspect[2], const float action_aspect[2]);
-/* state for scrolldrawing */
-#define UI_SCROLL_PRESSED (1 << 0)
-#define UI_SCROLL_ARROWS (1 << 1)
-#define UI_SCROLL_NO_OUTLINE (1 << 2)
+/** State for scrolldrawing. */
+enum {
+ UI_SCROLL_PRESSED = 1 << 0,
+ UI_SCROLL_ARROWS = 1 << 1,
+ UI_SCROLL_NO_OUTLINE = 1 << 2,
+};
void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state);
/* Shortening string helper. */
float UI_text_clip_middle_ex(
- struct uiFontStyle *fstyle, char *str, float okwidth, const float minwidth,
+ const struct uiFontStyle *fstyle, char *str, float okwidth, const float minwidth,
const size_t max_len, const char rpart_sep);
-/* Callbacks
+/**
+ * Callbacks
*
* UI_block_func_handle_set/ButmFunc are for handling events through a callback.
* HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
* mostly for compatibility with older code.
*
- * UI_but_func_complete_set is for tab completion.
+ * - #UI_but_func_complete_set is for tab completion.
*
- * uiButSearchFunc is for name buttons, showing a popup with matches
+ * - #uiButSearchFunc is for name buttons, showing a popup with matches
*
- * UI_block_func_set and UI_but_func_set are callbacks run when a button is used,
- * in case events, operators or RNA are not sufficient to handle the button.
+ * - #UI_block_func_set and UI_but_func_set are callbacks run when a button is used,
+ * in case events, operators or RNA are not sufficient to handle the button.
*
- * UI_but_funcN_set will free the argument with MEM_freeN. */
+ * - #UI_but_funcN_set will free the argument with MEM_freeN. */
typedef struct uiSearchItems uiSearchItems;
@@ -396,6 +438,7 @@ typedef struct ARegion *(*uiButSearchCreateFunc)(struct bContext *C, struct AReg
typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items);
/* Must return allocated string. */
typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip);
+typedef int (*uiButPushedStateFunc)(struct bContext *C, void *arg);
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
@@ -422,13 +465,14 @@ bool UI_block_is_empty(const uiBlock *block);
/* interface_region_menu_popup.c */
-/* Popup Menus
+/**
+ * Popup Menus
*
* Functions used to create popup menus. For more extended menus the
* UI_popup_menu_begin/End functions can be used to define own items with
* the uiItem functions in between. If it is a simple confirmation menu
- * or similar, popups can be created with a single function call. */
-
+ * or similar, popups can be created with a single function call.
+ */
typedef struct uiPopupMenu uiPopupMenu;
uiPopupMenu *UI_popup_menu_begin(
@@ -489,10 +533,14 @@ typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg);
void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op);
-/* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */
+#if 0 /* UNUSED */
+void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext);
+#endif
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
+bool UI_popup_block_name_exists(struct bContext *C, const char *name);
+
/* Blocks
*
* Functions for creating, drawing and freeing blocks. A Block is a
@@ -686,7 +734,7 @@ enum {
BUT_GET_RNA_TIP,
BUT_GET_RNAENUM_TIP,
BUT_GET_OP_KEYMAP,
- BUT_GET_PROP_KEYMAP
+ BUT_GET_PROP_KEYMAP,
};
typedef struct uiStringInfo {
@@ -703,7 +751,8 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0
/* Name of the main py op from i18n addon. */
#define EDTSRC_I18N_OP_NAME "UI_OT_edittranslation"
-/* Special Buttons
+/**
+ * Special Buttons
*
* Buttons with a more specific purpose:
* - MenuBut: buttons that popup a menu (in headers usually).
@@ -711,21 +760,23 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0
* - BlockBut: buttons that popup a block with more buttons.
* - KeyevtBut: buttons that can be used to turn key events into values.
* - PickerButtons: buttons like the color picker (for code sharing).
- * - AutoButR: RNA property button with type automatically defined. */
-
-#define UI_ID_RENAME (1 << 0)
-#define UI_ID_BROWSE (1 << 1)
-#define UI_ID_ADD_NEW (1 << 2)
-#define UI_ID_OPEN (1 << 3)
-#define UI_ID_ALONE (1 << 4)
-#define UI_ID_DELETE (1 << 5)
-#define UI_ID_LOCAL (1 << 6)
-#define UI_ID_AUTO_NAME (1 << 7)
-#define UI_ID_FAKE_USER (1 << 8)
-#define UI_ID_PIN (1 << 9)
-#define UI_ID_PREVIEWS (1 << 10)
-#define UI_ID_OVERRIDE (1 << 11)
-#define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL)
+ * - AutoButR: RNA property button with type automatically defined.
+ */
+enum {
+ UI_ID_RENAME = 1 << 0,
+ UI_ID_BROWSE = 1 << 1,
+ UI_ID_ADD_NEW = 1 << 2,
+ UI_ID_ALONE = 1 << 4,
+ UI_ID_OPEN = 1 << 3,
+ UI_ID_DELETE = 1 << 5,
+ UI_ID_LOCAL = 1 << 6,
+ UI_ID_AUTO_NAME = 1 << 7,
+ UI_ID_FAKE_USER = 1 << 8,
+ UI_ID_PIN = 1 << 9,
+ UI_ID_PREVIEWS = 1 << 10,
+ UI_ID_OVERRIDE = 1 << 11,
+ UI_ID_FULL = UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL,
+};
/**
* Ways to limit what is displayed in ID-search popup.
@@ -776,9 +827,9 @@ typedef enum {
/* Return info for uiDefAutoButsRNA */
typedef enum {
/* Returns when no buttons were added */
- UI_PROP_BUTS_NONE_ADDED = (1 << 0),
+ UI_PROP_BUTS_NONE_ADDED = 1 << 0,
/* Returned when any property failed the custom check callback (check_prop) */
- UI_PROP_BUTS_ANY_FAILED_CHECK = (1 << 1),
+ UI_PROP_BUTS_ANY_FAILED_CHECK = 1 << 1,
} eAutoPropButsReturn;
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
@@ -830,6 +881,8 @@ void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but);
void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN);
+void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg);
+
/* Autocomplete
*
* Tab complete helper functions, for use in uiButCompleteFunc callbacks.
@@ -911,44 +964,52 @@ void UI_exit(void);
* uiBlockCurLayout. */
/* layout */
-#define UI_LAYOUT_HORIZONTAL 0
-#define UI_LAYOUT_VERTICAL 1
+enum {
+ UI_LAYOUT_HORIZONTAL = 0,
+ UI_LAYOUT_VERTICAL = 1,
+};
-#define UI_LAYOUT_PANEL 0
-#define UI_LAYOUT_HEADER 1
-#define UI_LAYOUT_MENU 2
-#define UI_LAYOUT_TOOLBAR 3
-#define UI_LAYOUT_PIEMENU 4
-#define UI_LAYOUT_VERT_BAR 5
+enum {
+ UI_LAYOUT_PANEL = 0,
+ UI_LAYOUT_HEADER = 1,
+ UI_LAYOUT_MENU = 2,
+ UI_LAYOUT_TOOLBAR = 3,
+ UI_LAYOUT_PIEMENU = 4,
+ UI_LAYOUT_VERT_BAR = 5,
+};
#define UI_UNIT_X ((void)0, U.widget_unit)
#define UI_UNIT_Y ((void)0, U.widget_unit)
-#define UI_LAYOUT_ALIGN_EXPAND 0
-#define UI_LAYOUT_ALIGN_LEFT 1
-#define UI_LAYOUT_ALIGN_CENTER 2
-#define UI_LAYOUT_ALIGN_RIGHT 3
-
-#define UI_ITEM_O_RETURN_PROPS (1 << 0)
-#define UI_ITEM_R_EXPAND (1 << 1)
-#define UI_ITEM_R_SLIDER (1 << 2)
-#define UI_ITEM_R_TOGGLE (1 << 3)
-#define UI_ITEM_R_ICON_ONLY (1 << 4)
-#define UI_ITEM_R_EVENT (1 << 5)
-#define UI_ITEM_R_FULL_EVENT (1 << 6)
-#define UI_ITEM_R_NO_BG (1 << 7)
-#define UI_ITEM_R_IMMEDIATE (1 << 8)
-#define UI_ITEM_O_DEPRESS (1 << 9)
-#define UI_ITEM_R_COMPACT (1 << 10)
+enum {
+ UI_LAYOUT_ALIGN_EXPAND = 0,
+ UI_LAYOUT_ALIGN_LEFT = 1,
+ UI_LAYOUT_ALIGN_CENTER = 2,
+ UI_LAYOUT_ALIGN_RIGHT = 3,
+};
+
+enum {
+ UI_ITEM_O_RETURN_PROPS = 1 << 0,
+ UI_ITEM_R_EXPAND = 1 << 1,
+ UI_ITEM_R_SLIDER = 1 << 2,
+ UI_ITEM_R_TOGGLE = 1 << 3,
+ UI_ITEM_R_ICON_ONLY = 1 << 4,
+ UI_ITEM_R_EVENT = 1 << 5,
+ UI_ITEM_R_FULL_EVENT = 1 << 6,
+ UI_ITEM_R_NO_BG = 1 << 7,
+ UI_ITEM_R_IMMEDIATE = 1 << 8,
+ UI_ITEM_O_DEPRESS = 1 << 9,
+ UI_ITEM_R_COMPACT = 1 << 10,
+};
#define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)
/* uiLayoutOperatorButs flags */
enum {
- UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0),
- UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 1),
- UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 2),
- UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = (1 << 3),
+ UI_TEMPLATE_OP_PROPS_SHOW_TITLE = 1 << 0,
+ UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = 1 << 1,
+ UI_TEMPLATE_OP_PROPS_COMPACT = 1 << 2,
+ UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = 1 << 3,
};
/* used for transp checkers */
@@ -962,13 +1023,13 @@ enum {
* 8------4 */
enum {
- UI_CNR_TOP_LEFT = (1 << 0),
- UI_CNR_TOP_RIGHT = (1 << 1),
- UI_CNR_BOTTOM_RIGHT = (1 << 2),
- UI_CNR_BOTTOM_LEFT = (1 << 3),
+ UI_CNR_TOP_LEFT = 1 << 0,
+ UI_CNR_TOP_RIGHT = 1 << 1,
+ UI_CNR_BOTTOM_RIGHT = 1 << 2,
+ UI_CNR_BOTTOM_LEFT = 1 << 3,
/* just for convenience */
UI_CNR_NONE = 0,
- UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)
+ UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT),
};
uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style);
@@ -1087,7 +1148,9 @@ void uiTemplatePreview(
struct MTex *slot, const char *preview_id);
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand);
void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale);
-void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale);
+void uiTemplateIconView(
+ uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels,
+ float icon_scale, float icon_scale_popup);
void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
@@ -1129,7 +1192,7 @@ void uiTemplateList(
uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id,
struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr,
const char *active_propname, const char *item_dyntip_propname,
- int rows, int maxrows, int layout_type, int columns, bool reverse);
+ int rows, int maxrows, int layout_type, int columns, bool sort_reverse, bool sort_lock);
void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
@@ -1189,13 +1252,19 @@ void uiItemsFullEnumO_items(
const EnumPropertyItem *item_array, int totitem);
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
-void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
-void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); /* menu */
-void uiItemMContents(uiLayout *layout, const char *menuname); /* menu contents */
-void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
-void uiItemS(uiLayout *layout); /* separator */
+/* label icon for dragging */
+void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon);
+/* menu */
+void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon);
+/* menu contents */
+void uiItemMContents(uiLayout *layout, const char *menuname);
+/* value */
+void uiItemV(uiLayout *layout, const char *name, int icon, int argval);
+/* separator */
+void uiItemS(uiLayout *layout);
void uiItemS_ex(uiLayout *layout, float factor);
-void uiItemSpacer(uiLayout *layout); /* Special separator. */
+/* Special separator. */
+void uiItemSpacer(uiLayout *layout);
void uiItemPopoverPanel_ptr(
uiLayout *layout, struct bContext *C,
@@ -1252,20 +1321,33 @@ struct ID *UI_context_active_but_get_tab_ID(struct bContext *C);
uiBut *UI_region_active_but_get(struct ARegion *ar);
+/* uiFontStyle.align */
+typedef enum eFontStyle_Align {
+ UI_STYLE_TEXT_LEFT = 0,
+ UI_STYLE_TEXT_CENTER = 1,
+ UI_STYLE_TEXT_RIGHT = 2,
+} eFontStyle_Align;
+
+struct uiFontStyleDraw_Params {
+ eFontStyle_Align align;
+ uint word_wrap : 1;
+};
+
/* Styled text draw */
void UI_fontstyle_set(const struct uiFontStyle *fs);
void UI_fontstyle_draw_ex(
const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
- const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs);
+ const uchar col[4], const struct uiFontStyleDraw_Params *fs_params,
+ size_t len, float *r_xofs, float *r_yofs);
void UI_fontstyle_draw(
const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
- const unsigned char col[4]);
+ const uchar col[4], const struct uiFontStyleDraw_Params *fs_params);
void UI_fontstyle_draw_rotated(
const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
- const unsigned char col[4]);
+ const uchar col[4]);
void UI_fontstyle_draw_simple(
const struct uiFontStyle *fs, float x, float y, const char *str,
- const unsigned char col[4]);
+ const uchar col[4]);
void UI_fontstyle_draw_simple_backdrop(
const struct uiFontStyle *fs, float x, float y, const char *str,
const float col_fg[4], const float col_bg[4]);
@@ -1323,6 +1405,10 @@ void UI_widgetbase_draw_cache_begin(void);
void UI_widgetbase_draw_cache_flush(void);
void UI_widgetbase_draw_cache_end(void);
+/* Use for resetting the theme. */
+void UI_theme_init_default(void);
+void UI_style_init_default(void);
+
/* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */
#define USE_UI_TOOLBAR_HACK
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index 640d66c9ac4..bd1f04ebcff 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,26 +15,20 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_interface_icons.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_INTERFACE_ICONS_H__
#define __UI_INTERFACE_ICONS_H__
-struct bContext;
struct ID;
-struct Scene;
-struct PreviewImage;
struct PointerRNA;
+struct PreviewImage;
+struct Scene;
+struct bContext;
enum eIconSizes;
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 277aae923d6..85b2ccf2077 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file UI_resources.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
-#include "BLI_sys_types.h"
-
#ifndef __UI_RESOURCES_H__
#define __UI_RESOURCES_H__
+#include "BLI_sys_types.h"
+
/* Define icon enum. */
#define DEF_ICON(name) ICON_##name,
#define DEF_ICON_VECTOR(name) ICON_##name,
@@ -58,6 +50,8 @@ typedef enum ThemeColorID {
// common colors among spaces
TH_BACK,
+ /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */
+ TH_BACK_GRAD,
TH_TEXT,
TH_TEXT_HI,
TH_TITLE,
@@ -162,7 +156,7 @@ typedef enum ThemeColorID {
TH_KEYBORDER,
TH_KEYBORDER_SELECT,
- TH_LAMP,
+ TH_LIGHT,
TH_SPEAKER,
TH_CAMERA,
TH_EMPTY,
@@ -296,8 +290,6 @@ typedef enum ThemeColorID {
TH_GIZMO_A,
TH_GIZMO_B,
- TH_LOW_GRAD,
- TH_HIGH_GRAD,
TH_SHOW_BACK_GRAD,
TH_INFO_SELECTED,
@@ -343,6 +335,7 @@ int UI_GetThemeValueType(int colorid, int spacetype);
void UI_GetThemeColor3fv(int colorid, float col[3]);
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
+void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]);
// get the color, range 0.0-1.0, complete with shading offset
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
@@ -353,6 +346,10 @@ void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int o
// get four color values, scaled to 0.0-1.0 range
void UI_GetThemeColor4fv(int colorid, float col[4]);
+
+/* get four color values from specified space type, scaled to 0.0-1.0 range */
+void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]);
+
// get four color values, range 0.0-1.0, complete with shading offset for the RGB components
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]);
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]);
@@ -369,7 +366,8 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
// get a theme color from specified space type
-void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
+void UI_GetThemeColorType3ubv(int colorid, int spacetype, unsigned char col[3]);
+void UI_GetThemeColorType4ubv(int colorid, int spacetype, unsigned char col[4]);
// get theme color for coloring monochrome icons
bool UI_GetIconThemeColor4fv(int colorid, float col[4]);
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index f35976750c9..8c944760972 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- *
* Generic 2d view with should allow drawing grids,
* panning, zooming, scrolling, ..
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_view2d.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_VIEW2D_H__
@@ -61,7 +53,7 @@ enum eView2D_CommonViewTypes {
/* headers (this is basically the same as listview, but no y-panning) */
V2D_COMMONVIEW_HEADER,
/* ui region containing panels */
- V2D_COMMONVIEW_PANELS_UI
+ V2D_COMMONVIEW_PANELS_UI,
};
/* ---- Defines for Scroller/Grid Arguments ----- */
@@ -85,7 +77,7 @@ enum eView2D_Units {
/* clamping of grid values to whole numbers */
enum eView2D_Clamp {
V2D_GRID_NOCLAMP = 0,
- V2D_GRID_CLAMP
+ V2D_GRID_CLAMP,
};
/* flags for grid-lines to draw */
@@ -134,13 +126,13 @@ struct View2D;
struct View2DGrid;
struct View2DScrollers;
-struct wmKeyConfig;
-struct bScreen;
+struct ARegion;
struct Scene;
struct ScrArea;
-struct ARegion;
struct bContext;
+struct bScreen;
struct rctf;
+struct wmKeyConfig;
typedef struct View2DGrid View2DGrid;
typedef struct View2DScrollers View2DScrollers;
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index c2c2438b942..1ecd9e64924 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d90135001c4..f379432ede9 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008, full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -164,7 +158,18 @@ void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, c
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
}
-void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
+float ui_block_to_window_scale(const ARegion *ar, uiBlock *block)
+{
+ /* We could have function for this to avoid dummy arg. */
+ float dummy_x;
+ float min_y = 0, max_y = 1;
+ ui_block_to_window_fl(ar, block, &dummy_x, &min_y);
+ ui_block_to_window_fl(ar, block, &dummy_x, &max_y);
+ return max_y - min_y;
+}
+
+/* for mouse cursor */
+void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
{
float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey;
@@ -436,7 +441,7 @@ static void ui_block_bounds_calc_centered_pie(uiBlock *block)
{
const int xy[2] = {
block->pie_data.pie_center_spawned[0],
- block->pie_data.pie_center_spawned[1]
+ block->pie_data.pie_center_spawned[1],
};
UI_block_translate(block, xy[0], xy[1]);
@@ -505,7 +510,8 @@ static void ui_block_bounds_calc_popup(
ui_block_bounds_calc(block);
/* If given, adjust input coordinates such that they would generate real final popup position.
- * Needed to handle correctly floating panels once they have been dragged around, see T52999. */
+ * Needed to handle correctly floating panels once they have been dragged around,
+ * see T52999. */
if (r_xy) {
r_xy[0] = xy[0] + block->rect.xmin - raw_x;
r_xy[1] = xy[1] + block->rect.ymin - raw_y;
@@ -843,8 +849,8 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
{
uiBut *but;
- unsigned int menu_key_mask = 0;
- unsigned char menu_key;
+ uint menu_key_mask = 0;
+ uchar menu_key;
const char *str_pt;
int pass;
int tot_missing = 0;
@@ -1071,17 +1077,17 @@ static bool ui_but_event_property_operator_string(
"WM_OT_context_cycle_enum",
"WM_OT_context_cycle_array",
"WM_OT_context_menu_enum",
- NULL
+ NULL,
};
const char *ctx_enum_opnames[] = {
"WM_OT_context_set_enum",
- NULL
+ NULL,
};
const char *ctx_enum_opnames_for_Area_ui_type[] = {
"SCREEN_OT_space_type_set_or_cycle",
- NULL
+ NULL,
};
const char **opnames = ctx_toggle_opnames;
@@ -1116,7 +1122,8 @@ static bool ui_but_event_property_operator_string(
/* Don't use the button again. */
but = NULL;
- /* this version is only for finding hotkeys for properties (which get set via context using operators) */
+ /* this version is only for finding hotkeys for properties
+ * (which get set via context using operators) */
if (prop) {
/* to avoid massive slowdowns on property panels, for now, we only check the
* hotkeys for Editor / Scene settings...
@@ -1327,7 +1334,8 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
continue;
}
else if (((block->flag & UI_BLOCK_POPOVER) == 0) && UI_but_is_tool(but)) {
- /* For non-popovers, shown in shortcut only (has special shortcut handling code). */
+ /* For non-popovers, shown in shortcut only
+ * (has special shortcut handling code). */
continue;
}
}
@@ -2090,7 +2098,8 @@ void ui_but_value_set(uiBut *but, double value)
case PROP_ENUM:
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
int ivalue = (int)value;
- ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
+ /* toggle for enum/flag buttons */
+ ivalue ^= RNA_property_enum_get(&but->rnapoin, prop);
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
}
else {
@@ -2294,7 +2303,8 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
{
int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but));
const double step_orig = step_default * UI_PRECISION_FLOAT_SCALE;
- /* Scaling up 'step_origg ' here is a bit arbitrary, its just giving better scales from user POV */
+ /* Scaling up 'step_origg ' here is a bit arbitrary,
+ * its just giving better scales from user POV */
const double scale_step = ui_get_but_scale_unit(but, step_orig * 10);
const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type);
@@ -2514,7 +2524,8 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but));
/* only enable verbose if we won't run again with units */
if (BPY_execute_string_as_number(C, NULL, str, is_unit_but == false, r_value)) {
- /* if the value parsed ok without unit conversion this button may still need a unit multiplier */
+ /* if the value parsed ok without unit conversion
+ * this button may still need a unit multiplier */
if (is_unit_but) {
char str_new[128];
@@ -2643,7 +2654,7 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
}
else if (but->type == UI_BTYPE_TEXT) {
/* string */
- if (!but->poin || (str[0] == '\0')) {
+ if (!but->poin) {
str = "";
}
else if (ui_but_is_utf8(but)) {
@@ -3569,7 +3580,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
uiItemL(column, item->name, item->icon);
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
}
@@ -3837,7 +3849,7 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, in
* ((1 << findBitIndex(x)) == x);
* \endcode
*/
-static int findBitIndex(unsigned int x)
+static int findBitIndex(uint x)
{
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
return -1;
@@ -4344,7 +4356,7 @@ PointerRNA *UI_but_operator_ptr_get(uiBut *but)
void UI_but_unit_type_set(uiBut *but, const int unit_type)
{
- but->unit_type = (unsigned char)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
+ but->unit_type = (uchar)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
}
int UI_but_unit_type_get(const uiBut *but)
@@ -4444,6 +4456,12 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
but->tip_argN = argN;
}
+void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg)
+{
+ but->pushed_state_func = func;
+ but->pushed_state_arg = arg;
+}
+
uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -4588,7 +4606,8 @@ void UI_but_func_search_set(
uiButSearchFunc search_func, void *arg,
uiButHandleFunc bfunc, void *active)
{
- /* needed since callers don't have access to internal functions (as an alternative we could expose it) */
+ /* needed since callers don't have access to internal functions
+ * (as an alternative we could expose it) */
if (search_create_func == NULL) {
search_create_func = ui_searchbox_create_generic;
}
@@ -4637,7 +4656,8 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free);
for (item = item_array; item->identifier; item++) {
- /* note: need to give the index rather than the identifier because the enum can be freed */
+ /* note: need to give the index rather than the
+ * identifier because the enum can be freed */
if (BLI_strcasestr(item->name, str)) {
if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon))
break;
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index d102c7c582d..9fc8c8f4bb1 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008, full recode.
- * Bastien Montagne 2015, full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_align.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_rect.h"
@@ -42,22 +34,25 @@
#ifdef USE_UIBUT_SPATIAL_ALIGN
/**
- * This struct stores a (simplified) 2D representation of all buttons of a same align group, with their
- * immediate neighbors (if found), and needed value to compute 'stitching' of aligned buttons.
+ * This struct stores a (simplified) 2D representation of all buttons of a same align group,
+ * with their immediate neighbors (if found),
+ * and needed value to compute 'stitching' of aligned buttons.
*
- * \note This simplistic struct cannot fully represent complex layouts where buttons share some 'align space' with
- * several others (see schema below), we'd need linked list and more complex code to handle that.
- * However, looks like we can do without that for now, which is rather lucky!
+ * \note This simplistic struct cannot fully represent complex layouts where buttons share some
+ * 'align space' with several others (see schema below), we'd need linked list and more
+ * complex code to handle that. However, looks like we can do without that for now,
+ * which is rather lucky!
*
* <pre>
- * +-----------+-----------+
- * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
- * |-----------------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
- * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
- * +-----------------------+
+ * +--------+-------+
+ * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
+ * |----------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
+ * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
+ * +----------------+
* </pre>
*
- * This will probably not work in all possible cases, but not sure we want to support such exotic cases anyway.
+ * This will probably not work in all possible cases,
+ * but not sure we want to support such exotic cases anyway.
*/
typedef struct ButAlign {
uiBut *but;
@@ -71,13 +66,15 @@ typedef struct ButAlign {
/* Distances to the neighbors. */
float dists[4];
- /* Flags, used to mark whether we should 'stitch' the corners of this button with its neighbors' ones. */
+ /* Flags, used to mark whether we should 'stitch'
+ * the corners of this button with its neighbors' ones. */
char flags[4];
} ButAlign;
/* Side-related enums and flags. */
enum {
- /* Sides (used as indices, order is **crucial**, this allows us to factorize code in a loop over the four sides). */
+ /* Sides (used as indices, order is **crucial**,
+ * this allows us to factorize code in a loop over the four sides). */
LEFT = 0,
TOP = 1,
RIGHT = 2,
@@ -162,14 +159,17 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
for (side = 0; side < RIGHT; side++) {
- /* We are only interested in buttons which share a same line (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
+ /* We are only interested in buttons which share a same line
+ * (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
if (buts_share[IS_COLUMN(side)]) {
side_opp = OPPOSITE(side);
- /* We check both opposite sides at once, because with very small buttons, delta could be below max_delta for
- * the wrong side (that is, in horizontal case, the total width of two buttons can be below max_delta).
- * We rely on exact zero value here as an 'already processed' flag, so ensure we never actually
- * set a zero value at this stage. FLT_MIN is zero-enough for UI position computing. ;) */
+ /* We check both opposite sides at once, because with very small buttons,
+ * delta could be below max_delta for the wrong side
+ * (that is, in horizontal case, the total width of two buttons can be below max_delta).
+ * We rely on exact zero value here as an 'already processed' flag,
+ * so ensure we never actually set a zero value at this stage.
+ * FLT_MIN is zero-enough for UI position computing. ;) */
delta = max_ff(fabsf(*butal->borders[side] - *butal_other->borders[side_opp]), FLT_MIN);
delta_side_opp = max_ff(fabsf(*butal->borders[side_opp] - *butal_other->borders[side]), FLT_MIN);
if (delta_side_opp < delta) {
@@ -178,18 +178,21 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
if (delta < max_delta) {
- /* We are only interested in neighbors that are at least as close as already found ones. */
+ /* We are only interested in neighbors that are
+ * at least as close as already found ones. */
if (delta <= butal->dists[side]) {
{
/* We found an as close or closer neighbor.
* If both buttons are alignable, we set them as each other neighbors.
- * Else, we have an unalignable one, we need to reset the others matching neighbor to NULL
- * if its 'proximity distance' is really lower with current one.
+ * Else, we have an unalignable one, we need to reset the others matching
+ * neighbor to NULL if its 'proximity distance'
+ * is really lower with current one.
*
- * NOTE: We cannot only execute that piece of code in case we found a **closer** neighbor,
- * due to the limited way we represent neighbors (buttons only know **one** neighbor
- * on each side, when they can actually have several ones), it would prevent
- * some buttons to be properly 'neighborly-initialized'. */
+ * NOTE: We cannot only execute that piece of code in case we found a
+ * **closer** neighbor, due to the limited way we represent neighbors
+ * (buttons only know **one** neighbor on each side, when they can
+ * actually have several ones), it would prevent some buttons to be
+ * properly 'neighborly-initialized'. */
if (butal_can_align && butal_other_can_align) {
butal->neighbors[side] = butal_other;
butal_other->neighbors[side_opp] = butal;
@@ -217,10 +220,12 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
butal_other->neighbors[side_opp] = butal;
}
- /* We have a pair of neighbors, we have to check whether we can stitch their matching corners.
+ /* We have a pair of neighbors, we have to check whether we
+ * can stitch their matching corners.
* E.g. if butal_other is on the left of butal (that is, side == LEFT),
- * if both TOP (side_s1) coordinates of buttons are close enough, we can stitch
- * their upper matching corners, and same for DOWN (side_s2) side. */
+ * if both TOP (side_s1) coordinates of buttons are close enough,
+ * we can stitch their upper matching corners,
+ * and same for DOWN (side_s2) side. */
delta = fabsf(*butal->borders[side_s1] - *butal_other->borders[side_s1]);
if (delta < max_delta) {
butal->flags[side_s1] |= stitch;
@@ -233,7 +238,8 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
}
}
- /* We assume two buttons can only share one side at most - for until we have sperical UI... */
+ /* We assume two buttons can only share one side at most - for until
+ * we have sperical UI... */
return;
}
}
@@ -329,9 +335,10 @@ static int ui_block_align_butal_cmp(const void *a, const void *b)
return (*butal->borders[LEFT] > *butal_other->borders[LEFT]) ? 1 : -1;
}
- /* XXX We cannot actually assert here, since in some very compressed space cases, stupid UI code produces
- * widgets which have the same TOP and LEFT positions...
- * We do not care really, because this happens when UI is way too small to be usable anyway. */
+ /* XXX We cannot actually assert here, since in some very compressed space cases,
+ * stupid UI code produces widgets which have the same TOP and LEFT positions...
+ * We do not care really,
+ * because this happens when UI is way too small to be usable anyway. */
/* BLI_assert(0); */
return 0;
}
@@ -423,27 +430,29 @@ void ui_block_align_calc(uiBlock *block, const ARegion *region)
}
/* This will give us ButAlign items regrouped by align group, vertical and horizontal location.
- * Note that, given how buttons are defined in UI code, butal_array shall already be "nearly sorted"... */
+ * Note that, given how buttons are defined in UI code,
+ * butal_array shall already be "nearly sorted"... */
qsort(butal_array, (size_t)num_buttons, sizeof(*butal_array), ui_block_align_butal_cmp);
- /* Third loop: for each pair of buttons in the same align group, we compute their potential proximity.
- * Note that each pair is checked only once, and that we break early in case we know all remaining pairs will
- * always be too far away. */
+ /* Third loop: for each pair of buttons in the same align group,
+ * we compute their potential proximity. Note that each pair is checked only once, and that we
+ * break early in case we know all remaining pairs will always be too far away. */
for (i = 0, butal = butal_array; i < num_buttons; i++, butal++) {
const short alignnr = butal->but->alignnr;
for (j = i + 1, butal_other = &butal_array[i + 1]; j < num_buttons; j++, butal_other++) {
const float max_delta = MAX_DELTA;
- /* Since they are sorted, buttons after current butal can only be of same or higher group, and once
- * they are not of same group, we know we can break this sub-loop and start checking with next butal. */
+ /* Since they are sorted, buttons after current butal can only be of same or higher
+ * group, and once they are not of same group, we know we can break this sub-loop and
+ * start checking with next butal. */
if (butal_other->but->alignnr != alignnr) {
break;
}
- /* Since they are sorted vertically first, buttons after current butal can only be at same or lower height,
- * and once they are lower than a given threshold, we know we can break this sub-loop and
- * start checking with next butal. */
+ /* Since they are sorted vertically first, buttons after current butal can only be at
+ * same or lower height, and once they are lower than a given threshold, we know we can
+ * break this sub-loop and start checking with next butal. */
if ((*butal->borders[DOWN] - *butal_other->borders[TOP]) > max_delta) {
break;
}
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 9ec238d7b5e..c8a9f3b9446 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_anim.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <stdio.h>
@@ -98,8 +92,11 @@ void ui_but_anim_flag(uiBut *but, float cfra)
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
but->flag |= UI_BUT_ANIMATED_KEY;
- if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra))
- but->drawflag |= UI_BUT_ANIMATED_CHANGED;
+ /* XXX: this feature is totally broken and useless with NLA */
+ if (adt == NULL || adt->nla_tracks.first == NULL) {
+ if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra))
+ but->drawflag |= UI_BUT_ANIMATED_CHANGED;
+ }
}
else {
but->flag |= UI_BUT_DRIVEN;
@@ -213,7 +210,8 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
}
/* make sure we have animdata for this */
- /* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
+ /* FIXME: until materials can be handled by depsgraph,
+ * don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
if (G.debug & G_DEBUG)
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index d9967625199..7ed80aac28f 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_context_menu.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Generic context popup menus.
*/
@@ -54,7 +50,8 @@
#include "WM_api.h"
#include "WM_types.h"
-/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */
+/* This hack is needed because we don't have a good way to
+ * re-reference keymap items once added: T42944 */
#define USE_KEYMAP_ADD_HACK
/* -------------------------------------------------------------------- */
@@ -135,7 +132,8 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id;
- /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
+ /* XXX this guess_opname can potentially return a different keymap
+ * than being found on adding later... */
km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
kmi_id = kmi->id;
@@ -407,7 +405,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
bool is_idprop = RNA_property_is_idprop(prop);
bool is_set = RNA_property_is_set(ptr, prop);
- /* second slower test, saved people finding keyframe items in menus when its not possible */
+ /* second slower test,
+ * saved people finding keyframe items in menus when its not possible */
if (is_anim)
is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
@@ -418,7 +417,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
const int override_status = RNA_property_static_override_status(ptr, prop, -1);
const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
- /* Set the (button_pointer, button_prop) and pointer data for Python access to the hovered ui element. */
+ /* Set the (button_pointer, button_prop)
+ * and pointer data for Python access to the hovered ui element. */
uiLayoutSetContextFromBut(layout, but);
/* Keyframes */
@@ -675,7 +675,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
}
- /* Pointer properties and string properties with prop_search support jumping to target object/bone. */
+ /* Pointer properties and string properties with
+ * prop_search support jumping to target object/bone. */
if (but->rnapoin.data && but->rnaprop) {
const PropertyType type = RNA_property_type(but->rnaprop);
@@ -691,25 +692,38 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
uiBlock *block = uiLayoutGetBlock(layout);
const int w = uiLayoutGetWidth(layout);
uiBut *but2;
-
- but2 = uiDefIconTextBut(
- block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- "Add to a user defined context menu (stored in the user preferences)");
- UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL);
-
- bUserMenu *um = ED_screen_user_menu_find(C);
- if (um) {
+ bool item_found = false;
+
+ uint um_array_len;
+ bUserMenu **um_array = ED_screen_user_menus_find(C, &um_array_len);
+ for (int um_index = 0; um_index < um_array_len; um_index++) {
+ bUserMenu *um = um_array[um_index];
+ if (um == NULL) {
+ continue;
+ }
bUserMenuItem *umi = ui_but_user_menu_find(C, but, um);
if (umi != NULL) {
but2 = uiDefIconTextBut(
- block, UI_BTYPE_BUT, 0, ICON_BLANK1,
+ block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"),
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
UI_but_func_set(but2, popup_user_menu_remove_func, um, umi);
+ item_found = true;
}
}
+ if (um_array) {
+ MEM_freeN(um_array);
+ }
+
+ if (!item_found) {
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ "Add to a user defined context menu (stored in the user preferences)");
+ UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL);
+ }
+
uiItemS(layout);
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index f1ada343faa..7a9b65ac830 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_draw.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -84,7 +78,7 @@ int UI_draw_roundbox_corner_get(void)
}
#endif
-void UI_draw_roundbox_3ubAlpha(bool filled, float minx, float miny, float maxx, float maxy, float rad, const unsigned char col[3], unsigned char alpha)
+void UI_draw_roundbox_3ubAlpha(bool filled, float minx, float miny, float maxx, float maxy, float rad, const uchar col[3], uchar alpha)
{
float colv[4];
colv[0] = ((float)col[0]) / 255;
@@ -251,15 +245,15 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
}
#if 0
-static void round_box_shade_col(unsigned attrib, const float col1[3], float const col2[3], const float fac)
+static void round_box_shade_col(uint attr, const float col1[3], float const col2[3], const float fac)
{
float col[4] = {
fac * col1[0] + (1.0f - fac) * col2[0],
fac * col1[1] + (1.0f - fac) * col2[1],
fac * col1[2] + (1.0f - fac) * col2[2],
- 1.0f
+ 1.0f,
};
- immAttr4fv(attrib, col);
+ immAttr4fv(attr, col);
}
#endif
@@ -547,8 +541,9 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
/* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
-/* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */
-void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3])
+/* based on UI_draw_roundbox_gl_mode,
+ * check on making a version which allows us to skip some sides */
+void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3])
{
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -634,7 +629,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh
immUnbindProgram();
}
-void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect)
+void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
{
#ifdef WITH_HEADLESS
(void)rect;
@@ -685,8 +680,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
*
* \Note This functionn is to be used with the 2D dashed shader enabled.
*
- * \param pos: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib
- * \param line_origin: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib
+ * \param pos: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attribute.
+ * \param line_origin: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attribute.
*
* The next 4 parameters are the offsets for the view, not the zones.
*/
@@ -732,7 +727,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor)
static void histogram_draw_one(
float r, float g, float b, float alpha,
float x, float y, float w, float h, const float *data, int res, const bool is_line,
- unsigned int pos_attrib)
+ uint pos_attr)
{
float color[4] = {r, g, b, alpha};
@@ -752,19 +747,19 @@ static void histogram_draw_one(
immBegin(GPU_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
}
immEnd();
}
else {
/* under the curve */
immBegin(GPU_PRIM_TRI_STRIP, res * 2);
- immVertex2f(pos_attrib, x, y);
- immVertex2f(pos_attrib, x, y + (data[0] * h));
+ immVertex2f(pos_attr, x, y);
+ immVertex2f(pos_attr, x, y + (data[0] * h));
for (int i = 1; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
- immVertex2f(pos_attrib, x2, y);
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y);
}
immEnd();
@@ -775,7 +770,7 @@ static void histogram_draw_one(
immBegin(GPU_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
}
immEnd();
}
@@ -785,7 +780,7 @@ static void histogram_draw_one(
#define HISTOGRAM_TOT_GRID_LINES 4
-void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
+void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
Histogram *hist = (Histogram *)but->poin;
int res = hist->x_resolution;
@@ -795,7 +790,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
float w = BLI_rctf_size_x(&rect);
@@ -886,13 +881,14 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3])
GPU_batch_discard(batch);
}
-void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
+void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
int scissor[4];
float colors[3][3];
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
- float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
+ /* colors pre multiplied by alpha for speed up */
+ float colors_alpha[3][3], colorsycc_alpha[3][3];
float min, max;
if (scopes == NULL) return;
@@ -901,7 +897,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
if (scopes->wavefrm_yfac < 0.5f)
@@ -1122,7 +1118,7 @@ static float polar_to_y(float center, float diam, float ampli, float angle)
return center + diam * ampli * sinf(angle);
}
-static void vectorscope_draw_target(unsigned int pos, float centerx, float centery, float diam, const float colf[3])
+static void vectorscope_draw_target(uint pos, float centerx, float centery, float diam, const float colf[3])
{
float y, u, v;
float tangle = 0.0f, tampli;
@@ -1174,7 +1170,7 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente
immEnd();
}
-void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
+void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
Scopes *scopes = (Scopes *)but->poin;
@@ -1187,7 +1183,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
float w = BLI_rctf_size_x(&rect);
@@ -1280,7 +1276,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
GPU_blend(false);
}
-static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, float y1, float halfwidth, float height)
+static void ui_draw_colorband_handle_tri_hlight(uint pos, float x1, float y1, float halfwidth, float height)
{
GPU_line_smooth(true);
@@ -1293,7 +1289,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa
GPU_line_smooth(false);
}
-static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, float halfwidth, float height, bool fill)
+static void ui_draw_colorband_handle_tri(uint pos, float x1, float y1, float halfwidth, float height, bool fill)
{
glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH);
@@ -1306,7 +1302,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f
glDisable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH);
}
-static void ui_draw_colorband_handle_box(unsigned int pos, float x1, float y1, float x2, float y2, bool fill)
+static void ui_draw_colorband_handle_box(uint pos, float x1, float y1, float x2, float y2, bool fill)
{
immBegin(fill ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
@@ -1402,7 +1398,7 @@ static void ui_draw_colorband_handle(
ui_draw_colorband_handle_box(shdr_pos, x - (half_width - 2), y1 + 1, x + (half_width - 2), y1 + height - 2, true);
}
-void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect)
+void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
{
struct ColorManagedDisplay *display = ui_block_cm_display_get(but->block);
uint pos_id, col_id;
@@ -1527,7 +1523,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
immUnbindProgram();
}
-void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
+void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
{
/* sphere color */
float diffuse[3] = {1.0f, 1.0f, 1.0f};
@@ -1536,7 +1532,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
/* backdrop */
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_3ubAlpha(true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, (unsigned char *)wcol->inner, 255);
+ UI_draw_roundbox_3ubAlpha(true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, (uchar *)wcol->inner, 255);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
@@ -1568,7 +1564,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor3ubv((unsigned char *)wcol->inner);
+ immUniformColor3ubv((uchar *)wcol->inner);
GPU_blend(true);
GPU_line_smooth(true);
@@ -1582,7 +1578,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
immUnbindProgram();
}
-static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step)
+static void ui_draw_but_curve_grid(uint pos, const rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step)
{
float dx = step * zoomx;
float fx = rect->xmin + zoomx * (-offsx);
@@ -1611,15 +1607,29 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
}
-static void gl_shaded_color(unsigned char *col, int shade)
+
+static void gl_shaded_color_get(const uchar color[3], int shade, uchar r_color[3])
+{
+ r_color[0] = color[0] - shade > 0 ? color[0] - shade : 0;
+ r_color[1] = color[1] - shade > 0 ? color[1] - shade : 0;
+ r_color[2] = color[2] - shade > 0 ? color[2] - shade : 0;
+}
+
+static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[3])
+{
+ uchar color_shaded[3];
+ gl_shaded_color_get(color, shade, color_shaded);
+ rgb_uchar_to_float(r_color, color_shaded);
+}
+
+static void gl_shaded_color(uchar *color, int shade)
{
- immUniformColor3ub(
- col[0] - shade > 0 ? col[0] - shade : 0,
- col[1] - shade > 0 ? col[1] - shade : 0,
- col[2] - shade > 0 ? col[2] - shade : 0);
+ uchar color_shaded[3];
+ gl_shaded_color_get(color, shade, color_shaded);
+ immUniformColor3ubv(color_shaded);
}
-void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect)
+void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
{
CurveMapping *cumap;
@@ -1639,7 +1649,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
.xmin = rect->xmin,
.ymin = rect->ymin,
.xmax = rect->xmax,
- .ymax = rect->ymax
+ .ymax = rect->ymax,
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
@@ -1664,7 +1674,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
.xmin = rect->xmin + zoomx * (-offsx),
.xmax = grid.xmin + zoomx,
.ymin = rect->ymin + zoomy * (-offsy),
- .ymax = grid.ymin + zoomy
+ .ymax = grid.ymin + zoomy,
};
ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
@@ -1677,19 +1687,23 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* backdrop */
+ float color_backdrop[4] = {0, 0, 0, 1};
+
if (but->a1 == UI_GRAD_H) {
/* grid, hsv uses different grid */
GPU_blend(true);
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
- immUniformColor4ub(0, 0, 0, 48);
+ ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0);
+ immUniformColor4fv(color_backdrop);
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
GPU_blend(false);
}
else {
if (cumap->flag & CUMA_DO_CLIP) {
- gl_shaded_color((unsigned char *)wcol->inner, -20);
+ gl_shaded_color_get_fl((uchar *)wcol->inner, -20, color_backdrop);
+ immUniformColor3fv(color_backdrop);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- immUniformColor3ubv((unsigned char *)wcol->inner);
+ immUniformColor3ubv((uchar *)wcol->inner);
immRectf(pos,
rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
@@ -1697,18 +1711,19 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
}
else {
- immUniformColor3ubv((unsigned char *)wcol->inner);
+ rgb_uchar_to_float(color_backdrop, (const uchar *)wcol->inner);
+ immUniformColor3fv(color_backdrop);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
/* grid, every 0.25 step */
- gl_shaded_color((unsigned char *)wcol->inner, -16);
+ gl_shaded_color((uchar *)wcol->inner, -16);
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
- gl_shaded_color((unsigned char *)wcol->inner, -24);
+ gl_shaded_color((uchar *)wcol->inner, -24);
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
- gl_shaded_color((unsigned char *)wcol->inner, -50);
+ gl_shaded_color((uchar *)wcol->inner, -50);
immBegin(GPU_PRIM_LINES, 4);
immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy));
immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy));
@@ -1795,7 +1810,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
GPU_blend(true);
/* Curve filled. */
- immUniformColor3ubvAlpha((unsigned char *)wcol->item, 128);
+ immUniformColor3ubvAlpha((uchar *)wcol->item, 128);
GPU_polygon_smooth(true);
immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4);
immVertex2f(pos, line_range.xmin, rect->ymin);
@@ -1813,7 +1828,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* Curve line. */
GPU_line_width(1.0f);
- immUniformColor3ubvAlpha((unsigned char *)wcol->item, 255);
+ immUniformColor3ubvAlpha((uchar *)wcol->item, 255);
GPU_line_smooth(true);
immBegin(GPU_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2);
immVertex2f(pos, line_range.xmin, line_range.ymin);
@@ -1836,18 +1851,25 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+ /* Calculate vertex colors based on text theme. */
+ float color_vert[4], color_vert_select[4];
+ UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
+ UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
+ if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
+ interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
+ }
+ if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
+ /* Ensure brightest text color is used for selection. */
+ swap_v3_v3(color_vert, color_vert_select);
+ }
+
cmp = cuma->curve;
GPU_point_size(max_ff(1.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
immBegin(GPU_PRIM_POINTS, cuma->totpoint);
for (int a = 0; a < cuma->totpoint; a++) {
- float color[4];
- if (cmp[a].flag & CUMA_SELECT)
- UI_GetThemeColor4fv(TH_TEXT_HI, color);
- else
- UI_GetThemeColor4fv(TH_TEXT, color);
float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
- immAttr4fv(col, color);
+ immAttr4fv(col, (cmp[a].flag & CUMA_SELECT) ? color_vert_select : color_vert);
immVertex2f(pos, fx, fy);
}
immEnd();
@@ -1861,13 +1883,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor3ubv((unsigned char *)wcol->outline);
+ immUniformColor3ubv((uchar *)wcol->outline);
imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUnbindProgram();
}
-void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
+void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
bool ok = false;
MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
@@ -1876,7 +1898,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
int width = BLI_rctf_size_x(&rect) + 1;
@@ -2000,7 +2022,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
GPU_blend(false);
}
-void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
+void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
static const float size = 5.0f;
@@ -2009,7 +2031,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
-0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
- -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
+ -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f,
};
/* 16 values of cos function */
const float co[16] = {
@@ -2028,7 +2050,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
.xmin = recti->xmin,
.ymin = recti->ymin,
.xmax = recti->xmax,
- .ymax = recti->ymax
+ .ymax = recti->ymax,
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
@@ -2076,7 +2098,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
* would replace / modify the following 3 functions - merwin
*/
-static void ui_shadowbox(unsigned pos, unsigned color, float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha)
+static void ui_shadowbox(uint pos, uint color, float minx, float miny, float maxx, float maxy, float shadsize, uchar alpha)
{
/**
* <pre>
@@ -2139,7 +2161,7 @@ static void ui_shadowbox(unsigned pos, unsigned color, float minx, float miny, f
immVertex2fv(pos, v3);
}
-void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
+void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float maxy)
{
GPU_blend(true);
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 3a799c6e7db..112fde4a15c 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "BLI_blenlib.h"
-#include "BLI_math_vector.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -59,7 +52,7 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
{EYE_MODAL_SAMPLE_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
{EYE_MODAL_SAMPLE_BEGIN, "SAMPLE_BEGIN", 0, "Start Sampling", ""},
{EYE_MODAL_SAMPLE_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper Modal Map");
@@ -73,7 +66,6 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
/* assign to operators */
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_colorband");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_color");
- WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_color_crypto");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_id");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_depth");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_driver");
@@ -88,7 +80,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
{EYE_MODAL_POINT_SAMPLE, "SAMPLE_SAMPLE", 0, "Sample a point", ""},
{EYE_MODAL_POINT_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
{EYE_MODAL_POINT_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper ColorBand PointSampling Map");
diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index 8e80d5657d7..e2f85c4d7cc 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_color.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (RGB Color)
*
@@ -36,7 +32,6 @@
#include "DNA_screen_types.h"
#include "BLI_math_vector.h"
-#include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_main.h"
@@ -53,6 +48,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "RNA_define.h"
+
#include "interface_intern.h"
#include "ED_image.h"
@@ -67,25 +64,24 @@ typedef struct Eyedropper {
PointerRNA ptr;
PropertyRNA *prop;
int index;
+ bool is_undo;
+ bool is_set;
float init_col[3]; /* for resetting on cancel */
bool accum_start; /* has mouse been pressed */
float accum_col[3];
int accum_tot;
- bool accumulate; /* Color picking for cryptomatte, without accumulation. */
+ bool use_accum;
} Eyedropper;
static bool eyedropper_init(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
- Eyedropper *eye;
+ Eyedropper *eye = MEM_callocN(sizeof(Eyedropper), __func__);
+ eye->use_accum = RNA_boolean_get(op->ptr, "use_accumulate");
- op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper");
- eye->accumulate = !STREQ(op->type->idname, "UI_OT_eyedropper_color_crypto");
-
- UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
+ uiBut *but = UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
if ((eye->ptr.data == NULL) ||
(eye->prop == NULL) ||
@@ -93,23 +89,28 @@ static bool eyedropper_init(bContext *C, wmOperator *op)
(RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
(RNA_property_type(eye->prop) != PROP_FLOAT))
{
+ MEM_freeN(eye);
return false;
}
+ op->customdata = eye;
+
+ eye->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+ float col[4];
+ RNA_property_float_get_array(&eye->ptr, eye->prop, col);
if (RNA_property_subtype(eye->prop) != PROP_COLOR) {
+ Scene *scene = CTX_data_scene(C);
const char *display_device;
- float col[4];
display_device = scene->display_settings.display_device;
eye->display = IMB_colormanagement_display_get_named(display_device);
/* store initial color */
- RNA_property_float_get_array(&eye->ptr, eye->prop, col);
if (eye->display) {
IMB_colormanagement_display_to_scene_linear_v3(col, eye->display);
}
- copy_v3_v3(eye->init_col, col);
}
+ copy_v3_v3(eye->init_col, col);
return true;
}
@@ -207,6 +208,7 @@ static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3
}
RNA_property_float_set_array(&eye->ptr, eye->prop, col_conv);
+ eye->is_set = true;
RNA_property_update(C, &eye->ptr, eye->prop);
}
@@ -217,7 +219,7 @@ static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my
float col[3];
eyedropper_color_sample_fl(C, mx, my, col);
- if (eye->accumulate) {
+ if (eye->use_accum) {
add_v3_v3(eye->accum_col, col);
eye->accum_tot++;
}
@@ -240,7 +242,9 @@ static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my
static void eyedropper_cancel(bContext *C, wmOperator *op)
{
Eyedropper *eye = op->customdata;
- eyedropper_color_set(C, eye, eye->init_col);
+ if (eye->is_set) {
+ eyedropper_color_set(C, eye, eye->init_col);
+ }
eyedropper_exit(C, op);
}
@@ -256,11 +260,15 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
eyedropper_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = eye->is_undo;
if (eye->accum_tot == 0) {
eyedropper_color_sample(C, eye, event->x, event->y);
}
eyedropper_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
eye->accum_start = true;
@@ -296,7 +304,6 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
return OPERATOR_RUNNING_MODAL;
}
else {
- eyedropper_exit(C, op);
return OPERATOR_PASS_THROUGH;
}
}
@@ -341,23 +348,12 @@ void UI_OT_eyedropper_color(wmOperatorType *ot)
ot->poll = eyedropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
-}
-
-void UI_OT_eyedropper_color_crypto(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Cryptomatte Eyedropper";
- ot->idname = "UI_OT_eyedropper_color_crypto";
- ot->description = "Pick a color from Cryptomatte node Pick output image";
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
- /* api callbacks */
- ot->invoke = eyedropper_invoke;
- ot->modal = eyedropper_modal;
- ot->cancel = eyedropper_cancel;
- ot->exec = eyedropper_exec;
- ot->poll = eyedropper_poll;
+ /* properties */
+ PropertyRNA *prop;
- /* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ /* Needed for color picking with crypto-matte. */
+ prop = RNA_def_boolean(ot->srna, "use_accumulate", true, "Accumulate", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c
index f414d524cd8..98dbb31d049 100644
--- a/source/blender/editors/interface/interface_eyedropper_colorband.c
+++ b/source/blender/editors/interface/interface_eyedropper_colorband.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_colorband.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (Color Band).
*
@@ -72,6 +68,8 @@ typedef struct EyedropperColorband {
ColorBand *color_band;
PointerRNA ptr;
PropertyRNA *prop;
+ bool is_undo;
+ bool is_set;
} EyedropperColorband;
/* For user-data only. */
@@ -83,7 +81,6 @@ struct EyedropperColorband_Context {
static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
{
ColorBand *band = NULL;
- EyedropperColorband *eye;
uiBut *but = UI_context_active_but_get(C);
@@ -99,10 +96,11 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
band = (ColorBand *)but->custom_data;
}
- if (!band)
+ if (!band) {
return false;
+ }
- op->customdata = eye = MEM_callocN(sizeof(EyedropperColorband), __func__);
+ EyedropperColorband *eye = MEM_callocN(sizeof(EyedropperColorband), __func__);
eye->color_buffer_alloc = 16;
eye->color_buffer = MEM_mallocN(sizeof(*eye->color_buffer) * eye->color_buffer_alloc, __func__);
eye->color_buffer_len = 0;
@@ -110,6 +108,9 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
eye->init_color_band = *eye->color_band;
eye->ptr = ((Colorband_RNAUpdateCb *)but->func_argN)->ptr;
eye->prop = ((Colorband_RNAUpdateCb *)but->func_argN)->prop;
+ eye->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+
+ op->customdata = eye;
return true;
}
@@ -128,6 +129,7 @@ static void eyedropper_colorband_sample_point(bContext *C, EyedropperColorband *
eye->color_buffer_len += 1;
eye->last_x = mx;
eye->last_y = my;
+ eye->is_set = true;
}
}
@@ -168,14 +170,17 @@ static void eyedropper_colorband_apply(bContext *C, wmOperator *op)
/* Always filter, avoids noise in resulting color-band. */
bool filter_samples = true;
BKE_colorband_init_from_table_rgba(eye->color_band, eye->color_buffer, eye->color_buffer_len, filter_samples);
+ eye->is_set = true;
RNA_property_update(C, &eye->ptr, eye->prop);
}
static void eyedropper_colorband_cancel(bContext *C, wmOperator *op)
{
EyedropperColorband *eye = op->customdata;
- *eye->color_band = eye->init_color_band;
- RNA_property_update(C, &eye->ptr, eye->prop);
+ if (eye->is_set) {
+ *eye->color_band = eye->init_color_band;
+ RNA_property_update(C, &eye->ptr, eye->prop);
+ }
eyedropper_colorband_exit(C, op);
}
@@ -190,10 +195,14 @@ static int eyedropper_colorband_modal(bContext *C, wmOperator *op, const wmEvent
eyedropper_colorband_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = eye->is_undo;
eyedropper_colorband_sample_segment(C, eye, event->x, event->y);
eyedropper_colorband_apply(C, op);
eyedropper_colorband_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
eye->sample_start = true;
@@ -266,7 +275,6 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven
return OPERATOR_RUNNING_MODAL;
}
else {
- eyedropper_colorband_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -311,7 +319,7 @@ void UI_OT_eyedropper_colorband(wmOperatorType *ot)
ot->poll = eyedropper_colorband_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
@@ -321,7 +329,7 @@ void UI_OT_eyedropper_colorband_point(wmOperatorType *ot)
/* identifiers */
ot->name = "Eyedropper colorband (points)";
ot->idname = "UI_OT_eyedropper_colorband_point";
- ot->description = "Pointsample a color band";
+ ot->description = "Point-sample a color band";
/* api callbacks */
ot->invoke = eyedropper_colorband_invoke;
@@ -331,7 +339,7 @@ void UI_OT_eyedropper_colorband_point(wmOperatorType *ot)
ot->poll = eyedropper_colorband_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index 781032ef971..ffd8f672622 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_datablock.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (ID data-blocks)
*
@@ -37,7 +33,6 @@
#include "DNA_object_types.h"
#include "BLI_string.h"
-#include "BLI_math_vector.h"
#include "BLT_translation.h"
@@ -68,6 +63,7 @@ typedef struct DataDropper {
PropertyRNA *prop;
short idcode;
const char *idcode_name;
+ bool is_undo;
ID *init_id; /* for resetting on cancel */
@@ -86,7 +82,6 @@ static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg
static int datadropper_init(bContext *C, wmOperator *op)
{
- DataDropper *ddr;
int index_dummy;
StructRNA *type;
@@ -96,17 +91,21 @@ static int datadropper_init(bContext *C, wmOperator *op)
st = BKE_spacetype_from_id(SPACE_VIEW3D);
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
- op->customdata = ddr = MEM_callocN(sizeof(DataDropper), "DataDropper");
+ DataDropper *ddr = MEM_callocN(sizeof(DataDropper), __func__);
- UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
(RNA_property_type(ddr->prop) != PROP_POINTER))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
+
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
ddr->art = art;
ddr->draw_handle_pixel = ED_region_draw_cb_activate(art, datadropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
@@ -114,7 +113,8 @@ static int datadropper_init(bContext *C, wmOperator *op)
type = RNA_property_pointer_type(&ddr->ptr, ddr->prop);
ddr->idcode = RNA_type_to_ID_code(type);
BLI_assert(ddr->idcode != 0);
- /* Note we can translate here (instead of on draw time), because this struct has very short lifetime. */
+ /* Note we can translate here (instead of on draw time),
+ * because this struct has very short lifetime. */
ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode));
PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop);
@@ -145,7 +145,6 @@ static void datadropper_exit(bContext *C, wmOperator *op)
/* *** datadropper id helper functions *** */
/**
* \brief get the ID from the screen.
- *
*/
static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int my, ID **r_id)
{
@@ -252,13 +251,12 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
{
- bool success;
-
- success = datadropper_id_sample(C, ddr, event->x, event->y);
+ const bool is_undo = ddr->is_undo;
+ const bool success = datadropper_id_sample(C, ddr, event->x, event->y);
datadropper_exit(C, op);
-
if (success) {
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
else {
BKE_report(op->reports, RPT_WARNING, "Failed to set value");
@@ -288,7 +286,6 @@ static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
return OPERATOR_RUNNING_MODAL;
}
else {
- datadropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -348,7 +345,7 @@ void UI_OT_eyedropper_id(wmOperatorType *ot)
ot->poll = datadropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c
index 1dae076f930..9e559f65335 100644
--- a/source/blender/editors/interface/interface_eyedropper_depth.c
+++ b/source/blender/editors/interface/interface_eyedropper_depth.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_depth.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* This file defines an eyedropper for picking 3D depth value (primary use is depth-of-field).
*
@@ -41,7 +37,6 @@
#include "BLI_math_vector.h"
#include "BKE_context.h"
-#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_unit.h"
@@ -67,7 +62,9 @@
typedef struct DepthDropper {
PointerRNA ptr;
PropertyRNA *prop;
+ bool is_undo;
+ bool is_set;
float init_depth; /* for resetting on cancel */
bool accum_start; /* has mouse been presed */
@@ -89,7 +86,6 @@ static void depthdropper_draw_cb(const struct bContext *C, ARegion *ar, void *ar
static int depthdropper_init(bContext *C, wmOperator *op)
{
- DepthDropper *ddr;
int index_dummy;
SpaceType *st;
@@ -98,9 +94,9 @@ static int depthdropper_init(bContext *C, wmOperator *op)
st = BKE_spacetype_from_id(SPACE_VIEW3D);
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
- op->customdata = ddr = MEM_callocN(sizeof(DepthDropper), "DepthDropper");
+ DepthDropper *ddr = MEM_callocN(sizeof(DepthDropper), __func__);
- UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
/* fallback to the active camera's dof */
if (ddr->prop == NULL) {
@@ -110,17 +106,23 @@ static int depthdropper_init(bContext *C, wmOperator *op)
if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
+ ddr->is_undo = true;
}
}
}
+ else {
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+ }
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
(RNA_property_type(ddr->prop) != PROP_FLOAT))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
ddr->art = art;
ddr->draw_handle_pixel = ED_region_draw_cb_activate(art, depthdropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
@@ -149,7 +151,6 @@ static void depthdropper_exit(bContext *C, wmOperator *op)
/* *** depthdropper id helper functions *** */
/**
* \brief get the ID from the screen.
- *
*/
static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx, int my, float *r_depth)
{
@@ -215,6 +216,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
static void depthdropper_depth_set(bContext *C, DepthDropper *ddr, const float depth)
{
RNA_property_float_set(&ddr->ptr, ddr->prop, depth);
+ ddr->is_set = true;
RNA_property_update(C, &ddr->ptr, ddr->prop);
}
@@ -251,7 +253,9 @@ static void depthdropper_depth_sample_accum(bContext *C, DepthDropper *ddr, int
static void depthdropper_cancel(bContext *C, wmOperator *op)
{
DepthDropper *ddr = op->customdata;
- depthdropper_depth_set(C, ddr, ddr->init_depth);
+ if (ddr->is_set) {
+ depthdropper_depth_set(C, ddr, ddr->init_depth);
+ }
depthdropper_exit(C, op);
}
@@ -267,6 +271,8 @@ static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
depthdropper_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = ddr->is_undo;
if (ddr->accum_tot == 0) {
depthdropper_depth_sample(C, ddr, event->x, event->y);
}
@@ -274,7 +280,9 @@ static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
depthdropper_depth_set_accum(C, ddr);
}
depthdropper_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
ddr->accum_start = true;
@@ -312,7 +320,6 @@ static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_RUNNING_MODAL;
}
else {
- depthdropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -380,7 +387,7 @@ void UI_OT_eyedropper_depth(wmOperatorType *ot)
ot->poll = depthdropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c
index 93719527380..e1f38860721 100644
--- a/source/blender/editors/interface/interface_eyedropper_driver.c
+++ b/source/blender/editors/interface/interface_eyedropper_driver.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_driver.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (Animation Driver Targets).
*
@@ -38,7 +32,6 @@
#include "DNA_screen_types.h"
#include "DNA_object_types.h"
-#include "BLI_math_vector.h"
#include "BKE_context.h"
#include "BKE_animsys.h"
@@ -64,18 +57,16 @@ typedef struct DriverDropper {
PointerRNA ptr;
PropertyRNA *prop;
int index;
+ bool is_undo;
// TODO: new target?
} DriverDropper;
static bool driverdropper_init(bContext *C, wmOperator *op)
{
- DriverDropper *ddr;
- uiBut *but;
+ DriverDropper *ddr = MEM_callocN(sizeof(DriverDropper), __func__);
- op->customdata = ddr = MEM_callocN(sizeof(DriverDropper), "DriverDropper");
-
- but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index);
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
@@ -83,8 +74,12 @@ static bool driverdropper_init(bContext *C, wmOperator *op)
(RNA_property_animateable(&ddr->ptr, ddr->prop) == false) ||
(but->flag & UI_BUT_DRIVEN))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
+
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
return true;
}
@@ -154,18 +149,24 @@ static void driverdropper_cancel(bContext *C, wmOperator *op)
/* main modal status check */
static int driverdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
+ DriverDropper *ddr = op->customdata;
+
/* handle modal keymap */
if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
case EYE_MODAL_CANCEL:
+ {
driverdropper_cancel(C, op);
return OPERATOR_CANCELLED;
-
+ }
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = ddr->is_undo;
driverdropper_sample(C, op, event);
driverdropper_exit(C, op);
-
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
}
}
@@ -185,7 +186,6 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
return OPERATOR_RUNNING_MODAL;
}
else {
- driverdropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -226,7 +226,7 @@ void UI_OT_eyedropper_driver(wmOperatorType *ot)
ot->poll = driverdropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL | OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
RNA_def_enum(ot->srna, "mapping_type", prop_driver_create_mapping_types, 0,
diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h
index 18935c6cc9f..1ce0cb6d3e1 100644
--- a/source/blender/editors/interface/interface_eyedropper_intern.h
+++ b/source/blender/editors/interface/interface_eyedropper_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Share between interface_eyedropper_*.c files.
*/
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9dc1f1e4e24..498e2f07ea4 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_handlers.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <float.h>
@@ -229,10 +223,14 @@ typedef struct uiButMultiState {
typedef struct uiHandleButtonMulti {
enum {
- BUTTON_MULTI_INIT_UNSET = 0, /* gesture direction unknown, wait until mouse has moved enough... */
- BUTTON_MULTI_INIT_SETUP, /* vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
- BUTTON_MULTI_INIT_ENABLE, /* flag buttons finished, apply horizontal motion to active and flagged */
- BUTTON_MULTI_INIT_DISABLE, /* vertical gesture _not_ detected, take no further action */
+ /** gesture direction unknown, wait until mouse has moved enough... */
+ BUTTON_MULTI_INIT_UNSET = 0,
+ /** vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
+ BUTTON_MULTI_INIT_SETUP,
+ /** flag buttons finished, apply horizontal motion to active and flagged */
+ BUTTON_MULTI_INIT_ENABLE,
+ /** vertical gesture _not_ detected, take no further action */
+ BUTTON_MULTI_INIT_DISABLE,
} init;
bool has_mbuts; /* any buttons flagged UI_BUT_DRAG_MULTI */
@@ -241,11 +239,12 @@ typedef struct uiHandleButtonMulti {
bool is_proportional;
- /* In some cases we directly apply the changes to multiple buttons, so we don't want to do it twice. */
+ /* In some cases we directly apply the changes to multiple buttons,
+ * so we don't want to do it twice. */
bool skip;
- /* before activating, we need to check gesture direction
- * accumulate signed cursor movement here so we can tell if this is a vertical motion or not. */
+ /* before activating, we need to check gesture direction accumulate signed cursor movement
+ * here so we can tell if this is a vertical motion or not. */
float drag_dir[2];
/* values copied direct from event->x,y
@@ -288,7 +287,7 @@ typedef struct uiHandleButtonData {
ColorBand *coba;
/* tooltip */
- unsigned int tooltip_force : 1;
+ uint tooltip_force : 1;
/* auto open */
bool used_mouse;
@@ -323,8 +322,10 @@ typedef struct uiHandleButtonData {
CBData *dragcbd;
#ifdef USE_CONT_MOUSE_CORRECT
- /* when ungrabbing buttons which are #ui_but_is_cursor_warp(), we may want to position them
- * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl() to get this into a usable space */
+ /* when ungrabbing buttons which are #ui_but_is_cursor_warp(),
+ * we may want to position them.
+ * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl()
+ * to get this into a usable space. */
float ungrab_mval[2];
#endif
@@ -1125,14 +1126,12 @@ static bool ui_multibut_states_tag(
static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *data)
{
- uiBut *but;
-
BLI_assert(data->multi_data.init == BUTTON_MULTI_INIT_SETUP);
BLI_assert(data->multi_data.has_mbuts);
data->multi_data.bs_mbuts = UI_butstore_create(but_active->block);
- for (but = but_active->block->buttons.first; but; but = but->next) {
+ for (uiBut *but = but_active->block->buttons.first; but; but = but->next) {
if (but->flag & UI_BUT_DRAG_MULTI) {
ui_multibut_add(data, but);
}
@@ -1141,11 +1140,14 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat
/* edit buttons proportionally to eachother
* note: if we mix buttons which are proportional and others which are not,
* this may work a bit strangely */
- if (but_active->rnaprop) {
- if ((data->origvalue != 0.0) && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) {
+ if ((but_active->rnaprop && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) ||
+ ELEM(but_active->unit_type, PROP_UNIT_LENGTH))
+ {
+ if (data->origvalue != 0.0) {
data->multi_data.is_proportional = true;
}
}
+
}
static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBlock *block)
@@ -1236,22 +1238,32 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
}
}
-static bool ui_drag_toggle_but_is_pushed(uiBut *but)
+/* Button pushed state to compare if other buttons match. Can be more
+ * then just true or false for toggle buttons with more than 2 states. */
+static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but)
{
- if (ui_but_is_bool(but)) {
- return ui_but_is_pushed(but);
+ if (but->rnapoin.data == NULL && but->poin == NULL && but->icon) {
+ if (but->pushed_state_func) {
+ return but->pushed_state_func(C, but->pushed_state_arg);
+ }
+ else {
+ /* Assume icon identifies a unique state, for buttons that
+ * work though functions callbacks and don't have an boolean
+ * value that indicates the state. */
+ return but->icon + but->iconadd;
+ }
}
- else if (UI_but_is_decorator(but)) {
- return (but->icon == ICON_DECORATE_KEYFRAME);
+ else if (ui_but_is_bool(but)) {
+ return ui_but_is_pushed(but);
}
else {
- return false;
+ return 0;
}
}
typedef struct uiDragToggleHandle {
/* init */
- bool is_set;
+ int pushed_state;
float but_cent_start[2];
bool is_xy_lock_init;
@@ -1262,7 +1274,7 @@ typedef struct uiDragToggleHandle {
} uiDragToggleHandle;
static bool ui_drag_toggle_set_xy_xy(
- bContext *C, ARegion *ar, const bool is_set,
+ bContext *C, ARegion *ar, const int pushed_state,
const int xy_src[2], const int xy_dst[2])
{
/* popups such as layers won't re-evaluate on redraw */
@@ -1288,8 +1300,8 @@ static bool ui_drag_toggle_set_xy_xy(
/* execute the button */
if (ui_drag_toggle_but_is_supported(but)) {
/* is it pressed? */
- bool is_set_but = ui_drag_toggle_but_is_pushed(but);
- if (is_set_but != is_set) {
+ int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but);
+ if (pushed_state_but != pushed_state) {
UI_but_execute(C, but);
if (do_check) {
ui_but_update_edited(but);
@@ -1334,7 +1346,8 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
BLI_rctf_cent_y(&but->rect),
};
- /* check if this is a different button, chances are high the button wont move about :) */
+ /* check if this is a different button,
+ * chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
@@ -1360,7 +1373,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
/* touch all buttons between last mouse coord and this one */
- do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->is_set, drag_info->xy_last, xy);
+ do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->pushed_state, drag_info->xy_last, xy);
if (do_draw) {
ED_region_tag_redraw(ar);
@@ -1595,18 +1608,22 @@ static void ui_selectcontext_apply(
RNA_property_int_range(&but->rnapoin, prop, &min.i, &max.i);
}
else if (rna_type == PROP_ENUM) {
- delta.i = RNA_property_enum_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.i = RNA_property_enum_get(&but->rnapoin, prop);
}
else if (rna_type == PROP_BOOLEAN) {
if (is_array) {
- delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index);
}
else {
- delta.b = RNA_property_boolean_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get(&but->rnapoin, prop);
}
}
else if (rna_type == PROP_POINTER) {
- delta.p = RNA_property_pointer_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.p = RNA_property_pointer_get(&but->rnapoin, prop);
}
#ifdef USE_ALLSELECT_LAYER_HACK
@@ -1724,8 +1741,13 @@ static bool ui_but_drag_init(
/* prevent other WM gestures to start while we try to drag */
WM_gestures_remove(C);
- if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold * U.dpi_fac) {
+ /* Clamp the maximum to half the UI unit size so a high user preference
+ * doesn't require the user to drag more then half the default button height. */
+ const int drag_threshold = min_ii(
+ U.tweak_threshold * U.dpi_fac,
+ (int)((UI_UNIT_Y / 2) * ui_block_to_window_scale(data->region, but->block)));
+ if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > drag_threshold) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel = true;
#ifdef USE_DRAG_TOGGLE
@@ -1737,7 +1759,7 @@ static bool ui_but_drag_init(
* typically 'button_activate_exit()' handles this */
ui_apply_but_autokey(C, but);
- drag_info->is_set = ui_drag_toggle_but_is_pushed(but);
+ drag_info->pushed_state = ui_drag_toggle_but_pushed_state(C, but);
drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
copy_v2_v2_int(drag_info->xy_init, &event->x);
@@ -2468,7 +2490,6 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
* the cursor position and selection start/end.
*
* \note: remapping is used, because password could contain UTF-8 characters.
- *
*/
static int ui_text_position_from_hidden(uiBut *but, int pos)
@@ -2756,7 +2777,7 @@ static bool ui_textedit_insert_ascii(uiBut *but, uiHandleButtonData *data, char
if (ui_but_is_utf8(but) && (BLI_str_utf8_size(buf) == -1)) {
printf("%s: entering invalid ascii char into an ascii key (%d)\n",
- __func__, (int)(unsigned char)ascii);
+ __func__, (int)(uchar)ascii);
return false;
}
@@ -2911,7 +2932,7 @@ static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData
enum {
UI_TEXTEDIT_PASTE = 1,
UI_TEXTEDIT_COPY,
- UI_TEXTEDIT_CUT
+ UI_TEXTEDIT_CUT,
};
static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const int mode)
@@ -3243,7 +3264,8 @@ static void ui_do_but_textedit(
{
bool had_selection = but->selsta != but->selend;
- /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
+ /* exit on LMB only on RELEASE for searchbox, to mimic other popups,
+ * and allow multiple menu levels */
if (data->searchbox)
inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
@@ -3281,7 +3303,8 @@ static void ui_do_but_textedit(
changed = true;
}
else if (inbox) {
- /* if we allow activation on key press, it gives problems launching operators [#35713] */
+ /* if we allow activation on key press,
+ * it gives problems launching operators T35713. */
if (event->val == KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval = WM_UI_HANDLER_BREAK;
@@ -3740,7 +3763,8 @@ static bool ui_do_but_ANY_drag_toggle(
}
}
else if (data->state == BUTTON_STATE_WAIT_DRAG) {
- /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into its own function */
+ /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into
+ * its own function */
data->applied = false;
*r_retval = ui_do_but_EXIT(C, but, data, event);
return true;
@@ -3900,8 +3924,10 @@ static bool ui_but_is_mouse_over_icon_extra(const ARegion *region, uiBut *but, c
static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
+ const bool is_property = (but->rnaprop != NULL);
+
#ifdef USE_DRAG_TOGGLE
- {
+ if (is_property) {
int retval;
if (ui_do_but_ANY_drag_toggle(C, but, data, event, &retval)) {
return retval;
@@ -3912,7 +3938,7 @@ static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
const int rna_type = but->rnaprop ? RNA_property_type(but->rnaprop) : 0;
- if (but->rnaprop &&
+ if (is_property &&
ELEM(rna_type, PROP_POINTER, PROP_STRING) &&
(but->custom_data != NULL) &&
(event->type == LEFTMOUSE) &&
@@ -3921,9 +3947,12 @@ static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
- else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && (event->val == KM_PRESS)) {
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
+ else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY)) {
+ int event_val = (is_property) ? KM_PRESS : KM_CLICK;
+ if (event->val == event_val) {
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ return WM_UI_HANDLER_BREAK;
+ }
}
}
else if (data->state == BUTTON_STATE_TEXT_EDITING) {
@@ -4020,7 +4049,23 @@ static int ui_do_but_TOG(
#endif
if (data->state == BUTTON_STATE_HIGHLIGHT) {
- if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
+ bool do_activate = false;
+ if (ELEM(event->type, PADENTER, RETKEY)) {
+ if (event->val == KM_PRESS) {
+ do_activate = true;
+ }
+ }
+ else if (event->type == LEFTMOUSE) {
+ if (ui_block_is_menu(but->block)) {
+ /* Behave like other menu items. */
+ do_activate = (event->val == KM_RELEASE);
+ }
+ else {
+ do_activate = (event->val == KM_PRESS);
+ }
+ }
+
+ if (do_activate) {
#if 0 /* UNUSED */
data->togdual = event->ctrl;
data->togonly = !event->shift;
@@ -4295,7 +4340,8 @@ static bool ui_numedit_but_NUM(
float non_linear_pixel_map;
float non_linear_scale;
- /* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
+ /* Use a non-linear mapping of the mouse drag especially for large floats
+ * (normal behavior) */
deler = 500;
if (is_float) {
/* not needed for smaller float buttons */
@@ -4437,8 +4483,10 @@ static int ui_do_but_NUM(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
but->drawflag &= ~UI_BUT_ACTIVE_RIGHT;
@@ -4739,8 +4787,10 @@ static int ui_do_but_SLI(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
click = 2;
@@ -4755,7 +4805,8 @@ static int ui_do_but_SLI(
retval = WM_UI_HANDLER_BREAK;
}
#ifndef USE_ALLSELECT
- /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons, and match wheel usage above */
+ /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons,
+ * and match wheel usage above */
else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = BLI_rctf_cent_x(&but->rect);
click = 2;
@@ -4860,7 +4911,8 @@ static int ui_do_but_SLI(
#if 0
if (but->type == SLI) {
- f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */
+ /* same as below */
+ f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect));
}
else
#endif
@@ -6091,7 +6143,8 @@ static bool ui_numedit_but_CURVE(
int a;
bool changed = false;
- /* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */
+ /* evtx evty and drag coords are absolute mousecoords,
+ * prevents errors when editing when layout changes */
mx = evtx;
my = evty;
ui_window_to_block(data->region, block, &mx, &my);
@@ -6260,7 +6313,8 @@ static int ui_do_but_CURVE(
changed = true;
- /* reset cmp back to the curve points again, rather than drawing segments */
+ /* reset cmp back to the curve points again,
+ * rather than drawing segments */
cmp = cuma->curve;
/* find newly added point and make it 'sel' */
@@ -7180,7 +7234,8 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but)
}
}
-/* removes tooltip timer from active but (meaning tooltip is disabled until it's reenabled again) */
+/* removes tooltip timer from active but
+ * (meaning tooltip is disabled until it's reenabled again) */
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
{
uiHandleButtonData *data;
@@ -7988,7 +8043,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
uiBut *but_other = ui_but_find_mouse_over(ar, event);
bool exit = false;
- /* always deactivate button for pie menus, else moving to blank space will leave activated */
+ /* always deactivate button for pie menus,
+ * else moving to blank space will leave activated */
if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) &&
!ui_but_contains_point_px(ar, but, event->x, event->y))
{
@@ -8012,18 +8068,20 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
case TIMER:
{
- /* handle menu auto open timer */
+ /* Handle menu auto open timer. */
if (event->customdata == data->autoopentimer) {
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer = NULL;
- if (ui_but_contains_point_px(ar, but, event->x, event->y))
+ if (ui_but_contains_point_px(ar, but, event->x, event->y) || but->active) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
+ }
}
break;
}
- /* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
+ /* XXX hardcoded keymap check... but anyway,
+ * while view changes, tooltips should be removed */
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
case MIDDLEMOUSE:
@@ -8140,6 +8198,17 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
break;
}
+ case RIGHTMOUSE:
+ {
+ if (event->val == KM_PRESS) {
+ uiBut *bt = ui_but_find_mouse_over(ar, event);
+ if (bt && bt->active == data) {
+ button_activate_state(C, bt, BUTTON_STATE_HIGHLIGHT);
+ }
+ }
+ break;
+ }
+
}
ui_do_button(C, block, but, event);
@@ -8249,7 +8318,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
}
if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) {
- /* If we have a display order different from collection order, we have some work! */
+ /* If we have a display order different from
+ * collection order, we have some work! */
int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__);
const int *new_order = dyn_data->items_filter_neworder;
int i, org_idx = -1, len = dyn_data->items_len;
@@ -8389,7 +8459,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
/* ************************* menu handling *******************************/
/**
- * Function used to prevent losing the open menu when using nested pulldowns,
+ * Function used to prevent losing the open menu when using nested pull-downs,
* when moving mouse towards the pulldown menu over other buttons that could
* steal the highlight from the current button, only checks:
*
@@ -8785,7 +8855,29 @@ static int ui_handle_menu_event(
switch (event->type) {
- /* closing sublevels of pulldowns */
+ /* Closing sub-levels of pull-downs.
+ *
+ * The actual event is handled by the button under the cursor.
+ * This is done so we can right click on menu items even when they have sub-menus open. */
+ case RIGHTMOUSE:
+ if (inside == false) {
+ if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+ if (block->saferct.first) {
+ /* Currently right clicking on a top level pull-down (typically in the header)
+ * just closes the menu and doesn't support immediately handling the RMB event.
+ *
+ * To support we would need UI_RETURN_OUT_PARENT to be handled by
+ * top-level buttons, not just menus. Note that this isn't very important
+ * since it's easy to manually close these menus by clicking on them. */
+ menu->menuretval = (level > 0) ? UI_RETURN_OUT_PARENT : UI_RETURN_OUT;
+
+ }
+ }
+ retval = WM_UI_HANDLER_BREAK;
+ }
+ break;
+
+ /* Closing sub-levels of pull-downs. */
case LEFTARROWKEY:
if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP))
if (block->saferct.first)
@@ -8794,7 +8886,7 @@ static int ui_handle_menu_event(
retval = WM_UI_HANDLER_BREAK;
break;
- /* opening sublevels of pulldowns */
+ /* Opening sub-levels of pull-downs. */
case RIGHTARROWKEY:
if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
@@ -8985,7 +9077,7 @@ static int ui_handle_menu_event(
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
}
else if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) {
- /* open submenus (like right arrow key) */
+ /* open sub-menus (like right arrow key) */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
else if (but->type == UI_BTYPE_MENU) {
@@ -9009,13 +9101,16 @@ static int ui_handle_menu_event(
/* here we check return conditions for menus */
if (block->flag & UI_BLOCK_LOOP) {
- /* if we click outside the block, verify if we clicked on the
+ /* If we click outside the block, verify if we clicked on the
* button that opened us, otherwise we need to close,
*
* note that there is an exception for root level menus and
* popups which you can click again to close.
+ *
+ * Events handled above may have already set the return value,
+ * don't overwrite them, see: T61015.
*/
- if (inside == 0) {
+ if ((inside == 0) && (menu->menuretval == 0)) {
uiSafetyRct *saferct = block->saferct.first;
if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
@@ -9035,7 +9130,8 @@ static int ui_handle_menu_event(
}
}
else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) {
- /* For buttons that use a hold function, exit when mouse-up outside the menu. */
+ /* For buttons that use a hold function,
+ * exit when mouse-up outside the menu. */
if (block->flag & UI_BLOCK_POPUP_HOLD) {
/* Note, we could check the cursor is over the parent button. */
menu->menuretval = UI_RETURN_CANCEL;
@@ -9050,12 +9146,12 @@ static int ui_handle_menu_event(
}
#ifdef USE_KEYNAV_LIMIT
else if ((event->type == MOUSEMOVE) && ui_mouse_motion_keynav_test(&menu->keynav_state, event)) {
- /* don't handle the mousemove if we're using key-navigation */
+ /* Don't handle the mouse-move if we're using key-navigation. */
retval = WM_UI_HANDLER_BREAK;
}
#endif
else if (event->type == ESCKEY && event->val == KM_PRESS) {
- /* esc cancels this and all preceding menus */
+ /* Escape cancels this and all preceding menus. */
menu->menuretval = UI_RETURN_CANCEL;
}
else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) {
@@ -9288,7 +9384,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
bool is_click_style;
float dist;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
if (event->type == EVT_DROP) {
@@ -9318,6 +9415,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]);
+ /* Distance from initial point. */
dist = ui_block_calc_pie_segment(block, event_xy);
if (but && button_modal_state(but->active->state)) {
@@ -9402,8 +9500,9 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
ED_region_tag_redraw(ar);
}
else {
- /* distance from initial point */
- if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
+ if ((duration < 0.01 * U.pie_tap_timeout) &&
+ !(block->pie_data.flags & UI_PIE_DRAG_STYLE))
+ {
block->pie_data.flags |= UI_PIE_CLICK_STYLE;
}
else {
@@ -9435,7 +9534,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
- /* here instead, we use the offset location to account for the initial direction timeout */
+ /* here instead, we use the offset location to account for the initial
+ * direction timeout */
if ((U.pie_menu_confirm > 0) &&
(dist >= U.dpi_fac * (U.pie_menu_threshold + U.pie_menu_confirm)))
{
@@ -9553,7 +9653,8 @@ static int ui_handle_menus_recursive(
uiBlock *block = menu->region->uiblocks.first;
const bool is_menu = ui_block_is_menu(block);
bool inside = false;
- /* root pie menus accept the key that spawned them as double click to improve responsiveness */
+ /* root pie menus accept the key that spawned
+ * them as double click to improve responsiveness */
bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || event->type != block->pie_data.event);
if (do_recursion) {
@@ -9753,7 +9854,8 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
data = but->active;
if ((data->state == BUTTON_STATE_MENU_OPEN) &&
- (is_inside_menu == false) && /* make sure mouse isn't inside another menu (see T43247) */
+ /* make sure mouse isn't inside another menu (see T43247) */
+ (is_inside_menu == false) &&
(ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER)) &&
(but_other = ui_but_find_mouse_over(ar, event)) &&
(but != but_other) &&
@@ -9817,7 +9919,8 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
{
uiPopupBlockHandle *menu = userdata;
struct ARegion *menu_region;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
bool reset_pie = false;
@@ -9929,22 +10032,26 @@ void UI_popup_handlers_add(bContext *C, ListBase *handlers, uiPopupBlockHandle *
void UI_popup_handlers_remove(ListBase *handlers, uiPopupBlockHandle *popup)
{
- wmEventHandler *handler;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
- for (handler = handlers->first; handler; handler = handler->next) {
- if (handler->ui_handle == ui_popup_handler &&
- handler->ui_remove == ui_popup_handler_remove &&
- handler->ui_userdata == popup)
- {
- /* tag refresh parent popup */
- if (handler->next &&
- handler->next->ui_handle == ui_popup_handler &&
- handler->next->ui_remove == ui_popup_handler_remove)
+ if (handler->handle_fn == ui_popup_handler &&
+ handler->remove_fn == ui_popup_handler_remove &&
+ handler->user_data == popup)
{
- uiPopupBlockHandle *parent_popup = handler->next->ui_userdata;
- ED_region_tag_refresh_ui(parent_popup->region);
+ /* tag refresh parent popup */
+ wmEventHandler_UI *handler_next = (wmEventHandler_UI *)handler->head.next;
+ if (handler_next &&
+ handler_next->head.type == WM_HANDLER_TYPE_UI &&
+ handler_next->handle_fn == ui_popup_handler &&
+ handler_next->remove_fn == ui_popup_handler_remove)
+ {
+ uiPopupBlockHandle *parent_popup = handler_next->user_data;
+ ED_region_tag_refresh_ui(parent_popup->region);
+ }
+ break;
}
- break;
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index f371bae77c0..ae9ee152d0f 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: Blender Foundation, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_icons.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <math.h>
@@ -97,8 +91,8 @@
typedef struct IconImage {
int w;
int h;
- unsigned int *rect;
- unsigned char *datatoc_rect;
+ uint *rect;
+ uchar *datatoc_rect;
int datatoc_size;
} IconImage;
@@ -209,7 +203,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
if (bbuf) {
int y, imgsize;
- iimg->rect = MEM_mallocN(size * size * sizeof(unsigned int), "icon_rect");
+ iimg->rect = MEM_mallocN(size * size * sizeof(uint), "icon_rect");
/* Here we store the rect in the icon - same as before */
if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0)
@@ -402,15 +396,15 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU
/* XXX: Include alpha into this... */
/* normal */
- immUniformColor3ubv((unsigned char *)cs->solid);
+ immUniformColor3ubv((uchar *)cs->solid);
immRecti(pos, x, y, a, y + h);
/* selected */
- immUniformColor3ubv((unsigned char *)cs->select);
+ immUniformColor3ubv((uchar *)cs->select);
immRecti(pos, a, y, b, y + h);
/* active */
- immUniformColor3ubv((unsigned char *)cs->active);
+ immUniformColor3ubv((uchar *)cs->active);
immRecti(pos, b, y, c, y + h);
immUnbindProgram();
@@ -474,7 +468,7 @@ static void init_brush_icons(void)
#define INIT_BRUSH_ICON(icon_id, name) \
{ \
- unsigned char *rect = (unsigned char *)datatoc_ ##name## _png; \
+ uchar *rect = (uchar *)datatoc_ ##name## _png; \
int size = datatoc_ ##name## _png_size; \
DrawInfo *di; \
\
@@ -709,7 +703,10 @@ static void init_internal_icons(void)
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
- bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */
+
+ /* if the image is missing bbuf will just be NULL */
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL);
+
if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf);
@@ -722,13 +719,13 @@ static void init_internal_icons(void)
}
#endif
if (b16buf == NULL)
- b16buf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons16_png,
+ b16buf = IMB_ibImageFromMemory((uchar *)datatoc_blender_icons16_png,
datatoc_blender_icons16_png_size, IB_rect, NULL, "<blender icons>");
if (b16buf)
IMB_premultiply_alpha(b16buf);
if (b32buf == NULL)
- b32buf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons32_png,
+ b32buf = IMB_ibImageFromMemory((uchar *)datatoc_blender_icons32_png,
datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>");
if (b32buf)
IMB_premultiply_alpha(b32buf);
@@ -1069,7 +1066,7 @@ int UI_preview_render_size(enum eIconSizes size)
*/
static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
{
- unsigned int render_size = UI_preview_render_size(size);
+ uint render_size = UI_preview_render_size(size);
if (!prv_img) {
if (G.debug & G_DEBUG)
@@ -1080,7 +1077,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
prv_img->h[size] = render_size;
prv_img->flag[size] |= PRV_CHANGED;
prv_img->changed_timestamp[size] = 0;
- prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(unsigned int), "prv_rect");
+ prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(uint), "prv_rect");
}
}
@@ -1262,7 +1259,7 @@ PreviewImage *UI_icon_to_preview(int icon_id)
}
static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh,
- unsigned int *rect, float alpha, const float rgb[3], const float desaturate)
+ uint *rect, float alpha, const float rgb[3], const float desaturate)
{
ImBuf *ima = NULL;
int draw_w = w;
@@ -1302,16 +1299,13 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
/* first allocate imbuf for scaling and copy preview into it */
ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
- memcpy(ima->rect, rect, rw * rh * sizeof(unsigned int));
+ memcpy(ima->rect, rect, rw * rh * sizeof(uint));
IMB_scaleImBuf(ima, draw_w, draw_h); /* scale it */
rect = ima->rect;
}
- /* We need to flush widget base first to ensure correct ordering. */
- UI_widgetbase_draw_cache_flush();
-
/* draw */
- GPUBuiltinShader shader;
+ eGPUBuiltinShader shader;
if (desaturate != 0.0f) {
shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR;
}
@@ -1373,8 +1367,8 @@ static void icon_draw_cache_flush_ex(void)
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR);
GPU_shader_bind(shader);
- int img_loc = GPU_shader_get_uniform(shader, "image");
- int data_loc = GPU_shader_get_uniform(shader, "calls_data[0]");
+ int img_loc = GPU_shader_get_uniform_ensure(shader, "image");
+ int data_loc = GPU_shader_get_uniform_ensure(shader, "calls_data[0]");
glUniform1i(img_loc, 0);
glUniform4fv(data_loc, ICON_DRAW_CACHE_SIZE * 3, (float *)g_icon_draw_cache.drawcall_cache);
@@ -1462,9 +1456,9 @@ static void icon_draw_texture(
if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha);
else glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
- glUniform1i(GPU_shader_get_uniform(shader, "image"), 0);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), x1, y1, x2, y2);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), x, y, x + w, y + h);
+ glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), x1, y1, x2, y2);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), x, y, x + w, y + h);
GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4);
@@ -1513,19 +1507,18 @@ static void icon_draw_size(
DrawInfo *di = icon_ensure_drawinfo(icon);
+ /* We need to flush widget base first to ensure correct ordering. */
+ UI_widgetbase_draw_cache_flush();
+
if (di->type == ICON_TYPE_VECTOR) {
- /* We need to flush widget base first to ensure correct ordering. */
- UI_widgetbase_draw_cache_flush();
/* vector icons use the uiBlock transformation, they are not drawn
* with untransformed coordinates like the other icons */
di->data.vector.func((int)x, (int)y, w, h, 1.0f);
}
else if (di->type == ICON_TYPE_GEOM) {
- /* We need to flush widget base first to ensure correct ordering. */
- UI_widgetbase_draw_cache_flush();
-
#ifdef USE_UI_TOOLBAR_HACK
- /* TODO(campbell): scale icons up for toolbar, we need a way to detect larger buttons and do this automatic. */
+ /* TODO(campbell): scale icons up for toolbar,
+ * we need a way to detect larger buttons and do this automatic. */
{
float scale = (float)ICON_DEFAULT_HEIGHT_TOOLBAR / (float)ICON_DEFAULT_HEIGHT;
y = (y + (h / 2)) - ((h * scale) / 2);
@@ -1547,7 +1540,8 @@ static void icon_draw_size(
ibuf = BKE_icon_geom_rasterize(icon->obj, w, h);
di->data.geom.image_cache = ibuf;
}
- glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, w, h, ibuf->rect, alpha, rgb, desaturate);
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
@@ -1591,9 +1585,7 @@ static void icon_draw_size(
#endif
if (!iimg->rect) return; /* something has gone wrong! */
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, desaturate);
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
else if (di->type == ICON_TYPE_PREVIEW) {
PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
@@ -1602,9 +1594,8 @@ static void icon_draw_size(
/* no create icon on this level in code */
if (!pi->rect[size]) return; /* something has gone wrong! */
- /* preview images use premul alpha ... */
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
-
+ /* Preview images use premultiplied alpha. */
+ GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, rgb, desaturate);
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
@@ -1612,9 +1603,6 @@ static void icon_draw_size(
else if (di->type == ICON_TYPE_GPLAYER) {
BLI_assert(icon->obj != NULL);
- /* We need to flush widget base first to ensure correct ordering. */
- UI_widgetbase_draw_cache_flush();
-
/* Just draw a colored rect - Like for vicon_colorset_draw() */
#ifndef WITH_HEADLESS
vicon_gplayer_color_draw(icon, (int)x, (int)y, w, h);
@@ -1625,7 +1613,8 @@ static void icon_draw_size(
static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
{
- if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) { /* changed only ever set by dynamic icons */
+ /* changed only ever set by dynamic icons */
+ if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) {
/* create the rect if necessary */
icon_set_image(C, scene, id, pi, size, use_job);
@@ -1638,10 +1627,14 @@ void UI_id_icon_render(const bContext *C, Scene *scene, ID *id, const bool big,
PreviewImage *pi = BKE_previewimg_id_ensure(id);
if (pi) {
- if (big)
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job); /* bigger preview size */
- else
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job); /* icon size */
+ if (big) {
+ /* bigger preview size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job);
+ }
+ else {
+ /* icon size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job);
+ }
}
}
@@ -1894,7 +1887,7 @@ int UI_idcode_icon_get(const int idcode)
case ID_MB:
return ICON_META_DATA;
case ID_MC:
- return ICON_CLIP;
+ return ICON_TRACKER;
case ID_ME:
return ICON_MESH_DATA;
case ID_MSK:
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c
index 598adcce87f..e77b47d19e5 100644
--- a/source/blender/editors/interface/interface_icons_event.c
+++ b/source/blender/editors/interface/interface_icons_event.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_icons_event.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* A special set of icons to represent input devices,
* this is a mix of text (via fonts) and a handful of custom glyphs for special keys.
@@ -41,7 +37,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_math_vector.h"
#include "DNA_brush_types.h"
@@ -55,8 +50,6 @@
#include "RNA_access.h"
#include "RNA_enum_types.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_appdir.h"
#include "BKE_studiolight.h"
@@ -65,7 +58,6 @@
#include "IMB_imbuf_types.h"
#include "IMB_thumbs.h"
-#include "BIF_glutil.h"
#include "BLF_api.h"
#include "DEG_depsgraph.h"
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 24fb68dba0c..82d6115fbbb 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -39,19 +31,19 @@
#include "DNA_listBase.h"
struct ARegion;
+struct ID;
+struct ImBuf;
+struct Scene;
struct bContext;
+struct bContextStore;
struct uiHandleButtonData;
+struct uiLayout;
+struct uiStyle;
+struct uiWidgetColors;
struct wmEvent;
struct wmKeyConfig;
struct wmOperatorType;
struct wmTimer;
-struct uiStyle;
-struct uiWidgetColors;
-struct uiLayout;
-struct bContextStore;
-struct Scene;
-struct ID;
-struct ImBuf;
/* ****************** general defines ************** */
@@ -106,7 +98,8 @@ typedef enum {
} uiWidgetTypeEnum;
#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9)
-#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC) /* some extra padding added to menus containing submenu icons */
+/* some extra padding added to menus containing submenu icons */
+#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC)
/* menu scrolling */
#define UI_MENU_SCROLL_ARROW 12
@@ -163,7 +156,7 @@ extern const short ui_radial_dir_to_angle[8];
/* internal panel drawing defines */
#define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */
-#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */
+#define PNL_HEADER (UI_UNIT_Y * 1.2) /* 24 default */
/* bit button defines */
/* Bit operations */
@@ -181,13 +174,20 @@ extern const short ui_radial_dir_to_angle[8];
/* PieMenuData->flags */
enum {
- UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), /* pie menu item collision is detected at 90 degrees */
- UI_PIE_INITIAL_DIRECTION = (1 << 1), /* use initial center of pie menu to calculate direction */
- UI_PIE_DRAG_STYLE = (1 << 2), /* pie menu is drag style */
- UI_PIE_INVALID_DIR = (1 << 3), /* mouse not far enough from center position */
- UI_PIE_CLICK_STYLE = (1 << 4), /* pie menu changed to click style, click to confirm */
- UI_PIE_ANIMATION_FINISHED = (1 << 5), /* pie animation finished, do not calculate any more motion */
- UI_PIE_GESTURE_END_WAIT = (1 << 6), /* pie gesture selection has been done, now wait for mouse motion to end */
+ /** pie menu item collision is detected at 90 degrees */
+ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0),
+ /** use initial center of pie menu to calculate direction */
+ UI_PIE_INITIAL_DIRECTION = (1 << 1),
+ /** pie menu is drag style */
+ UI_PIE_DRAG_STYLE = (1 << 2),
+ /** mouse not far enough from center position */
+ UI_PIE_INVALID_DIR = (1 << 3),
+ /** pie menu changed to click style, click to confirm */
+ UI_PIE_CLICK_STYLE = (1 << 4),
+ /** pie animation finished, do not calculate any more motion */
+ UI_PIE_ANIMATION_FINISHED = (1 << 5),
+ /** pie gesture selection has been done, now wait for mouse motion to end */
+ UI_PIE_GESTURE_END_WAIT = (1 << 6),
};
#define PIE_CLICK_THRESHOLD_SQ 50.0f
@@ -233,7 +233,7 @@ struct uiBut {
*/
float a2;
- unsigned char col[4];
+ uchar col[4];
uiButHandleFunc func;
void *func_arg1;
@@ -256,7 +256,7 @@ struct uiBut {
void *rename_arg1;
void *rename_orig;
- /* Run an action when holding the button down. */
+ /** Run an action when holding the button down. */
uiButHandleHoldFunc hold_func;
void *hold_argN;
@@ -264,14 +264,18 @@ struct uiBut {
uiButToolTipFunc tip_func;
void *tip_argN;
- /* info on why button is disabled, displayed in tooltip */
+ /** info on why button is disabled, displayed in tooltip */
const char *disabled_info;
BIFIconID icon;
- char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
- signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */
- bool changed; /* could be made into a single flag */
- unsigned char unit_type; /* so buttons can support unit systems which are not RNA */
+ /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
+ char dt;
+ /** direction in a pie menu, used for collision detection (RadialDirection) */
+ signed char pie_dir;
+ /** could be made into a single flag */
+ bool changed;
+ /** so buttons can support unit systems which are not RNA */
+ uchar unit_type;
short modifier_key;
short iconadd;
@@ -295,7 +299,7 @@ struct uiBut {
struct wmOperatorType *optype;
struct PointerRNA *opptr;
short opcontext;
- unsigned char menu_key; /* 'a'-'z', always lower case */
+ uchar menu_key; /* 'a'-'z', always lower case */
/* Draggable data, type is WM_DRAG_... */
char dragtype;
@@ -316,6 +320,9 @@ struct uiBut {
void *editcoba;
void *editcumap;
+ uiButPushedStateFunc pushed_state_func;
+ void *pushed_state_arg;
+
/* pointer back */
uiBlock *block;
};
@@ -327,8 +334,11 @@ typedef struct uiButTab {
typedef struct ColorPicker {
struct ColorPicker *next, *prev;
- float color_data[3]; /* colr data may be HSV or HSL for now */
- int representation; /* store hsv/hsl value */
+ /** Color data, may be HSV or HSL. */
+ float color_data[3];
+ /** Initial color data (detect changes). */
+ float color_data_init[3];
+ bool is_init;
} ColorPicker;
typedef struct ColorPickerData {
@@ -336,7 +346,7 @@ typedef struct ColorPickerData {
} ColorPickerData;
struct PieMenuData {
- /* store title and icon to allow access when pie levels are created */
+ /** store title and icon to allow access when pie levels are created */
const char *title;
int icon;
@@ -346,13 +356,14 @@ struct PieMenuData {
float last_pos[2];
double duration_gesture;
int flags;
- int event; /* initial event used to fire the pie menu, store here so we can query for release */
+ /** initial event used to fire the pie menu, store here so we can query for release */
+ int event;
float alphafac;
};
/* uiBlock.content_hints */
enum eBlockContentHints {
- /* In a menu block, if there is a single sub-menu button, we add some
+ /** In a menu block, if there is a single sub-menu button, we add some
* padding to the right to put nicely aligned triangle icons there. */
UI_BLOCK_CONTAINS_SUBMENU_BUT = (1 << 0),
};
@@ -378,7 +389,7 @@ struct uiBlock {
rctf rect;
float aspect;
- unsigned int puphash; /* popup menu hash for memory */
+ uint puphash; /* popup menu hash for memory */
uiButHandleFunc func;
void *func_arg1;
@@ -403,14 +414,16 @@ struct uiBlock {
int flag;
short alignnr;
- /* Hints about the buttons of this block. Used to avoid iterating over
+ /** Hints about the buttons of this block. Used to avoid iterating over
* buttons to find out if some criteria is met by any. Instead, check this
* criteria when adding the button and set a flag here if it's met. */
short content_hints; /* eBlockContentHints */
char direction;
- char theme_style; /* UI_BLOCK_THEME_STYLE_* */
- char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ /** UI_BLOCK_THEME_STYLE_* */
+ char theme_style;
+ /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ char dt;
bool auto_open;
char _pad[5];
double auto_open_last;
@@ -418,32 +431,46 @@ struct uiBlock {
const char *lockstr;
char lock;
- char active; /* to keep blocks while drawing and free them afterwards */
- char tooltipdisabled; /* to avoid tooltip after click */
- char endblock; /* UI_block_end done? */
-
- eBlockBoundsCalc bounds_type; /* for doing delayed */
+ /** to keep blocks while drawing and free them afterwards */
+ char active;
+ /** to avoid tooltip after click */
+ char tooltipdisabled;
+ /** UI_block_end done? */
+ char endblock;
+
+ /** for doing delayed */
+ eBlockBoundsCalc bounds_type;
int mx, my;
- int bounds, minbounds; /* for doing delayed */
+ /** for doing delayed */
+ int bounds, minbounds;
- rctf safety; /* pulldowns, to detect outside, can differ per case how it is created */
- ListBase saferct; /* uiSafetyRct list */
+ /** pulldowns, to detect outside, can differ per case how it is created */
+ rctf safety;
+ /** uiSafetyRct list */
+ ListBase saferct;
uiPopupBlockHandle *handle; /* handle */
- struct wmOperator *ui_operator; /* use so presets can find the operator, */
- /* across menus and from nested popups which fail for operator context. */
+ /** use so presets can find the operator,
+ * across menus and from nested popups which fail for operator context. */
+ struct wmOperator *ui_operator;
- void *evil_C; /* XXX hack for dynamic operator enums */
+ /** XXX hack for dynamic operator enums */
+ void *evil_C;
- struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */
- ColorPickerData color_pickers; /* XXX, only accessed by color picker templates */
+ /** unit system, used a lot for numeric buttons so include here
+ * rather then fetching through the scene every time. */
+ struct UnitSettings *unit;
+ /** \note only accessed by color picker templates. */
+ ColorPickerData color_pickers;
bool is_color_gamma_picker; /* Block for color picker with gamma baked in. */
- char display_device[64]; /* display device name used to display this block,
- * used by color widgets to transform colors from/to scene linear
- */
+ /** display device name used to display this block,
+ * used by color widgets to transform colors from/to scene linear
+ */
+ char display_device[64];
+
struct PieMenuData pie_data;
};
@@ -460,6 +487,7 @@ void ui_fontscale(short *points, float aspect);
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
+extern float ui_block_to_window_scale(const struct ARegion *ar, uiBlock *block);
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
@@ -648,13 +676,6 @@ uiPopupBlockHandle *ui_popup_menu_create(
uiMenuCreateFunc create_func, void *arg);
/* interface_region_popover.c */
-uiBlock *ui_popover_block_refresh(
- struct bContext *C, uiPopupBlockHandle *handle,
- ARegion *butregion, uiBut *but);
-uiPopupBlockHandle *ui_popover_block_create(
- struct bContext *C, struct ARegion *butregion, uiBut *but,
- uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func,
- void *arg);
uiPopupBlockHandle *ui_popover_panel_create(
struct bContext *C, struct ARegion *butregion, uiBut *but,
uiMenuCreateFunc create_func, void *arg);
@@ -686,16 +707,16 @@ extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, floa
void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha);
-void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3]);
-void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_UNITVEC(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3]);
+void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_COLORBAND(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_UNITVEC(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
+void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
/* interface_handlers.c */
PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext, bool create_props);
@@ -711,7 +732,6 @@ extern void ui_but_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut
extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction);
extern uiBut *ui_but_find_active_in_region(struct ARegion *ar);
extern uiBut *ui_but_find_mouse_over(struct ARegion *ar, const struct wmEvent *event);
-void ui_but_pie_dir_visual(RadialDirection dir, float vec[2]);
void ui_but_pie_dir(RadialDirection dir, float vec[2]);
float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]);
@@ -765,7 +785,7 @@ void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_pie_center(uiBlock *block);
-struct uiWidgetColors *ui_tooltip_get_theme(void);
+const struct uiWidgetColors *ui_tooltip_get_theme(void);
void ui_draw_widget_back_color(
uiWidgetTypeEnum type, bool use_shadow, const rcti *rect,
@@ -776,8 +796,8 @@ void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, r
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
-void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep);
-void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
+void ui_draw_menu_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep);
+void ui_draw_preview_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
#define UI_TEXT_MARGIN_X 0.4f
#define UI_POPUP_MARGIN (UI_DPI_FAC * 12)
@@ -801,8 +821,6 @@ void icon_draw_rect_input(
/* resources.c */
void init_userdef_do_versions(struct Main *bmain);
-void ui_theme_init_default(void);
-void ui_style_init_default(void);
void ui_resources_init(void);
void ui_resources_free(void);
@@ -851,7 +869,6 @@ struct wmKeyMap *eyedropper_colorband_modal_keymap(struct wmKeyConfig *keyconf);
/* interface_eyedropper_color.c */
void UI_OT_eyedropper_color(struct wmOperatorType *ot);
-void UI_OT_eyedropper_color_crypto(struct wmOperatorType *ot);
/* interface_eyedropper_colorband.c */
void UI_OT_eyedropper_colorband(struct wmOperatorType *ot);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 9b145fdba92..b0ac22898b6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_layout.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -158,7 +152,7 @@ struct uiLayout {
bContextStore *context;
ListBase items;
- /* Sub layout to add child items, if not the layout itself. */
+ /** Sub layout to add child items, if not the layout itself. */
uiLayout *child_items_layout;
int x, y, w, h;
@@ -169,10 +163,12 @@ struct uiLayout {
bool enabled;
bool redalert;
bool keepaspect;
- bool variable_size; /* For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
+ /** For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
+ bool variable_size;
char alignment;
char emboss;
- float units[2]; /* for fixed width or height to avoid UI size changes */
+ /** for fixed width or height to avoid UI size changes */
+ float units[2];
};
typedef struct uiLayoutItemFlow {
@@ -188,9 +184,12 @@ typedef struct uiLayoutItemGridFlow {
bool row_major; /* Fill first row first, instead of filling first column first. */
bool even_columns; /* Same width for all columns. */
bool even_rows; /* Same height for all rows. */
- /* If positive, absolute fixed number of columns.
- * If 0, fully automatic (based on available width).
- * If negative, automatic but only generates number of columns/rows multiple of given (absolute) value. */
+ /**
+ * - If positive, absolute fixed number of columns.
+ * - If 0, fully automatic (based on available width).
+ * - If negative, automatic but only generates number of columns/rows
+ * multiple of given (absolute) value.
+ */
int columns_len;
/* Pure internal runtime storage. */
@@ -274,8 +273,9 @@ static int ui_layout_vary_direction(uiLayout *layout)
static bool ui_layout_variable_size(uiLayout *layout)
{
- /* Note that this code is probably a bit flacky, we'd probably want to know whether it's variable in X and/or Y,
- * etc. But for now it mimics previous one, with addition of variable flag set for children of gridflow layouts. */
+ /* Note that this code is probably a bit flacky, we'd probably want to know whether it's
+ * variable in X and/or Y, etc. But for now it mimics previous one,
+ * with addition of variable flag set for children of gridflow layouts. */
return ui_layout_vary_direction(layout) == UI_ITEM_VARY_X || layout->variable_size;
}
@@ -291,6 +291,9 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool
variable = ui_layout_variable_size(layout);
if (variable) {
+ if (!icon && !name[0]) {
+ return unit_x; /* No icon or name. */
+ }
if (layout->alignment != UI_LAYOUT_ALIGN_EXPAND) {
layout->item.flag |= UI_ITEM_MIN;
}
@@ -446,7 +449,7 @@ static void ui_item_array(
PropertyType type;
PropertySubType subtype;
uiLayout *sub;
- unsigned int a, b;
+ uint a, b;
/* retrieve type and subtype */
type = RNA_property_type(prop);
@@ -465,9 +468,9 @@ static void ui_item_array(
/* special check for layer layout */
int butw, buth, unit;
int cols = (len >= 20) ? 2 : 1;
- const unsigned int colbuts = len / (2 * cols);
- unsigned int layer_used = 0;
- unsigned int layer_active = 0;
+ const uint colbuts = len / (2 * cols);
+ uint layer_used = 0;
+ uint layer_active = 0;
UI_block_layout_set_current(block, uiLayoutAbsolute(layout, false));
@@ -497,7 +500,7 @@ static void ui_item_array(
for (a = 0; a < colbuts; a++) {
const int layer_num = a + b * colbuts;
- const unsigned int layer_flag = (1u << layer_num);
+ const uint layer_flag = (1u << layer_num);
if (layer_used & layer_flag) {
if (layer_active & layer_flag)
@@ -515,7 +518,7 @@ static void ui_item_array(
}
for (a = 0; a < colbuts; a++) {
const int layer_num = a + len / 2 + b * colbuts;
- const unsigned int layer_flag = (1u << layer_num);
+ const uint layer_flag = (1u << layer_num);
if (layer_used & layer_flag) {
if (layer_active & layer_flag)
@@ -655,7 +658,6 @@ static void ui_item_enum_expand_exec(
uiLayout *layout_radial = NULL;
const EnumPropertyItem *item, *item_array;
const char *name;
- char group_name[UI_MAX_NAME_STR];
int itemw, icon, value;
bool free;
bool radial = (layout->root->type == UI_LAYOUT_PIEMENU);
@@ -695,13 +697,13 @@ static void ui_item_enum_expand_exec(
/* Separate items, potentially with a label. */
if (next_item->identifier) {
- /* Item without identifier but with name: Add group label for the following items. */
+ /* Item without identifier but with name:
+ * Add group label for the following items. */
if (item->name) {
if (!is_first) {
uiItemS(block->curlayout);
}
- BLI_snprintf(group_name, sizeof(group_name), "%s:", item->name);
- uiItemL(block->curlayout, group_name, item->icon);
+ uiItemL(block->curlayout, item->name, item->icon);
}
else if (radial && layout_radial) {
uiItemS(layout_radial);
@@ -721,7 +723,7 @@ static void ui_item_enum_expand_exec(
if (icon && name[0] && !icon_only)
but = uiDefIconTextButR_prop(block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else if (icon)
- but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - UI_DPI_FAC), h, ptr, prop, -1, 0, value, -1, -1, NULL);
+ but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - U.pixelsize), h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
but = uiDefButR_prop(block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
@@ -734,7 +736,8 @@ static void ui_item_enum_expand_exec(
if (uiLayoutGetLocalDir(layout) != UI_LAYOUT_HORIZONTAL)
but->drawflag |= UI_BUT_TEXT_LEFT;
- /* Allow quick, inaccurate swipe motions to switch tabs (no need to keep cursor over them). */
+ /* Allow quick, inaccurate swipe motions to switch tabs
+ * (no need to keep cursor over them). */
if (but_type == UI_BTYPE_TAB) {
but->flag |= UI_BUT_DRAG_LOCK;
}
@@ -805,7 +808,8 @@ static uiBut *ui_item_with_label(
}
else {
if (ui_layout_variable_size(layout)) {
- /* w_hint is width for label in this case. Use a default width for property button(s) */
+ /* w_hint is width for label in this case.
+ * Use a default width for property button(s) */
prop_but_width = UI_UNIT_X * 5;
w_label = w_hint;
}
@@ -876,7 +880,7 @@ void UI_context_active_but_prop_get_filebrowser(
{
ARegion *ar = CTX_wm_region(C);
uiBlock *block;
- uiBut *but, *prevbut;
+ uiBut *but, *prevbut = NULL;
memset(r_ptr, 0, sizeof(*r_ptr));
*r_prop = NULL;
@@ -887,16 +891,18 @@ void UI_context_active_but_prop_get_filebrowser(
for (block = ar->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
- prevbut = but->prev;
+ if (but && but->rnapoin.data) {
+ if (RNA_property_type(but->rnaprop) == PROP_STRING) {
+ prevbut = but;
+ }
+ }
/* find the button before the active one */
- if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
- if (RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
- *r_ptr = prevbut->rnapoin;
- *r_prop = prevbut->rnaprop;
- *r_is_undo = (prevbut->flag & UI_BUT_UNDO) != 0;
- return;
- }
+ if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut) {
+ *r_ptr = prevbut->rnapoin;
+ *r_prop = prevbut->rnaprop;
+ *r_is_undo = (prevbut->flag & UI_BUT_UNDO) != 0;
+ return;
}
}
}
@@ -1250,7 +1256,8 @@ void uiItemsFullEnumO_items(
but = block->buttons.last;
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
0.0, 0.0, 0, 0, "");
@@ -1259,7 +1266,8 @@ void uiItemsFullEnumO_items(
}
else {
if (radial) {
- /* invisible dummy button to ensure all items are always at the same position */
+ /* invisible dummy button to ensure all items are
+ * always at the same position */
uiItemS(target);
}
else {
@@ -1748,7 +1756,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
/* Expanded enums each have their own name. */
- /* Often expanded enum's are better arranged into a row, so check the existing layout. */
+ /* Often expanded enum's are better arranged into a row,
+ * so check the existing layout. */
if (uiLayoutGetLocalDir(layout) == UI_LAYOUT_HORIZONTAL) {
layout = uiLayoutRow(layout_split, true);
}
@@ -2103,7 +2112,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
but->free_search_arg = true;
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
- /* In case we fail to find proper searchprop, so other code might have already set but->type to search menu... */
+ /* In case we fail to find proper searchprop,
+ * so other code might have already set but->type to search menu... */
but->flag |= UI_BUT_DISABLED;
}
}
@@ -2228,7 +2238,7 @@ static uiBut *ui_item_menu(
/* pass */
}
else if (force_menu) {
- w += UI_UNIT_X;
+ w += 0.6f * UI_UNIT_X;
}
else {
if (name[0]) {
@@ -2237,12 +2247,18 @@ static uiBut *ui_item_menu(
}
}
- if (name[0] && icon)
+ if (name[0] && icon) {
but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
- else if (icon)
+ }
+ else if (icon) {
but = uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
- else
+ if (force_menu) {
+ UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT);
+ }
+ }
+ else {
but = uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
+ }
if (argN) {
/* ugly .. */
@@ -2253,7 +2269,8 @@ static uiBut *ui_item_menu(
}
if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) ||
- (force_menu && layout->root->type != UI_LAYOUT_MENU)) /* We never want a dropdown in menu! */
+ /* We never want a dropdown in menu! */
+ (force_menu && layout->root->type != UI_LAYOUT_MENU))
{
UI_but_type_set_menu_from_pulldown(but);
}
@@ -3173,7 +3190,8 @@ typedef struct UILayoutGridFlowInput {
const bool even_rows : 1; /* All rows will have same height. */
const int space_x; /* Space between columns. */
const int space_y; /* Space between rows. */
- /* Real data about current position and size of this layout item (either estimated, or final values). */
+ /* Real data about current position and size of this layout item
+ * (either estimated, or final values). */
const int litem_w; /* Layout item width. */
const int litem_x; /* Layout item X position. */
const int litem_y; /* Layout item Y position. */
@@ -3421,7 +3439,8 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
}
}
- /* Set evenly-spaced axes size (quick optimization in case we have even columns and rows). */
+ /* Set evenly-spaced axes size
+ * (quick optimization in case we have even columns and rows). */
if (gflow->even_columns && gflow->even_rows) {
litem->w = (int)(gflow->tot_columns * avg_w) + space_x * (gflow->tot_columns - 1);
litem->h = (int)(gflow->tot_rows * max_h) + space_y * (gflow->tot_rows - 1);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 1cb9f156eeb..615259077b5 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_ops.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <string.h>
@@ -76,31 +70,6 @@
#include "BKE_main.h"
#include "BLI_ghash.h"
-/* Reset Default Theme ------------------------ */
-
-static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
-{
- ui_theme_init_default();
- ui_style_init_default();
- WM_event_add_notifier(C, NC_WINDOW, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static void UI_OT_reset_default_theme(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Reset to Default Theme";
- ot->idname = "UI_OT_reset_default_theme";
- ot->description = "Reset to the default theme colors";
-
- /* callbacks */
- ot->exec = reset_default_theme_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER;
-}
-
/* Copy Data Path Operator ------------------------ */
static bool copy_data_path_button_poll(bContext *C)
@@ -408,7 +377,7 @@ static EnumPropertyItem override_type_items[] = {
{UIOverride_Type_Replace, "REPLACE", 0, "Replace", "Completely replace value from linked data by local one"},
{UIOverride_Type_Difference, "DIFFERENCE", 0, "Difference", "Store difference to linked data value"},
{UIOverride_Type_Factor, "FACTOR", 0, "Factor", "Store factor to linked data value (useful e.g. for scale)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -444,7 +413,8 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
operation = IDOVERRIDESTATIC_OP_REPLACE;
break;
case UIOverride_Type_Difference:
- operation = IDOVERRIDESTATIC_OP_ADD; /* override code will automatically switch to subtract if needed. */
+ /* override code will automatically switch to subtract if needed. */
+ operation = IDOVERRIDESTATIC_OP_ADD;
break;
case UIOverride_Type_Factor:
operation = IDOVERRIDESTATIC_OP_MULTIPLY;
@@ -549,13 +519,15 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
if (!all && index != -1) {
bool is_strict_find;
- /* Remove override operation for given item, add singular operations for the other items as needed. */
+ /* Remove override operation for given item,
+ * add singular operations for the other items as needed. */
IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find(
oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
/* No specific override operation, we have to get generic one,
- * and create item-specific override operations for all but given index, before removing generic one. */
+ * and create item-specific override operations for all but given index,
+ * before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--; ) {
if (idx != index) {
BKE_override_static_property_operation_get(oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL);
@@ -735,7 +707,8 @@ bool UI_context_copy_to_selected_list(
}
else if (GS(id->name) == ID_SCE) {
/* Sequencer's ID is scene :/ */
- /* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */
+ /* Try to recursively find an RNA_Sequence ancestor,
+ * to handle situations like T41062... */
if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) {
*r_lb = CTX_data_collection_get(C, "selected_editable_sequences");
}
@@ -1345,7 +1318,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
if (!BLI_is_dir(root)) {
BKE_report(
op->reports, RPT_ERROR,
- "Please set your User Preferences' 'Translation Branches "
+ "Please set your Preferences' 'Translation Branches "
"Directory' path to a valid directory");
return OPERATOR_CANCELLED;
}
@@ -1605,7 +1578,6 @@ static void UI_OT_drop_color(wmOperatorType *ot)
void ED_operatortypes_ui(void)
{
- WM_operatortype_append(UI_OT_reset_default_theme);
WM_operatortype_append(UI_OT_copy_data_path_button);
WM_operatortype_append(UI_OT_copy_python_command_button);
WM_operatortype_append(UI_OT_reset_default_button);
@@ -1626,7 +1598,6 @@ void ED_operatortypes_ui(void)
/* external */
WM_operatortype_append(UI_OT_eyedropper_color);
- WM_operatortype_append(UI_OT_eyedropper_color_crypto);
WM_operatortype_append(UI_OT_eyedropper_colorband);
WM_operatortype_append(UI_OT_eyedropper_colorband_point);
WM_operatortype_append(UI_OT_eyedropper_id);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 1e97cbc29d0..1897d07d224 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,18 +15,15 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_panel.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
-/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
+/* a full doc with API notes can be found in
+ * bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
@@ -130,7 +125,7 @@ static void panel_title_color_get(bool show_background, uchar color[4])
/*********************** space specific code ************************/
/* temporary code to remove all sbuts stuff from panel code */
-/* SpaceButs.align */
+/* SpaceProperties.align */
typedef enum eSpaceButtons_Align {
BUT_HORIZONTAL = 0,
BUT_VERTICAL = 1,
@@ -139,7 +134,7 @@ typedef enum eSpaceButtons_Align {
static int panel_aligned(ScrArea *sa, ARegion *ar)
{
- if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW)
+ if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
@@ -147,7 +142,7 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return BUT_VERTICAL;
- else if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS, RGN_TYPE_HUD, RGN_TYPE_NAV_BAR))
+ else if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS, RGN_TYPE_HUD, RGN_TYPE_NAV_BAR, RGN_TYPE_EXECUTE))
return BUT_VERTICAL;
return 0;
@@ -195,8 +190,8 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **pa_animate)
{
*pa_animate = NULL;
- if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
- SpaceButs *sbuts = sa->spacedata.first;
+ if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
+ SpaceProperties *sbuts = sa->spacedata.first;
if (sbuts->mainbo != sbuts->mainb) {
return true;
@@ -485,7 +480,7 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4])
}
}
-static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float y2)
+static void ui_draw_anti_x(uint pos, float x1, float y1, float x2, float y2)
{
/* set antialias line */
@@ -510,7 +505,7 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float
}
/* x 'icon' for panel header */
-static void ui_draw_x_icon(unsigned int pos, float x, float y)
+static void ui_draw_x_icon(uint pos, float x, float y)
{
ui_draw_anti_x(pos, x, y, x + 9.375f, y + 9.375f);
@@ -519,7 +514,7 @@ static void ui_draw_x_icon(unsigned int pos, float x, float y)
#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */
-static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
+static void ui_draw_panel_scalewidget(uint pos, const rcti *rect)
{
float xmin, xmax, dx;
float ymin, ymax, dy;
@@ -561,8 +556,8 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
}
static void immRectf_tris_color_ex(
- unsigned int pos, float x1, float y1, float x2, float y2,
- unsigned int col, const float color[3])
+ uint pos, float x1, float y1, float x2, float y2,
+ uint col, const float color[3])
{
immAttr4fv(col, color);
immVertex2f(pos, x1, y1);
@@ -579,7 +574,7 @@ static void immRectf_tris_color_ex(
immVertex2f(pos, x1, y2);
}
-static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const rctf *rect)
+static void ui_draw_panel_dragwidget(uint pos, uint col, const rctf *rect)
{
float col_high[4], col_dark[4];
const int col_tint = 84;
@@ -621,14 +616,13 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r
void UI_panel_label_offset(uiBlock *block, int *x, int *y)
{
Panel *panel = block->panel;
- uiStyle *style = UI_style_get_dpi();
const bool is_subpanel = (panel->type && panel->type->parent);
- *x = UI_UNIT_X * 1.1f;
- *y = (UI_UNIT_Y * 1.1f) + style->panelspace;
+ *x = UI_UNIT_X * 1.0f;
+ *y = UI_UNIT_Y * 1.5f;
if (is_subpanel) {
- *x += 5.0f / block->aspect;
+ *x += (0.7f * UI_UNIT_X);
}
}
@@ -646,9 +640,9 @@ static void ui_draw_aligned_panel_header(
/* + 0.001f to avoid flirting with float inaccuracy */
if (panel->control & UI_PNL_CLOSE)
- pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f;
+ pnl_icons = (panel->labelofs + (2.0f * PNL_ICON)) / block->aspect + 0.001f;
else
- pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
+ pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f;
/* draw text label */
panel_title_color_get(show_background, col_title);
@@ -657,8 +651,10 @@ static void ui_draw_aligned_panel_header(
hrect = *rect;
if (dir == 'h') {
hrect.xmin = rect->xmin + pnl_icons;
- hrect.ymin += 2.0f / block->aspect;
- UI_fontstyle_draw(fontstyle, &hrect, activename, col_title);
+ hrect.ymin -= 2.0f / block->aspect;
+ UI_fontstyle_draw(
+ fontstyle, &hrect, activename, col_title,
+ &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_LEFT, });
}
else {
/* ignore 'pnl_icons', otherwise the text gets offset horizontally
@@ -698,7 +694,7 @@ void ui_draw_aligned_panel(
rcti titlerect = headrect;
if (is_subpanel) {
- titlerect.xmin += 5.0f / block->aspect;
+ titlerect.xmin += (0.7f * UI_UNIT_X);
}
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -761,7 +757,7 @@ void ui_draw_aligned_panel(
col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
/* itemrect smaller */
- itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
+ itemrect.xmax = headrect.xmax - (0.2f * UI_UNIT_X);
itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect);
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
@@ -833,7 +829,7 @@ void ui_draw_aligned_panel(
/* draw collapse icon */
/* itemrect smaller */
- itemrect.xmin = titlerect.xmin + 3.0f / block->aspect;
+ itemrect.xmin = titlerect.xmin;
itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect);
itemrect.ymin = titlerect.ymin;
itemrect.ymax = titlerect.ymax;
@@ -1740,8 +1736,8 @@ static void ui_panel_category_draw_tab(
bool filled, float minx, float miny, float maxx, float maxy, float rad,
const int roundboxtype,
const bool use_highlight, const bool use_shadow, const bool use_flip_x,
- const unsigned char highlight_fade[3],
- const unsigned char col[3])
+ const uchar highlight_fade[3],
+ const uchar col[3])
{
float vec[4][2] = {
{0.195, 0.02},
@@ -1871,8 +1867,10 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
const int px_x_sign = is_left ? px : -px;
const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom);
const float dpi_fac = UI_DPI_FAC;
- const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* padding of tabs around text */
- const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); /* padding between tabs */
+ /* padding of tabs around text */
+ const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom);
+ /* padding between tabs */
+ const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom);
const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom;
/* We flip the tab drawing, so always use these flags. */
const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
@@ -1891,20 +1889,20 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
int y_ofs = tab_v_pad;
/* Primary theme colors */
- unsigned char theme_col_back[4];
- unsigned char theme_col_text[3];
- unsigned char theme_col_text_hi[3];
+ uchar theme_col_back[4];
+ uchar theme_col_text[3];
+ uchar theme_col_text_hi[3];
/* Tab colors */
- unsigned char theme_col_tab_bg[4];
- unsigned char theme_col_tab_active[3];
- unsigned char theme_col_tab_inactive[3];
+ uchar theme_col_tab_bg[4];
+ uchar theme_col_tab_active[3];
+ uchar theme_col_tab_inactive[3];
/* Secondary theme colors */
- unsigned char theme_col_tab_outline[3];
- unsigned char theme_col_tab_divider[3]; /* line that divides tabs from the main region */
- unsigned char theme_col_tab_highlight[3];
- unsigned char theme_col_tab_highlight_inactive[3];
+ uchar theme_col_tab_outline[3];
+ uchar theme_col_tab_divider[3]; /* line that divides tabs from the main region */
+ uchar theme_col_tab_highlight[3];
+ uchar theme_col_tab_highlight_inactive[3];
@@ -2152,7 +2150,8 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, ARegion *ar, c
const bool backwards = event->shift;
pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next;
if (!pc_dyn) {
- /* proper cyclic behavior, back to first/last category (only used for ctrl+tab) */
+ /* proper cyclic behavior,
+ * back to first/last category (only used for ctrl+tab) */
pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
}
}
@@ -2224,10 +2223,13 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
/* checks for mouse position inside */
pa = block->panel;
- if (!pa || pa->paneltab != NULL)
+ if (!pa || pa->paneltab != NULL) {
continue;
- if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */
+ }
+ /* XXX - accessed freed panels when scripts reload, need to fix. */
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) {
continue;
+ }
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
@@ -2312,7 +2314,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
ScrArea *sa = CTX_wm_area(C);
SpaceLink *sl = sa->spacedata.first;
- if (sa->spacetype != SPACE_BUTS) {
+ if (sa->spacetype != SPACE_PROPERTIES) {
if (!(pa->control & UI_PNL_SCALE)) {
if (event->type == PADPLUSKEY) sl->blockscale += 0.1;
else sl->blockscale -= 0.1;
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index d49a1a727aa..d4d5e3d3df6 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_query.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Utilities to inspect the interface, extract information.
*/
diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c
index 082459925e0..f96210b46d4 100644
--- a/source/blender/editors/interface/interface_region_color_picker.c
+++ b/source/blender/editors/interface/interface_region_color_picker.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_color_picker.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Color Picker Region & Color Utils
*/
@@ -59,6 +53,12 @@
#include "interface_intern.h"
+enum ePickerType {
+ PICKER_TYPE_RGB = 0,
+ PICKER_TYPE_HSV = 1,
+ PICKER_TYPE_HEX = 2,
+};
+
/* -------------------------------------------------------------------- */
/** \name Color Conversion
* \{ */
@@ -175,7 +175,8 @@ static void ui_update_color_picker_buts_rgb(
}
ui_rgb_to_color_picker_compat_v(tmp, hsv);
- /* this updates button strings, is hackish... but button pointers are on stack of caller function */
+ /* this updates button strings,
+ * is hackish... but button pointers are on stack of caller function */
for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->custom_data != cpicker)
continue;
@@ -189,11 +190,12 @@ static void ui_update_color_picker_buts_rgb(
}
else if (STREQ(bt->str, "Hex: ")) {
float rgb_hex[3];
- unsigned char rgb_hex_uchar[3];
+ uchar rgb_hex_uchar[3];
double intpart;
char col[16];
- /* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */
+ /* Hex code is assumed to be in sRGB space
+ * (coming from other applications, web, etc) */
copy_v3_v3(rgb_hex, rgb);
if (from_but && !ui_but_is_color_gamma(from_but)) {
IMB_colormanagement_scene_linear_to_srgb_v3(rgb_hex);
@@ -288,7 +290,7 @@ static void ui_colorpicker_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexc
IMB_colormanagement_srgb_to_scene_linear_v3(rgb);
}
- ui_update_color_picker_buts_rgb(NULL, but->block, cpicker, rgb);
+ ui_update_color_picker_buts_rgb(but, but->block, cpicker, rgb);
if (popup)
popup->menuretval = UI_RETURN_UPDATE;
@@ -299,30 +301,33 @@ static void ui_popup_close_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
uiBut *but = (uiBut *)bt1;
uiPopupBlockHandle *popup = but->block->handle;
- if (popup)
- popup->menuretval = UI_RETURN_OK;
+ if (popup) {
+ ColorPicker *cpicker = but->custom_data;
+ BLI_assert(cpicker->is_init);
+ popup->menuretval = (
+ equals_v3v3(cpicker->color_data, cpicker->color_data_init) ?
+ UI_RETURN_CANCEL : UI_RETURN_OK);
+ }
}
-static void ui_colorpicker_hide_reveal(uiBlock *block, short colormode)
+static void ui_colorpicker_hide_reveal(uiBlock *block, enum ePickerType colormode)
{
- uiBut *bt;
-
/* tag buttons */
- for (bt = block->buttons.first; bt; bt = bt->next) {
- if ((bt->func == ui_colorpicker_rna_cb) && bt->type == UI_BTYPE_NUM_SLIDER && bt->rnaindex != 3) {
+ for (uiBut *bt = block->buttons.first; bt; bt = bt->next) {
+ if ((bt->func == ui_colorpicker_rna_cb) &&
+ (bt->type == UI_BTYPE_NUM_SLIDER) &&
+ (bt->rnaindex != 3))
+ {
/* RGB sliders (color circle and alpha are always shown) */
- if (colormode == 0) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_RGB), UI_HIDDEN);
}
else if (bt->func == ui_color_wheel_rna_cb) {
/* HSV sliders */
- if (colormode == 1) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_HSV), UI_HIDDEN);
}
else if (bt->func == ui_colorpicker_hex_rna_cb || bt->type == UI_BTYPE_LABEL) {
- /* hex input or gamma correction status label */
- if (colormode == 2) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ /* HEX input or gamma correction status label */
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_HEX), UI_HIDDEN);
}
}
}
@@ -393,7 +398,8 @@ static void ui_colorpicker_square(uiBlock *block, PointerRNA *ptr, PropertyRNA *
static void ui_block_colorpicker(
uiBlock *block, uiBut *from_but, float rgba[4], bool show_picker)
{
- static short colormode = 0; /* temp? 0=rgb, 1=hsv, 2=hex */
+ /* ePickerType */
+ static char colormode = 1;
uiBut *bt;
int width, butwidth;
static char hexcol[128];
@@ -418,6 +424,10 @@ static void ui_block_colorpicker(
copy_v3_v3(rgb_perceptual, rgba);
ui_scene_linear_to_color_picker_space(from_but, rgb_perceptual);
ui_rgb_to_color_picker_v(rgb_perceptual, hsv);
+ if (cpicker->is_init == false) {
+ copy_v3_v3(cpicker->color_data_init, cpicker->color_data);
+ cpicker->is_init = true;
+ }
/* when the softmax isn't defined in the RNA,
* using very large numbers causes sRGB/linear round trip to fail. */
@@ -447,26 +457,24 @@ static void ui_block_colorpicker(
/* mode */
yco = -1.5f * UI_UNIT_Y;
UI_block_align_begin(block);
- bt = uiDefButS(
+ bt = uiDefButC(
block, UI_BTYPE_ROW, 0, IFACE_("RGB"), 0, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 0.0, 0, 0, "");
+ &colormode, 0.0, (float)PICKER_TYPE_RGB, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
- if (U.color_picker_type == USER_CP_CIRCLE_HSL) {
- bt = uiDefButS(
- block, UI_BTYPE_ROW, 0, IFACE_("HSL"), width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 1.0, 0, 0, "");
- }
- else {
- bt = uiDefButS(
- block, UI_BTYPE_ROW, 0, IFACE_("HSV"), width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 1.0, 0, 0, "");
- }
+ bt = uiDefButC(
+ block, UI_BTYPE_ROW, 0,
+ IFACE_((U.color_picker_type == USER_CP_CIRCLE_HSL) ? "HSL" : "HSV"),
+ width / 3, yco, width / 3, UI_UNIT_Y,
+ &colormode, 0.0, PICKER_TYPE_HSV, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
- bt = uiDefButS(
+ bt = uiDefButC(
block, UI_BTYPE_ROW, 0, IFACE_("Hex"), 2 * width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 2.0, 0, 0, "");
+ &colormode, 0.0, PICKER_TYPE_HEX, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
UI_block_align_end(block);
@@ -476,10 +484,14 @@ static void ui_block_colorpicker(
bt = uiDefIconButO(
block, UI_BTYPE_BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER,
butwidth + 10, yco, UI_UNIT_X, UI_UNIT_Y, NULL);
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
+ UI_but_drawflag_disable(bt, UI_BUT_ICON_LEFT);
UI_but_func_set(bt, ui_popup_close_cb, bt, NULL);
bt->custom_data = cpicker;
}
+ /* Note: don't disable UI_BUT_UNDO for RGBA values, since these don't add undo steps. */
+
/* RGB values */
UI_block_align_begin(block);
bt = uiDefButR_prop(
@@ -507,11 +519,13 @@ static void ui_block_colorpicker(
bt = uiDefButF(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("H:"), 0, yco, butwidth,
UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
bt->custom_data = cpicker;
bt = uiDefButF(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("S:"), 0, yco -= UI_UNIT_Y,
butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
bt->custom_data = cpicker;
if (U.color_picker_type == USER_CP_CIRCLE_HSL) {
@@ -524,6 +538,7 @@ static void ui_block_colorpicker(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("V:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y,
hsv + 2, 0.0, softmax, 10, 3, TIP_("Value"));
}
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
bt->hardmax = hardmax; /* not common but rgb may be over 1.0 */
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
@@ -544,7 +559,7 @@ static void ui_block_colorpicker(
/* Hex color is in sRGB space. */
float rgb_hex[3];
- unsigned char rgb_hex_uchar[3];
+ uchar rgb_hex_uchar[3];
copy_v3_v3(rgb_hex, rgba);
@@ -559,6 +574,7 @@ static void ui_block_colorpicker(
bt = uiDefBut(
block, UI_BTYPE_TEXT, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y,
hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_hex_rna_cb, bt, hexcol);
bt->custom_data = cpicker;
uiDefBut(
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index 0a5a88f2cb6..e874609f61e 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_hud.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Floating Persistent Region
*/
@@ -39,18 +33,15 @@
#include "BLI_rect.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BLI_math_color.h"
#include "BKE_context.h"
#include "BKE_screen.h"
-#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -188,8 +179,8 @@ static void hud_region_layout(const bContext *C, ARegion *ar)
if (ar->panels.first && (ar->sizey != size_y)) {
View2D *v2d = &ar->v2d;
- ar->winx = ar->sizex;
- ar->winy = ar->sizey;
+ ar->winx = ar->sizex * UI_DPI_FAC;
+ ar->winy = ar->sizey * UI_DPI_FAC;
ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1;
ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1;
@@ -213,7 +204,7 @@ static void hud_region_draw(const bContext *C, ARegion *ar)
GPU_clear(GPU_COLOR_BIT);
if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
- ui_draw_menu_back(NULL, NULL, &(rcti){.xmax = ar->winx, .ymax = ar->winy});
+ ui_draw_menu_back(NULL, NULL, &(rcti){ .xmax = ar->winx, .ymax = ar->winy, });
ED_region_panels_draw(C, ar);
}
}
@@ -337,7 +328,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
ED_region_tag_redraw(ar);
/* Reset zoom level (not well supported). */
- ar->v2d.cur = ar->v2d.tot = (rctf){.xmax = ar->winx, .ymax = ar->winy};
+ ar->v2d.cur = ar->v2d.tot = (rctf){ .xmax = ar->winx, .ymax = ar->winy, };
ar->v2d.minzoom = 1.0f;
ar->v2d.maxzoom = 1.0f;
@@ -352,7 +343,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
if (was_hidden) {
ar->winx = ar->v2d.winx;
ar->winy = ar->v2d.winy;
- ar->v2d.cur = ar->v2d.tot = (rctf){.xmax = ar->winx, .ymax = ar->winy};
+ ar->v2d.cur = ar->v2d.tot = (rctf){ .xmax = ar->winx, .ymax = ar->winy, };
}
CTX_wm_region_set((bContext *)C, ar_prev);
}
diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c
index 44effc8c097..2631f38d73d 100644
--- a/source/blender/editors/interface/interface_region_menu_pie.c
+++ b/source/blender/editors/interface/interface_region_menu_pie.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_menu_pie.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Pie Menu Region
*/
@@ -126,7 +120,8 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co
pie->block_radial->puphash = ui_popup_menu_hash(title);
pie->block_radial->flag |= UI_BLOCK_RADIAL;
- /* if pie is spawned by a left click, release or click event, it is always assumed to be click style */
+ /* if pie is spawned by a left click, release or click event,
+ * it is always assumed to be click style */
if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) {
pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE;
pie->block_radial->pie_data.event = EVENT_NONE;
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index bdac03de86b..52fd9efe2cd 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_menu_popup.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* PopUp Menu Region
*/
@@ -199,19 +193,12 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
minwidth = UI_MENU_WIDTH_MIN;
}
- /* settings (typically rna-enum-popups) show above the button,
- * menu's like file-menu, show below */
if (pup->block->direction != 0) {
/* allow overriding the direction from menu_func */
direction = pup->block->direction;
}
- else if ((pup->but->type == UI_BTYPE_PULLDOWN) ||
- (UI_but_menutype_get(pup->but) != NULL))
- {
- direction = UI_DIR_DOWN;
- }
else {
- direction = UI_DIR_UP;
+ direction = UI_DIR_DOWN;
}
}
else {
@@ -235,6 +222,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
+ /* Flip layout because rna enum list ordered in reverse. */
+ if ((pup->but && pup->but->type != UI_BTYPE_PULLDOWN) &&
+ (UI_but_menutype_get(pup->but) == NULL))
+ {
+ UI_block_order_flip(block);
+ }
+
if (pup->popup) {
uiBut *bt;
int offset[2];
@@ -393,7 +387,8 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *
pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);
/* note, this intentionally differs from the menu & submenu default because many operators
- * use popups like this to select one of their options - where having invoke doesn't make sense */
+ * use popups like this to select one of their options -
+ * where having invoke doesn't make sense */
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */
@@ -640,7 +635,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
UI_popup_handlers_remove(&win->modalhandlers, block->handle);
ui_popup_block_free(C, block->handle);
- /* In the case we have nested popups, closing one may need to redraw another, see: T48874 */
+ /* In the case we have nested popups,
+ * closing one may need to redraw another, see: T48874 */
for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
ED_region_tag_refresh_ui(ar);
}
@@ -648,4 +644,20 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
}
}
+bool UI_popup_block_name_exists(bContext *C, const char *name)
+{
+ bScreen *sc = CTX_wm_screen(C);
+ uiBlock *block;
+ ARegion *ar;
+
+ for (ar = sc->regionbase.first; ar; ar = ar->next) {
+ for (block = ar->uiblocks.first; block; block = block->next) {
+ if (STREQ(block->name, name)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
/** \} */
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index cb4939adc56..4fd25c4c7e2 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_popover.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Pop-Over Region
*
@@ -82,7 +76,7 @@ struct uiPopover {
/* Needed for keymap removal. */
wmWindow *window;
wmKeyMap *keymap;
- struct wmEventHandler *keymap_handler;
+ struct wmEventHandler_Keymap *keymap_handler;
uiMenuCreateFunc menu_func;
void *menu_arg;
@@ -165,7 +159,8 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
if (!handle->refresh) {
float center[2] = {BLI_rctf_cent_x(&pup->but->rect), BLI_rctf_cent_y(&pup->but->rect)};
ui_block_to_window_fl(handle->ctx_region, pup->but->block, &center[0], &center[1]);
- /* These variables aren't used for popovers, we could add new variables if there is a conflict. */
+ /* These variables aren't used for popovers,
+ * we could add new variables if there is a conflict. */
handle->prev_mx = block->mx = (int)center[0];
handle->prev_my = block->my = (int)center[1];
}
@@ -353,7 +348,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
UI_block_flag_enable(pup->block, UI_BLOCK_SHOW_SHORTCUT_ALWAYS);
pup->keymap = keymap;
pup->keymap_handler = WM_event_add_keymap_handler_priority(&window->modalhandlers, keymap, 0);
- WM_event_set_keymap_handler_callback(pup->keymap_handler, popover_keymap_fn, pup);
+ WM_event_set_keymap_handler_post_callback(pup->keymap_handler, popover_keymap_fn, pup);
}
handle = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPOVER, pup);
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index b62857983df..91020cea371 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_popup.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* PopUp Region (Generic)
*/
@@ -75,6 +69,10 @@ void ui_popup_translate(ARegion *ar, const int mdiff[2])
/* update blocks */
for (block = ar->uiblocks.first; block; block = block->next) {
+ uiPopupBlockHandle *handle = block->handle;
+ /* Make empty, will be initialized on next use, see T60608. */
+ BLI_rctf_init(&handle->prev_block_rect, 0, 0, 0, 0);
+
uiSafetyRct *saferct;
for (saferct = block->saferct.first; saferct; saferct = saferct->next) {
BLI_rctf_translate(&saferct->parent, UNPACK2(mdiff));
@@ -366,8 +364,8 @@ static void ui_block_region_popup_window_listener(
static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
{
uiBut *bt;
- float xofs = 0.0f;
- int width = UI_SCREEN_MARGIN;
+ const float xmin_orig = block->rect.xmin;
+ const int margin = UI_SCREEN_MARGIN;
int winx, winy;
if (block->flag & UI_BLOCK_NO_WIN_CLIP) {
@@ -377,30 +375,32 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
winx = WM_window_pixels_x(window);
winy = WM_window_pixels_y(window);
- /* shift menus to right if outside of view */
- if (block->rect.xmin < width) {
- xofs = (width - block->rect.xmin);
+ /* shift to left if outside of view */
+ if (block->rect.xmax > winx - margin) {
+ const float xofs = winx - margin - block->rect.xmax;
block->rect.xmin += xofs;
block->rect.xmax += xofs;
}
- /* or shift to left if outside of view */
- if (block->rect.xmax > winx - width) {
- xofs = winx - width - block->rect.xmax;
+ /* shift menus to right if outside of view */
+ if (block->rect.xmin < margin) {
+ const float xofs = (margin - block->rect.xmin);
block->rect.xmin += xofs;
block->rect.xmax += xofs;
}
- if (block->rect.ymin < width)
- block->rect.ymin = width;
- if (block->rect.ymax > winy - UI_POPUP_MENU_TOP)
+ if (block->rect.ymin < margin) {
+ block->rect.ymin = margin;
+ }
+ if (block->rect.ymax > winy - UI_POPUP_MENU_TOP) {
block->rect.ymax = winy - UI_POPUP_MENU_TOP;
+ }
/* ensure menu items draw inside left/right boundary */
+ const float xofs = block->rect.xmin - xmin_orig;
for (bt = block->buttons.first; bt; bt = bt->next) {
bt->rect.xmin += xofs;
bt->rect.xmax += xofs;
}
-
}
void ui_popup_block_scrolltest(uiBlock *block)
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 48d59830c2a..65d5fdaba88 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_search.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Search Box Region & Interaction
*/
@@ -52,7 +46,6 @@
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -90,10 +83,14 @@ typedef struct uiSearchboxData {
rcti bbox;
uiFontStyle fstyle;
uiSearchItems items;
- int active; /* index in items array */
- bool noback; /* when menu opened with enough space for this */
- bool preview; /* draw thumbnail previews, rather than list */
- bool use_sep; /* use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ /** index in items array */
+ int active;
+ /** when menu opened with enough space for this */
+ bool noback;
+ /** draw thumbnail previews, rather than list */
+ bool preview;
+ /** use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ bool use_sep;
int prv_rows, prv_cols;
} uiSearchboxData;
@@ -262,7 +259,8 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
- /* It is valid for _VALUE_CLEAR flavor to have no active element (it's a valid way to unlink). */
+ /* It is valid for _VALUE_CLEAR flavor to have no active element
+ * (it's a valid way to unlink). */
but->editstr[0] = '\0';
return true;
@@ -516,7 +514,6 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
/* set font, get bb */
data->fstyle = style->widget; /* copy struct */
- data->fstyle.align = UI_STYLE_TEXT_CENTER;
ui_fontscale(&data->fstyle.points, aspect);
UI_fontstyle_set(&data->fstyle);
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index 1a167b3fd72..0da96cc09c6 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_tooltip.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* ToolTip Region and Construction
*/
@@ -49,7 +43,6 @@
#include "BLI_math.h"
#include "BLI_string.h"
-#include "BLI_string_utf8.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
@@ -62,7 +55,6 @@
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
@@ -167,10 +159,10 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
const float pad_px = UI_TIP_PADDING;
uiTooltipData *data = ar->regiondata;
- uiWidgetColors *theme = ui_tooltip_get_theme();
+ const uiWidgetColors *theme = ui_tooltip_get_theme();
rcti bbox = data->bbox;
float tip_colors[UI_TIP_LC_MAX][3];
- unsigned char drawcol[4] = {0, 0, 0, 255}; /* to store color in while drawing (alpha is always 255) */
+ uchar drawcol[4] = {0, 0, 0, 255}; /* to store color in while drawing (alpha is always 255) */
float *main_color = tip_colors[UI_TIP_LC_MAIN]; /* the color from the theme */
float *value_color = tip_colors[UI_TIP_LC_VALUE];
@@ -189,10 +181,10 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
ui_draw_tooltip_background(UI_style_get(), NULL, &bbox);
/* set background_color */
- rgb_uchar_to_float(background_color, (const unsigned char *)theme->inner);
+ rgb_uchar_to_float(background_color, (const uchar *)theme->inner);
/* calculate normal_color */
- rgb_uchar_to_float(main_color, (const unsigned char *)theme->text);
+ rgb_uchar_to_float(main_color, (const uchar *)theme->text);
copy_v3_v3(active_color, main_color);
copy_v3_v3(normal_color, main_color);
copy_v3_v3(python_color, main_color);
@@ -224,15 +216,14 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
bbox.ymin = bbox.ymax - (data->lineh * field->geom.lines);
if (field->format.style == UI_TIP_STYLE_HEADER) {
+ const struct uiFontStyleDraw_Params fs_params = {
+ .align = UI_STYLE_TEXT_LEFT,
+ .word_wrap = true,
+ };
/* draw header and active data (is done here to be able to change color) */
- uiFontStyle fstyle_header = data->fstyle;
-
- /* override text-style */
- fstyle_header.word_wrap = true;
-
rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_MAIN]);
- UI_fontstyle_set(&fstyle_header);
- UI_fontstyle_draw(&fstyle_header, &bbox, field->text, drawcol);
+ UI_fontstyle_set(&data->fstyle);
+ UI_fontstyle_draw(&data->fstyle, &bbox, field->text, drawcol, &fs_params);
/* offset to the end of the last line */
if (field->text_suffix) {
@@ -242,7 +233,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
bbox.ymax -= yofs;
rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_ACTIVE]);
- UI_fontstyle_draw(&fstyle_header, &bbox, field->text_suffix, drawcol);
+ UI_fontstyle_draw(&data->fstyle, &bbox, field->text_suffix, drawcol, &fs_params);
/* undo offset */
bbox.xmin -= xofs;
@@ -250,25 +241,30 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
}
}
else if (field->format.style == UI_TIP_STYLE_MONO) {
+ const struct uiFontStyleDraw_Params fs_params = {
+ .align = UI_STYLE_TEXT_LEFT,
+ .word_wrap = true,
+ };
uiFontStyle fstyle_mono = data->fstyle;
fstyle_mono.uifont_id = blf_mono_font;
- fstyle_mono.word_wrap = true;
UI_fontstyle_set(&fstyle_mono);
/* XXX, needed because we dont have mono in 'U.uifonts' */
BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi);
rgb_float_to_uchar(drawcol, tip_colors[field->format.color_id]);
- UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, drawcol);
+ UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, drawcol, &fs_params);
}
else {
- uiFontStyle fstyle_normal = data->fstyle;
BLI_assert(field->format.style == UI_TIP_STYLE_NORMAL);
- fstyle_normal.word_wrap = true;
+ const struct uiFontStyleDraw_Params fs_params = {
+ .align = UI_STYLE_TEXT_LEFT,
+ .word_wrap = true,
+ };
/* draw remaining data */
rgb_float_to_uchar(drawcol, tip_colors[field->format.color_id]);
- UI_fontstyle_set(&fstyle_normal);
- UI_fontstyle_draw(&fstyle_normal, &bbox, field->text, drawcol);
+ UI_fontstyle_set(&data->fstyle);
+ UI_fontstyle_draw(&data->fstyle, &bbox, field->text, drawcol, &fs_params);
}
bbox.ymax -= data->lineh * field->geom.lines;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 0decc937e19..8e3e99940a6 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_regions.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* General Interface Region Code
*
diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h
index d23cf964c5e..0d24b310817 100644
--- a/source/blender/editors/interface/interface_regions_intern.h
+++ b/source/blender/editors/interface/interface_regions_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_regions_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Share between interface_region_*.c files.
*/
@@ -30,7 +26,7 @@
#define MENU_PADDING (int)(0.2f * UI_UNIT_Y)
/* interface_region_menu_popup.c */
-unsigned int ui_popup_menu_hash(const char *str);
+uint ui_popup_menu_hash(const char *str);
/* interface_regions_intern.h */
ARegion *ui_region_temp_add(bScreen *sc);
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index d4f6933693e..4aea1fad89f 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_style.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -45,8 +39,6 @@
#include "BKE_global.h"
-#include "BIF_gl.h"
-
#include "BLF_api.h"
#ifdef WITH_INTERNATIONAL
# include "BLT_translation.h"
@@ -153,7 +145,8 @@ static uiFont *uifont_to_blfont(int id)
void UI_fontstyle_draw_ex(
- const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4],
+ const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4],
+ const struct uiFontStyleDraw_Params *fs_params,
size_t len, float *r_xofs, float *r_yofs)
{
int xofs = 0, yofs;
@@ -171,13 +164,13 @@ void UI_fontstyle_draw_ex(
if (fs->kerning == 1) {
font_flag |= BLF_KERNING_DEFAULT;
}
- if (fs->word_wrap == 1) {
+ if (fs_params->word_wrap == 1) {
font_flag |= BLF_WORD_WRAP;
}
BLF_enable(fs->uifont_id, font_flag);
- if (fs->word_wrap == 1) {
+ if (fs_params->word_wrap == 1) {
/* draw from boundbox top */
yofs = BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id);
}
@@ -187,14 +180,14 @@ void UI_fontstyle_draw_ex(
yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
}
- if (fs->align == UI_STYLE_TEXT_CENTER) {
+ if (fs_params->align == UI_STYLE_TEXT_CENTER) {
xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len)));
/* don't center text if it chops off the start of the text, 2 gives some margin */
if (xofs < 2) {
xofs = 2;
}
}
- else if (fs->align == UI_STYLE_TEXT_RIGHT) {
+ else if (fs_params->align == UI_STYLE_TEXT_RIGHT) {
xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len) - 0.1f * U.widget_unit;
}
@@ -211,17 +204,19 @@ void UI_fontstyle_draw_ex(
*r_yofs = yofs;
}
-void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4])
+void UI_fontstyle_draw(
+ const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4],
+ const struct uiFontStyleDraw_Params *fs_params)
{
float xofs, yofs;
UI_fontstyle_draw_ex(
- fs, rect, str, col,
+ fs, rect, str, col, fs_params,
BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs);
}
/* drawn same as above, but at 90 degree angle */
-void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4])
+void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4])
{
float height;
int xofs, yofs;
@@ -282,7 +277,7 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch
*
* For drawing on-screen labels.
*/
-void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const unsigned char col[4])
+void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
{
if (fs->kerning == 1)
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
@@ -408,7 +403,7 @@ void uiStyleInit(void)
uiFont *font;
uiStyle *style = U.uistyles.first;
int monofont_size = datatoc_bmonofont_ttf_size;
- unsigned char *monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf;
+ uchar *monofont_ttf = (uchar *)datatoc_bmonofont_ttf;
/* recover from uninitialized dpi */
if (U.dpi == 0)
@@ -451,7 +446,7 @@ void uiStyleInit(void)
if (font->uifont_id == UIFONT_DEFAULT) {
#ifdef WITH_INTERNATIONAL
int font_size = datatoc_bfont_ttf_size;
- unsigned char *font_ttf = (unsigned char *)datatoc_bfont_ttf;
+ uchar *font_ttf = (uchar *)datatoc_bfont_ttf;
static int last_font_size = 0;
/* use unicode font for translation */
@@ -461,7 +456,7 @@ void uiStyleInit(void)
if (!font_ttf) {
/* fall back if not found */
font_size = datatoc_bfont_ttf_size;
- font_ttf = (unsigned char *)datatoc_bfont_ttf;
+ font_ttf = (uchar *)datatoc_bfont_ttf;
}
}
@@ -473,13 +468,13 @@ void uiStyleInit(void)
font->blf_id = BLF_load_mem("default", font_ttf, font_size);
#else
- font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+ font->blf_id = BLF_load_mem("default", (uchar *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
#endif
}
else {
font->blf_id = BLF_load(font->filename);
if (font->blf_id == -1) {
- font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+ font->blf_id = BLF_load_mem("default", (uchar *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
}
}
@@ -512,12 +507,13 @@ void uiStyleInit(void)
if (!monofont_ttf) {
/* fall back if not found */
monofont_size = datatoc_bmonofont_ttf_size;
- monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf;
+ monofont_ttf = (uchar *)datatoc_bmonofont_ttf;
}
}
#endif
- /* XXX, this should be moved into a style, but for now best only load the monospaced font once. */
+ /* XXX, this should be moved into a style,
+ * but for now best only load the monospaced font once. */
BLI_assert(blf_mono_font == -1);
if (U.font_path_ui_mono[0]) {
blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e290546dfa5..22b13ad54b7 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_templates.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -129,8 +123,12 @@ static void template_add_button_search_menu(
ARegion *region = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
/* XXX ugly top-bar exception */
- const bool use_big_size = (region->regiontype != RGN_TYPE_HEADER) && (area->spacetype != SPACE_TOPBAR); /* silly check, could be more generic */
- /* Ugly exception for screens here, drawing their preview in icon size looks ugly/useless */
+ const bool use_big_size = (
+ /* silly check, could be more generic */
+ (region->regiontype != RGN_TYPE_HEADER) &&
+ (area->spacetype != SPACE_TOPBAR));
+ /* Ugly exception for screens here,
+ * drawing their preview in icon size looks ugly/useless */
const bool use_preview_icon = use_big_size || (id && (GS(id->name) != ID_SCR));
const short width = UI_UNIT_X * (use_big_size ? 6 : 1.6f);
const short height = UI_UNIT_Y * (use_big_size ? 6 : 1);
@@ -297,8 +295,8 @@ static bool id_search_add(
}
if (*str == '\0' || BLI_strcasestr(id->name + 2, str)) {
- /* +1 is needed because BKE_id_ui_prefix uses 3 letter prefix
- * followed by ID_NAME-2 characters from id->name.
+ /* +1 is needed because BKE_id_ui_prefix used 3 letter prefix
+ * followed by ID_NAME-2 characters from id->name
*/
char name_ui[MAX_ID_FULL_NAME];
BKE_id_full_name_ui_prefix_get(name_ui, id);
@@ -600,7 +598,7 @@ static uiBut *template_id_def_new_but(
BLT_I18NCONTEXT_ID_TEXTURE,
BLT_I18NCONTEXT_ID_IMAGE,
BLT_I18NCONTEXT_ID_LATTICE,
- BLT_I18NCONTEXT_ID_LAMP,
+ BLT_I18NCONTEXT_ID_LIGHT,
BLT_I18NCONTEXT_ID_CAMERA,
BLT_I18NCONTEXT_ID_WORLD,
BLT_I18NCONTEXT_ID_SCREEN,
@@ -735,8 +733,7 @@ static void template_ID(
but->flag |= UI_BUT_UNDO;
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ALONE));
- if (/* test only */
- (id_copy(CTX_data_main(C), id, NULL, true) == false) ||
+ if ((!BKE_id_copy_is_allowed(id)) ||
(idfrom && idfrom->lib) ||
(!editable) ||
/* object in editmode - don't change data */
@@ -802,7 +799,7 @@ static void template_ID(
but = NULL;
if (unlinkop) {
- but = uiDefIconButO(block, UI_BTYPE_BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+ but = uiDefIconButO(block, UI_BTYPE_BUT, unlinkop, WM_OP_INVOKE_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
UI_but_funcN_set(but, NULL, MEM_dupallocN(template_ui), NULL);
}
@@ -1048,7 +1045,9 @@ void uiTemplateAnyID(
}
/* Start drawing UI Elements using standard defines */
- split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */
+
+ /* NOTE: split amount here needs to be synced with normal labels */
+ split = uiLayoutSplit(layout, 0.33f, false);
/* FIRST PART ................................................ */
row = uiLayoutRow(split, false);
@@ -1066,14 +1065,20 @@ void uiTemplateAnyID(
row = uiLayoutRow(split, true);
/* ID-Type Selector - just have a menu of icons */
- sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ /* HACK: special group just for the enum,
+ * otherwise we get ugly layout with text included too... */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* ID-Block Selector - just use pointer widget... */
- sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ /* HACK: special group to counteract the effects of the previous enum,
+ * which now pushes everything too far right. */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
}
@@ -1312,7 +1317,8 @@ void uiTemplatePathBuilder(
/* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA);
- /* TODO: attach something to this to make allow searching of nested properties to 'build' the path */
+ /* TODO: attach something to this to make allow
+ * searching of nested properties to 'build' the path */
}
/************************ Modifier Template *************************/
@@ -1350,7 +1356,8 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
-/* Check whether Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
+/* Check whether Modifier is a simulation or not,
+ * this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
/* Physic Tab */
@@ -1477,7 +1484,8 @@ static uiLayout *draw_modifier(
UI_block_align_end(block);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- /* When Modifier is a simulation, show button to switch to context rather than the delete button. */
+ /* When Modifier is a simulation,
+ * show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) &&
!modifier_is_simulation(md))
{
@@ -1507,12 +1515,14 @@ static uiLayout *draw_modifier(
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
- if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
+ if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) {
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
"OBJECT_OT_duplicates_make_real");
- else if (psys->part->ren_as == PART_DRAW_PATH && psys->pathcache)
+ }
+ else if (psys->part->ren_as == PART_DRAW_PATH) {
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
"OBJECT_OT_modifier_convert");
+ }
}
}
else {
@@ -1540,7 +1550,8 @@ static uiLayout *draw_modifier(
}
}
- /* result is the layout block inside the box, that we return so that modifier settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that modifier settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -1677,7 +1688,8 @@ static uiLayout *gpencil_draw_modifier(
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
"OBJECT_OT_gpencil_modifier_copy");
- /* result is the layout block inside the box, that we return so that modifier settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that modifier settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -1795,7 +1807,8 @@ static uiLayout *gpencil_draw_shaderfx(
/* only here obdata, the rest of effect is ob level */
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- /* result is the layout block inside the box, that we return so that effect settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that effect settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -2020,7 +2033,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
if (proxy_protected) {
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- /* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
+ /* draw a ghost icon (for proxy) and also a lock beside it,
+ * to show that constraint is "proxy locked" */
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_GHOST_ENABLED, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
@@ -2130,7 +2144,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
/************************* Preview Template ***************************/
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_world_types.h"
@@ -2178,7 +2192,7 @@ void uiTemplatePreview(
else if (parent && (GS(parent->name) == ID_WO))
pr_texture = &((World *)parent)->pr_texture;
else if (parent && (GS(parent->name) == ID_LA))
- pr_texture = &((Lamp *)parent)->pr_texture;
+ pr_texture = &((Light *)parent)->pr_texture;
else if (parent && (GS(parent->name) == ID_LS))
pr_texture = &((FreestyleLineStyle *)parent)->pr_texture;
@@ -2255,7 +2269,8 @@ void uiTemplatePreview(
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_LA) {
- uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"),
+ 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_WO) {
@@ -2650,7 +2665,9 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
/**
* \param icon_scale: Scale of the icon, 1x == button height.
*/
-void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale)
+void uiTemplateIconView(
+ uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels,
+ float icon_scale, float icon_scale_popup)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
IconViewMenuArgs *cb_args;
@@ -2677,12 +2694,16 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname,
cb_args->ptr = *ptr;
cb_args->prop = prop;
cb_args->show_labels = show_labels;
- cb_args->icon_scale = icon_scale;
+ cb_args->icon_scale = icon_scale_popup;
- but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb_args, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
+ but = uiDefBlockButN(
+ block, ui_icon_view_menu_cb, cb_args, "",
+ 0, 0, UI_UNIT_X * icon_scale, UI_UNIT_Y * icon_scale, "");
}
else {
- but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, ICON_X, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, NULL, 0.0, 0.0, 0.0, 0.0, "");
+ but = uiDefIconBut(
+ block, UI_BTYPE_LABEL, 0, ICON_X,
+ 0, 0, UI_UNIT_X * icon_scale, UI_UNIT_Y * icon_scale, NULL, 0.0, 0.0, 0.0, 0.0, "");
}
@@ -3049,7 +3070,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
rna_update_cb(C, cb_v, NULL);
}
-/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
+/* still unsure how this call evolves...
+ * we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout(
uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels,
bool brush, bool neg_slope, bool tone, RNAUpdateCb *cb)
@@ -3436,10 +3458,14 @@ void uiTemplateCryptoPicker(uiLayout *layout, PointerRNA *ptr, const char *propn
block = uiLayoutGetBlock(layout);
- but = uiDefIconTextButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color_crypto", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, RNA_property_ui_name(prop), 0, 0, UI_UNIT_X, UI_UNIT_Y, RNA_property_ui_description(prop));
+ but = uiDefIconTextButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, RNA_property_ui_name(prop), 0, 0, UI_UNIT_X, UI_UNIT_Y, RNA_property_ui_description(prop));
but->rnapoin = *ptr;
but->rnaprop = prop;
but->rnaindex = -1;
+
+ PointerRNA *opptr = UI_but_operator_ptr_get(but);
+ /* Important for crypto-matte operation. */
+ RNA_boolean_set(opptr, "use_accumulate", false);
}
/********************* Layer Buttons Template ************************/
@@ -3565,7 +3591,7 @@ static void uilist_draw_item_default(
}
}
-static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout, bool reverse)
+static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout)
{
PointerRNA listptr;
uiLayout *row, *subrow;
@@ -3579,8 +3605,7 @@ static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *
uiItemR(subrow, &listptr, "use_filter_invert", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
(ui_list->filter_flag & UILST_FLT_EXCLUDE) ? ICON_ZOOM_OUT : ICON_ZOOM_IN);
- /* a reverse list, cannot sort or invert order in filter */
- if (!reverse) {
+ if ((ui_list->filter_sort_flag & UILST_FLT_SORT_LOCK) == 0) {
subrow = uiLayoutRow(row, true);
uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
@@ -3609,7 +3634,7 @@ static void uilist_filter_items_default(
const char *filter_raw = ui_list->filter_byname;
char *filter = (char *)filter_raw, filter_buff[32], *filter_dyn = NULL;
const bool filter_exclude = (ui_list->filter_flag & UILST_FLT_EXCLUDE) != 0;
- const bool order_by_name = (ui_list->filter_sort_flag & UILST_FLT_SORT_ALPHA) != 0;
+ const bool order_by_name = (ui_list->filter_sort_flag & UILST_FLT_SORT_MASK) == UILST_FLT_SORT_ALPHA;
int len = RNA_property_collection_length(dataptr, prop);
dyn_data->items_shown = dyn_data->items_len = len;
@@ -3749,7 +3774,8 @@ static void uilist_prepare(
rows = min_ii(dyn_data->height, maxrows);
}
- /* If list length changes or list is tagged to check this, and active is out of view, scroll to it .*/
+ /* If list length changes or list is tagged to check this,
+ * and active is out of view, scroll to it .*/
if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) {
if (activei_row < ui_list->list_scroll) {
ui_list->list_scroll = activei_row;
@@ -3808,7 +3834,8 @@ static char *uilist_item_tooltip_func(bContext *UNUSED(C), void *argN, const cha
void uiTemplateList(
uiLayout *layout, bContext *C, const char *listtype_name, const char *list_id,
PointerRNA *dataptr, const char *propname, PointerRNA *active_dataptr, const char *active_propname,
- const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns, bool reverse)
+ const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns,
+ bool sort_reverse, bool sort_lock)
{
uiListType *ui_list_type;
uiList *ui_list = NULL;
@@ -3913,6 +3940,12 @@ void uiTemplateList(
BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id));
BLI_addtail(&ar->ui_lists, ui_list);
ui_list->list_grip = -UI_LIST_AUTO_SIZE_THRESHOLD; /* Force auto size by default. */
+ if (sort_reverse) {
+ ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
+ }
+ if (sort_lock) {
+ ui_list->filter_sort_flag |= UILST_FLT_SORT_LOCK;
+ }
}
if (!ui_list->dyn_data) {
@@ -3929,19 +3962,6 @@ void uiTemplateList(
MEM_SAFE_FREE(dyn_data->items_filter_neworder);
dyn_data->items_len = dyn_data->items_shown = -1;
- /* if reverse, enable reverse and forced flag */
- if (reverse) {
- ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
- ui_list->filter_sort_flag |= UILST_FLT_FORCED_REVERSE;
- }
- else {
- /* if it was forced, disable forced flag to restore all normal behavior */
- if (ui_list->filter_sort_flag & UILST_FLT_FORCED_REVERSE) {
- ui_list->filter_sort_flag &= ~UILST_FLT_SORT_REVERSE;
- ui_list->filter_sort_flag &= ~UILST_FLT_FORCED_REVERSE;
- }
- }
-
/* When active item changed since last draw, scroll to it. */
if (activei != ui_list->list_last_activei) {
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
@@ -4219,7 +4239,7 @@ void uiTemplateList(
subblock = uiLayoutGetBlock(col);
uiDefBut(subblock, UI_BTYPE_SEPR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.05f, NULL, 0.0, 0.0, 0, 0, "");
- draw_filter(ui_list, C, col, reverse);
+ draw_filter(ui_list, C, col);
}
else {
but = uiDefIconButBitI(subblock, UI_BTYPE_TOGGLE, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_RIGHT, 0, 0,
@@ -4396,7 +4416,8 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
/* menu */
if (op->type->flag & OPTYPE_PRESET) {
- /* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
+ /* XXX, no simple way to get WM_MT_operator_presets.bl_label
+ * from python! Label remains the same always! */
PointerRNA op_ptr;
uiLayout *row;
@@ -4425,7 +4446,7 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
else {
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
- struct uiTemplateOperatorPropertyPollParam user_data = {.C = C, .op = op, .flag = flag};
+ struct uiTemplateOperatorPropertyPollParam user_data = { .C = C, .op = op, .flag = flag, };
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
@@ -4581,7 +4602,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
owner = sa;
handle_event = B_STOPCLIP;
- icon = ICON_CLIP;
+ icon = ICON_TRACKER;
}
else if (sa->spacetype == SPACE_FILE) {
if (WM_jobs_test(wm, sa, WM_JOB_TYPE_FILESEL_READDIR)) {
@@ -4867,7 +4888,8 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
if (but->rnaprop) {
UI_but_func_set(but, keymap_item_modified, ptr->data, NULL);
- /* Otherwise the keymap will be re-generated which we're trying to edit, see: T47685 */
+ /* Otherwise the keymap will be re-generated which we're trying to edit,
+ * see: T47685 */
UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY);
}
}
@@ -5028,7 +5050,7 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
return;
}
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
uiLayout *row = uiLayoutRow(layout, false);
uiBlock *block = uiLayoutGetBlock(row);
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index a7787d14776..7400e922b30 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_utils.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -43,7 +37,6 @@
#include "BLT_translation.h"
-#include "BKE_library.h"
#include "BKE_report.h"
#include "MEM_guardedalloc.h"
@@ -271,28 +264,22 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char
continue;
}
+ name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
iconid = 0;
if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
- name = MEM_malloc_arrayN(MAX_ID_FULL_NAME, sizeof(*name), __func__);
- BKE_id_full_name_ui_prefix_get(name, itemptr.data);
iconid = ui_id_icon_get(C, itemptr.data, false);
}
- else {
- name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
- }
if (name) {
if (skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->data = itemptr.data;
- cis->name = name; /* Still ownership of that memory. */
+ cis->name = MEM_dupallocN(name);
cis->index = i;
cis->iconid = iconid;
BLI_addtail(items_list, cis);
}
- else {
- MEM_freeN(name);
- }
+ MEM_freeN(name);
}
i++;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index a4ab8910c64..7e43ac8c850 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_widgets.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <limits.h>
@@ -104,12 +98,12 @@ enum {
/* it has outline, back, and two optional tria meshes */
typedef struct uiWidgetTrias {
- unsigned int tot;
+ uint tot;
int type;
float size, center[2];
float vec[16][2];
- const unsigned int (*index)[3];
+ const uint (*index)[3];
} uiWidgetTrias;
@@ -140,7 +134,7 @@ typedef struct uiWidgetBase {
typedef struct uiWidgetType {
/* pointer to theme color definition */
- uiWidgetColors *wcol_theme;
+ const uiWidgetColors *wcol_theme;
uiWidgetStateColors *wcol_state;
/* converted colors for state */
@@ -149,7 +143,7 @@ typedef struct uiWidgetType {
void (*state)(struct uiWidgetType *, int state, int drawflag);
void (*draw)(uiWidgetColors *, rcti *, int state, int roundboxalign);
void (*custom)(uiBut *, uiWidgetColors *, rcti *, int state, int roundboxalign);
- void (*text)(uiFontStyle *, uiWidgetColors *, uiBut *, rcti *);
+ void (*text)(const uiFontStyle *, const uiWidgetColors *, uiBut *, rcti *);
} uiWidgetType;
@@ -159,7 +153,7 @@ typedef struct uiWidgetType {
static const float cornervec[WIDGET_CURVE_RESOLU][2] = {
{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067},
{0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45},
- {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}
+ {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0},
};
@@ -167,7 +161,7 @@ const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2] = {
{ 0.468813, -0.481430}, {-0.155755, -0.352820},
{ 0.219306, -0.238501}, {-0.393286, -0.110949},
{-0.024699, 0.013908}, { 0.343805, 0.147431},
- {-0.272855, 0.269918}, { 0.095909, 0.388710}
+ {-0.272855, 0.269918}, { 0.095909, 0.388710},
};
#define WIDGET_AA_JITTER UI_PIXEL_AA_JITTER
#define jit ui_pixel_jitter
@@ -177,36 +171,36 @@ const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2] = {
* \{ */
static const float g_shape_preset_number_arrow_vert[3][2] = {
- {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}
+ {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353},
};
static const uint g_shape_preset_number_arrow_face[1][3] = {
- {0, 1, 2}
+ {0, 1, 2},
};
static const float g_shape_preset_scroll_circle_vert[16][2] = {
{0.382684, 0.923879}, {0.000001, 1.000000}, {-0.382683, 0.923880}, {-0.707107, 0.707107},
{-0.923879, 0.382684}, {-1.000000, 0.000000}, {-0.923880, -0.382684}, {-0.707107, -0.707107},
{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
- {0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}
+ {0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107},
};
static const uint g_shape_preset_scroll_circle_face[14][3] = {
{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6},
- {6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}
+ {6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9},
};
static const float g_shape_preset_menu_arrow_vert[6][2] = {
{-0.33, 0.16}, {0.33, 0.16}, {0, 0.82},
- {0, -0.82}, {-0.33, -0.16}, {0.33, -0.16}
+ {0, -0.82}, {-0.33, -0.16}, {0.33, -0.16},
};
static const uint g_shape_preset_menu_arrow_face[2][3] = {{2, 0, 1}, {3, 5, 4}};
static const float g_shape_preset_checkmark_vert[6][2] = {
{-0.578579, 0.253369}, {-0.392773, 0.412794}, {-0.004241, -0.328551},
- {-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895}
+ {-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895},
};
static const uint g_shape_preset_checkmark_face[4][3] = {
- {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}
+ {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3},
};
#define OY (-0.2 / 2)
@@ -368,7 +362,8 @@ GPUBatch *ui_batch_roundbox_widget_get(int tria)
set_roundbox_vertex_data(&vflag_step, last_data);
set_roundbox_vertex(&vflag_step, 0, 0, 0, false, false, EMBOSS);
/* Emboss */
- bool rev = false; /* go back and forth : avoid degenerate triangle (but beware of backface cull) */
+ /* go back and forth : avoid degenerate triangle (but beware of backface cull) */
+ bool rev = false;
for (int j = 0; j < WIDGET_AA_JITTER; j++, rev = !rev) {
for (int c = (rev) ? 1 : 0; (rev) ? c >= 0 : c < 2; (rev) ? c-- : c++) {
int sta = (rev) ? WIDGET_CURVE_RESOLU - 1 : 0;
@@ -546,7 +541,7 @@ void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4])
}
-void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float color[4])
+void UI_draw_anti_fan(float tri_array[][2], uint length, const float color[4])
{
float draw_color[4];
@@ -685,7 +680,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float maxxi = maxx - U.pixelsize;
float minyi = miny + U.pixelsize;
float maxyi = maxy - U.pixelsize;
- float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
+ /* for uv, can divide by zero */
+ float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f;
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
const int hnum = (
@@ -855,7 +851,7 @@ static void shape_preset_init_trias_ex(
uiWidgetTrias *tria, const rcti *rect, float triasize, char where,
/* input data */
const float verts[][2], const int verts_tot,
- const unsigned int tris[][3], const int tris_tot)
+ const uint tris[][3], const int tris_tot)
{
float centx, centy, sizex, sizey, minsize;
int a, i1 = 0, i2 = 1;
@@ -932,10 +928,10 @@ static void shape_preset_init_scroll_circle(uiWidgetTrias *tria, const rcti *rec
g_shape_preset_scroll_circle_face, ARRAY_SIZE(g_shape_preset_scroll_circle_face));
}
-static void widget_draw_vertex_buffer(unsigned int pos, unsigned int col, int mode,
+static void widget_draw_vertex_buffer(uint pos, uint col, int mode,
const float quads_pos[WIDGET_SIZE_MAX][2],
- const unsigned char quads_col[WIDGET_SIZE_MAX][4],
- unsigned int totvert)
+ const uchar quads_col[WIDGET_SIZE_MAX][4],
+ uint totvert)
{
immBegin(mode, totvert);
for (int i = 0; i < totvert; ++i) {
@@ -948,16 +944,23 @@ static void widget_draw_vertex_buffer(unsigned int pos, unsigned int col, int mo
static void shape_preset_trias_from_rect_menu(uiWidgetTrias *tria, const rcti *rect)
{
+ float width = BLI_rcti_size_x(rect);
+ float height = BLI_rcti_size_y(rect);
float centx, centy, size;
- int a;
+
tria->type = ROUNDBOX_TRIA_MENU;
- /* center position and size */
- tria->center[0] = centx = rect->xmax - 0.32f * BLI_rcti_size_y(rect);
- tria->center[1] = centy = rect->ymin + 0.50f * BLI_rcti_size_y(rect);
- tria->size = size = 0.4f * BLI_rcti_size_y(rect);
+ /* Center position and size. */
+ tria->center[0] = centx = rect->xmin + 0.52f * BLI_rcti_size_y(rect);
+ tria->center[1] = centy = rect->ymin + 0.52f * BLI_rcti_size_y(rect);
+ tria->size = size = 0.4f * height;
+
+ if (width > height * 1.1f) {
+ /* For wider buttons align tighter to the right. */
+ tria->center[0] = centx = rect->xmax - 0.32f * height;
+ }
- for (a = 0; a < 6; a++) {
+ for (int a = 0; a < 6; a++) {
tria->vec[a][0] = size * g_shape_preset_menu_arrow_vert[a][0] + centx;
tria->vec[a][1] = size * g_shape_preset_menu_arrow_vert[a][1] + centy;
}
@@ -969,15 +972,15 @@ static void shape_preset_trias_from_rect_menu(uiWidgetTrias *tria, const rcti *r
static void shape_preset_trias_from_rect_checkmark(uiWidgetTrias *tria, const rcti *rect)
{
float centx, centy, size;
- int a;
+
tria->type = ROUNDBOX_TRIA_CHECK;
- /* center position and size */
+ /* Center position and size. */
tria->center[0] = centx = rect->xmin + 0.5f * BLI_rcti_size_y(rect);
tria->center[1] = centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect);
tria->size = size = 0.5f * BLI_rcti_size_y(rect);
- for (a = 0; a < 6; a++) {
+ for (int a = 0; a < 6; a++) {
tria->vec[a][0] = size * g_shape_preset_checkmark_vert[a][0] + centx;
tria->vec[a][1] = size * g_shape_preset_checkmark_vert[a][1] + centy;
}
@@ -1003,7 +1006,7 @@ static void shadecolors4(char coltop[4], char coldown[4], const char *color, sho
coldown[3] = color[3];
}
-static void round_box_shade_col4_r(unsigned char r_col[4], const char col1[4], const char col2[4], const float fac)
+static void round_box_shade_col4_r(uchar r_col[4], const char col1[4], const char col2[4], const float fac)
{
const int faci = unit_float_to_uchar_clamp(fac);
const int facm = 255 - faci;
@@ -1025,7 +1028,7 @@ static void widget_verts_to_triangle_strip(uiWidgetBase *wtb, const int totvert,
copy_v2_v2(triangle_strip[a * 2 + 1], wtb->inner_v[0]);
}
-static void widgetbase_outline(uiWidgetBase *wtb, unsigned int pos)
+static void widgetbase_outline(uiWidgetBase *wtb, uint pos)
{
float triangle_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 because the last pair is wrapped */
widget_verts_to_triangle_strip(wtb, wtb->totvert, triangle_strip);
@@ -1064,10 +1067,10 @@ static void widgetbase_set_uniform_discard_factor(
static void widgetbase_set_uniform_colors_ubv(
uiWidgetBase *wtb,
- const unsigned char *col1, const unsigned char *col2,
- const unsigned char *outline,
- const unsigned char *emboss,
- const unsigned char *tria,
+ const uchar *col1, const uchar *col2,
+ const uchar *outline,
+ const uchar *emboss,
+ const uchar *tria,
const bool alpha_check)
{
widgetbase_set_uniform_alpha_check(wtb, alpha_check);
@@ -1181,11 +1184,11 @@ static void widgetbase_draw_ex(
uiWidgetBase *wtb, const uiWidgetColors *wcol,
bool show_alpha_checkers)
{
- unsigned char inner_col1[4] = {0};
- unsigned char inner_col2[4] = {0};
- unsigned char emboss_col[4] = {0};
- unsigned char outline_col[4] = {0};
- unsigned char tria_col[4] = {0};
+ uchar inner_col1[4] = {0};
+ uchar inner_col2[4] = {0};
+ uchar emboss_col[4] = {0};
+ uchar outline_col[4] = {0};
+ uchar tria_col[4] = {0};
/* For color widget. */
if (wcol->shaded != 0) {
show_alpha_checkers = false;
@@ -1197,10 +1200,10 @@ static void widgetbase_draw_ex(
if (wtb->draw_inner) {
if (wcol->shaded == 0) {
/* simple fill */
- inner_col1[0] = inner_col2[0] = (unsigned char)wcol->inner[0];
- inner_col1[1] = inner_col2[1] = (unsigned char)wcol->inner[1];
- inner_col1[2] = inner_col2[2] = (unsigned char)wcol->inner[2];
- inner_col1[3] = inner_col2[3] = (unsigned char)wcol->inner[3];
+ inner_col1[0] = inner_col2[0] = (uchar)wcol->inner[0];
+ inner_col1[1] = inner_col2[1] = (uchar)wcol->inner[1];
+ inner_col1[2] = inner_col2[2] = (uchar)wcol->inner[2];
+ inner_col1[3] = inner_col2[3] = (uchar)wcol->inner[3];
}
else {
/* gradient fill */
@@ -1224,7 +1227,7 @@ static void widgetbase_draw_ex(
tria_col[0] = wcol->item[0];
tria_col[1] = wcol->item[1];
tria_col[2] = wcol->item[2];
- tria_col[3] = (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER);
+ tria_col[3] = (uchar)((float)wcol->item[3] / WIDGET_AA_JITTER);
}
/* Draw everything in one drawcall */
@@ -1401,7 +1404,7 @@ static void ui_text_clip_give_next_off(uiBut *but, const char *str)
* Return the length of modified (right-clipped + ellipsis) string.
*/
static void ui_text_clip_right_ex(
- uiFontStyle *fstyle, char *str, const size_t max_len, const float okwidth,
+ const uiFontStyle *fstyle, char *str, const size_t max_len, const float okwidth,
const char *sep, const int sep_len, const float sep_strwidth, size_t *r_final_len)
{
float tmp;
@@ -1435,13 +1438,14 @@ static void ui_text_clip_right_ex(
* for strings with shortcuts, like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O').
*/
float UI_text_clip_middle_ex(
- uiFontStyle *fstyle, char *str, float okwidth, const float minwidth,
+ const uiFontStyle *fstyle, char *str, float okwidth, const float minwidth,
const size_t max_len, const char rpart_sep)
{
float strwidth;
/* Add some epsilon to OK width, avoids 'ellipsing' text that nearly fits!
- * Better to have a small piece of the last char cut out, than two remaining chars replaced by an ellipsis... */
+ * Better to have a small piece of the last char cut out,
+ * than two remaining chars replaced by an ellipsis... */
okwidth += 1.0f + UI_DPI_FAC;
BLI_assert(str[0]);
@@ -1456,7 +1460,8 @@ float UI_text_clip_middle_ex(
strwidth = BLF_width(fstyle->uifont_id, str, max_len);
if ((okwidth > 0.0f) && (strwidth > okwidth)) {
- /* utf8 two-dots leader '..' (shorter than ellipsis '...'), some compilers complain with real litteral string. */
+ /* utf8 two-dots leader '..' (shorter than ellipsis '...'),
+ * some compilers complain with real litteral string. */
const char sep[] = {0xe2, 0x80, 0xA5, 0x0};
const int sep_len = sizeof(sep) - 1;
const float sep_strwidth = BLF_width(fstyle->uifont_id, sep, sep_len + 1);
@@ -1520,7 +1525,8 @@ float UI_text_clip_middle_ex(
else {
memmove(str + l_end + sep_len, str + r_offset, r_len);
memcpy(str + l_end, sep, sep_len);
- final_lpart_len = (size_t)(l_end + sep_len + r_len - 1); /* -1 to remove trailing '\0'! */
+ /* -1 to remove trailing '\0'! */
+ final_lpart_len = (size_t)(l_end + sep_len + r_len - 1);
while (BLF_width(fstyle->uifont_id, str, max_len) > okwidth) {
/* This will happen because a lot of string width processing is done in integer pixels,
@@ -1555,7 +1561,7 @@ float UI_text_clip_middle_ex(
/**
* Wrapper around UI_text_clip_middle_ex.
*/
-static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
+static void ui_text_clip_middle(const uiFontStyle *fstyle, uiBut *but, const rcti *rect)
{
/* No margin for labels! */
const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU, UI_BTYPE_POPOVER) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
@@ -1571,7 +1577,7 @@ static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rec
* Like ui_text_clip_middle(), but protect/preserve at all cost the right part of the string after sep.
* Useful for strings with shortcuts (like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O').
*/
-static void ui_text_clip_middle_protect_right(uiFontStyle *fstyle, uiBut *but, const rcti *rect, const char rsep)
+static void ui_text_clip_middle_protect_right(const uiFontStyle *fstyle, uiBut *but, const rcti *rect, const char rsep)
{
/* No margin for labels! */
const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU, UI_BTYPE_POPOVER) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
@@ -1586,7 +1592,7 @@ static void ui_text_clip_middle_protect_right(uiFontStyle *fstyle, uiBut *but, c
/**
* Cut off the text, taking into account the cursor location (text display while editing).
*/
-static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
+static void ui_text_clip_cursor(const uiFontStyle *fstyle, uiBut *but, const rcti *rect)
{
const int border = (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
@@ -1648,7 +1654,7 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec
*
* \note deals with ': ' especially for number buttons
*/
-static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
+static void ui_text_clip_right_label(const uiFontStyle *fstyle, uiBut *but, const rcti *rect)
{
const int border = UI_TEXT_CLIP_MARGIN + 1;
const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
@@ -1683,7 +1689,8 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
int bytes = cp2 - prev_utf8;
- /* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
+ /* shift the text after and including cp2 back by 1 char,
+ * +1 to include null terminator */
memmove(cp2 - bytes, cp2, drawstr_len + 1);
cp2 -= bytes;
@@ -1766,7 +1773,7 @@ static void widget_draw_text_ime_underline(
}
#endif /* WITH_INPUT_IME */
-static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
+static void widget_draw_text(const uiFontStyle *fstyle, const uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
int drawstr_left_len = UI_MAX_DRAW_STR;
const char *drawstr = but->drawstr;
@@ -1779,12 +1786,16 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
UI_fontstyle_set(fstyle);
- if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT))
- fstyle->align = UI_STYLE_TEXT_LEFT;
- else if (but->drawflag & UI_BUT_TEXT_RIGHT)
- fstyle->align = UI_STYLE_TEXT_RIGHT;
- else
- fstyle->align = UI_STYLE_TEXT_CENTER;
+ eFontStyle_Align align;
+ if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) {
+ align = UI_STYLE_TEXT_LEFT;
+ }
+ else if (but->drawflag & UI_BUT_TEXT_RIGHT) {
+ align = UI_STYLE_TEXT_RIGHT;
+ }
+ else {
+ align = UI_STYLE_TEXT_CENTER;
+ }
if (fstyle->kerning == 1) /* for BLF_width */
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
@@ -1796,7 +1807,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uiBut *but_edit = ui_but_drag_multi_edit_get(but);
if (but_edit) {
drawstr = but_edit->editstr;
- fstyle->align = UI_STYLE_TEXT_LEFT;
+ align = UI_STYLE_TEXT_LEFT;
}
}
else {
@@ -1852,7 +1863,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor4ubv((unsigned char *)wcol->item);
+ immUniformColor4ubv((uchar *)wcol->item);
immRecti(pos, rect->xmin + selsta_draw,
rect->ymin + 2,
min_ii(rect->xmin + selwidth_draw, rect->xmax - 2),
@@ -1964,8 +1975,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
int drawlen = (drawstr_left_len == INT_MAX) ? strlen(drawstr + but->ofs) : (drawstr_left_len - but->ofs);
if (drawlen > 0) {
- UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, (unsigned char *)wcol->text,
- drawlen, &font_xofs, &font_yofs);
+ UI_fontstyle_draw_ex(
+ fstyle, rect, drawstr + but->ofs, (uchar *)wcol->text,
+ &(struct uiFontStyleDraw_Params) { .align = align, },
+ drawlen, &font_xofs, &font_yofs);
if (but->menu_key != '\0') {
char fixedbuf[128];
@@ -1991,7 +2004,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
ul_advance = BLF_width(fstyle->uifont_id, fixedbuf, ul_index) + (1.0f * UI_DPI_FAC);
BLF_position(fstyle->uifont_id, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f);
- BLF_color4ubv(fstyle->uifont_id, (unsigned char *)wcol->text);
+ BLF_color4ubv(fstyle->uifont_id, (uchar *)wcol->text);
BLF_draw(fstyle->uifont_id, "_", 2);
if (fstyle->kerning == 1) {
@@ -2010,9 +2023,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
col[3] *= 0.5f;
}
- fstyle->align = UI_STYLE_TEXT_RIGHT;
rect->xmax -= UI_TEXT_CLIP_MARGIN;
- UI_fontstyle_draw(fstyle, rect, drawstr_right, (const uchar *)col);
+ UI_fontstyle_draw(
+ fstyle, rect, drawstr_right, (const uchar *)col,
+ &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_RIGHT, });
}
}
@@ -2032,7 +2046,7 @@ static BIFIconID widget_icon_id(uiBut *but)
}
/* draws text and icons for buttons */
-static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
+static void widget_draw_text_icon(const uiFontStyle *fstyle, const uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
const uiButExtraIconType extra_icon_type = ui_but_icon_extra_get(but);
const bool show_menu_icon = ui_but_draw_menu_icon(but);
@@ -2309,7 +2323,8 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag)
static void widget_state_numslider(uiWidgetType *wt, int state, int drawflag)
{
uiWidgetStateColors *wcol_state = wt->wcol_state;
- float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */
+ /* XXX special tweak to make sure that bar will still be visible */
+ float blend = wcol_state->blend - 0.2f;
/* call this for option button */
widget_state(wt, state, drawflag);
@@ -2570,7 +2585,7 @@ void ui_hsvcircle_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float
*ypos = centy + sinf(-ang) * radius;
}
-static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
+static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
{
/* TODO(merwin): reimplement as shader for pixel-perfect colors */
@@ -2654,7 +2669,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
GPU_blend(true);
GPU_line_smooth(true);
- immUniformColor3ubv((unsigned char *)wcol->outline);
+ immUniformColor3ubv((uchar *)wcol->outline);
imm_draw_circle_wire_2d(pos, centx, centy, radius, tot);
immUnbindProgram();
@@ -2742,7 +2757,9 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
immBegin(GPU_PRIM_TRIS, steps * 3 * 6);
- for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */
+
+ /* 0.999 = prevent float inaccuracy for steps */
+ for (dx = 0.0f; dx < 0.999f; dx += color_step) {
const float dx_next = dx + color_step;
/* previous color */
@@ -2960,14 +2977,14 @@ static void ui_draw_roundbox(const rcti *rect, const float rad, const uiWidgetCo
/* ************ separator, for menus etc ***************** */
-static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol)
+static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol)
{
int y = rect->ymin + BLI_rcti_size_y(rect) / 2 - 1;
- unsigned char col[4] = {
+ uchar col[4] = {
wcol->text[0],
wcol->text[1],
wcol->text[2],
- 30
+ 30,
};
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -3352,7 +3369,8 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
wtb.draw_inner = false;
widgetbase_draw(&wtb, wcol);
- /* Add space at either side of the button so text aligns with numbuttons (which have arrow icons). */
+ /* Add space at either side of the button so text aligns with numbuttons
+ * (which have arrow icons). */
if (!(state & UI_STATE_TEXT_INPUT)) {
rect->xmax -= toffs;
rect->xmin += toffs;
@@ -3402,7 +3420,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
if (!ui_but_is_color_gamma(but))
ui_block_cm_to_display_space_v3(but->block, col);
- rgba_float_to_uchar((unsigned char *)wcol->inner, col);
+ rgba_float_to_uchar((uchar *)wcol->inner, col);
const bool show_alpha_checkers = (wcol->inner[3] < 255);
wcol->shaded = 0;
@@ -3648,9 +3666,9 @@ static void widget_state_label(uiWidgetType *wt, int state, int drawflag)
/* call this for option button */
widget_state(wt, state, drawflag);
if (state & UI_SELECT)
- UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
+ UI_GetThemeColor3ubv(TH_TEXT_HI, (uchar *)wt->wcol.text);
else
- UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
+ UI_GetThemeColor3ubv(TH_TEXT, (uchar *)wt->wcol.text);
}
if (state & UI_BUT_REDALERT) {
@@ -3749,21 +3767,22 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
const float rad = wcol->roundness * U.widget_unit;
const bool is_active = (state & UI_SELECT);
-/* Draw shaded outline - Disabled for now, seems incorrect and also looks nicer without it imho ;) */
+/* Draw shaded outline - Disabled for now,
+ * seems incorrect and also looks nicer without it imho ;) */
//#define USE_TAB_SHADED_HIGHLIGHT
uiWidgetBase wtb;
- unsigned char theme_col_tab_highlight[3];
+ uchar theme_col_tab_highlight[3];
#ifdef USE_TAB_SHADED_HIGHLIGHT
/* create outline highlight colors */
if (is_active) {
- interp_v3_v3v3_uchar(theme_col_tab_highlight, (unsigned char *)wcol->inner_sel,
- (unsigned char *)wcol->outline, 0.2f);
+ interp_v3_v3v3_uchar(theme_col_tab_highlight, (uchar *)wcol->inner_sel,
+ (uchar *)wcol->outline, 0.2f);
}
else {
- interp_v3_v3v3_uchar(theme_col_tab_highlight, (unsigned char *)wcol->inner,
- (unsigned char *)wcol->outline, 0.12f);
+ interp_v3_v3v3_uchar(theme_col_tab_highlight, (uchar *)wcol->inner,
+ (uchar *)wcol->outline, 0.12f);
}
#endif
@@ -3785,7 +3804,7 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
#ifdef USE_TAB_SHADED_HIGHLIGHT
/* draw outline (3d look) */
- ui_draw_but_TAB_outline(rect, rad, theme_col_tab_highlight, (unsigned char *)wcol->inner);
+ ui_draw_but_TAB_outline(rect, rad, theme_col_tab_highlight, (uchar *)wcol->inner);
#endif
#ifndef USE_TAB_SHADED_HIGHLIGHT
@@ -3799,7 +3818,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
uiWidgetColors *wcol = &btheme->tui.wcol_radio;
uiWidgetBase wtb;
const float rad = wcol->roundness * U.widget_unit;
- unsigned char col[4];
+ uchar col[4];
/* state copy! */
wt->wcol = *(wt->wcol_theme);
@@ -4068,8 +4087,8 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
{
bTheme *btheme = UI_GetTheme();
- ThemeUI *tui = &btheme->tui;
- uiFontStyle *fstyle = &style->widget;
+ const ThemeUI *tui = &btheme->tui;
+ const uiFontStyle *fstyle = &style->widget;
uiWidgetType *wt = NULL;
#ifdef USE_UI_POPOVER_ONCE
@@ -4238,7 +4257,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case UI_BTYPE_HSVCUBE:
- if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */
+ if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
+ /* vertical V slider, uses new widget draw now */
ui_draw_but_HSV_v(but, rect);
}
else { /* other HSV pickers... */
@@ -4387,7 +4407,7 @@ static void ui_draw_clip_tri(uiBlock *block, rcti *rect, uiWidgetType *wt)
{
if (block) {
float draw_color[4];
- unsigned char *color = (unsigned char *)wt->wcol.text;
+ uchar *color = (uchar *)wt->wcol.text;
draw_color[0] = ((float)color[0]) / 255.0f;
draw_color[1] = ((float)color[1]) / 255.0f;
@@ -4451,7 +4471,7 @@ static void ui_draw_popover_back_impl(
if (ELEM(direction, UI_DIR_UP, UI_DIR_DOWN)) {
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor4ubv((unsigned char *)wcol->inner);
+ immUniformColor4ubv((uchar *)wcol->inner);
GPU_blend(true);
immBegin(GPU_PRIM_TRIS, 3);
if (direction == UI_DIR_DOWN) {
@@ -4502,8 +4522,8 @@ static void draw_disk_shaded(
float s, c;
float y1, y2;
float fac;
- unsigned char r_col[4];
- unsigned int pos, col;
+ uchar r_col[4];
+ uint pos, col;
GPUVertFormat *format = immVertexFormat();
pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -4513,7 +4533,7 @@ static void draw_disk_shaded(
}
else {
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor4ubv((unsigned char *)col1);
+ immUniformColor4ubv((uchar *)col1);
}
immBegin(GPU_PRIM_TRI_STRIP, subd * 2);
@@ -4588,7 +4608,7 @@ void ui_draw_pie_center(uiBlock *block)
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor4ubv((unsigned char *)btheme->tui.wcol_pie_menu.outline);
+ immUniformColor4ubv((uchar *)btheme->tui.wcol_pie_menu.outline);
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, pie_radius_internal, subd);
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, pie_radius_external, subd);
@@ -4612,7 +4632,7 @@ void ui_draw_pie_center(uiBlock *block)
}
-uiWidgetColors *ui_tooltip_get_theme(void)
+const uiWidgetColors *ui_tooltip_get_theme(void)
{
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
return wt->wcol_theme;
@@ -4637,7 +4657,7 @@ void ui_draw_widget_back_color(
rcti rect_copy = *rect;
wt->state(wt, 0, 0);
if (color) {
- rgba_float_to_uchar((unsigned char *)wt->wcol.inner, color);
+ rgba_float_to_uchar((uchar *)wt->wcol.inner, color);
}
wt->draw(&wt->wcol, &rect_copy, 0, UI_CNR_ALL);
}
@@ -4656,7 +4676,7 @@ void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block),
/* helper call to draw a menu item without button */
/* state: UI_ACTIVE or 0 */
-void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep)
+void ui_draw_menu_item(const uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep)
{
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM);
rcti _rect = *rect;
@@ -4666,7 +4686,6 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
wt->draw(&wt->wcol, rect, 0, 0);
UI_fontstyle_set(fstyle);
- fstyle->align = UI_STYLE_TEXT_LEFT;
/* text location offset */
rect->xmin += 0.25f * UI_UNIT_X;
@@ -4704,15 +4723,18 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0');
}
- UI_fontstyle_draw(fstyle, rect, drawstr, (unsigned char *)wt->wcol.text);
+ UI_fontstyle_draw(
+ fstyle, rect, drawstr, (uchar *)wt->wcol.text,
+ &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_LEFT, });
}
/* part text right aligned */
if (use_sep) {
if (cpoin) {
- fstyle->align = UI_STYLE_TEXT_RIGHT;
rect->xmax = _rect.xmax - 5;
- UI_fontstyle_draw(fstyle, rect, cpoin + 1, (unsigned char *)wt->wcol.text);
+ UI_fontstyle_draw(
+ fstyle, rect, cpoin + 1, (uchar *)wt->wcol.text,
+ &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_RIGHT, });
*cpoin = UI_SEP_CHAR;
}
}
@@ -4729,12 +4751,13 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
aspect = ICON_DEFAULT_HEIGHT / height;
GPU_blend(true);
- UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f, wt->wcol.text); /* XXX scale weak get from fstyle? */
+ /* XXX scale weak get from fstyle? */
+ UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f, wt->wcol.text);
GPU_blend(false);
}
}
-void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
+void ui_draw_preview_item(const uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
rcti trect = *rect;
const float text_size = UI_UNIT_Y;
@@ -4770,7 +4793,9 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
BLI_strncpy(drawstr, name, sizeof(drawstr));
UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0');
- UI_fontstyle_draw(fstyle, &trect, drawstr, (unsigned char *)wt->wcol.text);
+ UI_fontstyle_draw(
+ fstyle, &trect, drawstr, (uchar *)wt->wcol.text,
+ &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_CENTER, });
}
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 09b8933206e..48b24da8f5c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/resources.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <math.h>
@@ -89,7 +81,7 @@ void ui_resources_free(void)
/* THEMES */
/* ******************************************************** */
-const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
+const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
{
ThemeSpace *ts = NULL;
static char error[4] = {240, 0, 240, 255};
@@ -117,59 +109,59 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
else {
switch (spacetype) {
- case SPACE_BUTS:
- ts = &btheme->tbuts;
+ case SPACE_PROPERTIES:
+ ts = &btheme->space_properties;
break;
case SPACE_VIEW3D:
- ts = &btheme->tv3d;
+ ts = &btheme->space_view3d;
break;
- case SPACE_IPO:
- ts = &btheme->tipo;
+ case SPACE_GRAPH:
+ ts = &btheme->space_graph;
break;
case SPACE_FILE:
- ts = &btheme->tfile;
+ ts = &btheme->space_file;
break;
case SPACE_NLA:
- ts = &btheme->tnla;
+ ts = &btheme->space_nla;
break;
case SPACE_ACTION:
- ts = &btheme->tact;
+ ts = &btheme->space_action;
break;
case SPACE_SEQ:
- ts = &btheme->tseq;
+ ts = &btheme->space_sequencer;
break;
case SPACE_IMAGE:
- ts = &btheme->tima;
+ ts = &btheme->space_image;
break;
case SPACE_TEXT:
- ts = &btheme->text;
+ ts = &btheme->space_text;
break;
case SPACE_OUTLINER:
- ts = &btheme->toops;
+ ts = &btheme->space_outliner;
break;
case SPACE_INFO:
- ts = &btheme->tinfo;
+ ts = &btheme->space_info;
break;
case SPACE_USERPREF:
- ts = &btheme->tuserpref;
+ ts = &btheme->space_preferences;
break;
case SPACE_CONSOLE:
- ts = &btheme->tconsole;
+ ts = &btheme->space_console;
break;
case SPACE_NODE:
- ts = &btheme->tnode;
+ ts = &btheme->space_node;
break;
case SPACE_CLIP:
- ts = &btheme->tclip;
+ ts = &btheme->space_clip;
break;
case SPACE_TOPBAR:
- ts = &btheme->ttopbar;
+ ts = &btheme->space_topbar;
break;
case SPACE_STATUSBAR:
- ts = &btheme->tstatusbar;
+ ts = &btheme->space_statusbar;
break;
default:
- ts = &btheme->tv3d;
+ ts = &btheme->space_view3d;
break;
}
@@ -183,6 +175,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->header;
else if (theme_regionid == RGN_TYPE_NAV_BAR)
cp = ts->navigation_bar;
+ else if (theme_regionid == RGN_TYPE_EXECUTE)
+ cp = ts->execution_buts;
else
cp = ts->button;
@@ -192,15 +186,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
}
cp = back;
break;
- case TH_LOW_GRAD:
- cp = ts->gradients.gradient;
- break;
- case TH_HIGH_GRAD:
- cp = ts->gradients.high_gradient;
+ case TH_BACK_GRAD:
+ cp = ts->back_grad;
break;
+
case TH_SHOW_BACK_GRAD:
cp = &setting;
- setting = ts->gradients.show_grad;
+ setting = ts->show_back_grad;
break;
case TH_TEXT:
if (theme_regionid == RGN_TYPE_WINDOW)
@@ -236,7 +228,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_HEADER:
cp = ts->header; break;
case TH_HEADERDESEL:
- /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
+ /* we calculate a dynamic builtin header deselect color,
+ * also for pulldowns... */
cp = ts->header;
headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
@@ -289,7 +282,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->syntaxr; break;
case TH_WIRE_EDIT:
cp = ts->wire_edit; break;
- case TH_LAMP:
+ case TH_LIGHT:
cp = ts->lamp; break;
case TH_SPEAKER:
cp = ts->speaker; break;
@@ -743,7 +736,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
}
}
- return (const unsigned char *)cp;
+ return (const uchar *)cp;
}
/**
@@ -751,9 +744,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
* \note: when you add new colors, created & saved themes need initialized
* use function below, init_userdef_do_versions()
*/
-void ui_theme_init_default(void)
+void UI_theme_init_default(void)
{
-
/* we search for the theme with name Default */
bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
if (btheme == NULL) {
@@ -768,7 +760,7 @@ void ui_theme_init_default(void)
btheme->active_theme_area = active_theme_area;
}
-void ui_style_init_default(void)
+void UI_style_init_default(void)
{
BLI_freelistN(&U.uistyles);
/* gets automatically re-allocated */
@@ -787,7 +779,7 @@ void UI_SetTheme(int spacetype, int regionid)
else if (regionid) {
/* popups */
theme_active = U.themes.first;
- theme_spacetype = SPACE_BUTS;
+ theme_spacetype = SPACE_PROPERTIES;
theme_regionid = regionid;
}
else {
@@ -815,10 +807,10 @@ void UI_Theme_Restore(struct bThemeState *theme_state)
g_theme_state = *theme_state;
}
-void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4])
+void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, uchar col[4])
{
int r, g, b, a;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = coloffset + (int) cp[0];
@@ -836,9 +828,9 @@ void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset,
col[3] = a;
}
-void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3])
+void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[3])
{
- const unsigned char *cp1, *cp2;
+ const uchar *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -851,7 +843,20 @@ void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned c
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3])
{
- const unsigned char *cp1, *cp2;
+ const uchar *cp1, *cp2;
+
+ cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+ cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+ CLAMP(fac, 0.0f, 1.0f);
+ r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
+ r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
+ r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
+}
+
+void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4])
+{
+ const uchar *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -860,11 +865,12 @@ void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[
r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
+ r_col[3] = ((1.0f - fac) * cp1[3] + fac * cp2[3]) / 255.0f;
}
void UI_FontThemeColor(int fontid, int colorid)
{
- unsigned char color[4];
+ uchar color[4];
UI_GetThemeColor4ubv(colorid, color);
BLF_color4ubv(fontid, color);
}
@@ -872,7 +878,7 @@ void UI_FontThemeColor(int fontid, int colorid)
/* get individual values, not scaled */
float UI_GetThemeValuef(int colorid)
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((float)cp[0]);
@@ -881,7 +887,7 @@ float UI_GetThemeValuef(int colorid)
/* get individual values, not scaled */
int UI_GetThemeValue(int colorid)
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((int) cp[0]);
@@ -890,7 +896,7 @@ int UI_GetThemeValue(int colorid)
/* versions of the function above, which take a space-type */
float UI_GetThemeValueTypef(int colorid, int spacetype)
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
return ((float)cp[0]);
@@ -898,7 +904,7 @@ float UI_GetThemeValueTypef(int colorid, int spacetype)
int UI_GetThemeValueType(int colorid, int spacetype)
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
return ((int)cp[0]);
@@ -908,7 +914,7 @@ int UI_GetThemeValueType(int colorid, int spacetype)
/* get the color, range 0.0-1.0 */
void UI_GetThemeColor3fv(int colorid, float col[3])
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
@@ -918,7 +924,7 @@ void UI_GetThemeColor3fv(int colorid, float col[3])
void UI_GetThemeColor4fv(int colorid, float col[4])
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
@@ -927,11 +933,22 @@ void UI_GetThemeColor4fv(int colorid, float col[4])
col[3] = ((float)cp[3]) / 255.0f;
}
+void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4])
+{
+ const unsigned char *cp;
+
+ cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
+ col[0] = ((float)cp[0]) / 255.0f;
+ col[1] = ((float)cp[1]) / 255.0f;
+ col[2] = ((float)cp[2]) / 255.0f;
+ col[3] = ((float)cp[3]) / 255.0f;
+}
+
/* get the color, range 0.0-1.0, complete with shading offset */
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
{
int r, g, b;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
@@ -947,10 +964,10 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
col[2] = ((float)b) / 255.0f;
}
-void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
+void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3])
{
int r, g, b;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
@@ -966,9 +983,9 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
col[2] = b;
}
-void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3])
+void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, uchar col[3])
{
- const unsigned char *cp1, *cp2;
+ const uchar *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -983,10 +1000,10 @@ void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int o
unit_float_to_uchar_clamp_v3(col, blend);
}
-void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
+void UI_GetThemeColorShade4ubv(int colorid, int offset, uchar col[4])
{
int r, g, b;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = offset + (int) cp[0];
@@ -1005,7 +1022,7 @@ void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
{
int r, g, b, a;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
@@ -1027,7 +1044,7 @@ void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset,
void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3])
{
int r, g, b;
- const unsigned char *cp1, *cp2;
+ const uchar *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -1049,7 +1066,7 @@ void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int of
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
{
int r, g, b, a;
- const unsigned char *cp1, *cp2;
+ const uchar *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -1072,9 +1089,9 @@ void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int of
}
/* get the color, in char pointer */
-void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
+void UI_GetThemeColor3ubv(int colorid, uchar col[3])
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = cp[0];
@@ -1086,7 +1103,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
{
int r, g, b, a;
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
@@ -1107,9 +1124,9 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
}
/* get the color, in char pointer */
-void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
+void UI_GetThemeColor4ubv(int colorid, uchar col[4])
{
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = cp[0];
@@ -1118,9 +1135,19 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
col[3] = cp[3];
}
-void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
+void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
{
- const unsigned char *cp;
+ const uchar *cp;
+
+ cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
+ col[0] = cp[0];
+ col[1] = cp[1];
+ col[2] = cp[2];
+}
+
+void UI_GetThemeColorType4ubv(int colorid, int spacetype, uchar col[4])
+{
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
col[0] = cp[0];
@@ -1144,7 +1171,7 @@ bool UI_GetIconThemeColor4fv(int colorid, float col[4])
return false;
}
- const unsigned char *cp;
+ const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
col[1] = ((float)cp[1]) / 255.0f;
@@ -1154,7 +1181,7 @@ bool UI_GetIconThemeColor4fv(int colorid, float col[4])
return true;
}
-void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset)
+void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset)
{
int r, g, b;
@@ -1173,7 +1200,7 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in
/* get a 3 byte color, blended and shaded between two other char color pointers */
void UI_GetColorPtrBlendShade3ubv(
- const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3],
+ const uchar cp1[3], const uchar cp2[3], uchar col[3],
float fac, int offset)
{
int r, g, b;
@@ -1214,9 +1241,9 @@ int UI_ThemeMenuShadowWidth(void)
return (int)(btheme->tui.menu_shadow_width * UI_DPI_FAC);
}
-void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
+void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axis)
{
- unsigned char col[3];
+ uchar col[3];
switch (axis) {
case 'X':
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 80f4bb57baa..bb49f024bc3 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/view2d.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -234,7 +228,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
*/
case V2D_COMMONVIEW_STANDARD:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM);
v2d->minzoom = 0.01f;
v2d->maxzoom = 1000.0f;
@@ -289,7 +284,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* scroller settings are currently not set here... that is left for regions... */
break;
}
- /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
+ /* 'header' regions - zoom, aspect ratio,
+ * alignment, and panning restrictions are set here */
case V2D_COMMONVIEW_HEADER:
{
/* zoom + aspect ratio are locked */
@@ -322,7 +318,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
case V2D_COMMONVIEW_PANELS_UI:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM);
v2d->minzoom = 0.5f;
v2d->maxzoom = 2.0f;
@@ -357,7 +354,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
/* other view types are completely defined using their own settings already */
default:
- /* we don't do anything here, as settings should be fine, but just make sure that rect */
+ /* we don't do anything here,
+ * as settings should be fine, but just make sure that rect */
break;
}
@@ -377,7 +375,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
/* set 'tot' rect before setting cur? */
- /* XXX confusing stuff here still - I made this function not check scroller hide - that happens in totrect_set */
+ /* XXX confusing stuff here still -
+ * I made this function not check scroller hide - that happens in totrect_set */
if (tot_changed)
UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init);
else
@@ -486,7 +485,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
}
}
else {
- /* make sure sizes don't exceed that of the min/max sizes (even though we're not doing zoom clamping) */
+ /* make sure sizes don't exceed that of the min/max sizes
+ * (even though we're not doing zoom clamping) */
CLAMP(width, v2d->min[0], v2d->max[0]);
CLAMP(height, v2d->min[1], v2d->max[1]);
}
@@ -576,7 +576,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
v2d->oldwiny = (short)winy;
}
- /* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */
+ /* Step 2: apply new sizes to cur rect,
+ * but need to take into account alignment settings here... */
if ((width != curwidth) || (height != curheight)) {
float temp, dh;
@@ -675,7 +676,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* (XXX - in the past, max was favored... if there are bugs, swap!)
*/
if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_x(tot);
diff = curwidth * 0.5f;
@@ -725,7 +727,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* We favour moving the 'minimum' across, as that's origin for most things
*/
if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_y(tot);
diff = curheight * 0.5f;
@@ -803,7 +806,8 @@ void UI_view2d_curRect_validate(View2D *v2d)
/* ------------------ */
-/* Called by menus to activate it, or by view2d operators to make sure 'related' views stay in synchrony */
+/* Called by menus to activate it, or by view2d operators
+ * to make sure 'related' views stay in synchrony */
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
{
ScrArea *sa;
@@ -992,7 +996,8 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
UI_view2d_totRect_set_resize(v2d, width, height, 0);
- /* solve bad recursion... if scroller state changed, mask is different, so you get different rects */
+ /* solve bad recursion... if scroller state changed,
+ * mask is different, so you get different rects */
if (scroll != view2d_scroll_mapped(v2d->scroll)) {
UI_view2d_totRect_set_resize(v2d, width, height, 0);
}
@@ -1046,7 +1051,7 @@ bool UI_view2d_tab_set(View2D *v2d, int tab)
void UI_view2d_zoom_cache_reset(void)
{
- /* TODO(sergey): This way we avoid threading conflict with VSE rendering
+ /* TODO(sergey): This way we avoid threading conflict with sequencer rendering
* text strip. But ideally we want to make glyph cache to be fully safe
* for threading.
*/
@@ -1072,7 +1077,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
float sizex = BLI_rcti_size_x(&v2d->mask);
float sizey = BLI_rcti_size_y(&v2d->mask);
- /* prevent tiny or narrow regions to get invalid coordinates - mask can get negative even... */
+ /* prevent tiny or narrow regions to get
+ * invalid coordinates - mask can get negative even... */
if (sizex > 0.0f && sizey > 0.0f) {
float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1);
float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
@@ -1109,7 +1115,8 @@ void UI_view2d_view_ortho(View2D *v2d)
if (sizey > 0)
yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
BLI_rctf_translate(&curmasked, -xofs, -yofs);
@@ -1145,7 +1152,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f;
yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
/* only set matrix with 'cur' coordinates on relevant axes */
@@ -1202,7 +1210,9 @@ static void step_to_grid(float *step, int *power, int unit)
/* for frames, we want 1.0 frame intervals only */
if (unit == V2D_UNIT_FRAMES) {
rem = 1.0f;
- *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */
+ /* use 2 since there are grid lines drawn in between,
+ * this way to get 1 line per frame */
+ *step = 2.0f;
}
/* prevents printing 1.0 2.0 3.0 etc */
@@ -1320,7 +1330,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
int a, step;
int vertical_minor_step = (BLI_rcti_size_x(&v2d->mask) + 1) / (U.v2d_min_gridsize * UI_DPI_FAC),
horizontal_major_step = (BLI_rcti_size_y(&v2d->mask) + 1) / (U.v2d_min_gridsize * UI_DPI_FAC);
- unsigned char grid_line_color[3];
+ uchar grid_line_color[3];
/* check for grid first, as it may not exist */
if (grid == NULL)
@@ -1537,7 +1547,7 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s
int offset = -10;
float lstep = step;
- unsigned char grid_line_color[3];
+ uchar grid_line_color[3];
/* Make an estimate of at least how many vertices will be needed */
unsigned vertex_count = 4;
@@ -1666,10 +1676,14 @@ View2DScrollers *UI_view2d_scrollers_calc(
vert = v2d->vert;
hor = v2d->hor;
- /* slider rects need to be smaller than region */
+ /* slider rects need to be smaller than region and not interfere with splitter areas */
+ hor.xmin += UI_HEADER_OFFSET;
+ hor.xmax -= UI_HEADER_OFFSET;
+ vert.ymin += UI_HEADER_OFFSET;
+ vert.ymax -= UI_HEADER_OFFSET;
+
+ /* width of sliders */
smaller = (int)(0.1f * U.widget_unit);
- hor.xmin += smaller;
- hor.xmax -= smaller;
if (scroll & V2D_SCROLL_BOTTOM)
hor.ymin += smaller;
else
@@ -1679,8 +1693,6 @@ View2DScrollers *UI_view2d_scrollers_calc(
vert.xmin += smaller;
else
vert.xmax -= smaller;
- vert.ymin += smaller;
- vert.ymax -= smaller;
CLAMP(vert.ymin, vert.ymin, vert.ymax - V2D_SCROLLER_HANDLE_SIZE);
CLAMP(hor.xmin, hor.xmin, hor.xmax - V2D_SCROLLER_HANDLE_SIZE);
@@ -1804,7 +1816,8 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val);
}
- /* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
+ /* get length of string,
+ * and adjust printing location to fit it into the horizontal scrollbar */
len = strlen(timecode_str);
if (dir == 'h') {
/* seconds/timecode display has slightly longer strings... */
@@ -1832,7 +1845,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
rcti vert, hor;
const int scroll = view2d_scroll_mapped(v2d->scroll);
const char emboss_alpha = btheme->tui.widget_emboss[3];
- unsigned char scrollers_back_color[4];
+ uchar scrollers_back_color[4];
/* Color for scrollbar backs */
UI_GetThemeColor4ubv(TH_BACK, scrollers_back_color);
@@ -1933,7 +1946,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
- /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
+ /* HACK: although we're drawing horizontal,
+ * we make this draw as 'vertical', just to get degree signs */
scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;
}
@@ -2002,7 +2016,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
UI_FontThemeColor(font_id, TH_TEXT);
val = grid->starty;
- /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
+ /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer),
+ * apply correction */
if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac;
@@ -2472,7 +2487,7 @@ char UI_view2d_mouse_in_scrollers(
typedef struct View2DString {
struct View2DString *next;
union {
- unsigned char ub[4];
+ uchar ub[4];
int pack;
} col;
rcti rect;
@@ -2557,6 +2572,8 @@ void UI_view2d_text_cache_draw(ARegion *ar)
/* investigate using BLF_ascender() */
const int font_id = BLF_default();
+
+ BLF_set_default();
const float default_height = g_v2d_strings ? BLF_height(font_id, "28", 3) : 0.0f;
wmOrtho2_region_pixelspace(ar);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 62bc7e87f0e..e6cce1f0df9 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/view2d_ops.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -77,19 +71,28 @@ static bool view2d_poll(bContext *C)
/* temp customdata for operator */
typedef struct v2dViewPanData {
- bScreen *sc; /* screen where view pan was initiated */
- ScrArea *sa; /* area where view pan was initiated */
- ARegion *ar; /* region where view pan was initiated */
- View2D *v2d; /* view2d we're operating in */
+ /** screen where view pan was initiated */
+ bScreen *sc;
+ /** area where view pan was initiated */
+ ScrArea *sa;
+ /** region where view pan was initiated */
+ ARegion *ar;
+ /** view2d we're operating in */
+ View2D *v2d;
- float facx, facy; /* amount to move view relative to zoom */
+ /** amount to move view relative to zoom */
+ float facx, facy;
/* options for version 1 */
- int startx, starty; /* mouse x/y values in window when operator was initiated */
- int lastx, lasty; /* previous x/y values of mouse in window */
- int invoke_event; /* event starting pan, for modal exit */
-
- short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */
+ /** mouse x/y values in window when operator was initiated */
+ int startx, starty;
+ /** previous x/y values of mouse in window */
+ int lastx, lasty;
+ /** event starting pan, for modal exit */
+ int invoke_event;
+
+ /** for MMB in scrollers (old feature in past, but now not that useful) */
+ short in_scroller;
} v2dViewPanData;
/* initialize panning customdata */
@@ -256,7 +259,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement
+ * need to be done here, not in the apply callback! */
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
@@ -669,7 +673,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.xmax -= dx;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -702,7 +707,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.ymax -= dy;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -1042,7 +1048,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
fac = 0.01f * (event->prevy - event->y);
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
- /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1095,7 +1102,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement need to be done here,
+ * not in the apply callback! */
static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
@@ -1141,7 +1149,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
}
- /* support zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1270,7 +1279,8 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
*/
float zoom, center, size;
- /* TODO: is this zoom factor calculation valid? It seems to produce same results every time... */
+ /* TODO: is this zoom factor calculation valid?
+ * It seems to produce same results every time... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect);
@@ -1487,7 +1497,8 @@ void UI_view2d_smooth_view(
if (v2d->smooth_timer)
WM_event_remove_timer(wm, win, v2d->smooth_timer);
/* TIMER1 is hardcoded in keymap */
- v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
@@ -1583,20 +1594,32 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot)
/* customdata for scroller-invoke data */
typedef struct v2dScrollerMove {
- View2D *v2d; /* View2D data that this operation affects */
- ARegion *ar; /* region that the scroller is in */
+ /** View2D data that this operation affects */
+ View2D *v2d;
+ /** region that the scroller is in */
+ ARegion *ar;
+
+ /** scroller that mouse is in ('h' or 'v') */
+ char scroller;
- char scroller; /* scroller that mouse is in ('h' or 'v') */
- short zone; /* -1 is min zoomer, 0 is bar, 1 is max zoomer */ // XXX find some way to provide visual feedback of this (active color?)
+ /* XXX find some way to provide visual feedback of this (active color?) */
+ /** -1 is min zoomer, 0 is bar, 1 is max zoomer */
+ short zone;
- float fac; /* view adjustment factor, based on size of region */
- float fac_round; /* for pixel rounding (avoid visible UI jitter) */
- float delta; /* amount moved by mouse on axis of interest */
+ /** view adjustment factor, based on size of region */
+ float fac;
+ /** for pixel rounding (avoid visible UI jitter) */
+ float fac_round;
+ /** amount moved by mouse on axis of interest */
+ float delta;
- float scrollbarwidth; /* width of the scrollbar itself, used for page up/down clicks */
- int scrollbar_orig; /* initial location of scrollbar x/y, mouse relative */
+ /** width of the scrollbar itself, used for page up/down clicks */
+ float scrollbarwidth;
+ /** initial location of scrollbar x/y, mouse relative */
+ int scrollbar_orig;
- int lastx, lasty; /* previous mouse coordinates (in screen coordinates) for determining movement */
+ /** previous mouse coordinates (in screen coordinates) for determining movement */
+ int lastx, lasty;
} v2dScrollerMove;
@@ -1719,8 +1742,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
*/
scrollers = UI_view2d_scrollers_calc(C, v2d, NULL, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'.
- * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */
+ /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. In this cases
+ * moving the scroll bars has far too little effect and the view can get stuck T31476. */
tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur);
@@ -1866,10 +1889,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
/* if using bar (i.e. 'panning') or 'max' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->lastx);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->lasty);
break;
}
@@ -1877,10 +1902,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
else if (vsm->zone == SCROLLHANDLE_MIN) {
/* using 'min' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves with mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves with mouse) */
vsm->delta = (float)(vsm->lastx - event->x);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves with to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves with to mouse) */
vsm->delta = (float)(vsm->lasty - event->y);
break;
}
@@ -1922,7 +1949,8 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
}
-/* a click (or click drag in progress) should have occurred, so check if it happened in scrollbar */
+/* a click (or click drag in progress)
+ * should have occurred, so check if it happened in scrollbar */
static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
@@ -1931,7 +1959,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* check if mouse in scrollbars, if they're enabled */
const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y);
- /* if in a scroller, init customdata then set modal handler which will catch mousedown to start doing useful stuff */
+ /* if in a scroller, init customdata then set modal handler which will
+ * catch mousedown to start doing useful stuff */
if (in_scroller) {
v2dScrollerMove *vsm;
@@ -1942,10 +1971,12 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* support for quick jump to location - gtk and qt do this on linux */
if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break;
}
@@ -2002,7 +2033,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
else {
- /* not in scroller, so nothing happened... (pass through let's something else catch event) */
+ /* not in scroller, so nothing happened...
+ * (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH;
}
}
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 4d3f106a5d6..2235e94180d 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Blender Foundation
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 8e446c73eab..576d51b7c49 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/io/io_alembic.c
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifdef WITH_ALEMBIC
@@ -77,6 +72,10 @@
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
+ if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
+ RNA_boolean_set(op->ptr, "as_background_job", true);
+ }
+
RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -126,6 +125,7 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
.normals = RNA_boolean_get(op->ptr, "normals"),
.vcolors = RNA_boolean_get(op->ptr, "vcolors"),
.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv"),
+ .curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh"),
.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten"),
.visible_layers_only = RNA_boolean_get(op->ptr, "visible_layers_only"),
.renderable_only = RNA_boolean_get(op->ptr, "renderable_only"),
@@ -242,6 +242,9 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "apply_subdiv", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
+ uiItemR(row, imfptr, "curves_as_mesh", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "triangulate", 0, NULL, ICON_NONE);
const bool triangulate = RNA_boolean_get(imfptr, "triangulate");
@@ -369,6 +372,9 @@ void WM_OT_alembic_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "apply_subdiv", 0,
"Apply Subsurf", "Export subdivision surfaces as meshes");
+ RNA_def_boolean(ot->srna, "curves_as_mesh", false,
+ "Curves as Mesh", "Export curves and NURBS surfaces as meshes");
+
RNA_def_enum(ot->srna, "compression_type", rna_enum_abc_compression_items,
ABC_ARCHIVE_OGAWA, "Compression", "");
@@ -388,8 +394,10 @@ void WM_OT_alembic_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves");
RNA_def_boolean(ot->srna, "export_particles", 1, "Export Particles", "Exports non-hair particle systems");
- RNA_def_boolean(ot->srna, "as_background_job", true, "Run as Background Job",
- "Enable this to run the import in the background, disable to block Blender while importing");
+ RNA_def_boolean(ot->srna, "as_background_job", false, "Run as Background Job",
+ "Enable this to run the import in the background, disable to block Blender while importing. "
+ "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
+ "to run as a background job");
/* This dummy prop is used to check whether we need to init the start and
* end frame values to that of the scene's, otherwise they are reset at
@@ -522,6 +530,17 @@ static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op)
ui_alembic_import_settings(op->layout, &ptr);
}
+
+/* op->invoke, opens fileselect if path property not set, otherwise executes */
+static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
+ RNA_boolean_set(op->ptr, "as_background_job", true);
+ }
+ return WM_operator_filesel(C, op, event);
+}
+
+
static int wm_alembic_import_exec(bContext *C, wmOperator *op)
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -568,7 +587,7 @@ void WM_OT_alembic_import(wmOperatorType *ot)
ot->description = "Load an Alembic archive";
ot->idname = "WM_OT_alembic_import";
- ot->invoke = WM_operator_filesel;
+ ot->invoke = wm_alembic_import_invoke;
ot->exec = wm_alembic_import_exec;
ot->poll = WM_operator_winactive;
ot->ui = wm_alembic_import_draw;
@@ -591,8 +610,10 @@ void WM_OT_alembic_import(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "is_sequence", false, "Is Sequence",
"Set to true if the cache is split into separate files");
- RNA_def_boolean(ot->srna, "as_background_job", true, "Run as Background Job",
- "Enable this to run the export in the background, disable to block Blender while exporting");
+ RNA_def_boolean(ot->srna, "as_background_job", false, "Run as Background Job",
+ "Enable this to run the export in the background, disable to block Blender while exporting. "
+ "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
+ "to run as a background job");
}
#endif
diff --git a/source/blender/editors/io/io_alembic.h b/source/blender/editors/io/io_alembic.h
index 5eefabef4be..881712fe630 100644
--- a/source/blender/editors/io/io_alembic.h
+++ b/source/blender/editors/io/io_alembic.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,13 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IO_ALEMBIC_H__
#define __IO_ALEMBIC_H__
-/** \file blender/editors/io/io_alembic.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
struct wmOperatorType;
diff --git a/source/blender/editors/io/io_cache.c b/source/blender/editors/io/io_cache.c
index 953dc24f6a5..6ec34ead9a8 100644
--- a/source/blender/editors/io/io_cache.c
+++ b/source/blender/editors/io/io_cache.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/io/io_cache.c
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/io/io_cache.h b/source/blender/editors/io/io_cache.h
index ea270c2aba1..25548dcdbce 100644
--- a/source/blender/editors/io/io_cache.h
+++ b/source/blender/editors/io/io_cache.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,13 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IO_CACHE_H__
#define __IO_CACHE_H__
-/** \file blender/editors/io/io_cache.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
struct wmOperatorType;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 943f6743ec0..d73ddfac2f6 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_collada.c
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifdef WITH_COLLADA
#include "DNA_space_types.h"
@@ -98,6 +91,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int sampling_rate;
int keep_smooth_curves;
int keep_keyframes;
+ int keep_flat_curves;
int export_animation_type;
int use_texture_copies;
@@ -157,6 +151,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
sampling_rate = (sample_animations) ? RNA_int_get(op->ptr, "sampling_rate") : 0;
keep_smooth_curves = RNA_boolean_get(op->ptr, "keep_smooth_curves");
keep_keyframes = RNA_boolean_get(op->ptr, "keep_keyframes");
+ keep_flat_curves = RNA_boolean_get(op->ptr, "keep_flat_curves");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
@@ -195,6 +190,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_settings.include_all_actions = include_all_actions != 0;
export_settings.sampling_rate = sampling_rate;
export_settings.keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
+ export_settings.keep_flat_curves = keep_flat_curves != 0;
export_settings.active_uv_only = active_uv_only != 0;
export_settings.export_animation_type = export_animation_type;
@@ -357,6 +353,9 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, sampling && include_animations);
+ row = uiLayoutColumn(box, false);
+ uiItemR(row, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
+
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
@@ -413,7 +412,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
static const EnumPropertyItem prop_bc_export_mesh_type[] = {
{BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
{BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_bc_export_transformation_type[] = {
@@ -424,7 +423,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
static const EnumPropertyItem prop_bc_export_animation_type[] = {
{ BC_ANIMATION_EXPORT_SAMPLES, "sample", 0, "Samples", "Export Sampled points guided by sampling rate" },
- { BC_ANIMATION_EXPORT_KEYS, "keys", 0, "Curves", "Export Curves\n Note: guided by curve keys" },
+ { BC_ANIMATION_EXPORT_KEYS, "keys", 0, "Curves", "Export Curves (note: guided by curve keys)" },
{ 0, NULL, 0, NULL, NULL }
};
@@ -456,10 +455,9 @@ void WM_OT_collada_export(wmOperatorType *ot)
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
RNA_def_enum(func, "prop_bc_export_ui_section", prop_bc_export_ui_section, 0,
- "Export Section", "Only for User Interface Organisation");
+ "Export Section", "Only for User Interface organization");
- RNA_def_boolean(func,
- "apply_modifiers", 0, "Apply Modifiers",
+ RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers",
"Apply modifiers to exported mesh (non destructive))");
RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX,
@@ -481,27 +479,32 @@ void WM_OT_collada_export(wmOperatorType *ot)
"Export all Shape Keys from Mesh Objects");
RNA_def_boolean(func, "deform_bones_only", false, "Deform Bones only",
- "Only export deforming bones with armatures");
+ "Only export deforming bones with armatures");
- RNA_def_boolean(func, "include_animations", true,
- "Include Animations", "Export Animations if available.\nExporting Animations will enforce the decomposition of node transforms\ninto <translation> <rotation> and <scale> components");
+ RNA_def_boolean(func, "include_animations", true, "Include Animations",
+ "Export animations if available (exporting animations will enforce the decomposition of "
+ "node transforms into <translation> <rotation> and <scale> components)");
- RNA_def_boolean(func, "include_all_actions", true,
- "Include all Actions", "Export also unassigned actions.\nThis allows you to export entire animation libraries for your charater(s)");
+ RNA_def_boolean(func, "include_all_actions", true, "Include all Actions",
+ "Export also unassigned actions (this allows you to export entire animation libraries for your character(s))");
- RNA_def_enum(func, "export_animation_type_selection", prop_bc_export_animation_type, 0,
- "Key Type", "Type for exported animations (use sample keys or Curve keys)");
+ RNA_def_enum(func, "export_animation_type_selection", prop_bc_export_animation_type, 0, "Key Type",
+ "Type for exported animations (use sample keys or Curve keys)");
- RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX,
- "Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX);
+ RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX, "Sampling Rate",
+ "The distance between 2 keyframes (1 to key every frame)", 1, INT_MAX);
- RNA_def_boolean(func, "keep_smooth_curves", 0,
- "Keep Smooth curves", "Export also the curve handles (if available).\nThis does only work when the inverse parent matrix is the Unity matrix\nOtherwise you may end up with odd results\n");
+ RNA_def_boolean(func, "keep_smooth_curves", 0, "Keep Smooth curves",
+ "Export also the curve handles (if available) (this does only work when the inverse parent matrix "
+ "is the unity matrix, otherwise you may end up with odd results)");
- RNA_def_boolean(func, "keep_keyframes", 0,
- "Keep Keyframes", "Use existing keyframes as additional sample points.\nThis helps when you want to keep manual tweeks");
+ RNA_def_boolean(func, "keep_keyframes", 0, "Keep Keyframes",
+ "Use existing keyframes as additional sample points (this helps when you want to keep manual tweaks)");
+
+ RNA_def_boolean(func, "keep_flat_curves", 0, "All keyed curves",
+ "Export also curves which have only one key or are totally flat");
RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map",
"Export only the selected UV Map");
@@ -514,29 +517,28 @@ void WM_OT_collada_export(wmOperatorType *ot)
"Export Polygons (Quads & NGons) as Triangles");
RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances",
- "Instantiate multiple Objects from same Data");
+ "Instantiate multiple Objects from same Data");
RNA_def_boolean(func, "use_blender_profile", 1, "Use Blender Profile",
- "Export additional Blender specific information (for material, shaders, bones, etc.)");
+ "Export additional Blender specific information (for material, shaders, bones, etc.)");
RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name",
"Sort exported data by Object name");
- RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX,
- "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX);
+ RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, "Transform",
+ "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX);
- RNA_def_enum(func, "export_transformation_type_selection", prop_bc_export_transformation_type, 0,
- "Transform", "Transformation type for translation, scale and rotation");
+ RNA_def_enum(func, "export_transformation_type_selection", prop_bc_export_transformation_type, 0, "Transform",
+ "Transformation type for translation, scale and rotation");
RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim",
"Compatibility mode for SL, OpenSim and other compatible online worlds");
- RNA_def_boolean(func, "limit_precision", 0,
- "Limit Precision", "Reduce the precision of the exported data to 6 digits");
-
- RNA_def_boolean(func, "keep_bind_info", 0,
- "Keep Bind Info", "Store Bindpose information in custom bone properties for later use during Collada export");
+ RNA_def_boolean(func, "limit_precision", 0, "Limit Precision",
+ "Reduce the precision of the exported data to 6 digits");
+ RNA_def_boolean(func, "keep_bind_info", 0, "Keep Bind Info",
+ "Store Bindpose information in custom bone properties for later use during Collada export");
}
diff --git a/source/blender/editors/io/io_collada.h b/source/blender/editors/io/io_collada.h
index ba122630aec..6330fc9639a 100644
--- a/source/blender/editors/io/io_collada.h
+++ b/source/blender/editors/io/io_collada.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_collada.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifndef __IO_COLLADA_H__
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
index 26414661f52..93874031ea2 100644
--- a/source/blender/editors/io/io_ops.c
+++ b/source/blender/editors/io/io_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_ops.c
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "io_ops.h" /* own include */
diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h
index 677ce40cc38..2923e052752 100644
--- a/source/blender/editors/io/io_ops.h
+++ b/source/blender/editors/io/io_ops.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_ops.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifndef __IO_OPS_H__
diff --git a/source/blender/editors/lattice/CMakeLists.txt b/source/blender/editors/lattice/CMakeLists.txt
index 2207e0fa736..f14de01c102 100644
--- a/source/blender/editors/lattice/CMakeLists.txt
+++ b/source/blender/editors/lattice/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c
index 9a50c5ba908..2c7f084fe17 100644
--- a/source/blender/editors/lattice/editlattice_select.c
+++ b/source/blender/editors/lattice/editlattice_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_select.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include <stdlib.h>
diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c
index 2f8dc37a2f6..0d57b94a493 100644
--- a/source/blender/editors/lattice/editlattice_tools.c
+++ b/source/blender/editors/lattice/editlattice_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_tools.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
@@ -135,7 +129,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
typedef enum eLattice_FlipAxes {
LATTICE_FLIP_U = 0,
LATTICE_FLIP_V = 1,
- LATTICE_FLIP_W = 2
+ LATTICE_FLIP_W = 2,
} eLattice_FlipAxes;
/**
@@ -239,7 +233,8 @@ static int lattice_flip_exec(bContext *C, wmOperator *op)
numW = lt->pntsw;
totP = numU * numV * numW;
- /* First Pass: determine midpoint - used for flipping center verts if there are odd number of points on axis */
+ /* First Pass: determine midpoint - used for flipping center verts if there
+ * are odd number of points on axis */
switch (axis) {
case LATTICE_FLIP_U:
isOdd = numU & 1;
@@ -351,7 +346,8 @@ void LATTICE_OT_flip(wmOperatorType *ot)
{LATTICE_FLIP_U, "U", 0, "U (X) Axis", ""},
{LATTICE_FLIP_V, "V", 0, "V (Y) Axis", ""},
{LATTICE_FLIP_W, "W", 0, "W (Z) Axis", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Flip (Distortion Free)";
diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c
index 744f353f129..be8e0ae0633 100644
--- a/source/blender/editors/lattice/editlattice_undo.c
+++ b/source/blender/editors/lattice/editlattice_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_undo.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include <stdlib.h>
@@ -151,13 +145,15 @@ static bool lattice_undosys_poll(bContext *C)
return editlatt_object_from_context(C) != NULL;
}
-static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool lattice_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
LatticeUndoStep *us = (LatticeUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -175,14 +171,15 @@ static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void lattice_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void lattice_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(lattice_undosys_poll(C));
-
LatticeUndoStep *us = (LatticeUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(lattice_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
LatticeUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -236,7 +233,6 @@ void ED_lattice_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = lattice_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(LatticeUndoStep);
diff --git a/source/blender/editors/lattice/lattice_intern.h b/source/blender/editors/lattice/lattice_intern.h
index 7902b992270..c08e6b6adb5 100644
--- a/source/blender/editors/lattice/lattice_intern.h
+++ b/source/blender/editors/lattice/lattice_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/lattice_intern.h
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
diff --git a/source/blender/editors/lattice/lattice_ops.c b/source/blender/editors/lattice/lattice_ops.c
index 76ccc2250ee..49be5a6a4c9 100644
--- a/source/blender/editors/lattice/lattice_ops.c
+++ b/source/blender/editors/lattice/lattice_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/lattice_ops.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt
index d17df344dc9..63f8dc78d13 100644
--- a/source/blender/editors/mask/CMakeLists.txt
+++ b/source/blender/editors/mask/CMakeLists.txt
@@ -15,10 +15,6 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2012 Blender Foundation.
-#
-# Contributor(s): Blender Foundation,
-# Sergey Sharybin
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index df07326c590..579f3765710 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_add.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -765,7 +757,8 @@ static int create_primitive_from_points(bContext *C, wmOperator *op, const float
location[0] -= 0.5f * scale;
location[1] -= 0.5f * scale;
- mask_layer = ED_mask_layer_ensure(C);
+ bool added_mask = false;
+ mask_layer = ED_mask_layer_ensure(C, &added_mask);
mask = CTX_data_edit_mask(C);
ED_mask_select_toggle_all(mask, SEL_DESELECT);
@@ -801,6 +794,9 @@ static int create_primitive_from_points(bContext *C, wmOperator *op, const float
}
}
+ if (added_mask) {
+ WM_event_add_notifier(C, NC_MASK | NA_ADDED, NULL);
+ }
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
/* TODO: only update this spline */
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index fc9cfc85bc5..82f7cb49d12 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_draw.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +26,6 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_rect.h"
-#include "BLI_task.h"
#include "BLI_listbase.h"
#include "BKE_context.h"
@@ -634,14 +624,17 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
/* sets up the opengl context.
* width, height are to match the values from ED_mask_get_size() */
-void ED_mask_draw_region(Mask *mask, ARegion *ar,
- const char draw_flag, const char draw_type, const char overlay_mode,
- const int width_i, const int height_i, /* convert directly into aspect corrected vars */
- const float aspx, const float aspy,
- const bool do_scale_applied, const bool do_draw_cb,
- float stabmat[4][4], /* optional - only used by clip */
- const bContext *C /* optional - only used when do_post_draw is set or called from clip editor */
- )
+void ED_mask_draw_region(
+ Mask *mask, ARegion *ar,
+ const char draw_flag, const char draw_type, const char overlay_mode,
+ /* convert directly into aspect corrected vars */
+ const int width_i, const int height_i,
+ const float aspx, const float aspy,
+ const bool do_scale_applied, const bool do_draw_cb,
+ /* optional - only used by clip */
+ float stabmat[4][4],
+ /* optional - only used when do_post_draw is set or called from clip editor */
+ const bContext *C)
{
struct View2D *v2d = &ar->v2d;
@@ -706,7 +699,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
GPU_matrix_mul(stabmat);
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL);
GPU_matrix_pop();
@@ -718,7 +711,8 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
MEM_freeN(buffer);
}
- /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
+ /* apply transformation so mask editing tools will assume drawing from the
+ * origin in normalized space */
GPU_matrix_push();
GPU_matrix_translate_2f(x + xofs, y + yofs);
GPU_matrix_scale_2f(zoomx, zoomy);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 03fc7252ea6..a2deaac30ac 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_edit.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c
index 00db3c6e659..9c7eed6ba51 100644
--- a/source/blender/editors/mask/mask_editaction.c
+++ b/source/blender/editors/mask/mask_editaction.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_editaction.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include <stdio.h>
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index cb2bb953994..77f537e2e4a 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __MASK_INTERN_H__
#define __MASK_INTERN_H__
-struct bContext;
struct Mask;
+struct bContext;
struct wmOperatorType;
/* internal exports only */
@@ -59,7 +51,7 @@ void MASK_OT_primitive_square_add(struct wmOperatorType *ot);
/* mask_ops.c */
struct Mask *ED_mask_new(struct bContext *C, const char *name);
-struct MaskLayer *ED_mask_layer_ensure(struct bContext *C);
+struct MaskLayer *ED_mask_layer_ensure(struct bContext *C, bool *r_added_mask);
void MASK_OT_new(struct wmOperatorType *ot);
void MASK_OT_layer_new(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index cb90d0a4888..1bb76045c72 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_ops.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -340,7 +332,7 @@ Mask *ED_mask_new(bContext *C, const char *name)
}
/* Get ative layer. Will create mask/layer to be sure there's an active layer. */
-MaskLayer *ED_mask_layer_ensure(bContext *C)
+MaskLayer *ED_mask_layer_ensure(bContext *C, bool *r_added_mask)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *mask_layer;
@@ -348,6 +340,7 @@ MaskLayer *ED_mask_layer_ensure(bContext *C)
if (mask == NULL) {
/* If there's no active mask, create one. */
mask = ED_mask_new(C, NULL);
+ *r_added_mask = true;
}
mask_layer = BKE_mask_layer_active(mask);
@@ -367,6 +360,8 @@ static int mask_new_exec(bContext *C, wmOperator *op)
ED_mask_new(C, name);
+ WM_event_add_notifier(C, NC_MASK | NA_ADDED, NULL);
+
return OPERATOR_FINISHED;
}
@@ -461,7 +456,7 @@ enum {
SLIDE_ACTION_POINT = 1,
SLIDE_ACTION_HANDLE = 2,
SLIDE_ACTION_FEATHER = 3,
- SLIDE_ACTION_SPLINE = 4
+ SLIDE_ACTION_SPLINE = 4,
};
typedef struct SlidePointData {
@@ -1917,7 +1912,7 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
{HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
{HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
{HD_FREE, "FREE", 0, "Free", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2159,7 +2154,7 @@ void MASK_OT_layer_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2217,7 +2212,8 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
MaskSplinePoint *new_point;
int b;
- /* BKE_mask_spline_add might allocate the points, need to free them in this case. */
+ /* BKE_mask_spline_add might allocate the points,
+ * need to free them in this case. */
if (new_spline->points) {
MEM_freeN(new_spline->points);
}
diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c
index c500ec75aee..d7dfcc64ab0 100644
--- a/source/blender/editors/mask/mask_relationships.c
+++ b/source/blender/editors/mask/mask_relationships.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_relationships.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index a5daa7b4565..3f0a3032cc1 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_select.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index d64963d4347..7d33d13cbd3 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_shapekey.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include <stdlib.h>
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 4cefbf21c24..bc8761f24c0 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 8e64ed93842..5afde1b3ba1 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editface.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -548,7 +542,8 @@ void paintvert_tag_select_update(struct bContext *C, struct Object *ob)
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
}
-/* note: if the caller passes false to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
+/* note: if the caller passes false to flush_flags,
+ * then they will need to run paintvert_flush_flags(ob) themselves */
void paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
{
Mesh *me;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index bcde2411899..d42b4c97d33 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_add.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_meshdata_types.h"
@@ -69,14 +61,15 @@ static Object *make_prim_init(
const float loc[3], const float rot[3], ushort local_view_bits,
MakePrimitiveData *r_creation_data)
{
+ struct Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
r_creation_data->was_editmode = false;
if (obedit == NULL || obedit->type != OB_MESH) {
obedit = ED_object_add_type(C, OB_MESH, idname, loc, rot, false, local_view_bits);
+ ED_object_editmode_enter_ex(bmain, scene, obedit, 0);
- /* create editmode */
- ED_object_editmode_enter(C, EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
r_creation_data->was_editmode = true;
}
@@ -215,7 +208,8 @@ static const EnumPropertyItem fill_type_items[] = {
{0, "NOTHING", 0, "Nothing", "Don't fill at all"},
{1, "NGON", 0, "Ngon", "Use ngons"},
{2, "TRIFAN", 0, "Triangle Fan", "Use triangle fans"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int add_primitive_circle_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index d3a81a3f9ed..b01a935e4d2 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_add_gizmo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Creation gizmos.
*/
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 4e398c36a2f..ee08b81759a 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Joseph Eagar, Howard Trickey, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_bevel.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -30,7 +24,6 @@
#include "BLI_string.h"
#include "BLI_math.h"
-#include "BLI_linklist_stack.h"
#include "BLT_translation.h"
@@ -41,6 +34,8 @@
#include "BKE_layer.h"
#include "BKE_mesh.h"
+#include "DNA_mesh_types.h"
+
#include "RNA_define.h"
#include "RNA_access.h"
@@ -88,7 +83,8 @@ typedef struct {
float initial_length[NUM_VALUE_KINDS];
float scale[NUM_VALUE_KINDS];
NumInput num_input[NUM_VALUE_KINDS];
- float shift_value[NUM_VALUE_KINDS]; /* The current value when shift is pressed. Negative when shift not active. */
+ /** The current value when shift is pressed. Negative when shift not active. */
+ float shift_value[NUM_VALUE_KINDS];
bool is_modal;
BevelObjectStore *ob_store;
@@ -102,130 +98,97 @@ typedef struct {
float segments; /* Segments as float so smooth mouse pan works in small increments */
} BevelData;
+enum {
+ BEV_MODAL_CANCEL = 1,
+ BEV_MODAL_CONFIRM,
+ BEV_MODAL_VALUE_OFFSET,
+ BEV_MODAL_VALUE_PROFILE,
+ BEV_MODAL_VALUE_SEGMENTS,
+ BEV_MODAL_SEGMENTS_UP,
+ BEV_MODAL_SEGMENTS_DOWN,
+ BEV_MODAL_OFFSET_MODE_CHANGE,
+ BEV_MODAL_CLAMP_OVERLAP_TOGGLE,
+ BEV_MODAL_VERTEX_ONLY_TOGGLE,
+ BEV_MODAL_HARDEN_NORMALS_TOGGLE,
+ BEV_MODAL_MARK_SEAM_TOGGLE,
+ BEV_MODAL_MARK_SHARP_TOGGLE,
+ BEV_MODAL_OUTER_MITER_CHANGE,
+ BEV_MODAL_INNER_MITER_CHANGE,
+};
+
static void edbm_bevel_update_header(bContext *C, wmOperator *op)
{
- const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), "
- "Vertex Only: %s (V), Profile Control: %s (P), Offset: %s, Segments: %d, Profile: %.3f");
-
- char msg[UI_MAX_DRAW_STR];
- ScrArea *sa = CTX_wm_area(C);
+ char header[UI_MAX_DRAW_STR];
+ char buf[UI_MAX_DRAW_STR];
+ char *p = buf;
+ int available_len = sizeof(buf);
Scene *sce = CTX_data_scene(C);
+ BevelData *opdata = op->customdata;
+ char offset_str[NUM_STR_REP_LEN];
+ const char *mode_str, *omiter_str, *imiter_str;
+ PropertyRNA *prop;
- if (sa) {
- BevelData *opdata = op->customdata;
- char offset_str[NUM_STR_REP_LEN];
- const char *type_str;
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type");
-
- if (hasNumInput(&opdata->num_input[OFFSET_VALUE])) {
- outputNumInput(&opdata->num_input[OFFSET_VALUE], offset_str, &sce->unit);
- }
- else {
- BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
- }
-
- RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str);
-
- BLI_snprintf(msg, sizeof(msg), str, type_str,
- WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
- WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
- WM_bool_as_string(opdata->value_mode == PROFILE_VALUE),
- offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile"));
+#define WM_MODALKEY(_id) \
+ WM_modalkeymap_operator_items_to_string_buf(op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p)
- ED_area_status_text(sa, msg);
+ if (hasNumInput(&opdata->num_input[OFFSET_VALUE])) {
+ outputNumInput(&opdata->num_input[OFFSET_VALUE], offset_str, &sce->unit);
}
-}
-
-static void bevel_harden_normals(BMEditMesh *em, BMOperator *bmop, float face_strength)
-{
- BKE_editmesh_lnorspace_update(em);
- BM_normals_loops_edges_tag(em->bm, true);
- const int cd_clnors_offset = CustomData_get_offset(&em->bm->ldata, CD_CUSTOMLOOPNORMAL);
-
- BMesh *bm = em->bm;
- BMFace *f;
- BMLoop *l, *l_cur, *l_first;
- BMIter fiter;
-
- BMOpSlot *nslot = BMO_slot_get(bmop->slots_out, "normals.out"); /* Per vertex normals depending on hn_mode */
-
- /* Similar functionality to bm_mesh_loops_calc_normals... Edges that can be smoothed are tagged */
- BM_ITER_MESH(f, &fiter, bm, BM_FACES_OF_MESH) {
- l_cur = l_first = BM_FACE_FIRST_LOOP(f);
- do {
- if ((BM_elem_flag_test(l_cur->v, BM_ELEM_SELECT)) &&
- ((!BM_elem_flag_test(l_cur->e, BM_ELEM_TAG)) ||
- (!BM_elem_flag_test(l_cur, BM_ELEM_TAG) && BM_loop_check_cyclic_smooth_fan(l_cur))))
- {
- /* Both adjacent loops are sharp, set clnor to face normal */
- if (!BM_elem_flag_test(l_cur->e, BM_ELEM_TAG) && !BM_elem_flag_test(l_cur->prev->e, BM_ELEM_TAG)) {
- const int loop_index = BM_elem_index_get(l_cur);
- short *clnors = BM_ELEM_CD_GET_VOID_P(l_cur, cd_clnors_offset);
- BKE_lnor_space_custom_normal_to_data(bm->lnor_spacearr->lspacearr[loop_index], f->no, clnors);
- }
- else {
- /* Find next corresponding sharp edge in this smooth fan */
- BMVert *v_pivot = l_cur->v;
- float *calc_n = BLI_ghash_lookup(nslot->data.ghash, v_pivot);
-
- BMEdge *e_next;
- const BMEdge *e_org = l_cur->e;
- BMLoop *lfan_pivot, *lfan_pivot_next;
-
- lfan_pivot = l_cur;
- e_next = lfan_pivot->e;
- BLI_SMALLSTACK_DECLARE(loops, BMLoop *);
- float cn_wght[3] = { 0.0f, 0.0f, 0.0f }, cn_unwght[3] = { 0.0f, 0.0f, 0.0f };
-
- /* Fan through current vert and accumulate normals and loops */
- while (true) {
- lfan_pivot_next = BM_vert_step_fan_loop(lfan_pivot, &e_next);
- if (lfan_pivot_next) {
- BLI_assert(lfan_pivot_next->v == v_pivot);
- }
- else {
- e_next = (lfan_pivot->e == e_next) ? lfan_pivot->prev->e : lfan_pivot->e;
- }
-
- BLI_SMALLSTACK_PUSH(loops, lfan_pivot);
- float cur[3];
- mul_v3_v3fl(cur, lfan_pivot->f->no, BM_face_calc_area(lfan_pivot->f));
- add_v3_v3(cn_wght, cur);
-
- if (BM_elem_flag_test(lfan_pivot->f, BM_ELEM_SELECT))
- add_v3_v3(cn_unwght, cur);
-
- if (!BM_elem_flag_test(e_next, BM_ELEM_TAG) || (e_next == e_org)) {
- break;
- }
- lfan_pivot = lfan_pivot_next;
- }
-
- normalize_v3(cn_wght);
- normalize_v3(cn_unwght);
- if (calc_n) {
- mul_v3_fl(cn_wght, face_strength);
- mul_v3_fl(calc_n, 1.0f - face_strength);
- add_v3_v3(calc_n, cn_wght);
- normalize_v3(calc_n);
- }
- while ((l = BLI_SMALLSTACK_POP(loops))) {
- const int l_index = BM_elem_index_get(l);
- short *clnors = BM_ELEM_CD_GET_VOID_P(l, cd_clnors_offset);
- if (calc_n) {
- BKE_lnor_space_custom_normal_to_data(
- bm->lnor_spacearr->lspacearr[l_index], calc_n, clnors);
- }
- else {
- BKE_lnor_space_custom_normal_to_data(
- bm->lnor_spacearr->lspacearr[l_index], cn_unwght, clnors);
- }
- }
- BLI_ghash_remove(nslot->data.ghash, v_pivot, NULL, MEM_freeN);
- }
- }
- } while ((l_cur = l_cur->next) != l_first);
+ else {
+ BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
}
+
+ prop = RNA_struct_find_property(op->ptr, "offset_type");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &mode_str);
+ prop = RNA_struct_find_property(op->ptr, "miter_outer");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &omiter_str);
+ prop = RNA_struct_find_property(op->ptr, "miter_inner");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &imiter_str);
+
+ BLI_snprintf(header, sizeof(header),
+ IFACE_("%s: confirm, "
+ "%s: cancel, "
+ "%s: mode (%s), "
+ "%s: offset (%s), "
+ "%s: segments (%d), "
+ "%s: profile (%.3f), "
+ "%s: clamp overlap (%s), "
+ "%s: vertex only (%s), "
+ "%s: outer miter (%s), "
+ "%s: inner imter (%s), "
+ "%s: harden normals (%s), "
+ "%s: mark seam (%s), "
+ "%s: mark sharp (%s)"
+ ),
+ WM_MODALKEY(BEV_MODAL_CONFIRM),
+ WM_MODALKEY(BEV_MODAL_CANCEL),
+ WM_MODALKEY(BEV_MODAL_OFFSET_MODE_CHANGE),
+ mode_str,
+ WM_MODALKEY(BEV_MODAL_VALUE_OFFSET),
+ offset_str,
+ WM_MODALKEY(BEV_MODAL_VALUE_SEGMENTS),
+ RNA_int_get(op->ptr, "segments"),
+ WM_MODALKEY(BEV_MODAL_VALUE_PROFILE),
+ RNA_float_get(op->ptr, "profile"),
+ WM_MODALKEY(BEV_MODAL_CLAMP_OVERLAP_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
+ WM_MODALKEY(BEV_MODAL_VERTEX_ONLY_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
+ WM_MODALKEY(BEV_MODAL_OUTER_MITER_CHANGE),
+ omiter_str,
+ WM_MODALKEY(BEV_MODAL_INNER_MITER_CHANGE),
+ imiter_str,
+ WM_MODALKEY(BEV_MODAL_HARDEN_NORMALS_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "harden_normals")),
+ WM_MODALKEY(BEV_MODAL_MARK_SEAM_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_seam")),
+ WM_MODALKEY(BEV_MODAL_MARK_SHARP_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_sharp"))
+ );
+
+#undef WM_MODALKEY
+
+ ED_workspace_status_text(C, header);
}
static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
@@ -245,7 +208,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
{
uint ob_store_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
+ view_layer, CTX_wm_view3d(C), &ob_store_len);
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
@@ -279,7 +243,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
if (i == OFFSET_VALUE) {
opdata->num_input[i].unit_sys = scene->unit.system;
}
- opdata->num_input[i].unit_type[0] = B_UNIT_NONE; /* Not sure this is a factor or a unit? */
+ /* Not sure this is a factor or a unit? */
+ opdata->num_input[i].unit_type[0] = B_UNIT_NONE;
}
/* avoid the cost of allocating a bm copy */
@@ -320,9 +285,11 @@ static bool edbm_bevel_calc(wmOperator *op)
const bool loop_slide = RNA_boolean_get(op->ptr, "loop_slide");
const bool mark_seam = RNA_boolean_get(op->ptr, "mark_seam");
const bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
- const float hn_strength = RNA_float_get(op->ptr, "strength");
- const int hnmode = RNA_enum_get(op->ptr, "hnmode");
-
+ const bool harden_normals = RNA_boolean_get(op->ptr, "harden_normals");
+ const int face_strength_mode = RNA_enum_get(op->ptr, "face_strength_mode");
+ const int miter_outer = RNA_enum_get(op->ptr, "miter_outer");
+ const int miter_inner = RNA_enum_get(op->ptr, "miter_inner");
+ const float spread = RNA_float_get(op->ptr, "spread");
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
em = opdata->ob_store[ob_index].em;
@@ -336,12 +303,22 @@ static bool edbm_bevel_calc(wmOperator *op)
material = CLAMPIS(material, -1, em->ob->totcol - 1);
}
+ Mesh *me = em->ob->data;
+
+ if (harden_normals && !(me->flag & ME_AUTOSMOOTH)) {
+ /* harden_normals only has a visible effect if autosmooth is on, so turn it on */
+ me->flag |= ME_AUTOSMOOTH;
+ }
+
EDBM_op_init(
em, &bmop, op,
- "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f clamp_overlap=%b "
- "material=%i loop_slide=%b mark_seam=%b mark_sharp=%b strength=%f hnmode=%i",
+ "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f "
+ "clamp_overlap=%b material=%i loop_slide=%b mark_seam=%b mark_sharp=%b "
+ "harden_normals=%b face_strength_mode=%i "
+ "miter_outer=%i miter_inner=%i spread=%f smoothresh=%f",
BM_ELEM_SELECT, offset, segments, vertex_only, offset_type, profile,
- clamp_overlap, material, loop_slide, mark_seam, mark_sharp, hn_strength, hnmode);
+ clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode,
+ miter_outer, miter_inner, spread, me->smoothresh);
BMO_op_exec(em->bm, &bmop);
@@ -352,10 +329,6 @@ static bool edbm_bevel_calc(wmOperator *op)
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
}
- if (hnmode != BEVEL_HN_NONE) {
- bevel_harden_normals(em, &bmop, hn_strength);
- }
-
/* no need to de-select existing geometry */
if (!EDBM_op_finish(em, &bmop, op, true)) {
continue;
@@ -457,7 +430,6 @@ static void edbm_bevel_calc_initial_length(wmOperator *op, const wmEvent *event,
static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- /* TODO make modal keymap (see fly mode) */
RegionView3D *rv3d = CTX_wm_region_view3d(C);
BevelData *opdata;
float center_3d[3];
@@ -484,6 +456,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (!edbm_bevel_calc(op)) {
edbm_bevel_cancel(C, op);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
}
@@ -550,70 +523,108 @@ static void edbm_bevel_numinput_set_value(wmOperator *op)
}
}
+wmKeyMap *bevel_modal_keymap(wmKeyConfig *keyconf)
+{
+ static const EnumPropertyItem modal_items[] = {
+ {BEV_MODAL_CANCEL, "CANCEL", 0, "Cancel", "Cancel bevel"},
+ {BEV_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", "Confirm bevel"},
+ {BEV_MODAL_VALUE_OFFSET, "VALUE_OFFSET", 0, "Value is offset",
+ "Value changes offset"},
+ {BEV_MODAL_VALUE_PROFILE, "VALUE_PROFILE", 0, "Value is profile",
+ "Value changes profile"},
+ {BEV_MODAL_VALUE_SEGMENTS, "VALUE_SEGMENTS", 0, "Value is segments",
+ "Value changes segments"},
+ {BEV_MODAL_SEGMENTS_UP, "SEGMENTS_UP", 0, "Increase segments",
+ "Increase segments"},
+ {BEV_MODAL_SEGMENTS_DOWN, "SEGMENTS_DOWN", 0, "Decrease segments",
+ "Decrease segments"},
+ {BEV_MODAL_OFFSET_MODE_CHANGE, "OFFSET_MODE_CHANGE", 0, "Change offset mode",
+ "Cycle through offset modes"},
+ {BEV_MODAL_CLAMP_OVERLAP_TOGGLE, "CLAMP_OVERLAP_TOGGLE", 0, "Toggle clamp overlap",
+ "Toggle clamp overlap flag"},
+ {BEV_MODAL_VERTEX_ONLY_TOGGLE, "VERTEX_ONLY_TOGGLE", 0, "Toggle vertex only",
+ "Toggle vertex only flag"},
+ {BEV_MODAL_HARDEN_NORMALS_TOGGLE, "HARDEN_NORMALS_TOGGLE", 0, "Toggle harden normals",
+ "Toggle harden normals flag"},
+ {BEV_MODAL_MARK_SEAM_TOGGLE, "MARK_SEAM_TOGGLE", 0, "Toggle mark seam",
+ "Toggle mark seam flag"},
+ {BEV_MODAL_MARK_SHARP_TOGGLE, "MARK_SHARP_TOGGLE", 0, "Toggle mark sharp",
+ "Toggle mark sharp flag"},
+ {BEV_MODAL_OUTER_MITER_CHANGE, "OUTER_MITER_CHANGE", 0, "Change outer miter",
+ "Cycle through outer miter kinds"},
+ {BEV_MODAL_INNER_MITER_CHANGE, "INNER_MITER_CHANGE", 0, "Change inner miter",
+ "Cycle through inner miter kinds"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Bevel Modal Map");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if (keymap && keymap->modal_items)
+ return NULL;
+
+ keymap = WM_modalkeymap_add(keyconf, "Bevel Modal Map", modal_items);
+
+ WM_modalkeymap_assign(keymap, "MESH_OT_bevel");
+
+ return keymap;
+}
+
static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
BevelData *opdata = op->customdata;
const bool has_numinput = hasNumInput(&opdata->num_input[opdata->value_mode]);
+ bool handled = false;
+ short etype = event->type;
+ short eval = event->val;
+ /* When activated from toolbar, need to convert leftmouse release to confirm */
+ if (etype == LEFTMOUSE && eval == KM_RELEASE &&
+ RNA_boolean_get(op->ptr, "release_confirm"))
+ {
+ etype = EVT_MODAL_MAP;
+ eval = BEV_MODAL_CONFIRM;
+ }
/* Modal numinput active, try to handle numeric inputs first... */
- if (event->val == KM_PRESS && has_numinput && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
+ if (etype != EVT_MODAL_MAP && eval == KM_PRESS && has_numinput && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
edbm_bevel_numinput_set_value(op);
edbm_bevel_calc(op);
edbm_bevel_update_header(C, op);
return OPERATOR_RUNNING_MODAL;
}
- else {
- bool handled = false;
- switch (event->type) {
- case ESCKEY:
- case RIGHTMOUSE:
+ else if (etype == MOUSEMOVE) {
+ if (!has_numinput) {
+ edbm_bevel_mouse_set_value(op, event);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ }
+ }
+ else if (etype == MOUSEPAN) {
+ float delta = 0.02f * (event->y - event->prevy);
+ if (opdata->segments >= 1 && opdata->segments + delta < 1)
+ opdata->segments = 1;
+ else
+ opdata->segments += delta;
+ RNA_int_set(op->ptr, "segments", (int)opdata->segments);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ }
+ else if (etype == EVT_MODAL_MAP) {
+ switch (eval) {
+ case BEV_MODAL_CANCEL:
edbm_bevel_cancel(C, op);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
- case MOUSEMOVE:
- if (!has_numinput) {
- edbm_bevel_mouse_set_value(op, event);
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- }
- break;
-
- case LEFTMOUSE:
- case PADENTER:
- case RETKEY:
- if ((event->val == KM_PRESS) ||
- ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm")))
- {
- edbm_bevel_calc(op);
- edbm_bevel_exit(C, op);
- return OPERATOR_FINISHED;
- }
- break;
-
- case MOUSEPAN: {
- float delta = 0.02f * (event->y - event->prevy);
- if (opdata->segments >= 1 && opdata->segments + delta < 1)
- opdata->segments = 1;
- else
- opdata->segments += delta;
- RNA_int_set(op->ptr, "segments", (int)opdata->segments);
+ case BEV_MODAL_CONFIRM:
edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- break;
- }
-
- /* Note this will prevent padplus and padminus to ever activate modal numinput.
- * This is not really an issue though, as we only expect positive values here...
- * Else we could force them to only modify segments number when shift is pressed, or so.
- */
-
- case WHEELUPMOUSE: /* change number of segments */
- case PADPLUSKEY:
- if (event->val == KM_RELEASE)
- break;
+ edbm_bevel_exit(C, op);
+ ED_workspace_status_text(C, NULL);
+ return OPERATOR_FINISHED;
+ case BEV_MODAL_SEGMENTS_UP:
opdata->segments = opdata->segments + 1;
RNA_int_set(op->ptr, "segments", (int)opdata->segments);
edbm_bevel_calc(op);
@@ -621,11 +632,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
handled = true;
break;
- case WHEELDOWNMOUSE: /* change number of segments */
- case PADMINUS:
- if (event->val == KM_RELEASE)
- break;
-
+ case BEV_MODAL_SEGMENTS_DOWN:
opdata->segments = max_ff(opdata->segments - 1, 1);
RNA_int_set(op->ptr, "segments", (int)opdata->segments);
edbm_bevel_calc(op);
@@ -633,13 +640,9 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
handled = true;
break;
- case MKEY:
- if (event->val == KM_RELEASE)
- break;
-
+ case BEV_MODAL_OFFSET_MODE_CHANGE:
{
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type");
- int type = RNA_property_enum_get(op->ptr, prop);
+ int type = RNA_enum_get(op->ptr, "offset_type");
type++;
if (type > BEVEL_AMT_PERCENT) {
type = BEVEL_AMT_OFFSET;
@@ -648,7 +651,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
opdata->value_mode = OFFSET_VALUE_PERCENT;
else if (opdata->value_mode == OFFSET_VALUE_PERCENT && type != BEVEL_AMT_PERCENT)
opdata->value_mode = OFFSET_VALUE;
- RNA_property_enum_set(op->ptr, prop, type);
+ RNA_enum_set(op->ptr, "offset_type", type);
if (opdata->initial_length[opdata->value_mode] == -1.0f)
edbm_bevel_calc_initial_length(op, event, true);
}
@@ -662,84 +665,110 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_bevel_update_header(C, op);
handled = true;
break;
- case CKEY:
- if (event->val == KM_RELEASE)
- break;
+ case BEV_MODAL_CLAMP_OVERLAP_TOGGLE:
{
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "clamp_overlap");
- RNA_property_boolean_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop));
- }
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- break;
- case PKEY:
- if (event->val == KM_RELEASE)
+ bool clamp_overlap = RNA_boolean_get(op->ptr, "clamp_overlap");
+ RNA_boolean_set(op->ptr, "clamp_overlap", !clamp_overlap);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
break;
- if (opdata->value_mode == PROFILE_VALUE) {
- opdata->value_mode = OFFSET_VALUE;
- }
- else {
- opdata->value_mode = PROFILE_VALUE;
}
+
+ case BEV_MODAL_VALUE_OFFSET:
+ opdata->value_mode = OFFSET_VALUE;
edbm_bevel_calc_initial_length(op, event, true);
break;
- case SKEY:
- if (event->val == KM_RELEASE)
- break;
- if (opdata->value_mode == SEGMENTS_VALUE) {
- opdata->value_mode = OFFSET_VALUE;
- }
- else {
- opdata->value_mode = SEGMENTS_VALUE;
- }
+
+ case BEV_MODAL_VALUE_PROFILE:
+ opdata->value_mode = PROFILE_VALUE;
edbm_bevel_calc_initial_length(op, event, true);
break;
- case VKEY:
- if (event->val == KM_RELEASE)
- break;
- {
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "vertex_only");
- RNA_property_boolean_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop));
- }
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
+ case BEV_MODAL_VALUE_SEGMENTS:
+ opdata->value_mode = SEGMENTS_VALUE;
+ edbm_bevel_calc_initial_length(op, event, true);
break;
- case UKEY:
- if (event->val == KM_RELEASE)
+
+ case BEV_MODAL_VERTEX_ONLY_TOGGLE:
+ {
+ bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
+ RNA_boolean_set(op->ptr, "vertex_only", !vertex_only);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
break;
- else {
+ }
+
+ case BEV_MODAL_MARK_SEAM_TOGGLE:
+ {
bool mark_seam = RNA_boolean_get(op->ptr, "mark_seam");
RNA_boolean_set(op->ptr, "mark_seam", !mark_seam);
edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
handled = true;
break;
}
- case KKEY:
- if (event->val == KM_RELEASE)
- break;
- else {
+
+ case BEV_MODAL_MARK_SHARP_TOGGLE:
+ {
bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
RNA_boolean_set(op->ptr, "mark_sharp", !mark_sharp);
edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
handled = true;
break;
}
- }
+ case BEV_MODAL_INNER_MITER_CHANGE:
+ {
+ int miter_inner = RNA_enum_get(op->ptr, "miter_inner");
+ miter_inner++;
+ if (miter_inner == BEVEL_MITER_PATCH)
+ miter_inner++; /* no patch option for inner miter */
+ if (miter_inner > BEVEL_MITER_ARC)
+ miter_inner = BEVEL_MITER_SHARP;
+ RNA_enum_set(op->ptr, "miter_inner", miter_inner);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
- /* Modal numinput inactive, try to handle numeric inputs last... */
- if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
- edbm_bevel_numinput_set_value(op);
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- return OPERATOR_RUNNING_MODAL;
+ case BEV_MODAL_OUTER_MITER_CHANGE:
+ {
+ int miter_outer = RNA_enum_get(op->ptr, "miter_outer");
+ miter_outer++;
+ if (miter_outer > BEVEL_MITER_ARC)
+ miter_outer = BEVEL_MITER_SHARP;
+ RNA_enum_set(op->ptr, "miter_outer", miter_outer);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
+
+ case BEV_MODAL_HARDEN_NORMALS_TOGGLE:
+ {
+ bool harden_normals = RNA_boolean_get(op->ptr, "harden_normals");
+ RNA_boolean_set(op->ptr, "harden_normals", !harden_normals);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
}
}
+ /* Modal numinput inactive, try to handle numeric inputs last... */
+ if (!handled && eval == KM_PRESS && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
+ edbm_bevel_numinput_set_value(op);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ return OPERATOR_RUNNING_MODAL;
+ }
+
return OPERATOR_RUNNING_MODAL;
}
@@ -766,11 +795,25 @@ void MESH_OT_bevel(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL},
};
- static EnumPropertyItem harden_normals_items[] = {
- { BEVEL_HN_NONE, "HN_NONE", 0, "Off", "Do not use Harden Normals" },
- { BEVEL_HN_FACE, "HN_FACE", 0, "Face Area", "Use faces as weight" },
- { BEVEL_HN_ADJ, "HN_ADJ", 0, "Vertex average", "Use adjacent vertices as weight" },
- { 0, NULL, 0, NULL, NULL },
+ static const EnumPropertyItem face_strength_mode_items[] = {
+ {BEVEL_FACE_STRENGTH_NONE, "NONE", 0, "None", "Do not set face strength"},
+ {BEVEL_FACE_STRENGTH_NEW, "NEW", 0, "New", "Set face strength on new faces only"},
+ {BEVEL_FACE_STRENGTH_AFFECTED, "AFFECTED", 0, "Affected", "Set face strength on new and modified faces only"},
+ {BEVEL_FACE_STRENGTH_ALL, "ALL", 0, "All", "Set face strength on all faces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem miter_outer_items[] = {
+ {BEVEL_MITER_SHARP, "SHARP", 0, "Sharp", "Outside of miter is sharp"},
+ {BEVEL_MITER_PATCH, "PATCH", 0, "Patch", "Outside of miter is squared-off patch"},
+ {BEVEL_MITER_ARC, "ARC", 0, "Arc", "Outside of miter is arc"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem miter_inner_items[] = {
+ {BEVEL_MITER_SHARP, "SHARP", 0, "Sharp", "Inside of miter is sharp"},
+ {BEVEL_MITER_ARC, "ARC", 0, "Arc", "Inside of miter is arc"},
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -802,10 +845,16 @@ void MESH_OT_bevel(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mark_sharp", false, "Mark Sharp", "Mark beveled edges as sharp");
RNA_def_int(ot->srna, "material", -1, -1, INT_MAX, "Material",
"Material for bevel faces (-1 means use adjacent faces)", -1, 100);
- RNA_def_float(ot->srna, "strength", 0.5f, 0.0f, 1.0f, "Normal Strength",
- "Strength of calculated normal", 0.0f, 1.0f);
- RNA_def_enum(ot->srna, "hnmode", harden_normals_items, BEVEL_HN_NONE, "Normal Mode",
- "Weighting mode for Harden Normals");
+ RNA_def_boolean(ot->srna, "harden_normals", false, "Harden Normals",
+ "Match normals of new faces to adjacent faces");
+ RNA_def_enum(ot->srna, "face_strength_mode", face_strength_mode_items, BEVEL_FACE_STRENGTH_NONE,
+ "Face Strength Mode", "Whether to set face strength, and which faces to set face strength on");
+ RNA_def_enum(ot->srna, "miter_outer", miter_outer_items, BEVEL_MITER_SHARP,
+ "Outer Miter", "Pattern to use for outside of miters");
+ RNA_def_enum(ot->srna, "miter_inner", miter_inner_items, BEVEL_MITER_SHARP,
+ "Inner Miter", "Pattern to use for inside of miters");
+ RNA_def_float(ot->srna, "spread", 0.1f, 0.0f, 1e6f, "Spread",
+ "Amount to spread arcs for arc inner miters", 0.0f, 100.0f);
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index 5b59f1aa5f9..61531109a01 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2013 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_bisect.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -404,8 +398,8 @@ void MESH_OT_bisect(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop = RNA_def_float_vector(ot->srna, "plane_co", 3, NULL, -1e12f, 1e12f,
- "Plane Point", "A point on the plane", -1e4f, 1e4f);
+ prop = RNA_def_float_vector_xyz(ot->srna, "plane_co", 3, NULL, -1e12f, 1e12f,
+ "Plane Point", "A point on the plane", -1e4f, 1e4f);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float_vector(ot->srna, "plane_no", 3, NULL, -1.0f, 1.0f,
"Plane Normal", "The direction the plane points", -1.0f, 1.0f);
@@ -429,7 +423,6 @@ void MESH_OT_bisect(struct wmOperatorType *ot)
#ifdef USE_GIZMO
/* -------------------------------------------------------------------- */
-
/** \name Bisect Gizmo
* \{ */
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index fad8d39e665..ab49a6ce203 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_modifier_types.h"
diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c
index 589e3987050..4b3a93a2111 100644
--- a/source/blender/editors/mesh/editmesh_extrude_screw.c
+++ b/source/blender/editors/mesh/editmesh_extrude_screw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_screw.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -49,8 +41,6 @@
#include "ED_screen.h"
#include "ED_view3d.h"
-
-
#include "mesh_intern.h" /* own include */
/* -------------------------------------------------------------------- */
@@ -207,8 +197,8 @@ void MESH_OT_screw(wmOperatorType *ot)
RNA_def_int(ot->srna, "steps", 9, 1, 100000, "Steps", "Steps", 3, 256);
RNA_def_int(ot->srna, "turns", 1, 1, 100000, "Turns", "Turns", 1, 256);
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
- "Center", "Center in global view space", -1e4f, 1e4f);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
+ "Center", "Center in global view space", -1e4f, 1e4f);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f,
"Axis", "Axis in global view space", -1.0f, 1.0f);
}
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c
index e9758cb1a5a..a098751fd21 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_spin.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_object_types.h"
@@ -71,7 +63,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "axis", axis);
const int steps = RNA_int_get(op->ptr, "steps");
const float angle = RNA_float_get(op->ptr, "angle");
- const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip") ^ (angle < 0.0f);
+ const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip");
const bool dupli = RNA_boolean_get(op->ptr, "dupli");
const bool use_auto_merge = (
RNA_boolean_get(op->ptr, "use_auto_merge") &&
@@ -208,8 +200,8 @@ void MESH_OT_spin(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_auto_merge", true, "Auto Merge", "Merge first/last when the angle is a full revolution");
RNA_def_boolean(ot->srna, "use_normal_flip", 0, "Flip Normals", "");
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
- "Center", "Center in global view space", -1e4f, 1e4f);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
+ "Center", "Center in global view space", -1e4f, 1e4f);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -1.0f, 1.0f);
WM_gizmogrouptype_append(MESH_GGT_spin);
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index dd5f97cd010..9884ded4f0a 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_spin_gizmo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "BLI_math.h"
@@ -144,7 +140,7 @@ static void gizmo_mesh_spin_init_setup(const bContext *UNUSED(C), wmGizmoGroup *
WM_gizmo_set_scale(gz, scale_button);
gz->color[3] = 0.6f;
- gz->flag |= WM_GIZMO_DRAW_OFFSET_SCALE;
+ gz->flag |= WM_GIZMO_DRAW_OFFSET_SCALE | WM_GIZMO_OPERATOR_TOOL_INIT;
ggd->gizmos.icon_button[i][j] = gz;
}
@@ -247,7 +243,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);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
/* Take care calling refresh from draw_prepare,
@@ -442,23 +438,15 @@ static void gizmo_mesh_spin_init_message_subscribe(
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
- PointerRNA scene_ptr;
- RNA_id_pointer_create(&scene->id, &scene_ptr);
-
- {
- extern PropertyRNA rna_Scene_cursor_location;
- const PropertyRNA *props[] = {
- &rna_Scene_cursor_location,
- };
- for (int i = 0; i < ARRAY_SIZE(props); i++) {
- WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
- }
- }
+ PointerRNA cursor_ptr;
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &cursor_ptr);
+ /* All cursor properties. */
+ WM_msg_subscribe_rna(mbus, &cursor_ptr, NULL, &msg_sub_value_gz_tag_refresh, __func__);
WM_msg_subscribe_rna_params(
mbus,
&(const wmMsgParams_RNA){
- .ptr = (PointerRNA){.type = gzgroup->type->srna},
+ .ptr = (PointerRNA){ .type = gzgroup->type->srna, },
.prop = ggd->data.gzgt_axis_prop,
},
&msg_sub_value_gz_tag_refresh, __func__);
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 9eae3d3b564..d638f4f60c9 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_inset.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -124,7 +118,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
ViewLayer *view_layer = CTX_data_view_layer(C);
if (is_modal) {
- RNA_float_set(op->ptr, "thickness", 0.01f);
+ RNA_float_set(op->ptr, "thickness", 0.0f);
RNA_float_set(op->ptr, "depth", 0.0f);
}
@@ -148,7 +142,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
opdata->ob_store_len = objects_used_len;
}
- opdata->old_thickness = 0.01;
+ opdata->old_thickness = 0.0;
opdata->old_depth = 0.0;
opdata->modify_depth = false;
opdata->shift = false;
@@ -241,7 +235,8 @@ static bool edbm_inset_calc(wmOperator *op)
const float thickness = RNA_float_get(op->ptr, "thickness");
const float depth = RNA_float_get(op->ptr, "depth");
const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
- const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
+ /* not passed onto the BMO */
+ const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset");
const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate");
@@ -565,7 +560,7 @@ void MESH_OT_inset(wmOperatorType *ot)
ot->srna, "use_edge_rail",
false, "Edge Rail", "Inset the region along existing edges");
- prop = RNA_def_float_distance(ot->srna, "thickness", 0.01f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f);
+ prop = RNA_def_float_distance(ot->srna, "thickness", 0.0f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f);
/* use 1 rather then 10 for max else dragging the button moves too far */
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c
index a625d8949a6..08486f28669 100644
--- a/source/blender/editors/mesh/editmesh_intersect.c
+++ b/source/blender/editors/mesh/editmesh_intersect.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_intersect.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -30,7 +26,6 @@
#include "BLI_memarena.h"
#include "BLI_stack.h"
#include "BLI_buffer.h"
-#include "BLI_kdopbvh.h"
#include "BLI_linklist_stack.h"
#include "BKE_layer.h"
@@ -233,7 +228,7 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
"Self intersect selected faces"},
{ISECT_SEL_UNSEL, "SELECT_UNSELECT", 0, "Selected/Unselected",
"Intersect selected with unselected faces"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem isect_separate_items[] = {
@@ -243,7 +238,7 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
"Cut into geometry keeping each side separate (Selected/Unselected only)"},
{ISECT_SEPARATE_NONE, "NONE", 0, "Merge",
"Merge all geometry from the intersection"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -329,7 +324,7 @@ void MESH_OT_intersect_boolean(struct wmOperatorType *ot)
{BMESH_ISECT_BOOLEAN_ISECT, "INTERSECT", 0, "Intersect", ""},
{BMESH_ISECT_BOOLEAN_UNION, "UNION", 0, "Union", ""},
{BMESH_ISECT_BOOLEAN_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -637,8 +632,9 @@ static BMEdge *bm_face_split_edge_find(
ok = false;
}
else if (found_other_face) {
- /* double check that _all_ the faces used by v_pivot's edges are attached to this edge
- * otherwise don't attempt the split since it will give non-deterministic results */
+ /* double check that _all_ the faces used by v_pivot's edges are attached
+ * to this edge otherwise don't attempt the split since it will give
+ * non-deterministic results */
BMLoop *l_radial_iter = l_iter->radial_next;
int other_face_shared = 0;
if (l_radial_iter != l_iter) {
@@ -786,7 +782,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
dot_test = fabsf(dot_v3v3(e_dir, l->f->no));
if (dot_test < dot_best) {
- /* check we're in the correct corner (works with convex loops too) */
+ /* check we're in the correct corner
+ * (works with convex loops too) */
if (angle_signed_on_axis_v3v3v3_v3(l->prev->v->co, l->v->co, v_other->co, l->f->no) <
angle_signed_on_axis_v3v3v3_v3(l->prev->v->co, l->v->co, l->next->v->co, l->f->no))
{
@@ -881,8 +878,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
for (int j = 0; j < 2; j++) {
BMVert *v_pivot = (&e->v1)[j];
- /* checking that \a v_pivot isn't in the face
- * prevents attempting to splice the same vertex into an edge from multiple faces */
+ /* checking that \a v_pivot isn't in the face prevents attempting
+ * to splice the same vertex into an edge from multiple faces */
if (!BM_vert_in_face(v_pivot, f)) {
float v_pivot_co[3];
float v_pivot_fac;
@@ -891,7 +888,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
v_pivot_co, &v_pivot_fac);
if (e_split) {
- /* for degenerate cases this vertex may be in one of this edges radial faces */
+ /* for degenerate cases this vertex may be in one
+ * of this edges radial faces */
if (!bm_vert_in_faces_radial(v_pivot, e_split, f)) {
BMEdge *e_new;
BMVert *v_new = BM_edge_split(bm, e_split, e_split->v1, &e_new, v_pivot_fac);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index b89a7dd91a1..0017044f2ff 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joseph Eagar, Joshua Leung, Howard Trickey,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_knife.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Interactive editmesh knife tool.
*/
@@ -96,12 +88,12 @@
#define KNIFE_FLT_EPS_PX_FACE 0.05f
typedef struct KnifeColors {
- unsigned char line[3];
- unsigned char edge[3];
- unsigned char curpoint[3];
- unsigned char curpoint_a[4];
- unsigned char point[3];
- unsigned char point_a[4];
+ uchar line[3];
+ uchar edge[3];
+ uchar curpoint[3];
+ uchar curpoint_a[4];
+ uchar point[3];
+ uchar point_a[4];
} KnifeColors;
/* knifetool operator */
@@ -1027,13 +1019,13 @@ static void knife_init_colors(KnifeColors *colors)
/* possible BMESH_TODO: add explicit themes or calculate these by
* figuring out contrasting colors with grid / edges / verts
* a la UI_make_axis_color */
- UI_GetThemeColor3ubv(TH_NURB_VLINE, colors->line);
- UI_GetThemeColor3ubv(TH_NURB_ULINE, colors->edge);
- UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint);
- UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint_a);
+ UI_GetThemeColorType3ubv(TH_NURB_VLINE, SPACE_VIEW3D, colors->line);
+ UI_GetThemeColorType3ubv(TH_NURB_ULINE, SPACE_VIEW3D, colors->edge);
+ UI_GetThemeColorType3ubv(TH_HANDLE_SEL_VECT, SPACE_VIEW3D, colors->curpoint);
+ UI_GetThemeColorType3ubv(TH_HANDLE_SEL_VECT, SPACE_VIEW3D, colors->curpoint_a);
colors->curpoint_a[3] = 102;
- UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point);
- UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point_a);
+ UI_GetThemeColorType3ubv(TH_ACTIVE_SPLINE, SPACE_VIEW3D, colors->point);
+ UI_GetThemeColorType3ubv(TH_ACTIVE_SPLINE, SPACE_VIEW3D, colors->point_a);
colors->point_a[3] = 102;
}
@@ -1457,7 +1449,7 @@ static bool point_is_visible(
/* avoid projecting behind the viewpoint */
if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
- dist = kcd->vc.v3d->far * 2.0f;
+ dist = kcd->vc.v3d->clip_end * 2.0f;
}
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
@@ -2098,7 +2090,8 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
knife_project_v2(kcd, kfv->cageco, kfv->sco);
- /* be strict about angle snapping, the vertex needs to be very close to the angle, or we ignore */
+ /* be strict about angle snapping, the vertex needs to be very close to the angle,
+ * or we ignore */
if (kcd->is_angle_snapping) {
if (dist_squared_to_line_segment_v2(kfv->sco, kcd->prev.mval, kcd->curr.mval) > KNIFE_FLT_EPSBIG) {
continue;
@@ -2756,7 +2749,7 @@ wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
{KNF_MODAL_NEW_CUT, "NEW_CUT", 0, "End Current Cut", ""},
{KNF_MODAL_ADD_CUT, "ADD_CUT", 0, "Add Cut", ""},
{KNF_MODAL_PANNING, "PANNING", 0, "Panning", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Knife Tool Modal Map");
@@ -3120,7 +3113,8 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug
keep_search = false;
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG) == false && (F_ISECT_IS_UNKNOWN(f))) {
- /* am I connected to a tagged face via an un-tagged edge (ie, not across a cut) */
+ /* am I connected to a tagged face via an un-tagged edge
+ * (ie, not across a cut) */
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first;
bool found = false;
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index a3396f75eaf..45ce8e8b76a 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_knife_project.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_curve_types.h"
@@ -77,7 +70,8 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, Scene *scene,
me_eval_needs_free = false;
}
else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
- me_eval = BKE_mesh_new_nomain_from_curve(ob);
+ Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+ me_eval = BKE_mesh_new_nomain_from_curve(ob_eval);
me_eval_needs_free = true;
}
else {
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 9c5372cafd8..f0c2023dfcc 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,22 +15,16 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joseph Eagar, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_loopcut.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_object_types.h"
#include "MEM_guardedalloc.h"
-#include "BLI_stack.h"
#include "BLI_string.h"
#include "BLI_math.h"
@@ -221,10 +213,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
/* XXX Is this piece of code ever used now? Simple loop select is now
* in editmesh_select.c (around line 1000)... */
/* sets as active, useful for other tools */
- if (em->selectmode & SCE_SELECT_VERTEX)
- BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
- if (em->selectmode & SCE_SELECT_EDGE)
+ if (em->selectmode & SCE_SELECT_VERTEX) {
+ /* low priority TODO, get vertrex close to mouse */
+ BM_select_history_store(em->bm, lcd->eed->v1);
+ }
+ if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, lcd->eed);
+ }
EDBM_selectmode_flush(lcd->em);
DEG_id_tag_update(lcd->ob->data, ID_RECALC_SELECT);
@@ -698,7 +693,8 @@ void MESH_OT_loopcut(wmOperatorType *ot)
/* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000000, "Number of Cuts", "", 1, 100);
- /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ /* avoid re-using last var because it can cause
+ * _very_ high poly meshes and annoy users (or worse crash) */
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -1e3f, 1e3f,
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c
index 91d08953b8a..d16cd639c0d 100644
--- a/source/blender/editors/mesh/editmesh_path.c
+++ b/source/blender/editors/mesh/editmesh_path.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_path.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -72,7 +64,8 @@
* \{ */
struct PathSelectParams {
- bool track_active; /* ensure the active element is the last selected item (handy for picking) */
+ /** ensure the active element is the last selected item (handy for picking) */
+ bool track_active;
bool use_topology_distance;
bool use_face_step;
bool use_fill;
@@ -294,7 +287,7 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
{
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
switch (edge_mode) {
case EDGE_MODE_TAG_CREASE:
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index 1d0521ec777..7012629ec95 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_polybuild.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Tools to implement polygon building tool,
* an experimental tool for quickly constructing/manipulating faces.
diff --git a/source/blender/editors/mesh/editmesh_preselect_edgering.c b/source/blender/editors/mesh/editmesh_preselect_edgering.c
index 3b31b9c15f6..9e761713f7e 100644
--- a/source/blender/editors/mesh/editmesh_preselect_edgering.c
+++ b/source/blender/editors/mesh/editmesh_preselect_edgering.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_preselect_edgering.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c
index e0b06019de1..827d47a265c 100644
--- a/source/blender/editors/mesh/editmesh_preselect_elem.c
+++ b/source/blender/editors/mesh/editmesh_preselect_elem.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,20 +12,16 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_preselect_elem.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
-#include "BLI_stack.h"
#include "BLI_math.h"
-#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "GPU_immediate.h"
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index f00973768ed..2117c2bb689 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_rip.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -313,7 +305,8 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid = uid_end + bm->totedge;
lp = BLI_array_append_ret(eloop_pairs);
- BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */
+ /* no need to check, we know this will be true */
+ BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b);
BLI_assert(tot == uid_end - uid_start);
@@ -408,7 +401,7 @@ typedef struct UnorderedLoopPair {
} UnorderedLoopPair;
enum {
ULP_FLIP_0 = (1 << 0),
- ULP_FLIP_1 = (1 << 1)
+ ULP_FLIP_1 = (1 << 1),
};
static UnorderedLoopPair *edbm_tagged_loop_pairs_to_fill(BMesh *bm)
@@ -795,7 +788,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
if (do_fill) {
/* Only needed when filling...
- * Also, we never want to tag best edge, that one won't change during split. See T44618. */
+ * Also, we never want to tag best edge,
+ * that one won't change during split. See T44618. */
if (larr[larr_len]->e == e_best) {
BM_elem_flag_enable(larr[larr_len]->prev->e, BM_ELEM_TAG);
}
diff --git a/source/blender/editors/mesh/editmesh_rip_edge.c b/source/blender/editors/mesh/editmesh_rip_edge.c
index ef07aac0ab2..e449f96bc05 100644
--- a/source/blender/editors/mesh/editmesh_rip_edge.c
+++ b/source/blender/editors/mesh/editmesh_rip_edge.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_rip_edge.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* based on mouse cursor position, split of vertices along the closest edge.
*/
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index e522c8849c7..796df504d31 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_select.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -204,7 +196,8 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
/** \name Back-Buffer OpenGL Selection
* \{ */
-unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0; /* set in drawobject.c ... for colorindices */
+/* set in drawobject.c ... for colorindices */
+unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0;
/* facilities for box select and circle select */
static BLI_bitmap *selbuf = NULL;
@@ -1161,16 +1154,13 @@ bool EDBM_unified_findnearest_from_raycast(
if ((BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false) &&
(BM_edge_is_boundary(e)))
{
- float depth;
-
if (use_vert) {
for (uint j = 0; j < 2; j++) {
BMVert *v = *((&e->v1) + j);
float point[3];
mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co);
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1194,9 +1184,8 @@ bool EDBM_unified_findnearest_from_raycast(
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
mul_m4_v3(obedit->obmat, point);
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1216,10 +1205,8 @@ bool EDBM_unified_findnearest_from_raycast(
if (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == false) {
float point[3];
mul_v3_m4v3(point, obedit->obmat, v->co);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- v->co, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, v->co);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1241,10 +1228,8 @@ bool EDBM_unified_findnearest_from_raycast(
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
mul_m4_v3(obedit->obmat, point);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1268,10 +1253,8 @@ bool EDBM_unified_findnearest_from_raycast(
BM_face_calc_center_median(f, point);
}
mul_m4_v3(obedit->obmat, point);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1466,7 +1449,7 @@ void MESH_OT_select_mode(wmOperatorType *ot)
{0, "DISABLE", 0, "Disable", "Disable selected markers"},
{1, "ENABLE", 0, "Enable", "Enable selected markers"},
{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2245,7 +2228,8 @@ void EDBM_selectmode_set(BMEditMesh *em)
em->bm->selectmode = em->selectmode;
- edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */
+ /* strip BMEditSelections from em->selected that are not relevant to new mode */
+ edbm_strip_selections(em);
if (em->bm->totvertsel == 0 &&
em->bm->totedgesel == 0 &&
@@ -3329,7 +3313,7 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot)
{1, "EQUAL", 0, "Equal To", ""},
{2, "GREATER", 0, "Greater Than", ""},
{3, "NOTEQUAL", 0, "Not Equal To", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4447,7 +4431,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
{SELECT_AXIS_POS, "POS", 0, "Positive Axis", ""},
{SELECT_AXIS_NEG, "NEG", 0, "Negative Axis", ""},
{SELECT_AXIS_ALIGN, "ALIGN", 0, "Aligned Axis", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4463,7 +4447,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_MANIP_LOCAL, "Axis Mode", "Axis orientation");
+ RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_ORIENT_LOCAL, "Axis Mode", "Axis orientation");
RNA_def_enum(ot->srna, "sign", axis_sign_items, SELECT_AXIS_POS, "Axis Sign", "Side to select");
RNA_def_enum(ot->srna, "axis", rna_enum_axis_xyz_items, 0, "Axis", "Select the axis to compare each vertex on");
RNA_def_float(ot->srna, "threshold", 0.0001f, 0.000001f, 50.0f, "Threshold", "", 0.00001f, 10.0f);
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index 55e79761681..c9dea33dc78 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_select_similar.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -64,7 +56,7 @@ static const EnumPropertyItem prop_similar_compare_types[] = {
{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
{SIM_CMP_LT, "LESS", 0, "Less", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_similar_types[] = {
@@ -97,7 +89,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMFACE_FREESTYLE, "FREESTYLE_FACE", 0, "Freestyle Face Marks", ""},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int mesh_select_similar_compare_int(const int delta, const int compare)
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index c8b3296d0d7..83366987c7a 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_tools.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include <stddef.h>
@@ -46,7 +38,6 @@
#include "BLI_listbase.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
-#include "BLI_noise.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_sort_utils.h"
@@ -150,7 +141,7 @@ static const EnumPropertyItem prop_mesh_cornervert_types[] = {
{SUBD_CORNER_PATH, "PATH", 0, "Path", ""},
{SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT", 0, "Straight Cut", ""},
{SUBD_CORNER_FAN, "FAN", 0, "Fan", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void MESH_OT_subdivide(wmOperatorType *ot)
@@ -171,7 +162,8 @@ void MESH_OT_subdivide(wmOperatorType *ot)
/* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10);
- /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ /* avoid re-using last var because it can cause
+ * _very_ high poly meshes and annoy users (or worse crash) */
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
@@ -214,7 +206,7 @@ static void mesh_operator_edgering_props(wmOperatorType *ot, const int cuts_min,
{SUBD_RING_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
{SUBD_RING_INTERP_PATH, "PATH", 0, "Blend Path", ""},
{SUBD_RING_INTERP_SURF, "SURFACE", 0, "Blend Surface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -499,7 +491,7 @@ void MESH_OT_delete(wmOperatorType *ot)
{MESH_DELETE_FACE, "FACE", 0, "Faces", ""},
{MESH_DELETE_EDGE_FACE, "EDGE_FACE", 0, "Only Edges & Faces", ""},
{MESH_DELETE_ONLY_FACE, "ONLY_FACE", 0, "Only Faces", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1005,10 +997,16 @@ static int edbm_mark_seam_exec(bContext *C, wmOperator *op)
BM_elem_flag_enable(eed, BM_ELEM_SEAM);
}
}
+ }
- ED_uvedit_live_unwrap(scene, obedit);
+ ED_uvedit_live_unwrap(scene, objects, objects_len);
+
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
EDBM_update_generic(em, true, false);
}
+
MEM_freeN(objects);
return OPERATOR_FINISHED;
@@ -1173,7 +1171,8 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, wmOperator *op)
len = 0;
}
else {
- EDBM_selectmode_flush(em); /* so newly created edges get the selection state from the vertex */
+ /* so newly created edges get the selection state from the vertex */
+ EDBM_selectmode_flush(em);
EDBM_update_generic(em, true, true);
}
@@ -1906,7 +1905,8 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he use_ccw=%b", BM_ELEM_TAG, use_ccw);
/* avoids leaving old verts selected which can be a problem running multiple times,
- * since this means the edges become selected around the face which then attempt to rotate */
+ * since this means the edges become selected around the face
+ * which then attempt to rotate */
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, true);
BMO_op_exec(em->bm, &bmop);
@@ -1984,6 +1984,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
{
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
ViewLayer *view_layer = CTX_data_view_layer(C);
+ bool changed = false;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
@@ -1992,18 +1993,28 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
- if ((bm->totvertsel == 0) &&
- (bm->totedgesel == 0) &&
- (bm->totfacesel == 0))
- {
- continue;
+ if (unselected) {
+ if (bm->totvertsel == bm->totvert) {
+ continue;
+ }
+ }
+ else {
+ if (bm->totvertsel == 0) {
+ continue;
+ }
}
- EDBM_mesh_hide(em, unselected);
- EDBM_update_generic(em, true, false);
+ if (EDBM_mesh_hide(em, unselected)) {
+ EDBM_update_generic(em, true, false);
+ changed = true;
+ }
}
-
MEM_freeN(objects);
+
+ if (!changed) {
+ return OPERATOR_CANCELLED;
+ }
+
return OPERATOR_FINISHED;
}
@@ -2042,8 +2053,9 @@ static int edbm_reveal_exec(bContext *C, wmOperator *op)
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- EDBM_mesh_reveal(em, select);
- EDBM_update_generic(em, true, false);
+ if (EDBM_mesh_reveal(em, select)) {
+ EDBM_update_generic(em, true, false);
+ }
}
MEM_freeN(objects);
@@ -2121,7 +2133,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Smooth Vertex Operator
+/** \name Smooth Vertices Operator
* \{ */
static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
@@ -2206,7 +2218,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
void MESH_OT_vertices_smooth(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Smooth Vertex";
+ ot->name = "Smooth Vertices";
ot->description = "Flatten angles of selected vertices";
ot->idname = "MESH_OT_vertices_smooth";
@@ -2217,7 +2229,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- ot->prop = RNA_def_float(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f);
+ ot->prop = RNA_def_float_factor(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f);
RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Repeat", "Number of times to smooth the mesh", 1, 100);
WM_operatortype_props_advanced_begin(ot);
@@ -2230,7 +2242,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Laplacian Vertex Smooth Operator
+/** \name Laplacian Smooth Vertices Operator
* \{ */
static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
@@ -2327,7 +2339,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Laplacian Smooth Vertex";
+ ot->name = "Laplacian Smooth Vertices";
ot->description = "Laplacian smooth of selected vertices";
ot->idname = "MESH_OT_vertices_smooth_laplacian";
@@ -2836,7 +2848,7 @@ static const EnumPropertyItem merge_type_items[] = {
{MESH_MERGE_CENTER, "CENTER", 0, "At Center", ""},
{MESH_MERGE_CURSOR, "CURSOR", 0, "At Cursor", ""},
{MESH_MERGE_COLLAPSE, "COLLAPSE", 0, "Collapse", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
@@ -2882,7 +2894,8 @@ static const EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(
return item;
}
- return NULL;
+ /* Get all items e.g. when creating keymap item. */
+ return merge_type_items;
}
void MESH_OT_merge(wmOperatorType *ot)
@@ -3055,7 +3068,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Mesh *me = obedit->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em->bm->totvertsel == 0) {
continue;
@@ -3116,7 +3129,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
Mesh *me_ref = obedit_ref->data;
Key *key_ref = me_ref->key;
KeyBlock *kb_ref = NULL;
- BMEditMesh *em_ref = me_ref->edit_btmesh;
+ BMEditMesh *em_ref = me_ref->edit_mesh;
BMVert *eve;
BMIter iter;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -3152,7 +3165,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
Mesh *me = obedit->data;
Key *key = me->key;
KeyBlock *kb = NULL;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
int shape;
if (em->bm->totvertsel == 0) {
@@ -3354,26 +3367,6 @@ void MESH_OT_solidify(wmOperatorType *ot)
/** \name Knife Subdivide Operator
* \{ */
-/* ******************************************************************** */
-/* Knife Subdivide Tool. Subdivides edges intersected by a mouse trail
- * drawn by user.
- *
- * Currently mapped to KKey when in MeshEdit mode.
- * Usage:
- * - Hit Shift K, Select Centers or Exact
- * - Hold LMB down to draw path, hit RETKEY.
- * - ESC cancels as expected.
- *
- * Contributed by Robert Wenzlaff (Det. Thorn).
- *
- * 2.5 Revamp:
- * - non modal (no menu before cutting)
- * - exit on mouse release
- * - polygon/segment drawing can become handled by WM cb later
- *
- * bmesh port version
- */
-
#define KNIFE_EXACT 1
#define KNIFE_MIDPOINT 2
#define KNIFE_MULTICUT 3
@@ -3382,7 +3375,7 @@ static const EnumPropertyItem knife_items[] = {
{KNIFE_EXACT, "EXACT", 0, "Exact", ""},
{KNIFE_MIDPOINT, "MIDPOINTS", 0, "Midpoints", ""},
{KNIFE_MULTICUT, "MULTICUT", 0, "Multicut", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* bm_edge_seg_isect() Determines if and where a mouse trail intersects an BMEdge */
@@ -3464,8 +3457,10 @@ static float bm_edge_seg_isect(
y12 = mouse_path[i][1];
/* Perp. Distance from point to line */
- if (m2 != MAXSLOPE) dist = (y12 - m2 * x12 - b2); /* /sqrt(m2 * m2 + 1); Only looking for */
- /* change in sign. Skip extra math */
+ if (m2 != MAXSLOPE) {
+ /* sqrt(m2 * m2 + 1); Only looking for change in sign. Skip extra math .*/
+ dist = (y12 - m2 * x12 - b2);
+ }
else dist = x22 - x12;
if (i == 0) lastdist = dist;
@@ -3592,7 +3587,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */
- /* the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer */
+ /* the floating point coordinates of verts in screen space will be
+ * stored in a hash table according to the vertices pointer */
screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__);
BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) {
@@ -3723,8 +3719,12 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_old, USER_DUP_MESH);
- /* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */
- assign_matarar(bmain, base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
+
+ /* normally would call directly after but in this case delay recalc */
+ /* DAG_relations_tag_update(bmain); */
+
+ /* new in 2.5 */
+ assign_matarar(bmain, base_new->object, give_matarar(obedit), *give_totcolp(obedit));
ED_object_base_select(base_new, BA_SELECT);
@@ -3743,7 +3743,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
BM_mesh_bm_to_me(bmain, bm_new, base_new->object->data, (&(struct BMeshToMeshParams){0}));
BM_mesh_free(bm_new);
- ((Mesh *)base_new->object->data)->edit_btmesh = NULL;
+ ((Mesh *)base_new->object->data)->edit_mesh = NULL;
return base_new;
}
@@ -4088,7 +4088,7 @@ void MESH_OT_separate(wmOperatorType *ot)
{MESH_SEPARATE_SELECTED, "SELECTED", 0, "Selection", ""},
{MESH_SEPARATE_MATERIAL, "MATERIAL", 0, "By Material", ""},
{MESH_SEPARATE_LOOSE, "LOOSE", 0, "By loose parts", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4375,7 +4375,11 @@ static int edbm_fill_grid_exec(bContext *C, wmOperator *op)
int span;
int offset;
- if (RNA_property_is_set(op->ptr, prop_span)) {
+ /* Only reuse on redo because these settings need to match the current selection.
+ * We never want to use them on other geometry, repeat last for eg, see: T60777. */
+ if ((op->flag & OP_IS_REPEAT) &&
+ RNA_property_is_set(op->ptr, prop_span))
+ {
span = RNA_property_int_get(op->ptr, prop_span);
span = min_ii(span, (clamp / 2) - 1);
calc_span = false;
@@ -4650,7 +4654,8 @@ void MESH_OT_poke(wmOperatorType *ot)
{BMOP_POKE_MEDIAN_WEIGHTED, "MEDIAN_WEIGHTED", 0, "Weighted Median", "Weighted median face center"},
{BMOP_POKE_MEDIAN, "MEDIAN", 0, "Median", "Median face center"},
{BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face bounds center"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
@@ -5662,7 +5667,8 @@ static void sort_bmelem_flag(
float fact = reverse ? -1.0 : 1.0;
int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0;
- mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat); /* Apply the view matrix to the object matrix. */
+ /* Apply the view matrix to the object matrix. */
+ mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat);
if (totelem[0]) {
pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock");
@@ -5801,9 +5807,11 @@ static void sort_bmelem_flag(
float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr;
pb[i] = false;
sb[affected[2]].org_idx = i;
- /* Multiplying with totface and adding i ensures us we keep current order for all faces of same mat. */
+ /* Multiplying with totface and adding i ensures us
+ * we keep current order for all faces of same mat. */
sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i);
-/* printf("e: %d; srt: %f; final: %f\n", i, srt, srt * ((float)totface) + ((float)i));*/
+ // printf("e: %d; srt: %f; final: %f\n",
+ // i, srt, srt * ((float)totface) + ((float)i));
}
else {
pb[i] = true;
@@ -6385,7 +6393,7 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
{MESH_BRIDGELOOP_SINGLE, "SINGLE", 0, "Open Loop", ""},
{MESH_BRIDGELOOP_CLOSED, "CLOSED", 0, "Closed Loop", ""},
{MESH_BRIDGELOOP_PAIRS, "PAIRS", 0, "Loop Pairs", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -7127,7 +7135,7 @@ wmKeyMap *point_normals_modal_keymap(wmKeyConfig *keyconf)
"Set new 3D cursor position and use it"},
{EDBM_CLNOR_MODAL_POINTTO_SET_USE_SELECTED, "SET_USE_SELECTED", 0, "Select and Use Mesh Item",
"Select new active mesh element and use its location"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const char *keymap_name = "Custom Normals Modal Map";
@@ -7157,7 +7165,7 @@ static EnumPropertyItem clnors_pointto_mode_items[] = {
{EDBM_CLNOR_POINTTO_MODE_COORDINATES, "COORDINATES", 0, "Coordinates",
"Use static coordinates (defined by various means)"},
{EDBM_CLNOR_POINTTO_MODE_MOUSE, "MOUSE", 0, "Mouse", "Follow mouse cursor"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Initialize loop normal data */
@@ -7260,7 +7268,10 @@ static void point_normals_apply(bContext *C, wmOperator *op, float target[3], co
float spherized_normal[3];
sub_v3_v3v3(spherized_normal, target, lnor_ed->loc);
- normalize_v3(spherized_normal); /* otherwise, multiplication by strength is meaningless... */
+
+ /* otherwise, multiplication by strength is meaningless... */
+ normalize_v3(spherized_normal);
+
mul_v3_fl(spherized_normal, strength);
mul_v3_v3fl(lnor_ed->nloc, lnor_ed->niloc, 1.0f - strength);
add_v3_v3(lnor_ed->nloc, spherized_normal);
@@ -7346,7 +7357,8 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
case EDBM_CLNOR_MODAL_POINTTO_USE_MOUSE:
new_mode = EDBM_CLNOR_POINTTO_MODE_MOUSE;
- force_mousemove = true; /* We want to immediately update to mouse cursor position... */
+ /* We want to immediately update to mouse cursor position... */
+ force_mousemove = true;
ret = OPERATOR_RUNNING_MODAL;
break;
@@ -7367,7 +7379,9 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
new_mode = EDBM_CLNOR_POINTTO_MODE_COORDINATES;
view3d_operator_needs_opengl(C);
if (EDBM_select_pick(C, event->mval, false, false, false)) {
- ED_object_calc_active_center_for_editmode(obedit, false, target); /* Point to newly selected active. */
+ /* Point to newly selected active. */
+ ED_object_calc_active_center_for_editmode(obedit, false, target);
+
add_v3_v3(target, obedit->loc);
ret = OPERATOR_RUNNING_MODAL;
}
@@ -7490,7 +7504,8 @@ static int edbm_point_normals_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* Note that 'mode' is ignored in exec case, we directly use vector stored in target_location, whatever that is. */
+ /* Note that 'mode' is ignored in exec case,
+ * we directly use vector stored in target_location, whatever that is. */
float target[3];
RNA_float_get_array(op->ptr, "target_location", target);
@@ -7554,8 +7569,8 @@ void MESH_OT_point_normals(struct wmOperatorType *ot)
RNA_def_boolean(ot->srna, "align", false, "Align", "Make all affected normals parallel");
- RNA_def_float_vector(ot->srna, "target_location", 3, NULL, -FLT_MAX, FLT_MAX,
- "Target", "Target location to which normals will point", -1000.0f, 1000.0f);
+ RNA_def_float_vector_xyz(ot->srna, "target_location", 3, NULL, -FLT_MAX, FLT_MAX,
+ "Target", "Target location to which normals will point", -1000.0f, 1000.0f);
RNA_def_boolean(ot->srna, "spherize", false,
"Spherize", "Interpolate between original and new normals");
@@ -7766,7 +7781,7 @@ static EnumPropertyItem average_method_items[] = {
{EDBM_CLNOR_AVERAGE_LOOP, "CUSTOM_NORMAL", 0, "Custom Normal", "Take Average of vert Normals"},
{EDBM_CLNOR_AVERAGE_FACE_AREA, "FACE_AREA", 0, "Face Area", "Set all vert normals by Face Area"},
{EDBM_CLNOR_AVERAGE_ANGLE, "CORNER_ANGLE", 0, "Corner Angle", "Set all vert normals by Corner Angle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int edbm_average_normals_exec(bContext *C, wmOperator *op)
@@ -7940,7 +7955,6 @@ void MESH_OT_average_normals(struct wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "average_type", average_method_items, EDBM_CLNOR_AVERAGE_LOOP,
"Type", "Averaging method");
- RNA_def_property_flag(ot->prop, PROP_HIDDEN);
RNA_def_int(ot->srna, "weight", 50, 1, 100, "Weight", "Weight applied per face", 1, 100);
@@ -7964,7 +7978,7 @@ static EnumPropertyItem normal_vector_tool_items[] = {
{EDBM_CLNOR_TOOLS_ADD, "ADD", 0, "Add Normal", "Add normal vector with selection"},
{EDBM_CLNOR_TOOLS_MULTIPLY, "MULTIPLY", 0, "Multiply Normal", "Multiply normal vector with selection"},
{EDBM_CLNOR_TOOLS_RESET, "RESET", 0, "Reset Normal", "Reset buffer and/or normal of selected element"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int edbm_normals_tools_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 9b24157e4d9..16aeba78118 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_undo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -34,7 +30,6 @@
#include "BLI_listbase.h"
#include "BLI_array_utils.h"
-#include "BLI_alloca.h"
#include "BKE_context.h"
#include "BKE_key.h"
@@ -667,7 +662,7 @@ static Object *editmesh_object_from_context(bContext *C)
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- if (me->edit_btmesh != NULL) {
+ if (me->edit_mesh != NULL) {
return obedit;
}
}
@@ -700,13 +695,15 @@ static bool mesh_undosys_poll(bContext *C)
return editmesh_object_from_context(C) != NULL;
}
-static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mesh_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MeshUndoStep *us = (MeshUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -717,32 +714,33 @@ static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
elem->obedit_ref.ptr = ob;
Mesh *me = elem->obedit_ref.ptr->data;
- undomesh_from_editmesh(&elem->data, me->edit_btmesh, me->key);
+ undomesh_from_editmesh(&elem->data, me->edit_mesh, me->key);
us->step.data_size += elem->data.undo_size;
}
MEM_freeN(objects);
return true;
}
-static void mesh_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(mesh_undosys_poll(C));
-
MeshUndoStep *us = (MeshUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(mesh_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
MeshUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
Mesh *me = obedit->data;
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
/* Should never fail, may not crash but can give odd behavior. */
CLOG_ERROR(&LOG, "name='%s', failed to enter edit-mode for object '%s', undo state invalid",
us_p->name, obedit->id.name);
continue;
}
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
undomesh_to_editmesh(&elem->data, em, obedit->data);
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
}
@@ -794,7 +792,6 @@ void ED_mesh_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = mesh_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MeshUndoStep);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 6c4e82f5b71..99b0b856d70 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_utils.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -305,26 +297,26 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
me, ob, add_key_index,
&((struct BMeshCreateParams){.use_toolflags = true,}));
- if (me->edit_btmesh) {
+ if (me->edit_mesh) {
/* this happens when switching shape keys */
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
}
/* currently executing operators re-tessellates, so we can avoid doing here
* but at some point it may need to be added back. */
#if 0
- me->edit_btmesh = BKE_editmesh_create(bm, true);
+ me->edit_mesh = BKE_editmesh_create(bm, true);
#else
- me->edit_btmesh = BKE_editmesh_create(bm, false);
+ me->edit_mesh = BKE_editmesh_create(bm, false);
#endif
- me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = select_mode;
- me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
- me->edit_btmesh->ob = ob;
+ me->edit_mesh->selectmode = me->edit_mesh->bm->selectmode = select_mode;
+ me->edit_mesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
+ me->edit_mesh->ob = ob;
/* we need to flush selection because the mode may have changed from when last in editmode */
- EDBM_selectmode_flush(me->edit_btmesh);
+ EDBM_selectmode_flush(me->edit_mesh);
}
/**
@@ -334,7 +326,7 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
void EDBM_mesh_load(Main *bmain, Object *ob)
{
Mesh *me = ob->data;
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
/* Workaround for T42360, 'ob->shapenr' should be 1 in this case.
* however this isn't synchronized between objects at the moment. */
@@ -802,7 +794,8 @@ UvElementMap *BM_uv_element_map_create(
island_number = MEM_mallocN(sizeof(*island_number) * totfaces, "uv_island_number_face");
copy_vn_i(island_number, totfaces, INVALID_ISLAND);
- /* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */
+ /* at this point, every UvElement in vert points to a UvElement sharing the same vertex.
+ * Now we should sort uv's in islands. */
for (i = 0; i < totuv; i++) {
if (element_map->buf[i].island == INVALID_ISLAND) {
element_map->buf[i].island = nislands;
@@ -821,7 +814,8 @@ UvElementMap *BM_uv_element_map_create(
initelement = element;
if (element->l->f == efa) {
- /* found the uv corresponding to our face and vertex. Now fill it to the buffer */
+ /* found the uv corresponding to our face and vertex.
+ * Now fill it to the buffer */
element->island = nislands;
map[element - element_map->buf] = islandbufsize;
islandbuf[islandbufsize].l = element->l;
@@ -1204,14 +1198,13 @@ void EDBM_verts_mirror_apply(BMEditMesh *em, const int sel_from, const int sel_t
* \{ */
/* swap is 0 or 1, if 1 it hides not selected */
-void EDBM_mesh_hide(BMEditMesh *em, bool swap)
+bool EDBM_mesh_hide(BMEditMesh *em, bool swap)
{
BMIter iter;
BMElem *ele;
int itermode;
char hflag_swap = swap ? BM_ELEM_SELECT : 0;
-
- if (em == NULL) return;
+ bool changed = true;
if (em->selectmode & SCE_SELECT_VERTEX)
itermode = BM_VERTS_OF_MESH;
@@ -1221,14 +1214,22 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
itermode = BM_FACES_OF_MESH;
BM_ITER_MESH (ele, &iter, em->bm, itermode) {
- if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ hflag_swap)
- BM_elem_hide_set(em->bm, ele, true);
+ if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ hflag_swap) {
+ BM_elem_hide_set(em->bm, ele, true);
+ changed = true;
+ }
+ }
}
- EDBM_selectmode_flush(em);
+ if (changed) {
+ EDBM_selectmode_flush(em);
+ }
+ return changed;
/* original hide flushing comment (OUTDATED):
- * hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
+ * hide happens on least dominant select mode, and flushes up, not down!
+ * (helps preventing errors in subsurf) */
/* - vertex hidden, always means edge is hidden too
* - edge hidden, always means face is hidden too
* - face hidden, only set face hide
@@ -1236,7 +1237,7 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
*/
}
-void EDBM_mesh_reveal(BMEditMesh *em, bool select)
+bool EDBM_mesh_reveal(BMEditMesh *em, bool select)
{
const char iter_types[3] = {
BM_VERTS_OF_MESH,
@@ -1250,6 +1251,7 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
(em->selectmode & SCE_SELECT_FACE) != 0,
};
int i;
+ bool changed = false;
/* Use tag flag to remember what was hidden before all is revealed.
* BM_ELEM_HIDDEN --> BM_ELEM_TAG */
@@ -1258,10 +1260,20 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
BMElem *ele;
BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
- BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
+ if (BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ BM_elem_flag_enable(ele, BM_ELEM_TAG);
+ changed = true;
+ }
+ else {
+ BM_elem_flag_disable(ele, BM_ELEM_TAG);
+ }
}
}
+ if (!changed) {
+ return false;
+ }
+
/* Reveal everything */
EDBM_flag_disable_all(em, BM_ELEM_HIDDEN);
@@ -1285,6 +1297,8 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
/* hidden faces can have invalid normals */
EDBM_mesh_normals_update(em);
+
+ return true;
}
/** \} */
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 8b2c7601524..a1c2f5e0121 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_data.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -38,7 +31,6 @@
#include "BLI_utildefines.h"
#include "BLI_alloca.h"
-#include "BLI_path_util.h"
#include "BLI_math.h"
#include "BKE_context.h"
@@ -66,7 +58,7 @@
static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_tot)
{
CustomData *data;
- BMesh *bm = (me->edit_btmesh) ? me->edit_btmesh->bm : NULL;
+ BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : NULL;
int tot;
/* this */
@@ -122,7 +114,7 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
return data;
}
-#define GET_CD_DATA(me, data) ((me)->edit_btmesh ? &(me)->edit_btmesh->bm->data : &(me)->data)
+#define GET_CD_DATA(me, data) ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)
static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
{
const int type = layer->type;
@@ -134,8 +126,8 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
n = (layer - &data->layers[layer_index]);
BLI_assert(n >= 0 && (n + layer_index) < data->totlayer);
- if (me->edit_btmesh) {
- BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
+ if (me->edit_mesh) {
+ BM_data_layer_free_n(me->edit_mesh->bm, data, type, n);
}
else {
CustomData_free_layer(data, type, tot, layer_index + n);
@@ -213,7 +205,7 @@ static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv)
/* without bContext, called in uvedit */
void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
{
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em) {
/* Collect BMesh UVs */
@@ -265,8 +257,8 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
bool is_init = false;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
if (layernum_dst >= MAX_MTFACE)
@@ -324,8 +316,8 @@ void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
BMEditMesh *em;
int layernum_dst;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
if (layernum_dst == 0)
@@ -390,8 +382,8 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
BMEditMesh *em;
int layernum;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
if (layernum >= MAX_MCOL) {
@@ -440,7 +432,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
{
- BLI_assert(me->edit_btmesh == NULL);
+ BLI_assert(me->edit_mesh == NULL);
if (!me->mloopcol && me->totloop) {
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
@@ -634,8 +626,8 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
BLI_assert(CustomData_layertype_is_singleton(type) == true);
if (CustomData_has_layer(data, type)) {
- if (me->edit_btmesh) {
- BM_data_layer_free(me->edit_btmesh->bm, data, type);
+ if (me->edit_mesh) {
+ BM_data_layer_free(me->edit_mesh->bm, data, type);
}
else {
CustomData_free_layers(data, type, tot);
@@ -792,13 +784,13 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
if (!BKE_mesh_has_custom_loop_normals(me)) {
CustomData *data = GET_CD_DATA(me, ldata);
- if (me->edit_btmesh) {
+ if (me->edit_mesh) {
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
if (me->flag & ME_AUTOSMOOTH) {
- BM_edges_sharp_from_angle_set(me->edit_btmesh->bm, me->smoothresh);
+ BM_edges_sharp_from_angle_set(me->edit_mesh->bm, me->smoothresh);
}
- BM_data_layer_add(me->edit_btmesh->bm, data, CD_CUSTOMLOOPNORMAL);
+ BM_data_layer_add(me->edit_mesh->bm, data, CD_CUSTOMLOOPNORMAL);
}
else {
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
@@ -1097,7 +1089,7 @@ static void mesh_remove_faces(Mesh *mesh, int len)
#if 0
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add geometry in edit mode");
return;
}
@@ -1113,7 +1105,7 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add tessfaces in edit mode");
return;
}
@@ -1128,7 +1120,7 @@ void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add edges in edit mode");
return;
}
@@ -1138,7 +1130,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add vertices in edit mode");
return;
}
@@ -1148,7 +1140,7 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove faces in edit mode");
return;
}
@@ -1162,7 +1154,7 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
return;
}
@@ -1176,7 +1168,7 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
return;
}
@@ -1190,7 +1182,7 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add loops in edit mode");
return;
}
@@ -1200,7 +1192,7 @@ void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add polygons in edit mode");
return;
}
@@ -1210,8 +1202,8 @@ void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_calc_tessface(Mesh *mesh, bool free_mpoly)
{
- if (mesh->edit_btmesh) {
- BKE_editmesh_tessface_calc(mesh->edit_btmesh);
+ if (mesh->edit_mesh) {
+ BKE_editmesh_tessface_calc(mesh->edit_mesh);
}
else {
BKE_mesh_tessface_calc(mesh);
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 9c70fdceb8d..06499ace422 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_intern.h
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
/* Internal for editmesh_xxxx.c functions */
@@ -35,15 +27,15 @@
#define __MESH_INTERN_H__
struct BMEditMesh;
-struct BMOperator;
struct BMElem;
+struct BMOperator;
struct EnumPropertyItem;
+struct LinkNode;
struct bContext;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperator;
struct wmOperatorType;
-struct LinkNode;
/* *** editmesh_utils.c *** */
@@ -97,6 +89,7 @@ void MESH_OT_primitive_cube_add_gizmo(struct wmOperatorType *ot);
/* *** editmesh_bevel.c *** */
void MESH_OT_bevel(struct wmOperatorType *ot);
+struct wmKeyMap *bevel_modal_keymap(struct wmKeyConfig *keyconf);
/* *** editmesh_bisect.c *** */
void MESH_OT_bisect(struct wmOperatorType *ot);
@@ -123,7 +116,6 @@ void MESH_GGT_spin_redo(struct wmGizmoGroupType *gzgt);
void MESH_OT_polybuild_face_at_cursor(struct wmOperatorType *ot);
void MESH_OT_polybuild_split_at_cursor(struct wmOperatorType *ot);
void MESH_OT_polybuild_dissolve_at_cursor(struct wmOperatorType *ot);
-void MESH_OT_polybuild_hover(struct wmOperatorType *ot);
/* *** editmesh_inset.c *** */
void MESH_OT_inset(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index b9479a660f9..3d49d874503 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_mirror.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Mirror calculation for edit-mode and object mode.
*/
@@ -29,7 +23,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_bitmap.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -71,7 +64,7 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, Mesh *me_eval, cons
}
else if (mode == 's') { /* start table */
Mesh *me = ob->data;
- const bool use_em = (!me_eval && em && me->edit_btmesh == em);
+ const bool use_em = (!me_eval && em && me->edit_mesh == em);
const int totvert = use_em ? em->bm->totvert : me_eval ? me_eval->totvert : me->totvert;
if (MirrKdStore.tree) /* happens when entering this call without ending it */
@@ -144,7 +137,7 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store)
{
- const bool is_editmode = (me->edit_btmesh != NULL);
+ const bool is_editmode = (me->edit_mesh != NULL);
int totvert;
int totedge;
@@ -152,9 +145,9 @@ bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mes
totvert = me_eval->totvert;
totedge = me_eval->totedge;
}
- else if (me->edit_btmesh) {
- totvert = me->edit_btmesh->bm->totvert;
- totedge = me->edit_btmesh->bm->totedge;
+ else if (me->edit_mesh) {
+ totvert = me->edit_mesh->bm->totvert;
+ totedge = me->edit_mesh->bm->totedge;
}
else {
totvert = me->totvert;
@@ -178,9 +171,9 @@ void ED_mesh_mirrtopo_init(
Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store,
const bool skip_em_vert_array_init)
{
- const bool is_editmode = (me->edit_btmesh != NULL);
+ const bool is_editmode = (me->edit_mesh != NULL);
MEdge *medge = NULL, *med;
- BMEditMesh *em = me_eval ? NULL : me->edit_btmesh;
+ BMEditMesh *em = me_eval ? NULL : me->edit_mesh;
/* editmode*/
BMEdge *eed;
@@ -216,7 +209,7 @@ void ED_mesh_mirrtopo_init(
/* Initialize the vert-edge-user counts used to detect unique topology */
if (em) {
- totedge = me->edit_btmesh->bm->totedge;
+ totedge = me->edit_mesh->bm->totedge;
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
const int i1 = BM_elem_index_get(eed->v1), i2 = BM_elem_index_get(eed->v2);
@@ -317,7 +310,8 @@ void ED_mesh_mirrtopo_init(
if (em) {
BMVert **vtable = em->bm->vtable;
for (a = 1; a <= totvert; a++) {
- /* printf("I %d %ld %d\n", (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs); */
+ // printf("I %d %ld %d\n",
+ // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs);
if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) {
const int match_count = a - last;
if (match_count == 2) {
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index a517f41d1fe..46837889489 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_ops.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_scene_types.h"
#include "DNA_modifier_types.h"
-
#include "RNA_access.h"
#include "WM_api.h"
@@ -329,4 +321,5 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
knifetool_modal_keymap(keyconf);
point_normals_modal_keymap(keyconf);
+ bevel_modal_keymap(keyconf);
}
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index cc49beb17b8..b316e054250 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/meshtools.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* meshtools.c: no editmode (violated already :), mirror & join),
* tools operating on meshes
@@ -151,7 +143,8 @@ static void join_mesh_single(
/* check if this mesh has such a shapekey */
KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : NULL;
if (okb) {
- /* copy this mesh's shapekey to the destination shapekey (need to transform first) */
+ /* copy this mesh's shapekey to the destination shapekey
+ * (need to transform first) */
float (*ocos)[3] = okb->data;
for (a = 0; a < me->totvert; a++, cos++, ocos++) {
copy_v3_v3(*cos, *ocos);
@@ -400,7 +393,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
if (me->totvert) {
- /* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */
+ /* Add this object's materials to the base one's if they don't exist already
+ * (but only if limits not exceeded yet) */
if (totcol < MAXMAT) {
for (a = 1; a <= ob_iter->totcol; a++) {
ma = give_current_material(ob_iter, a);
@@ -423,7 +417,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
}
- /* if this mesh has shapekeys, check if destination mesh already has matching entries too */
+ /* if this mesh has shapekeys,
+ * check if destination mesh already has matching entries too */
if (me->key && key) {
/* for remapping KeyBlock.relative */
int *index_map = MEM_mallocN(sizeof(int) * me->key->totkey, __func__);
@@ -454,7 +449,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* remap relative index values */
for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) {
- if (LIKELY(kb->relative < me->key->totkey)) { /* sanity check, should always be true */
+ /* sanity check, should always be true */
+ if (LIKELY(kb->relative < me->key->totkey)) {
kb_map[i]->relative = index_map[kb->relative];
}
}
@@ -488,8 +484,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* inverse transform for all selected meshes in this object */
invert_m4_m4(imat, ob->obmat);
- /* Add back active mesh first. This allows to keep things similar as they were, as much as possible (i.e. data from
- * active mesh will remain first ones in new result of the merge, in same order for CD layers, etc. See also T50084.
+ /* Add back active mesh first.
+ * This allows to keep things similar as they were, as much as possible
+ * (i.e. data from active mesh will remain first ones in new result of the merge,
+ * in same order for CD layers, etc). See also T50084.
*/
join_mesh_single(
depsgraph, bmain, scene,
@@ -580,7 +578,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* free temp copy of destination shapekeys (if applicable) */
if (nkey) {
/* We can assume nobody is using that ID currently. */
- BKE_libblock_free_ex(bmain, nkey, false, false);
+ BKE_id_free_ex(bmain, nkey, LIB_ID_FREE_NO_UI_USER, false);
}
/* ensure newly inserted keys are time sorted */
@@ -825,7 +823,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *e
int ED_mesh_mirror_get_vert(Object *ob, int index)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
int index_mirr;
@@ -1258,7 +1256,7 @@ MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
{
if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) {
Mesh *me = ob->data;
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
if (cd_dvert_offset != -1) {
diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt
index b0ae3122727..a0d6fb928ff 100644
--- a/source/blender/editors/metaball/CMakeLists.txt
+++ b/source/blender/editors/metaball/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c
index ebf056f71db..af6f78c7bcb 100644
--- a/source/blender/editors/metaball/editmball_undo.c
+++ b/source/blender/editors/metaball/editmball_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/editmball_undo.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include <math.h>
@@ -157,13 +153,15 @@ static bool mball_undosys_poll(bContext *C)
return editmball_object_from_context(C) != NULL;
}
-static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mball_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MBallUndoStep *us = (MBallUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -181,14 +179,15 @@ static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void mball_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mball_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(mball_undosys_poll(C));
-
MBallUndoStep *us = (MBallUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(mball_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
MBallUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -241,7 +240,6 @@ void ED_mball_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = mball_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MBallUndoStep);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index aedb182dceb..2af78261b87 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -18,15 +16,11 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * The Original Code is: all of this file.
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_edit.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include <math.h>
@@ -189,7 +183,7 @@ enum {
SIMMBALL_TYPE = 1,
SIMMBALL_RADIUS,
SIMMBALL_STIFFNESS,
- SIMMBALL_ROTATION
+ SIMMBALL_ROTATION,
};
static const EnumPropertyItem prop_similar_types[] = {
@@ -197,7 +191,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMMBALL_RADIUS, "RADIUS", 0, "Radius", ""},
{SIMMBALL_STIFFNESS, "STIFFNESS", 0, "Stiffness", ""},
{SIMMBALL_ROTATION, "ROTATION", 0, "Rotation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void mball_select_similar_type_get(Object *obedit, MetaBall *mb, int type, KDTree *r_tree)
@@ -718,7 +712,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
}
const uint hit_object = hitresult & 0xFFFF;
- if (vc.obedit->select_color != hit_object) {
+ if (vc.obedit->select_id != hit_object) {
continue;
}
@@ -747,8 +741,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
metaelem_id += 0x10000;
}
- /* When some metaelem was found, then it is necessary to select or
- * deselect it. */
+ /* When some metaelem was found, then it is necessary to select or deselect it. */
if (ml_act) {
if (!extend && !deselect && !toggle) {
uint objects_len;
diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h
index 927a8acf5db..dad1fa172fa 100644
--- a/source/blender/editors/metaball/mball_intern.h
+++ b/source/blender/editors/metaball/mball_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_intern.h
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index 0e029e36e0e..b8a209dc5eb 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_ops.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index db8997c5e0a..f15427e61ac 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -50,23 +47,23 @@ set(SRC
object_bake_api.c
object_collection.c
object_constraint.c
+ object_data_transfer.c
object_edit.c
object_facemap_ops.c
+ object_gpencil_modifier.c
object_hook.c
object_modes.c
object_modifier.c
- object_gpencil_modifier.c
- object_shader_fx.c
object_ops.c
object_random.c
object_relations.c
object_select.c
+ object_shader_fx.c
object_shapekey.c
- object_data_transfer.c
object_transform.c
object_utils.c
- object_warp.c
object_vgroup.c
+ object_warp.c
object_intern.h
)
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index c481a62acb7..b69c88ecb7f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_add.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -38,7 +32,7 @@
#include "DNA_camera_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -73,7 +67,7 @@
#include "BKE_font.h"
#include "BKE_gpencil.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_library.h"
@@ -90,7 +84,6 @@
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_speaker.h"
#include "DEG_depsgraph.h"
@@ -121,7 +114,7 @@
#include "object_intern.h"
-/* this is an exact copy of the define in rna_lamp.c
+/* this is an exact copy of the define in rna_light.c
* kept here because of linking order.
* Icons are only defined here */
const EnumPropertyItem rna_enum_light_type_items[] = {
@@ -129,7 +122,7 @@ const EnumPropertyItem rna_enum_light_type_items[] = {
{LA_SUN, "SUN", ICON_LIGHT_SUN, "Sun", "Constant direction parallel ray light source"},
{LA_SPOT, "SPOT", ICON_LIGHT_SPOT, "Spot", "Directional cone light source"},
{LA_AREA, "AREA", ICON_LIGHT_AREA, "Area", "Directional area light source"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* copy from rna_object_force.c */
@@ -147,7 +140,7 @@ static const EnumPropertyItem field_type_items[] = {
{PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", ""},
{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""},
{PFIELD_SMOKEFLOW, "SMOKE", ICON_FORCE_SMOKEFLOW, "Smoke Flow", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem lightprobe_type_items[] = {
@@ -157,7 +150,7 @@ static EnumPropertyItem lightprobe_type_items[] = {
"Planar reflection probe"},
{LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Irradiance Volume",
"Irradiance probe to capture diffuse indirect lighting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/************************** Exported *****************************/
@@ -396,7 +389,7 @@ Object *ED_object_add_type(
/* for as long scene has editmode... */
if (CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
/* deselects all, sets active object */
@@ -417,8 +410,9 @@ Object *ED_object_add_type(
DEG_id_tag_update_ex(bmain, (ID *)ob->data, ID_RECALC_EDITORS);
}
- if (enter_editmode)
- ED_object_editmode_enter(C, EM_IGNORE_LAYER);
+ if (enter_editmode) {
+ ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ }
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
@@ -446,7 +440,7 @@ static int object_add_exec(bContext *C, wmOperator *op)
if (ob->type == OB_LATTICE) {
/* lattice is a special case!
* we never want to scale the obdata since that is the rest-state */
- copy_v3_fl(ob->size, radius);
+ copy_v3_fl(ob->scale, radius);
}
else {
BKE_object_obdata_size_init(ob, radius);
@@ -471,7 +465,8 @@ void OBJECT_OT_add(wmOperatorType *ot)
/* properties */
ED_object_add_unit_props_radius(ot);
- RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+ PropertyRNA *prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
ED_object_add_generic_props(ot, true);
}
@@ -482,11 +477,11 @@ void OBJECT_OT_add(wmOperatorType *ot)
static const char *get_lightprobe_defname(int type)
{
switch (type) {
- case LIGHTPROBE_TYPE_GRID: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "IrradianceVolume");
- case LIGHTPROBE_TYPE_PLANAR: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "ReflectionPlane");
- case LIGHTPROBE_TYPE_CUBE: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "ReflectionCubemap");
+ case LIGHTPROBE_TYPE_GRID: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "IrradianceVolume");
+ case LIGHTPROBE_TYPE_PLANAR: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "ReflectionPlane");
+ case LIGHTPROBE_TYPE_CUBE: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "ReflectionCubemap");
default:
- return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "LightProbe");
+ return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "LightProbe");
}
}
@@ -967,6 +962,23 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot)
}
/********************* Add Gpencil Operator ********************/
+static bool object_gpencil_add_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
+
+ if ((scene == NULL) || (ID_IS_LINKED(scene))) {
+ return false;
+ }
+
+ if (obact && obact->type == OB_GPENCIL) {
+ if (obact->mode != OB_MODE_OBJECT) {
+ return false;
+ }
+ }
+
+ return true;
+}
static int object_gpencil_add_exec(bContext *C, wmOperator *op)
{
@@ -1006,12 +1018,9 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
}
}
- float radius = RNA_float_get(op->ptr, "radius");
ob = ED_object_add_type(C, OB_GPENCIL, ob_name, loc, rot, true, local_view_bits);
gpd = ob->data;
newob = true;
-
- BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE * radius);
}
else {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -1030,7 +1039,7 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
mul_v3_fl(mat[1], radius);
mul_v3_fl(mat[2], radius);
- ED_gpencil_create_stroke(C, mat);
+ ED_gpencil_create_stroke(C, ob, mat);
break;
}
case GP_MONKEY:
@@ -1043,7 +1052,7 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
mul_v3_fl(mat[1], radius);
mul_v3_fl(mat[2], radius);
- ED_gpencil_create_monkey(C, mat);
+ ED_gpencil_create_monkey(C, ob, mat);
break;
}
case GP_EMPTY:
@@ -1057,7 +1066,7 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
/* if this is a new object, initialise default stuff (colors, etc.) */
if (newob) {
- ED_gpencil_add_defaults(C);
+ ED_gpencil_add_defaults(C, ob);
}
return OPERATOR_FINISHED;
@@ -1073,7 +1082,7 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = object_gpencil_add_exec;
- ot->poll = ED_operator_scene_editable;
+ ot->poll = object_gpencil_add_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1090,12 +1099,12 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot)
static const char *get_light_defname(int type)
{
switch (type) {
- case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Point");
- case LA_SUN: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Sun");
- case LA_SPOT: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Spot");
- case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Area");
+ case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Point");
+ case LA_SUN: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Sun");
+ case LA_SPOT: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Spot");
+ case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Area");
default:
- return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Light");
+ return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Light");
}
}
@@ -1103,7 +1112,7 @@ static int object_light_add_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob;
- Lamp *la;
+ Light *la;
int type = RNA_enum_get(op->ptr, "type");
ushort local_view_bits;
float loc[3], rot[3];
@@ -1129,7 +1138,7 @@ static int object_light_add_exec(bContext *C, wmOperator *op)
}
BKE_object_obdata_size_init(ob, size);
- la = (Lamp *)ob->data;
+ la = (Light *)ob->data;
la->type = type;
if (BKE_scene_uses_cycles(scene)) {
@@ -1157,7 +1166,7 @@ void OBJECT_OT_light_add(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_light_type_items, 0, "Type", "");
- RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LAMP);
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LIGHT);
ED_object_add_unit_props_radius(ot);
ED_object_add_generic_props(ot, false);
@@ -1205,7 +1214,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
}
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, loc, rot, false, local_view_bits);
- ob->dup_group = collection;
+ ob->instance_collection = collection;
ob->transflag |= OB_DUPLICOLLECTION;
id_us_plus(&collection->id);
@@ -1361,7 +1370,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
*/
if (use_global && ob->id.lib == NULL) {
/* We want to nuke the object, let's nuke it the easy way (not for linked data though)... */
- BKE_libblock_delete(bmain, &ob->id);
+ BKE_id_delete(bmain, &ob->id);
changed_count += 1;
continue;
}
@@ -1600,8 +1609,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
BLI_ghash_insert(dupli_gh, dob, ob_dst);
if (parent_gh) {
void **val;
- /* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as 'the same',
- * this avoids trying to insert same key several time and raise asserts in debug builds... */
+ /* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as
+ * 'the same', this avoids trying to insert same key several time and
+ * raise asserts in debug builds... */
if (!BLI_ghash_ensure_p(parent_gh, dob, &val)) {
*val = ob_dst;
}
@@ -1609,7 +1619,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
for (dob = lb_duplis->first; dob; dob = dob->next) {
- Object *ob_src = DEG_get_original_object(dob->ob);
+ Object *ob_src = dob->ob;
Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
/* Remap new object to itself, and clear again newid pointer of orig object. */
@@ -1673,7 +1683,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
}
- if (base->object->transflag & OB_DUPLICOLLECTION && base->object->dup_group) {
+ if (base->object->transflag & OB_DUPLICOLLECTION && base->object->instance_collection) {
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->proxy_group == base->object) {
ob->proxy = NULL;
@@ -1746,7 +1756,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
static const EnumPropertyItem convert_target_items[] = {
{OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve from Mesh/Text", ""},
{OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh from Curve/Meta/Surf/Text", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob)
@@ -1759,7 +1769,7 @@ static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Objec
if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
/* We need 'for render' ON here, to enable computing bevel dipslist if needed.
* Also makes sense anyway, we would not want e.g. to loose hidden parts etc. */
- BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false, NULL);
}
else if (ob->type == OB_MBALL) {
BKE_displist_make_mball(depsgraph, scene, ob);
@@ -1981,7 +1991,8 @@ static int convert_exec(bContext *C, wmOperator *op)
* datablock, but for until we've got granular update
* lets take care by selves.
*/
- /* XXX This may fail/crash, since BKE_vfont_to_curve() accesses evaluated data in some cases (bastien). */
+ /* XXX This may fail/crash, since BKE_vfont_to_curve()
+ * accesses evaluated data in some cases (bastien). */
BKE_vfont_to_curve(newob, FO_EDIT);
newob->type = OB_CURVE;
@@ -2143,7 +2154,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
// XXX ED_object_editmode_enter(C, 0);
-// XXX exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
+// XXX exit_editmode(C, EM_FREEDATA|); /* freedata, but no undo */
if (basact) {
/* active base was changed */
@@ -2197,20 +2208,14 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* Does set ID->newid pointers. */
static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, int dupflag)
{
-#define ID_NEW_REMAP_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; }
-#define ID_NEW_REMAP_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; }
-
Base *base, *basen = NULL;
- Material ***matarar;
Object *obn;
- ID *id;
- int a, didit;
if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
else {
- obn = ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
+ obn = ID_NEW_SET(ob, BKE_object_duplicate(bmain, ob, dupflag));
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
base = BKE_view_layer_base_find(view_layer, ob);
@@ -2221,8 +2226,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
LayerCollection *layer_collection = BKE_layer_collection_get_active(view_layer);
BKE_collection_object_add(bmain, layer_collection->collection, obn);
}
+
basen = BKE_view_layer_base_find(view_layer, obn);
- basen->local_view_bits = base->local_view_bits;
+ if (base != NULL) {
+ basen->local_view_bits = base->local_view_bits;
+ }
/* 1) duplis should end up in same collection as the original
* 2) Rigid Body sim participants MUST always be part of a collection...
@@ -2235,218 +2243,8 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
BKE_collection_object_add(bmain, collection, obn);
}
}
-
- /* duplicates using userflags */
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &obn->id, true);
- }
-
- if (dupflag & USER_DUP_MAT) {
- for (a = 0; a < obn->totcol; a++) {
- id = (ID *)obn->mat[a];
- if (id) {
- ID_NEW_REMAP_US(obn->mat[a])
- else {
- obn->mat[a] = ID_NEW_SET(obn->mat[a], BKE_material_copy(bmain, obn->mat[a]));
- /* duplicate grease pencil settings */
- if (ob->mat[a]->gp_style) {
- obn->mat[a]->gp_style = MEM_dupallocN(ob->mat[a]->gp_style);
- }
- }
- id_us_min(id);
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &obn->mat[a]->id, true);
- }
- }
- }
- }
- if (dupflag & USER_DUP_PSYS) {
- ParticleSystem *psys;
- for (psys = obn->particlesystem.first; psys; psys = psys->next) {
- id = (ID *) psys->part;
- if (id) {
- ID_NEW_REMAP_US(psys->part)
- else {
- psys->part = ID_NEW_SET(psys->part, BKE_particlesettings_copy(bmain, psys->part));
- }
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &psys->part->id, true);
- }
-
- id_us_min(id);
- }
- }
- }
-
- id = obn->data;
- didit = 0;
-
- switch (obn->type) {
- case OB_MESH:
- if (dupflag & USER_DUP_MESH) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_mesh_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_CURVE:
- if (dupflag & USER_DUP_CURVE) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_SURF:
- if (dupflag & USER_DUP_SURF) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_FONT:
- if (dupflag & USER_DUP_FONT) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_MBALL:
- if (dupflag & USER_DUP_MBALL) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_mball_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LAMP:
- if (dupflag & USER_DUP_LAMP) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lamp_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_ARMATURE:
- DEG_id_tag_update(&obn->id, ID_RECALC_GEOMETRY);
- if (obn->pose)
- BKE_pose_tag_recalc(bmain, obn->pose);
- if (dupflag & USER_DUP_ARM) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_armature_copy(bmain, obn->data));
- BKE_pose_rebuild(bmain, obn, obn->data, true);
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LATTICE:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lattice_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_CAMERA:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_camera_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LIGHTPROBE:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lightprobe_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_SPEAKER:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_speaker_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_GPENCIL:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_gpencil_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- }
-
- /* check if obdata is copied */
- if (didit) {
- Key *key = BKE_key_from_object(obn);
-
- Key *oldkey = BKE_key_from_object(ob);
- if (oldkey != NULL) {
- ID_NEW_SET(oldkey, key);
- }
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true);
- if (key) {
- BKE_animdata_copy_id_action(bmain, (ID *)key, true);
- }
- }
-
- if (dupflag & USER_DUP_MAT) {
- matarar = give_matarar(obn);
- if (matarar) {
- for (a = 0; a < obn->totcol; a++) {
- id = (ID *)(*matarar)[a];
- if (id) {
- ID_NEW_REMAP_US((*matarar)[a])
- else {
- (*matarar)[a] = ID_NEW_SET((*matarar)[a], BKE_material_copy(bmain, (*matarar)[a]));
- }
- id_us_min(id);
- }
- }
- }
- }
- }
}
return basen;
-
-#undef ID_NEW_REMAP_US
-#undef ID_NEW_REMAP_US2
}
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
@@ -2514,8 +2312,6 @@ static int duplicate_exec(bContext *C, wmOperator *op)
copy_object_set_idnew(C);
- BKE_main_id_clear_newpoins(bmain);
-
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
@@ -2594,8 +2390,6 @@ static int add_named_exec(bContext *C, wmOperator *op)
copy_object_set_idnew(C);
- BKE_main_id_clear_newpoins(bmain);
-
/* TODO(sergey): Only update relations for the current scene. */
DEG_relations_tag_update(bmain);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 5a650d9dc05..9835d09ec3a 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Morten Mikkelsen,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_bake.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -43,15 +34,12 @@
#include "DNA_meshdata_types.h"
#include "BLI_blenlib.h"
-#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_blender.h"
-#include "BKE_screen.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
-#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_multires.h"
#include "BKE_report.h"
@@ -120,14 +108,22 @@ typedef struct MultiresBakerJobData {
typedef struct {
Scene *scene;
ListBase data;
- bool bake_clear; /* Clear the images before baking */
- int bake_filter; /* Bake-filter, aka margin */
- short mode; /* mode of baking (displacement, normals, AO) */
- bool use_lores_mesh; /* Use low-resolution mesh when baking displacement maps */
- int number_of_rays; /* Number of rays to be cast when doing AO baking */
- float bias; /* Bias between object and start ray point when doing AO baking */
- int threads; /* Number of threads to be used for baking */
- float user_scale; /* User scale used to scale displacement when baking derivative map. */
+ /** Clear the images before baking */
+ bool bake_clear;
+ /** Bake-filter, aka margin */
+ int bake_filter;
+ /** mode of baking (displacement, normals, AO) */
+ short mode;
+ /** Use low-resolution mesh when baking displacement maps */
+ bool use_lores_mesh;
+ /** Number of rays to be cast when doing AO baking */
+ int number_of_rays;
+ /** Bias between object and start ray point when doing AO baking */
+ float bias;
+ /** Number of threads to be used for baking */
+ int threads;
+ /** User scale used to scale displacement when baking derivative map. */
+ float user_scale;
} MultiresBakeJob;
static bool multiresbake_check(bContext *C, wmOperator *op)
@@ -277,7 +273,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
typedef enum ClearFlag {
CLEAR_TANGENT_NORMAL = 1,
- CLEAR_DISPLACEMENT = 2
+ CLEAR_DISPLACEMENT = 2,
} ClearFlag;
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 90b6be215d4..1dda976c8a8 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_bake_api.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -41,9 +33,7 @@
#include "RNA_enum_types.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_fileops.h"
-#include "BLI_math_geom.h"
#include "BLI_path_util.h"
#include "BKE_context.h"
@@ -635,9 +625,9 @@ static size_t initialize_internal_images(BakeImages *bake_images, ReportList *re
/* create new mesh with edit mode changes and modifiers applied */
static Mesh *bake_mesh_new_from_object(Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *ob)
{
- ED_object_editmode_load(bmain, ob);
+ bool apply_modifiers = (ob->type != OB_MESH);
+ Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, apply_modifiers, false);
- Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, 1, 0);
if (me->flag & ME_AUTOSMOOTH) {
BKE_mesh_split_faces(me, true);
}
@@ -655,7 +645,8 @@ static int bake(
const char *custom_cage, const char *filepath, const int width, const int height,
const char *identifier, ScrArea *sa, const char *uv_layer)
{
- /* We build a depsgraph for the baking, so we don't need to change the original data to adjust visibility and modifiers. */
+ /* We build a depsgraph for the baking,
+ * so we don't need to change the original data to adjust visibility and modifiers. */
Depsgraph *depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer);
@@ -805,7 +796,7 @@ static int bake(
ob_low_eval = DEG_get_evaluated_object(depsgraph, ob_low);
/* get the mesh as it arrives in the renderer */
- me_low = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
+ me_low = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval);
/* populate the pixel array with the face data */
if ((is_selected_to_active && (ob_cage == NULL) && is_cage) == false)
@@ -818,7 +809,7 @@ static int bake(
/* prepare cage mesh */
if (ob_cage) {
- me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_cage);
+ me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_cage_eval);
if ((me_low->totpoly != me_cage->totpoly) || (me_low->totloop != me_cage->totloop)) {
BKE_report(reports, RPT_ERROR,
"Invalid cage object, the cage mesh must have the same number "
@@ -827,6 +818,8 @@ static int bake(
}
}
else if (is_cage) {
+ BKE_object_eval_reset(ob_low_eval);
+
ModifierData *md = ob_low_eval->modifiers.first;
while (md) {
ModifierData *md_next = md->next;
@@ -844,7 +837,6 @@ static int bake(
md = md_next;
}
- BKE_object_eval_reset(ob_low_eval);
me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval);
RE_bake_pixels_populate(me_cage, pixel_array_low, num_pixels, &bake_images, uv_layer);
}
@@ -860,10 +852,10 @@ static int bake(
/* initialize highpoly_data */
highpoly[i].ob = ob_iter;
- highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob);
highpoly[i].ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter);
highpoly[i].ob_eval->restrictflag &= ~OB_RESTRICT_RENDER;
highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE | BASE_ENABLED_RENDER);
+ highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob_eval);
/* lowpoly to highpoly transformation matrix */
copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat);
@@ -887,7 +879,7 @@ static int bake(
/* populate the pixel arrays with the corresponding face data for each high poly object */
if (!RE_bake_pixels_populate_from_objects(
me_low, pixel_array_low, pixel_array_high, highpoly, tot_highpoly, num_pixels, ob_cage != NULL,
- cage_extrusion, ob_low->obmat, (ob_cage ? ob_cage->obmat : ob_low->obmat), me_cage))
+ cage_extrusion, ob_low_eval->obmat, (ob_cage ? ob_cage->obmat : ob_low_eval->obmat), me_cage))
{
BKE_report(reports, RPT_ERROR, "Error handling selected objects");
goto cleanup;
@@ -905,10 +897,10 @@ static int bake(
}
else {
/* If low poly is not renderable it should have failed long ago. */
- BLI_assert((ob_low->restrictflag & OB_RESTRICT_RENDER) == 0);
+ BLI_assert((ob_low_eval->restrictflag & OB_RESTRICT_RENDER) == 0);
if (RE_bake_has_engine(re)) {
- ok = RE_bake_engine(re, depsgraph, ob_low, 0, pixel_array_low, num_pixels, depth, pass_type, pass_filter, result);
+ ok = RE_bake_engine(re, depsgraph, ob_low_eval, 0, pixel_array_low, num_pixels, depth, pass_type, pass_filter, result);
}
else {
BKE_report(reports, RPT_ERROR, "Current render engine does not support baking");
@@ -936,13 +928,13 @@ static int bake(
}
case R_BAKE_SPACE_OBJECT:
{
- RE_bake_normal_world_to_object(pixel_array_low, num_pixels, depth, result, ob_low, normal_swizzle);
+ RE_bake_normal_world_to_object(pixel_array_low, num_pixels, depth, result, ob_low_eval, normal_swizzle);
break;
}
case R_BAKE_SPACE_TANGENT:
{
if (is_selected_to_active) {
- RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_low, normal_swizzle, ob_low->obmat);
+ RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_low, normal_swizzle, ob_low_eval->obmat);
}
else {
/* from multiresolution */
@@ -950,18 +942,20 @@ static int bake(
ModifierData *md = NULL;
int mode;
- md = modifiers_findByType(ob_low, eModifierType_Multires);
+ BKE_object_eval_reset(ob_low_eval);
+ md = modifiers_findByType(ob_low_eval, eModifierType_Multires);
if (md) {
mode = md->mode;
md->mode &= ~eModifierMode_Render;
}
- me_nores = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
+ /* Evaluate modifiers again. */
+ me_nores = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval, true, false);
RE_bake_pixels_populate(me_nores, pixel_array_low, num_pixels, &bake_images, uv_layer);
- RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low->obmat);
- BKE_libblock_free(bmain, me_nores);
+ RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low_eval->obmat);
+ BKE_id_free(bmain, me_nores);
if (md)
md->mode = mode;
@@ -1022,8 +1016,8 @@ static int bake(
BLI_path_suffix(name, FILE_MAX, bk_image->image->id.name + 2, "_");
}
else {
- if (ob_low->mat[i]) {
- BLI_path_suffix(name, FILE_MAX, ob_low->mat[i]->id.name + 2, "_");
+ if (ob_low_eval->mat[i]) {
+ BLI_path_suffix(name, FILE_MAX, ob_low_eval->mat[i]->id.name + 2, "_");
}
else if (me_low->mat[i]) {
BLI_path_suffix(name, FILE_MAX, me_low->mat[i]->id.name + 2, "_");
@@ -1070,7 +1064,7 @@ cleanup:
int i;
for (i = 0; i < tot_highpoly; i++) {
if (highpoly[i].me)
- BKE_libblock_free(bmain, highpoly[i].me);
+ BKE_id_free(bmain, highpoly[i].me);
}
MEM_freeN(highpoly);
}
@@ -1094,10 +1088,10 @@ cleanup:
MEM_freeN(result);
if (me_low)
- BKE_libblock_free(bmain, me_low);
+ BKE_id_free(bmain, me_low);
if (me_cage)
- BKE_libblock_free(bmain, me_cage);
+ BKE_id_free(bmain, me_cage);
DEG_graph_free(depsgraph);
diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c
index 5e1773bf3c2..61a450205be 100644
--- a/source/blender/editors/object/object_collection.c
+++ b/source/blender/editors/object/object_collection.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_collection.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -42,7 +34,6 @@
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_library.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -538,7 +529,7 @@ static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op))
if (!collection)
return OPERATOR_CANCELLED;
- BKE_libblock_delete(bmain, collection);
+ BKE_id_delete(bmain, collection);
DEG_relations_tag_update(bmain);
@@ -562,7 +553,8 @@ void OBJECT_OT_collection_unlink(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op)) /* Select objects in the same collection as the active */
+/* Select objects in the same collection as the active */
+static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 93ff94edc75..0e7e0d5b8ec 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_constraint.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -54,7 +46,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -105,7 +96,8 @@ ListBase *get_active_constraints(Object *ob)
return NULL;
}
-/* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */
+/* Find the list that a given constraint belongs to,
+ * and/or also get the posechannel this is from (if applicable) */
ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
{
if (r_pchan)
@@ -592,7 +584,8 @@ static void object_test_constraint(Main *bmain, Object *owner, bConstraint *con)
static const EnumPropertyItem constraint_owner_items[] = {
{EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"},
{EDIT_CONSTRAINT_OWNER_BONE, "BONE", 0, "Bone", "Edit a constraint on the active bone"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
@@ -1242,7 +1235,7 @@ static void object_pose_tag_update(Main *bmain, Object *ob)
* Note that this is a bit wide here, since we cannot be sure whether there are some locked proxy bones
* or not...
* XXX Temp hack until new depsgraph hopefully solves this. */
- ob->adt->recalc |= ADT_RECALC_ANIM;
+ DEG_id_tag_update(&ob->id, ID_RECALC_ANIMATION);
}
}
@@ -1306,7 +1299,8 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
if (BKE_constraint_remove_ex(lb, ob, con, true)) {
/* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL);
- ED_object_constraint_update(bmain, ob); /* needed to set the flags on posebones correctly */
+ /* needed to set the flags on posebones correctly */
+ ED_object_constraint_update(bmain, ob);
/* relatiols */
DEG_relations_tag_update(CTX_data_main(C));
@@ -1637,7 +1631,8 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
return false;
/* restricted target-type constraints -------------- */
- /* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */
+ /* NOTE: for these, we cannot try to add a target object if no valid ones are found,
+ * since that doesn't work */
/* curve-based constraints - set the only_curve and only_ob flags */
case CONSTRAINT_TYPE_CLAMPTO:
case CONSTRAINT_TYPE_FOLLOWPATH:
@@ -1854,7 +1849,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* We need to make use of ugly POSE_ANIMATION_WORKAROUND here too, else anim data are not reloaded
* after calling `BKE_pose_rebuild()`, which causes T43872.
* XXX Temp hack until new depsgraph hopefully solves this. */
- ob->adt->recalc |= ADT_RECALC_ANIM;
+ DEG_id_tag_update(&ob->id, ID_RECALC_ANIMATION);
}
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_TRANSFORM);
}
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index ad47e07b2e9..34f758900e9 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_data_transfer.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "DNA_mesh_types.h"
@@ -71,7 +63,8 @@ static const EnumPropertyItem DT_layer_items[] = {
#if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
#endif
-#if 0 /* XXX When SkinModifier is enabled, it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
+#if 0 /* XXX When SkinModifier is enabled,
+ * it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
#endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
@@ -88,7 +81,7 @@ static const EnumPropertyItem DT_layer_items[] = {
{0, "", 0, "Face Data", ""},
{DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"},
{DT_TYPE_FREESTYLE_FACE, "FREESTYLE_FACE", 0, "Freestyle Mark", "Transfer Freestyle face mark"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Note: rna_enum_dt_layers_select_src_items enum is from rna_modifier.c */
@@ -142,7 +135,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPUV);
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MASK_MLOOPUV);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV);
RNA_enum_item_add_separator(&item, &totitem);
@@ -164,7 +157,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPCOL);
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MASK_MLOOPCOL);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL);
RNA_enum_item_add_separator(&item, &totitem);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 59ce42c50a5..cd8eeba73d4 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_edit.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <stdlib.h>
@@ -38,10 +32,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -73,7 +65,6 @@
#include "BKE_image.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
@@ -81,6 +72,7 @@
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.h"
+#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_softbody.h"
#include "BKE_editmesh.h"
@@ -124,8 +116,6 @@ static void move_to_collection_menus_items(struct uiLayout *layout, struct MoveT
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
-static void waitcursor(int UNUSED(val)) {}
-static int pupmenu(const char *UNUSED(msg)) { return 0; }
/* port over here */
static void error_libdata(void) {}
@@ -211,21 +201,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
-
- /* Do nothing if no objects was selected. */
- bool have_selected = false;
- for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (base->flag & BASE_VISIBLE) {
- if (base->flag & BASE_SELECTED) {
- have_selected = true;
- break;
- }
- }
- }
-
- if (!have_selected) {
- return OPERATOR_CANCELLED;
- }
+ bool changed = false;
/* Hide selected or unselected objects. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
@@ -237,15 +213,20 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
if (base->flag & BASE_SELECTED) {
ED_object_base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
+ changed = true;
}
}
else {
if (!(base->flag & BASE_SELECTED)) {
ED_object_base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
+ changed = true;
}
}
}
+ if (!changed) {
+ return OPERATOR_CANCELLED;
+ }
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
@@ -293,9 +274,12 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
-
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (BKE_layer_collection_isolate(scene, view_layer, lc, extend)) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
@@ -322,12 +306,6 @@ void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout)
continue;
}
- if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS))
- {
- uiLayoutSetActive(row, false);
- }
-
int icon = ICON_NONE;
if (BKE_layer_collection_has_selected_objects(view_layer, lc)) {
icon = ICON_LAYER_ACTIVE;
@@ -368,7 +346,7 @@ static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEv
void OBJECT_OT_hide_collection(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Hide Objects By Collection";
+ ot->name = "Hide Collection";
ot->description = "Show only objects in collection (Shift to extend)";
ot->idname = "OBJECT_OT_hide_collection";
@@ -424,11 +402,11 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
return false;
}
- if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
+ if (me->edit_mesh->bm->totvert > MESH_MAX_VERTS) {
error("Too many vertices");
return false;
}
@@ -436,9 +414,9 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
EDBM_mesh_load(bmain, obedit);
if (freedata) {
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
- me->edit_btmesh = NULL;
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
+ me->edit_mesh = NULL;
}
/* will be recalculated as needed. */
{
@@ -518,15 +496,12 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
{
const bool freedata = (flag & EM_FREEDATA) != 0;
- if (flag & EM_WAITCURSOR) waitcursor(1);
-
if (ED_object_editmode_load_ex(bmain, obedit, freedata) == false) {
/* in rare cases (background mode) its possible active object
* is flagged for editmode, without 'obedit' being set [#35489] */
if (UNLIKELY(obedit && obedit->mode & OB_MODE_EDIT)) {
obedit->mode &= ~OB_MODE_EDIT;
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
return true;
}
@@ -538,11 +513,14 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, obedit, scene, 0);
for (pid = pidlist.first; pid; pid = pid->next) {
- if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ /* particles don't need reset on geometry change */
+ if (pid->type != PTCACHE_TYPE_PARTICLES) {
pid->cache->flag |= PTCACHE_OUTDATED;
+ }
}
BLI_freelistN(&pidlist);
+ BKE_particlesystem_reset_all(obedit);
BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_OUTDATED);
/* also flush ob recalc, doesn't take much overhead, but used for particles */
@@ -553,8 +531,6 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
obedit->mode &= ~OB_MODE_EDIT;
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
-
return (obedit->mode & OB_MODE_EDIT) == 0;
}
@@ -584,8 +560,6 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
return false;
}
- if (flag & EM_WAITCURSOR) waitcursor(1);
-
ob->restore_mode = ob->mode;
ob->mode = OB_MODE_EDIT;
@@ -611,7 +585,9 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
ok = 1;
ED_armature_to_edit(ob->data);
/* to ensure all goes in restposition and without striding */
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); /* XXX: should this be ID_RECALC_GEOMETRY? */
+
+ /* XXX: should this be ID_RECALC_GEOMETRY? */
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
}
@@ -650,8 +626,6 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
-
return (ob->mode & OB_MODE_EDIT) != 0;
}
@@ -659,15 +633,11 @@ bool ED_object_editmode_enter(bContext *C, int flag)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob;
- if ((flag & EM_IGNORE_LAYER) == 0) {
- ob = CTX_data_active_object(C); /* active layer checked here for view3d */
- }
- else {
- ob = view_layer->basact->object;
- }
+ /* Active layer checked here for view3d,
+ * callers that don't want view context can call the extended version. */
+ ob = CTX_data_active_object(C);
if ((ob == NULL) || ID_IS_LINKED(ob)) {
return false;
}
@@ -692,24 +662,24 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
}
if (!is_mode_set) {
- ED_object_editmode_enter(C, EM_WAITCURSOR);
+ ED_object_editmode_enter(C, 0);
if (obact->mode & mode_flag) {
FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
{
if ((ob != obact) && (ob->type == obact->type)) {
- ED_object_editmode_enter_ex(bmain, scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
+ ED_object_editmode_enter_ex(bmain, scene, ob, EM_NO_CONTEXT);
}
}
FOREACH_SELECTED_OBJECT_END;
}
}
else {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
if ((obact->mode & mode_flag) == 0) {
FOREACH_OBJECT_BEGIN(view_layer, ob)
{
if ((ob != obact) && (ob->type == obact->type)) {
- ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
}
}
FOREACH_OBJECT_END;
@@ -845,331 +815,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* both pointers should exist */
-static void copy_texture_space(Object *to, Object *ob)
-{
- float *poin1 = NULL, *poin2 = NULL;
- short texflag = 0;
-
- if (ob->type == OB_MESH) {
- texflag = ((Mesh *)ob->data)->texflag;
- poin2 = ((Mesh *)ob->data)->loc;
- }
- else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- texflag = ((Curve *)ob->data)->texflag;
- poin2 = ((Curve *)ob->data)->loc;
- }
- else if (ob->type == OB_MBALL) {
- texflag = ((MetaBall *)ob->data)->texflag;
- poin2 = ((MetaBall *)ob->data)->loc;
- }
- else
- return;
-
- if (to->type == OB_MESH) {
- ((Mesh *)to->data)->texflag = texflag;
- poin1 = ((Mesh *)to->data)->loc;
- }
- else if (ELEM(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
- ((Curve *)to->data)->texflag = texflag;
- poin1 = ((Curve *)to->data)->loc;
- }
- else if (to->type == OB_MBALL) {
- ((MetaBall *)to->data)->texflag = texflag;
- poin1 = ((MetaBall *)to->data)->loc;
- }
- else
- return;
-
- memcpy(poin1, poin2, 9 * sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
-
- if (to->type == OB_MESH) {
- /* pass */
- }
- else if (to->type == OB_MBALL) {
- BKE_mball_texspace_calc(to);
- }
- else {
- BKE_curve_texspace_calc(to->data);
- }
-
-}
-
-/* UNUSED, keep in case we want to copy functionality for use elsewhere */
-static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, short event)
-{
- Object *ob;
- Base *base;
- Curve *cu, *cu1;
- Nurb *nu;
-
- if (ID_IS_LINKED(scene)) return;
-
- if (!(ob = OBACT(view_layer))) return;
-
- if (BKE_object_is_in_editmode(ob)) {
- /* obedit_copymenu(); */
- return;
- }
-
- if (event == 24) {
- /* moved to BKE_object_link_modifiers */
- /* copymenu_modifiers(bmain, scene, v3d, ob); */
- return;
- }
-
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (base != BASACT(view_layer)) {
- if (TESTBASELIB(v3d, base)) {
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
-
- if (event == 1) { /* loc */
- copy_v3_v3(base->object->loc, ob->loc);
- copy_v3_v3(base->object->dloc, ob->dloc);
- }
- else if (event == 2) { /* rot */
- copy_v3_v3(base->object->rot, ob->rot);
- copy_v3_v3(base->object->drot, ob->drot);
-
- copy_qt_qt(base->object->quat, ob->quat);
- copy_qt_qt(base->object->dquat, ob->dquat);
- }
- else if (event == 3) { /* size */
- copy_v3_v3(base->object->size, ob->size);
- copy_v3_v3(base->object->dscale, ob->dscale);
- }
- else if (event == 4) { /* drawtype */
- base->object->dt = ob->dt;
- base->object->dtx = ob->dtx;
- base->object->empty_drawtype = ob->empty_drawtype;
- base->object->empty_drawsize = ob->empty_drawsize;
- }
- else if (event == 5) { /* time offs */
- base->object->sf = ob->sf;
- }
- else if (event == 6) { /* dupli */
- base->object->dupon = ob->dupon;
- base->object->dupoff = ob->dupoff;
- base->object->dupsta = ob->dupsta;
- base->object->dupend = ob->dupend;
-
- base->object->transflag &= ~OB_DUPLI;
- base->object->transflag |= (ob->transflag & OB_DUPLI);
-
- base->object->dup_group = ob->dup_group;
- if (ob->dup_group)
- id_us_plus(&ob->dup_group->id);
- }
- else if (event == 17) { /* tex space */
- copy_texture_space(base->object, ob);
- }
- else if (event == 18) { /* font settings */
-
- if (base->object->type == ob->type) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->spacemode = cu->spacemode;
- cu1->align_y = cu->align_y;
- cu1->spacing = cu->spacing;
- cu1->linedist = cu->linedist;
- cu1->shear = cu->shear;
- cu1->fsize = cu->fsize;
- cu1->xof = cu->xof;
- cu1->yof = cu->yof;
- cu1->textoncurve = cu->textoncurve;
- cu1->wordspace = cu->wordspace;
- cu1->ulpos = cu->ulpos;
- cu1->ulheight = cu->ulheight;
- if (cu1->vfont)
- id_us_min(&cu1->vfont->id);
- cu1->vfont = cu->vfont;
- id_us_plus((ID *)cu1->vfont);
- if (cu1->vfontb)
- id_us_min(&cu1->vfontb->id);
- cu1->vfontb = cu->vfontb;
- id_us_plus((ID *)cu1->vfontb);
- if (cu1->vfonti)
- id_us_min(&cu1->vfonti->id);
- cu1->vfonti = cu->vfonti;
- id_us_plus((ID *)cu1->vfonti);
- if (cu1->vfontbi)
- id_us_min(&cu1->vfontbi->id);
- cu1->vfontbi = cu->vfontbi;
- id_us_plus((ID *)cu1->vfontbi);
-
- BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 19) { /* bevel settings */
-
- if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->bevobj = cu->bevobj;
- cu1->taperobj = cu->taperobj;
- cu1->width = cu->width;
- cu1->bevresol = cu->bevresol;
- cu1->ext1 = cu->ext1;
- cu1->ext2 = cu->ext2;
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 25) { /* curve resolution */
-
- if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->resolu = cu->resolu;
- cu1->resolu_ren = cu->resolu_ren;
-
- nu = cu1->nurb.first;
-
- while (nu) {
- nu->resolu = cu1->resolu;
- nu = nu->next;
- }
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 21) {
- if (base->object->type == OB_MESH) {
- ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
-
- if (md) {
- ModifierData *tmd = modifiers_findByType(base->object, eModifierType_Subsurf);
-
- if (!tmd) {
- tmd = modifier_new(eModifierType_Subsurf);
- BLI_addtail(&base->object->modifiers, tmd);
- }
-
- modifier_copyData(md, tmd);
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- }
- else if (event == 22) {
- /* Copy the constraint channels over */
- BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
- DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- }
- else if (event == 23) {
- sbFree(base->object);
- BKE_object_copy_softbody(base->object, ob, 0);
-
- if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
- BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
- }
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- }
- else if (event == 26) {
-#if 0 // XXX old animation system
- BKE_nlastrip_copy(s(&base->object->nlastrips, &ob->nlastrips);
-#endif // XXX old animation system
- }
- else if (event == 27) { /* autosmooth */
- if (base->object->type == OB_MESH) {
- Mesh *me = ob->data;
- Mesh *cme = base->object->data;
- cme->smoothresh = me->smoothresh;
- if (me->flag & ME_AUTOSMOOTH)
- cme->flag |= ME_AUTOSMOOTH;
- else
- cme->flag &= ~ME_AUTOSMOOTH;
- }
- }
- else if (event == 28) { /* UV orco */
- if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- if (cu->flag & CU_UV_ORCO)
- cu1->flag |= CU_UV_ORCO;
- else
- cu1->flag &= ~CU_UV_ORCO;
- }
- }
- else if (event == 29) { /* protected bits */
- base->object->protectflag = ob->protectflag;
- }
- else if (event == 30) { /* index object */
- base->object->index = ob->index;
- }
- else if (event == 31) { /* object color */
- copy_v4_v4(base->object->col, ob->col);
- }
- }
- }
- }
-}
-
-static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit)
-{
- Object *ob;
- short event;
- char str[512];
-
- if (!(ob = OBACT(view_layer))) return;
-
- if (obedit) {
-/* if (ob->type == OB_MESH) */
-/* XXX mesh_copy_menu(); */
- return;
- }
-
- /* Object Mode */
-
- /* If you change this menu, don't forget to update the menu in header_view3d.c
- * view3d_edit_object_copyattrmenu() and in toolbox.c
- */
-
- strcpy(str,
- "Copy Attributes %t|Location %x1|Rotation %x2|Size %x3|Draw Options %x4|"
- "Time Offset %x5|Dupli %x6|Object Color %x31|%l|Mass %x7|Damping %x8|All Physical Attributes %x11|Properties %x9|"
- "Logic Bricks %x10|Protected Transform %x29|%l");
-
- strcat(str, "|Object Constraints %x22");
- strcat(str, "|NLA Strips %x26");
-
-/* XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) { */
-/* strcat(str, "|Texture Space %x17"); */
-/* } */
-
- if (ob->type == OB_FONT) strcat(str, "|Font Settings %x18|Bevel Settings %x19");
- if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings %x19|UV Orco %x28");
-
- if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
- strcat(str, "|Curve Resolution %x25");
- }
-
- if (ob->type == OB_MESH) {
- strcat(str, "|Subsurf Settings %x21|AutoSmooth %x27");
- }
-
- if (ob->soft) strcat(str, "|Soft Body Settings %x23");
-
- strcat(str, "|Pass Index %x30");
-
- if (ob->type == OB_MESH || ob->type == OB_CURVE || ob->type == OB_LATTICE || ob->type == OB_SURF) {
- strcat(str, "|Modifiers ... %x24");
- }
-
- event = pupmenu(str);
- if (event <= 0) return;
-
- copy_attr(bmain, scene, view_layer, v3d, event);
-}
-
/* ******************* force field toggle operator ***************** */
void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)
diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c
index a111a73a42c..c46310c8c9d 100644
--- a/source/blender/editors/object/object_facemap_ops.c
+++ b/source/blender/editors/object/object_facemap_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_facemap_ops.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -33,8 +26,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
#include "BLI_listbase.h"
#include "DNA_object_types.h"
@@ -109,8 +100,8 @@ static void object_fmap_swap_edit_mode(Object *ob, int num1, int num2)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_fmap_offset = CustomData_get_offset(&em->bm->pdata, CD_FACEMAP);
if (cd_fmap_offset != -1) {
@@ -248,7 +239,7 @@ static int face_map_assign_exec(bContext *C, wmOperator *UNUSED(op))
if (fmap) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -296,7 +287,7 @@ static int face_map_remove_from_exec(bContext *C, wmOperator *UNUSED(op))
if (fmap) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -341,7 +332,7 @@ void OBJECT_OT_face_map_remove_from(struct wmOperatorType *ot)
static void fmap_select(Object *ob, bool select)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -482,7 +473,7 @@ void OBJECT_OT_face_map_move(wmOperatorType *ot)
static EnumPropertyItem fmap_slot_move[] = {
{1, "UP", 0, "Up", ""},
{-1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 1523cafa928..a1f529b3bde 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2018
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_gpencil_modifier.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,9 +33,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
@@ -378,11 +370,6 @@ static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type,
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
- if (!ptr.data) {
- CTX_wm_operator_poll_msg_set(C, "Context missing 'modifier'");
- return 0;
- }
-
if (!ob || ID_IS_LINKED(ob)) return 0;
if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) return 0;
if (ptr.id.data && ID_IS_LINKED(ptr.id.data)) return 0;
@@ -587,7 +574,7 @@ static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEv
static const EnumPropertyItem gpencil_modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void OBJECT_OT_gpencil_modifier_apply(wmOperatorType *ot)
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 995f62f3cd8..f65abb2f269 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_hook.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -143,7 +137,7 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve;
BMIter iter;
int index = 0, nr = 0;
@@ -323,7 +317,7 @@ static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit,
DEG_id_tag_update(obedit->data, 0);
- em = me->edit_btmesh;
+ em = me->edit_mesh;
EDBM_mesh_normals_update(em);
BKE_editmesh_tessface_calc(em);
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 5bdba195a3a..89d8714dbca 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_intern.h
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#ifndef __OBJECT_INTERN_H__
#define __OBJECT_INTERN_H__
-struct wmOperatorType;
struct Object;
-struct bContext;
struct StructRNA;
+struct bContext;
struct wmOperator;
+struct wmOperatorType;
struct ModifierData;
@@ -43,7 +36,7 @@ struct ModifierData;
enum eObject_Hook_Add_Mode {
OBJECT_ADDHOOK_NEWOB = 1,
OBJECT_ADDHOOK_SELOB,
- OBJECT_ADDHOOK_SELOB_BONE
+ OBJECT_ADDHOOK_SELOB_BONE,
};
/* internal exports only */
@@ -65,8 +58,6 @@ void OBJECT_OT_parent_clear(struct wmOperatorType *ot);
void OBJECT_OT_vertex_parent_set(struct wmOperatorType *ot);
void OBJECT_OT_track_set(struct wmOperatorType *ot);
void OBJECT_OT_track_clear(struct wmOperatorType *ot);
-void OBJECT_OT_slow_parent_set(struct wmOperatorType *ot);
-void OBJECT_OT_slow_parent_clear(struct wmOperatorType *ot);
void OBJECT_OT_make_local(struct wmOperatorType *ot);
void OBJECT_OT_make_override_static(struct wmOperatorType *ot);
void OBJECT_OT_make_single_user(struct wmOperatorType *ot);
@@ -99,7 +90,6 @@ void OBJECT_OT_link_to_collection(struct wmOperatorType *ot);
void OBJECT_OT_select_all(struct wmOperatorType *ot);
void OBJECT_OT_select_random(struct wmOperatorType *ot);
void OBJECT_OT_select_by_type(struct wmOperatorType *ot);
-void OBJECT_OT_select_by_layer(struct wmOperatorType *ot);
void OBJECT_OT_select_linked(struct wmOperatorType *ot);
void OBJECT_OT_select_grouped(struct wmOperatorType *ot);
void OBJECT_OT_select_mirror(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 771bbc5c18c..dd0a37b4498 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_modes.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*
* General utils to handle mode switching,
* actual mode switching logic is per-object type.
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 07827a34bdd..8e7a7a71906 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_modifier.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -131,7 +125,7 @@ static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Scene *s
BKE_displist_make_mball(depsgraph, scene, ob);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false, NULL);
}
}
@@ -286,8 +280,8 @@ static bool object_has_modifier_cb(Object *ob, void *data)
}
/* Use with ED_object_iter_other(). Sets the total number of levels
-* for any multires modifiers on the object to the int pointed to by
-* callback_data. */
+ * for any multires modifiers on the object to the int pointed to by
+ * callback_data. */
bool ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v)
{
ModifierData *md;
@@ -451,10 +445,12 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
return 1;
}
-int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, ModifierData *md)
+int ED_object_modifier_convert(ReportList *UNUSED(reports),
+ Main *bmain, Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer,
+ Object *ob, ModifierData *md)
{
Object *obn;
- ParticleSystem *psys;
+ ParticleSystem *psys_orig, *psys_eval;
ParticleCacheKey *key, **cache;
ParticleSettings *part;
Mesh *me;
@@ -467,20 +463,25 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
if (md->type != eModifierType_ParticleSystem) return 0;
if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
- psys = ((ParticleSystemModifierData *)md)->psys;
- part = psys->part;
+ psys_orig = ((ParticleSystemModifierData *)md)->psys;
+ part = psys_orig->part;
- if (part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
+ if (part->ren_as != PART_DRAW_PATH) {
+ return 0;
+ }
+ psys_eval = psys_eval_get(depsgraph, ob, psys_orig);
+ if (psys_eval->pathcache == NULL) {
return 0;
+ }
- totpart = psys->totcached;
- totchild = psys->totchildcache;
+ totpart = psys_eval->totcached;
+ totchild = psys_eval->totchildcache;
if (totchild && (part->draw & PART_DRAW_PARENT) == 0)
totpart = 0;
/* count */
- cache = psys->pathcache;
+ cache = psys_eval->pathcache;
for (a = 0; a < totpart; a++) {
key = cache[a];
@@ -490,7 +491,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
}
- cache = psys->childcache;
+ cache = psys_eval->childcache;
for (a = 0; a < totchild; a++) {
key = cache[a];
@@ -517,7 +518,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
medge = me->medge;
/* copy coordinates */
- cache = psys->pathcache;
+ cache = psys_eval->pathcache;
for (a = 0; a < totpart; a++) {
key = cache[a];
kmax = key->segments;
@@ -536,7 +537,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
}
- cache = psys->childcache;
+ cache = psys_eval->childcache;
for (a = 0; a < totchild; a++) {
key = cache[a];
kmax = key->segments;
@@ -1080,7 +1081,7 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
static const EnumPropertyItem modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void OBJECT_OT_modifier_apply(wmOperatorType *ot)
@@ -1105,12 +1106,13 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
static int modifier_convert_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- if (!md || !ED_object_modifier_convert(op->reports, bmain, scene, view_layer, ob, md))
+ if (!md || !ED_object_modifier_convert(op->reports, bmain, depsgraph, scene, view_layer, ob, md))
return OPERATOR_CANCELLED;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -1503,7 +1505,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
static void modifier_skin_customdata_delete(Object *ob)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em)
BM_data_layer_free(em->bm, &em->bm->vdata, CD_MVERT_SKIN);
@@ -1639,7 +1641,7 @@ void OBJECT_OT_skin_loose_mark_clear(wmOperatorType *ot)
static const EnumPropertyItem action_items[] = {
{SKIN_LOOSE_MARK, "MARK", 0, "Mark", "Mark selected vertices as loose"},
{SKIN_LOOSE_CLEAR, "CLEAR", 0, "Clear", "Set selected vertices as not loose"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Skin Mark/Clear Loose";
@@ -1899,6 +1901,7 @@ static bool correctivesmooth_poll(bContext *C)
static int correctivesmooth_bind_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)edit_modifier_property_get(op, ob, eModifierType_CorrectiveSmooth);
@@ -1925,9 +1928,17 @@ static int correctivesmooth_bind_exec(bContext *C, wmOperator *op)
else {
/* signal to modifier to recalculate */
csmd->bind_coords_num = (unsigned int)-1;
+
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
+ const int mode = csmd->modifier.mode;
+ csmd->modifier.mode |= eModifierMode_Realtime;
+ object_force_modifier_update_for_bind(depsgraph, scene, ob);
+ csmd->modifier.mode = mode;
}
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ /* We need ID_RECALC_COPY_ON_WRITE to ensure (un)binding is flushed to CoW copies of the object... */
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
@@ -2192,23 +2203,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
/* precalculate time variable before baking */
for (f = omd->bakestart; f <= omd->bakeend; f++) {
- /* from physics_fluid.c:
- *
- * XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
- * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
- * --> BKE_animsys_evaluate_all_animation(bmain, eval_time);
- * This doesn't work with drivers:
- * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL);
- */
-
- /* Modifying the global scene isn't nice, but we can do it in
- * this part of the process before a threaded job is created */
-
- //scene->r.cfra = f;
- //ED_update_for_newframe(bmain, scene);
-
- /* ok, this doesn't work with drivers, but is way faster.
- * let's use this for now and hope nobody wants to drive the time value... */
+ /* For now only simple animation of time value is supported, nothing else.
+ * No drivers or other modifier parameters. */
BKE_animsys_evaluate_animdata(CTX_data_depsgraph(C), scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM);
och->time[i] = omd->time;
@@ -2306,7 +2302,8 @@ static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
lmd->flag |= MOD_LAPLACIANDEFORM_BIND;
}
- /* Force modifier to run, it will call binding routine (this has to happen outside of depsgraph evaluation). */
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
const int mode = lmd->modifier.mode;
lmd->modifier.mode |= eModifierMode_Realtime;
object_force_modifier_update_for_bind(depsgraph, scene, ob);
@@ -2368,7 +2365,8 @@ static int surfacedeform_bind_exec(bContext *C, wmOperator *op)
smd->flags |= MOD_SDEF_BIND;
}
- /* Force modifier to run, it will call binding routine (this has to happen outside of depsgraph evaluation). */
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
const int mode = smd->modifier.mode;
smd->modifier.mode |= eModifierMode_Realtime;
object_force_modifier_update_for_bind(depsgraph, scene, ob);
@@ -2540,7 +2538,7 @@ static void apply_scale(Depsgraph *depsgraph, Object* ob, Scene* scene)
apply_transform(depsgraph, ob, scene, smat);
/*clear scale too*/
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
+ ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f;
}
static int fracture_refresh_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
@@ -2675,7 +2673,7 @@ static Object* do_convert_meshisland_to_object(Main* bmain, Shard *mi, Scene* sc
copy_qt_qt(ob_new->quat, ob->quat);
copy_v3_v3(ob_new->rotAxis, ob->rotAxis);
ob_new->rotAngle = ob->rotAngle;
- copy_v3_v3(ob_new->size, ob->size);
+ copy_v3_v3(ob_new->scale, ob->scale);
}
if (rbw) {
@@ -2717,7 +2715,7 @@ static Object* do_convert_meshisland_to_object(Main* bmain, Shard *mi, Scene* sc
ob_new->data = BKE_mesh_copy(bmain, mi->mesh);//BKE_fracture_mesh_copy(mi->mesh, ob);
me = (Mesh*)ob_new->data;
- me->edit_btmesh = NULL;
+ me->edit_mesh = NULL;
//correct vertex positions, they are off by centroid location
for (mv = me->mvert, v = 0; v < me->totvert; v++, mv++)
@@ -2741,7 +2739,7 @@ static Object* do_convert_meshisland_to_object(Main* bmain, Shard *mi, Scene* sc
//except fore external mode... there it can be set, so in general use it... since we dont want separate external
//mode any more
- copy_v3_v3(ob_new->size, size);
+ copy_v3_v3(ob_new->scale, size);
copy_v3_v3(ob_new->loc, loc);
copy_qt_qt(ob_new->quat, rot);
quat_to_eulO(ob_new->rot, ob_new->rotmode, rot);
@@ -3109,7 +3107,7 @@ static Object* do_convert_meshIsland(Main* bmain, Depsgraph *depsgraph, Shard *m
ob_new->data = BKE_fracture_mesh_copy(mi->mesh, ob);
me = (Mesh*)ob_new->data;
- me->edit_btmesh = NULL;
+ me->edit_mesh = NULL;
//last parameter here means deferring removing the bake after all has been converted.
ED_rigidbody_object_add(bmain, scene, ob_new, RBO_TYPE_ACTIVE, reports, true);
@@ -3168,7 +3166,7 @@ static Object* do_convert_meshIsland(Main* bmain, Depsgraph *depsgraph, Shard *m
rotset[3] = false;
}
- copy_v3_v3(size, ob->size);
+ copy_v3_v3(size, ob->scale);
if (adaptive || dostep)
{
@@ -3262,7 +3260,7 @@ static Object* do_convert_meshIsland(Main* bmain, Depsgraph *depsgraph, Shard *m
copy_qt_qt(ob_new->quat, rot);
quat_to_compatible_eul(ob_new->rot, ob_new->rot, rot);
- copy_v3_v3(ob_new->size, size);
+ copy_v3_v3(ob_new->scale, size);
}
if (locset[0])
@@ -3314,7 +3312,7 @@ static Object* do_convert_meshIsland(Main* bmain, Depsgraph *depsgraph, Shard *m
mul_qt_qtqt(ob_new->quat, ob_new->quat, mi->rot);
copy_v3_v3(ob_new->rot, ob->rot);
- copy_v3_v3(ob_new->size, ob->size);
+ copy_v3_v3(ob_new->scale, ob->scale);
}
(*j)++;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index dff14107f90..940450aa161 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_ops.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -87,8 +80,6 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_vertex_parent_set);
WM_operatortype_append(OBJECT_OT_track_set);
WM_operatortype_append(OBJECT_OT_track_clear);
- WM_operatortype_append(OBJECT_OT_slow_parent_set);
- WM_operatortype_append(OBJECT_OT_slow_parent_clear);
WM_operatortype_append(OBJECT_OT_make_local);
WM_operatortype_append(OBJECT_OT_make_override_static);
WM_operatortype_append(OBJECT_OT_make_single_user);
diff --git a/source/blender/editors/object/object_random.c b/source/blender/editors/object/object_random.c
index 8291b68f15f..7c176318c57 100644
--- a/source/blender/editors/object/object_random.c
+++ b/source/blender/editors/object/object_random.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_random.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "MEM_guardedalloc.h"
@@ -162,12 +158,12 @@ void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- ot->prop = RNA_def_float(
+ ot->prop = RNA_def_float_distance(
ot->srna, "offset", 0.1f, -FLT_MAX, FLT_MAX,
"Amount", "Distance to offset", -10.0f, 10.0f);
- RNA_def_float(ot->srna, "uniform", 0.0f, 0.0f, 1.0f, "Uniform",
+ RNA_def_float_factor(ot->srna, "uniform", 0.0f, 0.0f, 1.0f, "Uniform",
"Increase for uniform offset distance", 0.0f, 1.0f);
- RNA_def_float(ot->srna, "normal", 0.0f, 0.0f, 1.0f, "Normal",
+ RNA_def_float_factor(ot->srna, "normal", 0.0f, 0.0f, 1.0f, "Normal",
"Align offset direction to normals", 0.0f, 1.0f);
RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 867b807c908..4d6864d2023 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_relations.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,7 +33,7 @@
#include "DNA_mesh_types.h"
#include "DNA_collection_types.h"
#include "DNA_constraint_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
@@ -70,11 +64,10 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_library.h"
@@ -152,7 +145,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(obedit->data, 0);
- em = me->edit_btmesh;
+ em = me->edit_mesh;
EDBM_mesh_normals_update(em);
BKE_editmesh_tessface_calc(em);
@@ -305,9 +298,9 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
/* Get object to work on - use a menu if we need to... */
- if (ob->dup_group && ID_IS_LINKED(ob->dup_group)) {
+ if (ob->instance_collection && ID_IS_LINKED(ob->instance_collection)) {
/* gives menu with list of objects in group */
- /* proxy_group_objects_menu(C, op, ob, ob->dup_group); */
+ /* proxy_group_objects_menu(C, op, ob, ob->instance_collection); */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
}
@@ -341,9 +334,9 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- if (gob->dup_group != NULL) {
- const ListBase dup_group_objects = BKE_collection_object_cache_get(gob->dup_group);
- Base *base = BLI_findlink(&dup_group_objects, RNA_enum_get(op->ptr, "object"));
+ if (gob->instance_collection != NULL) {
+ const ListBase instance_collection_objects = BKE_collection_object_cache_get(gob->instance_collection);
+ Base *base = BLI_findlink(&instance_collection_objects, RNA_enum_get(op->ptr, "object"));
ob = base->object;
}
else {
@@ -385,19 +378,20 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
}
/* Generic itemf's for operators that take library args */
-static const EnumPropertyItem *proxy_collection_object_itemf(bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *proxy_collection_object_itemf(
+ bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *r_free)
{
EnumPropertyItem item_tmp = {0}, *item = NULL;
int totitem = 0;
int i = 0;
Object *ob = ED_object_active_context(C);
- if (!ob || !ob->dup_group)
+ if (!ob || !ob->instance_collection)
return DummyRNA_DEFAULT_items;
/* find the object to affect */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->dup_group, object)
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->instance_collection, object)
{
item_tmp.identifier = item_tmp.name = object->id.name + 2;
item_tmp.value = i++;
@@ -452,7 +446,7 @@ EnumPropertyItem prop_clear_parent_types[] = {
"As 'Clear Parent', but keep the current visual transformations of the object"},
{CLEAR_PARENT_INVERSE, "CLEAR_INVERSE", 0, "Clear Parent Inverse",
"Reset the transform corrections applied to the parenting relationship, does not remove parenting itself"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Helper for ED_object_parent_clear() - Remove deform-modifiers associated with parent */
@@ -504,7 +498,8 @@ void ED_object_parent_clear(Object *ob, const int type)
switch (type) {
case CLEAR_PARENT_ALL:
{
- /* for deformers, remove corresponding modifiers to prevent a large number of modifiers building up */
+ /* for deformers, remove corresponding modifiers to prevent
+ * a large number of modifiers building up */
object_remove_parent_deform_modifiers(ob, ob->parent);
/* clear parenting relationship completely */
@@ -513,14 +508,16 @@ void ED_object_parent_clear(Object *ob, const int type)
}
case CLEAR_PARENT_KEEP_TRANSFORM:
{
- /* remove parent, and apply the parented transform result as object's local transforms */
+ /* remove parent, and apply the parented transform
+ * result as object's local transforms */
ob->parent = NULL;
BKE_object_apply_mat4(ob, ob->obmat, true, false);
break;
}
case CLEAR_PARENT_INVERSE:
{
- /* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state)
+ /* object stays parented, but the parent inverse
+ * (i.e. offset from parent to retain binding state)
* is cleared. In other words: nothing to do here! */
break;
}
@@ -609,7 +606,7 @@ EnumPropertyItem prop_make_parent_types[] = {
{PAR_LATTICE, "LATTICE", 0, "Lattice Deform", ""},
{PAR_VERTEX, "VERTEX", 0, "Vertex", ""},
{PAR_VERTEX_TRI, "VERTEX_TRI", 0, "Vertex (Triangle)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene, Object *ob, Object *par,
@@ -631,7 +628,8 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
- BKE_displist_make_curveTypes(depsgraph, scene, par, false, false); /* force creation of path data */
+ /* force creation of path data */
+ BKE_displist_make_curveTypes(depsgraph, scene, par, false, false, NULL);
}
else {
cu->flag |= CU_FOLLOW;
@@ -915,7 +913,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
- Object *ob = ED_object_active_context(C);
+ Object *parent = ED_object_active_context(C);
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
@@ -935,26 +933,46 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", true);
#endif
- /* ob becomes parent, make the associated menus */
- if (ob->type == OB_ARMATURE) {
+
+ struct {
+ bool mesh, gpencil;
+ } has_children_of_type = { 0 };
+
+ CTX_DATA_BEGIN (C, Object *, child, selected_editable_objects)
+ {
+ if (child == parent) {
+ continue;
+ }
+ if (child->type == OB_MESH) {
+ has_children_of_type.mesh = true;
+ }
+ if (child->type == OB_GPENCIL) {
+ has_children_of_type.gpencil = true;
+ }
+ }
+ CTX_DATA_END;
+
+ if (parent->type == OB_ARMATURE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_NAME);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
- uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
+ if (has_children_of_type.mesh || has_children_of_type.gpencil) {
+ uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
+ }
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
- else if (ob->type == OB_CURVE) {
+ else if (parent->type == OB_CURVE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_PATH_CONST);
}
- else if (ob->type == OB_LATTICE) {
+ else if (parent->type == OB_LATTICE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_LATTICE);
}
/* vertex parenting */
- if (OB_TYPE_SUPPORT_PARVERT(ob->type)) {
+ if (OB_TYPE_SUPPORT_PARVERT(parent->type)) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI);
}
@@ -1057,83 +1075,6 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/************************ Clear Slow Parent Operator *********************/
-
-static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
- Scene *scene = CTX_data_scene(C);
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
- if (ob->parent) {
- if (ob->partype & PARSLOW) {
- ob->partype -= PARSLOW;
- BKE_object_where_is_calc(depsgraph, scene, ob);
- ob->partype |= PARSLOW;
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- }
- }
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_SCENE, scene);
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear Slow Parent";
- ot->description = "Clear the object's slow parent";
- ot->idname = "OBJECT_OT_slow_parent_clear";
-
- /* api callbacks */
- ot->invoke = WM_operator_confirm;
- ot->exec = object_slow_parent_clear_exec;
- ot->poll = ED_operator_view3d_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-/********************** Make Slow Parent Operator *********************/
-
-static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
- if (ob->parent)
- ob->partype |= PARSLOW;
-
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_SCENE, scene);
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Set Slow Parent";
- ot->description = "Set the object's slow parent";
- ot->idname = "OBJECT_OT_slow_parent_set";
-
- /* api callbacks */
- ot->invoke = WM_operator_confirm;
- ot->exec = object_slow_parent_set_exec;
- ot->poll = ED_operator_view3d_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/* ******************** Clear Track Operator ******************* */
enum {
@@ -1144,7 +1085,7 @@ enum {
static const EnumPropertyItem prop_clear_track_types[] = {
{CLEAR_TRACK, "CLEAR", 0, "Clear Track", ""},
{CLEAR_TRACK_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* note, poll should check for editable scene */
@@ -1214,7 +1155,7 @@ static const EnumPropertyItem prop_make_track_types[] = {
{CREATE_TRACK_DAMPTRACK, "DAMPTRACK", 0, "Damped Track Constraint", ""},
{CREATE_TRACK_TRACKTO, "TRACKTO", 0, "Track To Constraint", ""},
{CREATE_TRACK_LOCKTRACK, "LOCKTRACK", 0, "Lock Track Constraint", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int track_set_exec(bContext *C, wmOperator *op)
@@ -1239,7 +1180,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->trackflag = TRACK_nZ;
}
@@ -1262,7 +1203,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->reserved1 = TRACK_nZ;
data->reserved2 = UP_Y;
@@ -1286,7 +1227,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->trackflag = TRACK_nZ;
data->lockflag = LOCK_Y;
@@ -1336,7 +1277,7 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
if (sce->id.lib) return;
for (base = FIRSTBASE; base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
nbase = MEM_mallocN(sizeof(Base), "newbase");
*nbase = *base;
BLI_addhead(&(sce->base), nbase);
@@ -1468,7 +1409,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* new approach, using functions from kernel */
for (a = 0; a < ob_src->totcol; a++) {
Material *ma = give_current_material(ob_src, a + 1);
- assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF); /* also works with ma==NULL */
+ /* also works with `ma == NULL` */
+ assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF);
}
DEG_id_tag_update(&ob_dst->id, ID_RECALC_GEOMETRY);
break;
@@ -1492,7 +1434,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* now add in the collections from the link nodes */
for (collection_node = ob_collections; collection_node; collection_node = collection_node->next) {
- if (ob_dst->dup_group != collection_node->link) {
+ if (ob_dst->instance_collection != collection_node->link) {
BKE_collection_object_add(bmain, collection_node->link, ob_dst);
}
else {
@@ -1502,9 +1444,9 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
}
case MAKE_LINKS_DUPLICOLLECTION:
- ob_dst->dup_group = ob_src->dup_group;
- if (ob_dst->dup_group) {
- id_us_plus(&ob_dst->dup_group->id);
+ ob_dst->instance_collection = ob_src->instance_collection;
+ if (ob_dst->instance_collection) {
+ id_us_plus(&ob_dst->instance_collection->id);
ob_dst->transflag |= OB_DUPLICOLLECTION;
}
break;
@@ -1601,11 +1543,12 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
- {MAKE_LINKS_GROUP, "GROUPS", 0, "Group", ""},
- {MAKE_LINKS_DUPLICOLLECTION, "DUPLICOLLECTION", 0, "DupliGroup", ""},
+ {MAKE_LINKS_GROUP, "GROUPS", 0, "Collection", ""},
+ {MAKE_LINKS_DUPLICOLLECTION, "DUPLICOLLECTION", 0, "Instance Collection", ""},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{MAKE_LINKS_FONTS, "FONTS", 0, "Fonts", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Link Data";
@@ -1654,7 +1597,7 @@ static void single_object_users_collection(
Object *ob = cob->ob;
/* an object may be in more than one collection */
if ((ob->id.newid == NULL) && ((ob->flag & flag) == flag)) {
- if (!ID_IS_LINKED(ob) && ob->id.us > 1) {
+ if (!ID_IS_LINKED(ob) && BKE_object_scenes_users_get(bmain, ob) > 1) {
ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
}
}
@@ -1756,7 +1699,7 @@ static void new_id_matar(Main *bmain, Material **matar, const int totcol)
static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag)
{
- Lamp *la;
+ Light *la;
Curve *cu;
/* Camera *cam; */
Mesh *me;
@@ -1773,7 +1716,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
switch (ob->type) {
case OB_LAMP:
- ob->data = la = ID_NEW_SET(ob->data, BKE_lamp_copy(bmain, ob->data));
+ ob->data = la = ID_NEW_SET(ob->data, BKE_light_copy(bmain, ob->data));
break;
case OB_CAMERA:
ob->data = ID_NEW_SET(ob->data, BKE_camera_copy(bmain, ob->data));
@@ -1867,7 +1810,8 @@ static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, V
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
if (ma) {
- /* do not test for LIB_TAG_NEW or use newid: this functions guaranteed delivers single_users! */
+ /* do not test for LIB_TAG_NEW or use newid:
+ * this functions guaranteed delivers single_users! */
if (ma->id.us > 1) {
man = BKE_material_copy(bmain, ma);
@@ -2182,7 +2126,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
{MAKE_LOCAL_SELECT_OBDATA, "SELECT_OBDATA", 0, "Selected Objects and Data", ""},
{MAKE_LOCAL_SELECT_OBDATA_MATERIAL, "SELECT_OBDATA_MATERIAL", 0, "Selected Objects, Data and Materials", ""},
{MAKE_LOCAL_ALL, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2213,8 +2157,9 @@ static void make_override_static_tag_object(Object *obact, Object *ob)
return;
}
- /* Note: all this is very case-by-case bad handling, ultimately we'll want a real full 'automatic', generic
- * handling of all this, will probably require adding some override-aware stuff to library_query code... */
+ /* Note: all this is very case-by-case bad handling, ultimately we'll want a real full
+ * 'automatic', generic handling of all this,
+ * will probably require adding some override-aware stuff to library_query code... */
if (obact->type == OB_ARMATURE && ob->modifiers.first != NULL) {
for (ModifierData *md = ob->modifiers.first; md != NULL; md = md->next) {
@@ -2256,7 +2201,7 @@ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEven
}
/* Get object to work on - use a menu if we need to... */
- if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
+ if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
/* Gives menu with list of objects in group. */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
@@ -2291,9 +2236,9 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
bool success = false;
- if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
+ if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
Object *obcollection = obact;
- Collection *collection = obcollection->dup_group;
+ Collection *collection = obcollection->instance_collection;
const ListBase dup_collection_objects = BKE_collection_object_cache_get(collection);
Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object"));
@@ -2356,10 +2301,12 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- /* obcollection is no more duplicollection-ing, it merely parents whole collection of overriding instantiated objects. */
- obcollection->dup_group = NULL;
+ /* obcollection is no more duplicollection-ing,
+ * it merely parents whole collection of overriding instantiated objects. */
+ obcollection->instance_collection = NULL;
- /* Also, we'd likely want to lock by default things like transformations of implicitly overridden objects? */
+ /* Also, we'd likely want to lock by default things like
+ * transformations of implicitly overridden objects? */
DEG_id_tag_update(&scene->id, 0);
@@ -2379,7 +2326,8 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
success = BKE_override_static_create_from_tag(bmain);
- /* Also, we'd likely want to lock by default things like transformations of implicitly overridden objects? */
+ /* Also, we'd likely want to lock by default things like
+ * transformations of implicitly overridden objects? */
/* Cleanup. */
BKE_main_id_clear_newpoins(bmain);
@@ -2403,7 +2351,7 @@ static bool make_override_static_poll(bContext *C)
return (BKE_override_static_is_enabled() &&
ED_operator_objectmode(C) && obact != NULL &&
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
- (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group))));
+ (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection))));
}
void OBJECT_OT_make_override_static(wmOperatorType *ot)
@@ -2486,7 +2434,8 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
static const EnumPropertyItem type_items[] = {
{MAKE_SINGLE_USER_SELECTED, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{MAKE_SINGLE_USER_ALL, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Make Single User";
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 0b032a3111a..96dc18b41f0 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_select.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,7 +33,7 @@
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "DNA_armature_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_workspace_types.h"
#include "DNA_gpencil_types.h"
@@ -72,6 +66,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "ED_armature.h"
#include "ED_object.h"
@@ -126,11 +121,13 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
*/
void ED_object_base_activate(bContext *C, Base *base)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
view_layer->basact = base;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_SELECT);
}
@@ -434,6 +431,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 1, "Type", "");
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);
}
/*********************** Selection by Links *********************/
@@ -445,7 +443,7 @@ enum {
OBJECT_SELECT_LINKED_DUPGROUP,
OBJECT_SELECT_LINKED_PARTICLE,
OBJECT_SELECT_LINKED_LIBRARY,
- OBJECT_SELECT_LINKED_LIBRARY_OBDATA
+ OBJECT_SELECT_LINKED_LIBRARY_OBDATA,
};
static const EnumPropertyItem prop_select_linked_types[] = {
@@ -456,7 +454,7 @@ static const EnumPropertyItem prop_select_linked_types[] = {
{OBJECT_SELECT_LINKED_PARTICLE, "PARTICLE", 0, "Particle System", ""},
{OBJECT_SELECT_LINKED_LIBRARY, "LIBRARY", 0, "Library", ""},
{OBJECT_SELECT_LINKED_LIBRARY_OBDATA, "LIBRARY_OBDATA", 0, "Library (Object Data)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool object_select_all_by_obdata(bContext *C, void *obdata)
@@ -503,16 +501,16 @@ static bool object_select_all_by_material(bContext *C, Material *mat)
return changed;
}
-static bool object_select_all_by_dup_group(bContext *C, Object *ob)
+static bool object_select_all_by_instance_collection(bContext *C, Object *ob)
{
bool changed = false;
- Collection *dup_group = (ob->transflag & OB_DUPLICOLLECTION) ? ob->dup_group : NULL;
+ Collection *instance_collection = (ob->transflag & OB_DUPLICOLLECTION) ? ob->instance_collection : NULL;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
- Collection *dup_group_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->dup_group : NULL;
- if (dup_group == dup_group_other) {
+ Collection *instance_collection_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->instance_collection : NULL;
+ if (instance_collection == instance_collection_other) {
ED_object_base_select(base, BA_SELECT);
changed = true;
}
@@ -652,10 +650,10 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
changed = object_select_all_by_material(C, mat);
}
else if (nr == OBJECT_SELECT_LINKED_DUPGROUP) {
- if (ob->dup_group == NULL)
+ if (ob->instance_collection == NULL)
return OPERATOR_CANCELLED;
- changed = object_select_all_by_dup_group(C, ob);
+ changed = object_select_all_by_instance_collection(C, ob);
}
else if (nr == OBJECT_SELECT_LINKED_PARTICLE) {
if (BLI_listbase_is_empty(&ob->particlesystem))
@@ -733,7 +731,7 @@ static const EnumPropertyItem prop_select_grouped_types[] = {
{OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object Color"},
{OBJECT_GRPSEL_KEYINGSET, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
{OBJECT_GRPSEL_LIGHT_TYPE, "LIGHT_TYPE", 0, "Light Type", "Matching light types"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool select_grouped_children(bContext *C, Object *ob, const bool recursive)
@@ -781,7 +779,8 @@ static bool select_grouped_parent(bContext *C) /* Makes parent active and de-sel
#define COLLECTION_MENU_MAX 24
-static bool select_grouped_collection(bContext *C, Object *ob) /* Select objects in the same group as the active */
+/* Select objects in the same group as the active */
+static bool select_grouped_collection(bContext *C, Object *ob)
{
bool changed = false;
Collection *collection, *ob_collections[COLLECTION_MENU_MAX];
@@ -867,16 +866,16 @@ static bool select_grouped_siblings(bContext *C, Object *ob)
CTX_DATA_END;
return changed;
}
-static bool select_grouped_lamptype(bContext *C, Object *ob)
+static bool select_grouped_lighttype(bContext *C, Object *ob)
{
- Lamp *la = ob->data;
+ Light *la = ob->data;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (base->object->type == OB_LAMP) {
- Lamp *la_test = base->object->data;
+ Light *la_test = base->object->data;
if ((la->type == la_test->type) && ((base->flag & BASE_SELECTED) == 0)) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -922,7 +921,7 @@ static bool select_grouped_color(bContext *C, Object *ob)
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
+ if (((base->flag & BASE_SELECTED) == 0) && (compare_v3v3(base->object->color, ob->color, 0.005f))) {
ED_object_base_select(base, BA_SELECT);
changed = true;
}
@@ -1039,7 +1038,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Active object must be a light");
break;
}
- changed |= select_grouped_lamptype(C, ob);
+ changed |= select_grouped_lighttype(C, ob);
break;
default:
break;
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index a7505c4b2cc..8580ea10d35 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2018
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_shader_fx.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,12 +33,12 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
+#include "BLT_translation.h"
+
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_shader_fx.h"
@@ -263,8 +257,6 @@ static const EnumPropertyItem *shaderfx_add_itemf(
void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
/* identifiers */
ot->name = "Add Effect";
ot->description = "Add a visual effect to the active object";
@@ -279,9 +271,9 @@ void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
- RNA_def_enum_funcs(prop, shaderfx_add_itemf);
- ot->prop = prop;
+ ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
+ RNA_def_enum_funcs(ot->prop, shaderfx_add_itemf);
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID); /* Abused, for "Light"... */
}
/************************ generic functions for operators using names and data context *********************/
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index cafb3a50202..d445177f236 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, shapekey support
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_shapekey.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1620d1f82f9..ea51fdb5c86 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_transform.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -35,7 +29,7 @@
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_gpencil_types.h"
@@ -228,15 +222,15 @@ static void object_clear_scale(Object *ob, const bool clear_delta)
{
/* clear scale factors which are not locked */
if ((ob->protectflag & OB_LOCK_SCALEX) == 0) {
- ob->size[0] = 1.0f;
+ ob->scale[0] = 1.0f;
if (clear_delta) ob->dscale[0] = 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEY) == 0) {
- ob->size[1] = 1.0f;
+ ob->scale[1] = 1.0f;
if (clear_delta) ob->dscale[1] = 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEZ) == 0) {
- ob->size[2] = 1.0f;
+ ob->scale[2] = 1.0f;
if (clear_delta) ob->dscale[2] = 1.0f;
}
}
@@ -491,7 +485,8 @@ static int apply_objects_internal(
bool has_unparented_layers = false;
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- /* Parented layers aren't supported as we can't easily re-evaluate the scene to sample parent movement */
+ /* Parented layers aren't supported as we can't easily re-evaluate
+ * the scene to sample parent movement */
if (gpl->parent == NULL) {
has_unparented_layers = true;
break;
@@ -515,7 +510,7 @@ static int apply_objects_internal(
}
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type == LA_AREA) {
if (apply_rot || apply_loc) {
BKE_reportf(reports, RPT_ERROR,
@@ -635,7 +630,7 @@ static int apply_objects_internal(
continue;
if (apply_scale)
- BKE_tracking_reconstruction_scale(&clip->tracking, ob->size);
+ BKE_tracking_reconstruction_scale(&clip->tracking, ob->scale);
}
else if (ob->type == OB_EMPTY) {
/* It's possible for empties too, even though they don't
@@ -654,12 +649,12 @@ static int apply_objects_internal(
(apply_rot == false) &&
(apply_scale == true))
{
- float max_scale = max_fff(fabsf(ob->size[0]), fabsf(ob->size[1]), fabsf(ob->size[2]));
+ float max_scale = max_fff(fabsf(ob->scale[0]), fabsf(ob->scale[1]), fabsf(ob->scale[2]));
ob->empty_drawsize *= max_scale;
}
}
else if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type != LA_AREA) {
continue;
}
@@ -685,7 +680,7 @@ static int apply_objects_internal(
if (apply_loc)
zero_v3(ob->loc);
if (apply_scale)
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
+ ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f;
if (apply_rot) {
zero_v3(ob->rot);
unit_qt(ob->quat);
@@ -785,9 +780,9 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "location", 0, "Location", "");
- RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
- RNA_def_boolean(ot->srna, "scale", 0, "Scale", "");
+ RNA_def_boolean(ot->srna, "location", true, "Location", "");
+ RNA_def_boolean(ot->srna, "rotation", true, "Rotation", "");
+ RNA_def_boolean(ot->srna, "scale", true, "Scale", "");
RNA_def_boolean(ot->srna, "properties", true, "Apply Properties",
"Modify properties such as curve vertex radius, font size and bone envelope");
}
@@ -810,9 +805,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *tob;
- float cursor[3], cent[3], cent_neg[3], centn[3];
+ float cent[3], cent_neg[3], centn[3];
+ const float *cursor = scene->cursor.location;
int centermode = RNA_enum_get(op->ptr, "type");
- int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
ListBase ctx_data_list;
CollectionPointerLink *ctx_ob;
@@ -825,12 +820,22 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode");
return OPERATOR_CANCELLED;
}
- else {
- /* get the view settings if 'around' isn't set and the view is available */
- View3D *v3d = CTX_wm_view3d(C);
- copy_v3_v3(cursor, scene->cursor.location);
- if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
- around = scene->toolsettings->transform_pivot_point;
+
+ int around;
+ {
+ PropertyRNA *prop_center = RNA_struct_find_property(op->ptr, "center");
+ if (RNA_property_is_set(op->ptr, prop_center)) {
+ around = RNA_property_enum_get(op->ptr, prop_center);
+ }
+ else {
+ if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_BOUNDS) {
+ around = V3D_AROUND_CENTER_BOUNDS;
+ }
+ else {
+ around = V3D_AROUND_CENTER_MEDIAN;
+ }
+ RNA_property_enum_set(op->ptr, prop_center, around);
+ }
}
zero_v3(cent);
@@ -838,7 +843,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (obedit) {
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve;
BMIter iter;
@@ -899,8 +904,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data)
((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
- if (tob->dup_group)
- ((ID *)tob->dup_group)->tag &= ~LIB_TAG_DOIT;
+ if (tob->instance_collection)
+ ((ID *)tob->instance_collection)->tag &= ~LIB_TAG_DOIT;
}
for (ctx_ob = ctx_data_list.first;
@@ -921,8 +926,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
- if ((ob->transflag & OB_DUPLICOLLECTION) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
- if (ID_IS_LINKED(ob->dup_group)) {
+ if ((ob->transflag & OB_DUPLICOLLECTION) && ob->instance_collection && (ob->instance_collection->id.tag & LIB_TAG_DOIT) == 0) {
+ if (ID_IS_LINKED(ob->instance_collection)) {
tot_lib_error++;
}
else {
@@ -939,10 +944,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mul_m4_v3(ob->imat, cent);
}
- add_v3_v3(ob->dup_group->dupli_ofs, cent);
+ add_v3_v3(ob->instance_collection->instance_offset, cent);
tot_change++;
- ob->dup_group->id.tag |= LIB_TAG_DOIT;
+ ob->instance_collection->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
}
@@ -1007,7 +1012,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Curve *cu = ob->data;
- if (ob->bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
+ if (ob->runtime.bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
/* do nothing*/
}
else {
@@ -1016,8 +1021,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
/* extra 0.5 is the height o above line */
- cent[0] = 0.5f * (ob->bb->vec[4][0] + ob->bb->vec[0][0]);
- cent[1] = 0.5f * (ob->bb->vec[0][1] + ob->bb->vec[2][1]);
+ cent[0] = 0.5f * (ob->runtime.bb->vec[4][0] + ob->runtime.bb->vec[0][0]);
+ cent[1] = 0.5f * (ob->runtime.bb->vec[0][1] + ob->runtime.bb->vec[2][1]);
}
cent[2] = 0.0f;
@@ -1122,7 +1127,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float diff_mat[4][4];
float inverse_diff_mat[4][4];
- /* recalculate all strokes (all layers are considered without evaluating lock attributtes) */
+ /* recalculate all strokes
+ * (all layers are considered without evaluating lock attributes) */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* calculate difference matrix */
ED_gpencil_parent_location(depsgraph, obact, gpd, gpl, diff_mat);
@@ -1192,7 +1198,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if ((ob_other->flag & OB_DONE) == 0 &&
((ob->data && (ob->data == ob_other->data)) ||
- (ob->dup_group == ob_other->dup_group &&
+ (ob->instance_collection == ob_other->instance_collection &&
(ob->transflag | ob_other->transflag) & OB_DUPLICOLLECTION)))
{
ob_other->flag |= OB_DONE;
@@ -1203,7 +1209,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_object_where_is_calc(depsgraph, scene, ob_other);
if (ob_other->type == OB_ARMATURE) {
- BKE_pose_where_is(depsgraph, scene, ob_other); /* needed for bone parents */
+ /* needed for bone parents */
+ BKE_pose_where_is(depsgraph, scene, ob_other);
}
ignore_parent_tx(C, bmain, scene, ob_other);
}
@@ -1250,13 +1257,13 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
"Calculate the center of mass from the surface area"},
{ORIGIN_TO_CENTER_OF_MASS_VOLUME, "ORIGIN_CENTER_OF_VOLUME", 0, "Origin to Center of Mass (Volume)",
"Calculate the center of mass from the volume (must be manifold geometry with consistent normals)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_set_bounds_types[] = {
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN", 0, "Median Center", ""},
{V3D_AROUND_CENTER_BOUNDS, "BOUNDS", 0, "Bounds Center", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1278,17 +1285,16 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
}
/* -------------------------------------------------------------------- */
-
/** \name Transform Axis Target
*
- * Note this is an experemental operator to point lamps/cameras at objects.
+ * Note this is an experemental operator to point lights/cameras at objects.
* We may re-work how this behaves based on user feedback.
* - campbell.
* \{ */
/* When using multiple objects, apply their relative rotational offset to the active object. */
#define USE_RELATIVE_ROTATION
-/* Disable overlays, ignoring user setting (lamp wire gets in the way). */
+/* Disable overlays, ignoring user setting (light wire gets in the way). */
#define USE_RENDER_OVERRIDE
/* Calculate a depth if the cursor isn't already over a depth (not essential but feels buggy without). */
#define USE_FAKE_DEPTH_INIT
@@ -1355,12 +1361,12 @@ static void object_transform_axis_target_calc_depth_init(struct XFormAxisData *x
static bool object_is_target_compat(const Object *ob)
{
if (ob->type == OB_LAMP) {
- const Lamp *la = ob->data;
+ const Light *la = ob->data;
if (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA)) {
return true;
}
}
- /* We might want to enable this later, for now just lamps */
+ /* We might want to enable this later, for now just lights. */
#if 0
else if (ob->type == OB_CAMERA) {
return true;
@@ -1396,10 +1402,10 @@ static void object_apply_rotation(Object *ob, const float rmat[3][3])
float rmat4[4][4];
copy_m4_m3(rmat4, rmat);
- copy_v3_v3(size, ob->size);
+ copy_v3_v3(size, ob->scale);
copy_v3_v3(loc, ob->loc);
BKE_object_apply_mat4(ob, rmat4, true, true);
- copy_v3_v3(ob->size, size);
+ copy_v3_v3(ob->scale, size);
copy_v3_v3(ob->loc, loc);
}
/* We may want to extract this to: BKE_object_apply_location */
@@ -1651,7 +1657,8 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
copy_v3_v3(loc, location_world);
madd_v3_v3fl(loc, target_normal, item->xform_dist);
object_apply_location(item->ob, loc);
- copy_v3_v3(item->ob->obmat[3], loc); /* so orient behaves as expected */
+ /* so orient behaves as expected */
+ copy_v3_v3(item->ob->obmat[3], loc);
}
object_orient_to_location(item->ob, item->rot_mat, item->rot_mat[2], location_world);
diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c
index 780942f04d2..39f5dad7698 100644
--- a/source/blender/editors/object/object_utils.c
+++ b/source/blender/editors/object/object_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_utils.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <stdlib.h>
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 036689509e9..f3181f227b2 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ove M Henriksen.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_vgroup.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -50,7 +42,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_linklist_stack.h"
#include "BLI_utildefines_stack.h"
@@ -90,7 +81,9 @@ static bool vertex_group_use_vert_sel(Object *ob)
if (ob->mode == OB_MODE_EDIT) {
return true;
}
- else if (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_VERT_SEL) {
+ else if ((ob->type == OB_MESH) &&
+ ((Mesh *)ob->data)->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
+ {
return true;
}
else {
@@ -155,8 +148,8 @@ bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, co
{
Mesh *me = (Mesh *)id;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
BMIter iter;
@@ -514,7 +507,7 @@ static void ED_mesh_defvert_mirror_update_em(
const int cd_dvert_offset)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve_mirr;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
@@ -551,7 +544,7 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx)
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
MDeformVert *dvert_act;
if (me->editflag & ME_EDIT_MIRROR_X) {
@@ -588,7 +581,7 @@ static void vgroup_remove_weight(Object *ob, const int def_nr)
static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve_act;
int v_act;
MDeformVert *dvert_act;
@@ -627,7 +620,7 @@ static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type
static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
MDeformVert *dvert_act;
int i, vgroup_tot, subset_count;
const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count);
@@ -683,7 +676,7 @@ static const EnumPropertyItem WT_vertex_group_select_item[] = {
"BONE_DEFORM", 0, "Deform Pose Bones", "All Vertex Groups assigned to Deform Bones"},
{WT_VGROUP_ALL,
"ALL", 0, "All Groups", "All Vertex Groups"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(
@@ -903,8 +896,8 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
/* warning, this lookup is _not_ fast */
@@ -960,7 +953,9 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
}
void ED_vgroup_select_by_name(Object *ob, const char *name)
-{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
+{
+ /* note: ob->actdef==0 signals on painting to create a new one,
+ * if a bone in posemode is selected */
ob->actdef = defgroup_name_index(ob, name) + 1;
}
@@ -978,8 +973,8 @@ static void vgroup_select_verts(Object *ob, int select)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
if (cd_dvert_offset != -1) {
@@ -1623,7 +1618,7 @@ enum {
VGROUP_TOGGLE,
VGROUP_LOCK,
VGROUP_UNLOCK,
- VGROUP_INVERT
+ VGROUP_INVERT,
};
static const EnumPropertyItem vgroup_lock_actions[] = {
@@ -1631,7 +1626,7 @@ static const EnumPropertyItem vgroup_lock_actions[] = {
{VGROUP_LOCK, "LOCK", 0, "Lock", "Lock all vertex groups"},
{VGROUP_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock all vertex groups"},
{VGROUP_INVERT, "INVERT", 0, "Invert", "Invert the lock state of all vertex groups"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void vgroup_lock_all(Object *ob, int action)
@@ -1946,20 +1941,22 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2)
{
/* qsort sorts in ascending order. We want descending order to save a memcopy
* so this compare function is inverted from the standard greater than comparison qsort needs.
- * A normal compare function is called with two pointer arguments and should return an integer less than, equal to,
- * or greater than zero corresponding to whether its first argument is considered less than, equal to,
- * or greater than its second argument. This does the opposite. */
+ * A normal compare function is called with two pointer arguments and should return an integer
+ * less than, equal to, or greater than zero corresponding to whether its first argument is
+ * considered less than, equal to, or greater than its second argument.
+ * This does the opposite. */
const struct MDeformWeight *dw1 = a1, *dw2 = a2;
if (dw1->weight < dw2->weight) return 1;
else if (dw1->weight > dw2->weight) return -1;
- else if (&dw1 < &dw2) return 1; /* compare addresses so we have a stable sort algorithm */
+ else if (&dw1 < &dw2) return 1; /* compare address for stable sort algorithm */
else return -1;
}
/* Used for limiting the number of influencing bones per vertex when exporting
* skinned meshes. if all_deform_weights is True, limit all deform modifiers
- * to max_weights regardless of type, otherwise, only limit the number of influencing bones per vertex*/
+ * to max_weights regardless of type, otherwise,
+ * only limit the number of influencing bones per vertex. */
static int vgroup_limit_total_subset(
Object *ob,
const bool *vgroup_validmap,
@@ -2214,7 +2211,7 @@ void ED_vgroup_mirror(
/* only the active group */
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em) {
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
@@ -2391,8 +2388,8 @@ static void vgroup_assign_verts(Object *ob, const float weight)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
int cd_dvert_offset;
BMIter iter;
@@ -2679,8 +2676,10 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- RNA_def_boolean(ot->srna, "all", 0, "All", "Remove all vertex groups");
- RNA_def_boolean(ot->srna, "all_unlocked", 0, "All Unlocked", "Remove all unlocked vertex groups");
+ PropertyRNA *prop = RNA_def_boolean(ot->srna, "all", 0, "All", "Remove all vertex groups");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "all_unlocked", 0, "All Unlocked", "Remove all unlocked vertex groups");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
static int vertex_group_assign_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3626,7 +3625,7 @@ static void vgroup_sort_bone_hierarchy(Object *ob, ListBase *bonebase)
enum {
SORT_TYPE_NAME = 0,
- SORT_TYPE_BONEHIERARCHY = 1
+ SORT_TYPE_BONEHIERARCHY = 1,
};
static int vertex_group_sort_exec(bContext *C, wmOperator *op)
@@ -3667,7 +3666,7 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
static const EnumPropertyItem vgroup_sort_type[] = {
{SORT_TYPE_NAME, "NAME", 0, "Name", ""},
{SORT_TYPE_BONEHIERARCHY, "BONE_HIERARCHY", 0, "Bone Hierarchy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Sort Vertex Groups";
@@ -3718,7 +3717,7 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
static const EnumPropertyItem vgroup_slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3742,7 +3741,7 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
MDeformVert *dvert_act;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
float weight_act;
int i;
diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c
index d28ed71c382..753e29ca9a7 100644
--- a/source/blender/editors/object/object_warp.c
+++ b/source/blender/editors/object/object_warp.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2013 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_warp.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "DNA_object_types.h"
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 3705ff9d41a..88d6f1b015c 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index dc38cc76604..a4ea8df1d4f 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/dynamicpaint_ops.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <math.h>
@@ -258,7 +254,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
static const EnumPropertyItem prop_output_toggle_types[] = {
{0, "A", 0, "Output A", ""},
{1, "B", 0, "Output B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 9f85ed08244..7ddb193b0e5 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Janne Karhu.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_boids.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 33ed3336355..f9b30de5dc5 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -46,7 +38,6 @@
#include "BLI_math.h"
#include "BLI_lasso_2d.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
#include "BLI_task.h"
@@ -67,7 +58,6 @@
#include "DEG_depsgraph.h"
-#include "BIF_gl.h"
#include "ED_object.h"
#include "ED_physics.h"
@@ -435,6 +425,7 @@ typedef struct PEData {
int select_action;
int select_toggle_action;
+ bool is_changed;
} PEData;
static void PE_set_data(bContext *C, PEData *data)
@@ -1325,25 +1316,26 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
mvert = &mesh->mvert[mface->v1];
copy_v3_v3(vec, mvert->co);
- VECCOPY(nor, mvert->no);
+ copy_v3fl_v3s(nor, mvert->no);
mvert = &mesh->mvert[mface->v2];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
mvert = &mesh->mvert[mface->v3];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
if (mface->v4) {
mvert = &mesh->mvert[mface->v4];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
mul_v3_fl(vec, 0.25);
}
- else
+ else {
mul_v3_fl(vec, 1.0f / 3.0f);
+ }
normalize_v3(nor);
@@ -1525,6 +1517,7 @@ static void select_key(PEData *data, int point_index, int key_index, bool UNUSED
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
+ data->is_changed = true;
}
static void select_key_op(PEData *data, int point_index, int key_index, bool is_inside)
@@ -1841,7 +1834,7 @@ enum { RAN_HAIR, RAN_POINTS };
static const EnumPropertyItem select_random_type_items[] = {
{RAN_HAIR, "HAIR", 0, "Hair", ""},
{RAN_POINTS, "POINTS", 0, "Points", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int select_random_exec(bContext *C, wmOperator *op)
@@ -2007,27 +2000,38 @@ int PE_box_select(bContext *C, const rcti *rect, const int sel_op)
/************************ circle select operator ************************/
-int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
+bool PE_circle_select(bContext *C, const int sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
PTCacheEdit *edit = PE_get_current(scene, ob);
PEData data;
- if (!PE_start_edit(edit))
- return OPERATOR_FINISHED;
+ if (!PE_start_edit(edit)) {
+ return false;
+ }
+
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ PE_deselect_all_visible(edit);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
PE_set_view3d_data(C, &data);
data.mval = mval;
data.rad = rad;
- data.select = selecting;
+ data.select = select;
for_mouse_hit_keys(&data, select_key, 0);
+ changed |= data.is_changed;
- PE_update_selection(data.depsgraph, scene, ob, 1);
- WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
-
- return OPERATOR_FINISHED;
+ if (changed) {
+ PE_update_selection(data.depsgraph, scene, ob, 1);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
+ }
+ return changed;
}
/************************ lasso select operator ************************/
@@ -2959,7 +2963,7 @@ enum { DEL_PARTICLE, DEL_KEY };
static const EnumPropertyItem delete_type_items[] = {
{DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
{DEL_KEY, "KEY", 0, "Key", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void set_delete_particle(PEData *data, int pa_index)
@@ -3384,7 +3388,10 @@ static void brush_puff(PEData *data, int point_index)
/* find root coordinate and normal on emitter */
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
- mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
+
+ /* use 'kco' as the object space version of worldspace 'co',
+ * ob->imat is set before calling */
+ mul_v3_m4v3(kco, data->ob->imat, co);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index == -1) return;
@@ -3468,7 +3475,10 @@ static void brush_puff(PEData *data, int point_index)
float oco[3], onor[3];
copy_v3_v3(oco, key->co);
mul_m4_v3(mat, oco);
- mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
+
+ /* use 'kco' as the object space version of worldspace 'co',
+ * ob->imat is set before calling */
+ mul_v3_m4v3(kco, data->ob->imat, oco);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index != -1) {
@@ -4354,7 +4364,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, const wmEvent *e
PointerRNA itemptr;
float mouse[2];
- VECCOPY2D(mouse, event->mval);
+ copy_v2fl_v2i(mouse, event->mval);
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
@@ -4650,25 +4660,6 @@ int PE_minmax(Scene *scene, ViewLayer *view_layer, float min[3], float max[3])
/************************ particle edit toggle operator ************************/
-static struct ParticleSystem *psys_eval_get(
- Depsgraph *depsgraph,
- Object *object,
- ParticleSystem *psys)
-{
- Object *object_eval = DEG_get_evaluated_object(depsgraph, object);
- if (object_eval == object) {
- return psys;
- }
- ParticleSystem *psys_eval = object_eval->particlesystem.first;
- while (psys_eval != NULL) {
- if (psys_eval->orig_psys == psys) {
- return psys_eval;
- }
- psys_eval = psys_eval->next;
- }
- return psys_eval;
-}
-
/* initialize needed data for bake edit */
void PE_create_particle_edit(
Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys)
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index 911a1ce0676..877bfbac953 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit_undo.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -41,7 +33,6 @@
#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -237,7 +228,7 @@ static bool particle_undosys_poll(struct bContext *C)
return (edit != NULL);
}
-static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool particle_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ParticleUndoStep *us = (ParticleUndoStep *)us_p;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -248,7 +239,7 @@ static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void particle_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void particle_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT);
@@ -292,7 +283,6 @@ void ED_particle_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = particle_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(ParticleUndoStep);
diff --git a/source/blender/editors/physics/particle_edit_utildefines.h b/source/blender/editors/physics/particle_edit_utildefines.h
index 1084bb9742a..afdeb5e985c 100644
--- a/source/blender/editors/physics/particle_edit_utildefines.h
+++ b/source/blender/editors/physics/particle_edit_utildefines.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit_utildefines.h
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#ifndef __PARTICLE_EDIT_UTILDEFNIES_H__
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 4619e063dd1..e10df28a75e 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_object.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
@@ -429,10 +423,10 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
- BLI_remlink(&part->dupliweights, dw);
- BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
+ BLI_remlink(&part->instance_weights, dw);
+ BLI_insertlinkbefore(&part->instance_weights, dw->prev, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -467,12 +461,12 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
dw->flag &= ~PART_DUPLIW_CURRENT;
dw = MEM_dupallocN(dw);
dw->flag |= PART_DUPLIW_CURRENT;
- BLI_addhead(&part->dupliweights, dw);
+ BLI_addhead(&part->instance_weights, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -508,15 +502,15 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
- BLI_remlink(&part->dupliweights, dw);
+ BLI_remlink(&part->instance_weights, dw);
MEM_freeN(dw);
break;
}
}
- dw = part->dupliweights.last;
+ dw = part->instance_weights.last;
if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
@@ -554,10 +548,10 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
- BLI_remlink(&part->dupliweights, dw);
- BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
+ BLI_remlink(&part->instance_weights, dw);
+ BLI_insertlinkafter(&part->instance_weights, dw->next, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -669,7 +663,8 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
ot->exec = disconnect_hair_exec;
/* flags */
- ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */
+ /* No REGISTER, redo does not work due to missing update, see T47750. */
+ ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
}
@@ -722,13 +717,7 @@ static bool remap_hair_emitter(
return false;
}
/* don't modify the original vertices */
- BKE_id_copy_ex(
- NULL, &mesh->id, (ID **)&mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&mesh, LIB_ID_COPY_LOCALIZE);
/* BMESH_ONLY, deform dm may not have tessface */
BKE_mesh_tessface_ensure(mesh);
@@ -935,7 +924,8 @@ void PARTICLE_OT_connect_hair(wmOperatorType *ot)
ot->exec = connect_hair_exec;
/* flags */
- ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */
+ /* No REGISTER, redo does not work due to missing update, see T47750. */
+ ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
}
@@ -1103,13 +1093,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd);
psmd->psys = psys;
- BKE_id_copy_ex(
- NULL, &final_mesh->id, (ID **)&psmd->mesh_final,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE);
BKE_mesh_calc_normals(psmd->mesh_final);
BKE_mesh_tessface_ensure(psmd->mesh_final);
@@ -1225,7 +1209,7 @@ void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot)
static const EnumPropertyItem space_items[] = {
{PAR_COPY_SPACE_OBJECT, "OBJECT", 0, "Object", "Copy inside each object's local space"},
{PAR_COPY_SPACE_WORLD, "WORLD", 0, "World", "Copy in world space"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Copy Particle Systems";
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 4279cfd5101..9192d1c2fe9 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_fluid.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <math.h>
@@ -41,15 +33,11 @@
#include "DNA_object_types.h"
#include "DNA_object_fluidsim_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_path_util.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_fluidsim.h"
-#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -69,7 +57,12 @@
/* enable/disable overall compilation */
#ifdef WITH_MOD_FLUID
+#include "BLI_blenlib.h"
+#include "BLI_path_util.h"
+#include "BLI_math.h"
+
#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
@@ -217,7 +210,6 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char
* CHANNEL_VEC:
* frame 1 |frame 2
* [dataX][dataY][dataZ][time][dataX][dataY][dataZ][time]
- *
*/
static void init_time(FluidsimSettings *domainSettings, FluidAnimChannels *channels)
@@ -398,13 +390,6 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
eval_time = domainSettings->bakeStart + i;
- /* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
- * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
- * --> BKE_animsys_evaluate_all_animation(CTX_data_main(C), eval_time);
- * This doesn't work with drivers:
- * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL);
- */
-
/* Modifying the global scene isn't nice, but we can do it in
* this part of the process before a threaded job is created */
scene->r.cfra = (int)eval_time;
@@ -453,7 +438,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
set_channel(fobj->Translation, timeAtFrame, ob->loc, i, CHANNEL_VEC);
set_channel(fobj->Rotation, timeAtFrame, rot_d, i, CHANNEL_VEC);
- set_channel(fobj->Scale, timeAtFrame, ob->size, i, CHANNEL_VEC);
+ set_channel(fobj->Scale, timeAtFrame, ob->scale, i, CHANNEL_VEC);
set_channel(fobj->Active, timeAtFrame, &active, i, CHANNEL_FLOAT);
set_channel(fobj->InitialVelocity, timeAtFrame, &fluidmd->fss->iniVelx, i, CHANNEL_VEC);
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index 3b61c2aad53..c4bcff41b42 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_intern.h
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 421e19d5109..e292a5dbe02 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_ops.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 58bd761a2a9..ab89922e89c 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_pointcache.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -40,13 +32,13 @@
#include "DNA_scene_types.h"
#include "BKE_context.h"
-#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
+#include "DEG_depsgraph.h"
+
#include "ED_particle.h"
#include "WM_api.h"
@@ -288,9 +280,9 @@ void PTCACHE_OT_bake_all(wmOperatorType *ot)
void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free All Physics Bakes";
+ ot->name = "Delete All Physics Bakes";
ot->idname = "PTCACHE_OT_free_bake_all";
- ot->description = "Free all baked caches of all objects in the current scene";
+ ot->description = "Delete all baked caches of all objects in the current scene";
/* api callbacks */
ot->exec = ptcache_free_bake_all_exec;
@@ -346,8 +338,8 @@ void PTCACHE_OT_bake(wmOperatorType *ot)
void PTCACHE_OT_free_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free Physics Bake";
- ot->description = "Free physics bake";
+ ot->name = "Delete Physics Bake";
+ ot->description = "Delete physics bake";
ot->idname = "PTCACHE_OT_free_bake";
/* api callbacks */
@@ -384,10 +376,11 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
PointCache *cache_new = BKE_ptcache_add(pid.ptcaches);
cache_new->step = pid.default_step;
*(pid.cache_ptr) = cache_new;
- }
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_POINT_CACHE);
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ }
return OPERATOR_FINISHED;
}
@@ -404,9 +397,10 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
BLI_remlink(pid.ptcaches, pid.cache);
BKE_ptcache_free(pid.cache);
*(pid.cache_ptr) = pid.ptcaches->first;
- }
- WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index 9583e754f29..ecd77829496 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody_constraint.c
- * \ingroup editor_physics
- * \brief Rigid Body constraint editing operators
+/** \file
+ * \ingroup editor_physics
+ * \brief Rigid Body constraint editing operators
*/
#include <stdlib.h>
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index c8533c2127b..7de20912bb0 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -56,6 +56,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -464,7 +465,7 @@ static rbMaterialDensityItem RB_MATERIAL_DENSITY_TABLE[] = {
{N_("Steel"), 7860.0f},
{N_("Stone"), 2515.0f},
{N_("Stone (Crushed)"), 1602.0f},
- {N_("Timber"), 610.0f}
+ {N_("Timber"), 610.0f},
};
static const int NUM_RB_MATERIAL_PRESETS = sizeof(RB_MATERIAL_DENSITY_TABLE) / sizeof(rbMaterialDensityItem);
@@ -508,6 +509,7 @@ static const EnumPropertyItem *rigidbody_materials_itemf(bContext *UNUSED(C), Po
static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
int material = RNA_enum_get(op->ptr, "material");
float density;
bool changed = false;
@@ -539,10 +541,10 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
/* mass is calculated from the approximate volume of the object,
* and the density of the material we're simulating
*/
-
- if (ob->type == OB_MESH) {
+ Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+ if (ob_eval->type == OB_MESH) {
/* if we have a mesh, determine its volume */
- dm_ob = ob->data;
+ dm_ob = ob_eval->data;
volume = BKE_rigidbody_calc_volume_dm(dm_ob, ob->rigidbody_object, ob);
}
else {
@@ -550,7 +552,7 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
/* else get object boundbox as last resort,
* because fracture modifier can operate on non-mesh objects too
* and there we need a fallback volume of the "whole" object as well*/
- BKE_object_dimensions_get(ob, dim);
+ BKE_object_dimensions_get(ob_eval, dim);
volume = dim[0] * dim[1] * dim[2];
}
@@ -594,7 +596,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
/* properties */
ot->prop = prop = RNA_def_enum(ot->srna, "material",
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index d6ffbb638e0..b9049f79d0c 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody_world.c
- * \ingroup editor_physics
- * \brief Rigid Body world editing operators
+/** \file
+ * \ingroup editor_physics
+ * \brief Rigid Body world editing operators
*/
#include <stdlib.h>
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index ed2e9747d1c..c65cada1cc0 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index 585a7999290..88f6df50420 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_intern.h
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#ifndef __RENDER_INTERN_H__
#define __RENDER_INTERN_H__
-struct bContext;
struct RenderEngine;
-struct wmOperatorType;
struct ScrArea;
+struct bContext;
+struct wmOperatorType;
/* render_shading.c */
void OBJECT_OT_material_slot_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 1ca06beefad..216d9713b6a 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_internal.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -34,7 +29,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
-#include "BLI_rect.h"
#include "BLI_timecode.h"
#include "BLI_math.h"
#include "BLI_threads.h"
@@ -87,9 +81,6 @@
#include "GPU_shader.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -152,7 +143,8 @@ static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibu
/* if renrect argument, we only refresh scanlines */
if (renrect) {
- /* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */
+ /* if (ymax == recty), rendering of layer is ready,
+ * we should not draw, other things happen... */
if (rr->renlay == NULL || renrect->ymax >= rr->recty)
return;
@@ -665,8 +657,9 @@ static void render_endjob(void *rjv)
{
RenderJob *rj = rjv;
- /* this render may be used again by the sequencer without the active 'Render' where the callbacks
- * would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
+ /* this render may be used again by the sequencer without the active
+ * 'Render' where the callbacks would be re-assigned. assign dummy callbacks
+ * to avoid referencing freed renderjobs bug T24508. */
RE_InitRenderCB(rj->re);
if (rj->main != G_MAIN)
@@ -896,7 +889,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
WM_cursor_wait(1);
/* flush sculpt and editmode changes */
- ED_editors_flush_edits(C, true);
+ ED_editors_flush_edits(bmain, true);
/* cleanup sequencer caches before starting user triggered render.
* otherwise, invalidated cache entries can make their way into
@@ -1098,7 +1091,8 @@ void RENDER_OT_shutter_curve_preset(wmOperatorType *ot)
{CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
{CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
ot->name = "Shutter Curve Preset";
ot->description = "Set shutter curve";
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 8006f5071d1..d4312b3d18a 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_opengl.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -329,10 +324,10 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
wmOrtho2(0, sizex, 0, sizey);
GPU_matrix_translate_2f(sizex / 2, sizey / 2);
- G.f |= G_RENDER_OGL;
+ G.f |= G_FLAG_RENDER_VIEWPORT;
ED_gpencil_draw_ex(
view_layer, rv3d, scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ);
- G.f &= ~G_RENDER_OGL;
+ G.f &= ~G_FLAG_RENDER_VIEWPORT;
gp_rect = MEM_mallocN(sizex * sizey * sizeof(unsigned char) * 4, "offscreen rect");
GPU_offscreen_read_pixels(oglrender->ofs, GL_UNSIGNED_BYTE, gp_rect);
@@ -602,11 +597,13 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->prevar = prevar;
if (is_view_context) {
- ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
+ /* so quad view renders camera */
+ ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar);
+
oglrender->rv3d = oglrender->ar->regiondata;
/* MUST be cleared on exit */
- oglrender->scene->customdata_mask_modal = ED_view3d_datamask(oglrender->scene, oglrender->v3d);
+ oglrender->scene->customdata_mask_modal = ED_view3d_datamask(C, oglrender->scene, oglrender->v3d);
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 7961ea27fdc..ad3a5a161ac 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_ops.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index ad2caead1e6..5ea63901085 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_preview.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -55,7 +47,7 @@
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
@@ -69,9 +61,8 @@
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_icons.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_layer.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
@@ -165,10 +156,11 @@ typedef struct ShaderPreview {
/* datablocks with nodes need full copy during preview render, glsl uses it too */
Material *matcopy;
Tex *texcopy;
- Lamp *lampcopy;
+ Light *lampcopy;
World *worldcopy;
- float col[4]; /* active object color */
+ /** Copy of the active objects #Object.color */
+ float color[4];
int sizex, sizey;
unsigned int *pr_rect;
@@ -276,7 +268,7 @@ static const char *preview_collection_name(const char pr_type)
case MA_TEXTURE:
return "Texture";
case MA_LAMP:
- return "Lamp";
+ return "Light";
case MA_SKY:
return "Sky";
case MA_HAIR:
@@ -338,7 +330,7 @@ static ID *duplicate_ids(ID *id, Depsgraph *depsgraph)
case ID_TE:
return (ID *)BKE_texture_localize((Tex *)id_eval);
case ID_LA:
- return (ID *)BKE_lamp_localize((Lamp *)id_eval);
+ return (ID *)BKE_light_localize((Light *)id_eval);
case ID_WO:
return (ID *)BKE_world_localize((World *)id_eval);
case ID_IM:
@@ -452,7 +444,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (base->object->id.name[2] == 'p') {
/* copy over object color, in case material uses it */
- copy_v4_v4(base->object->col, sp->col);
+ copy_v4_v4(base->object->color, sp->color);
if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
@@ -487,20 +479,20 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
}
}
else if (id_type == ID_LA) {
- Lamp *la = NULL, *origla = (Lamp *)id;
+ Light *la = NULL, *origla = (Light *)id;
/* work on a copy */
if (origla) {
BLI_assert(sp->id_copy != NULL);
- la = sp->lampcopy = (Lamp *)sp->id_copy;
+ la = sp->lampcopy = (Light *)sp->id_copy;
sp->id_copy = NULL;
- BLI_addtail(&pr_main->lamp, la);
+ BLI_addtail(&pr_main->light, la);
}
set_preview_collection(sce, view_layer, MA_LAMP);
if (sce->world) {
- /* Only use lighting from the lamp. */
+ /* Only use lighting from the light. */
sce->world->use_nodes = false;
sce->world->horr = 0.0f;
sce->world->horg = 0.0f;
@@ -632,7 +624,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
ID *id = (ID *)idp;
ID *parent = (ID *)parentp;
MTex *slot = (MTex *)slotp;
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ShaderPreview *sp = WM_jobs_customdata(wm, sa);
rcti newrect;
int ok;
@@ -713,7 +705,7 @@ static void shader_preview_updatejob(void *spv)
ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
}
else if (GS(sp->id->name) == ID_LA) {
- Lamp *la = (Lamp *)sp->id;
+ Light *la = (Light *)sp->id;
if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
@@ -920,7 +912,7 @@ static void shader_preview_free(void *customdata)
}
if (sp->lampcopy) {
sp->id_copy = (ID *)sp->lampcopy;
- BLI_remlink(&pr_main->lamp, sp->lampcopy);
+ BLI_remlink(&pr_main->light, sp->lampcopy);
}
if (sp->id_copy) {
/* node previews */
@@ -942,7 +934,7 @@ static void shader_preview_free(void *customdata)
BKE_texture_free((Tex *)sp->id_copy);
break;
case ID_LA:
- BKE_lamp_free((Lamp *)sp->id_copy);
+ BKE_light_free((Light *)sp->id_copy);
break;
case ID_WO:
BKE_world_free((World *)sp->id_copy);
@@ -1372,8 +1364,12 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->pr_main = G_pr_main_grease_pencil;
}
- if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
- else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
+ if (ob && ob->totcol) {
+ copy_v4_v4(sp->color, ob->color);
+ }
+ else {
+ ARRAY_SET_ITEMS(sp->color, 0.0f, 0.0f, 0.0f, 1.0f);
+ }
/* setup job */
WM_jobs_customdata_set(wm_job, sp, shader_preview_free);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index c4effd3a523..d1bed15872d 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_shading.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
@@ -32,7 +26,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
@@ -106,9 +100,9 @@
static Object **object_array_for_shading(bContext *C, uint *r_objects_len)
{
ScrArea *sa = CTX_wm_area(C);
- SpaceButs *sbuts = NULL;
+ SpaceProperties *sbuts = NULL;
View3D *v3d = NULL;
- if (sa->spacetype == SPACE_BUTS) {
+ if (sa->spacetype == SPACE_PROPERTIES) {
sbuts = sa->spacedata.first;
}
else if (sa->spacetype == SPACE_VIEW3D) {
@@ -499,7 +493,7 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot)
static const EnumPropertyItem material_slot_move[] = {
{1, "UP", 0, "Up", ""},
{-1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -523,29 +517,42 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
+ /* hook into UI */
+ UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
+
+ Object *ob = (prop && RNA_struct_is_a(ptr.type, &RNA_Object)) ? ptr.data : NULL;
+
/* add or copy material */
if (ma) {
- ma = BKE_material_copy(bmain, ma);
+ Material *new_ma = NULL;
+ BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
+ ma = new_ma;
}
else {
- if ((!ob) || (ob->type != OB_GPENCIL)) {
- ma = BKE_material_add(bmain, DATA_("Material"));
+ const char *name = DATA_("Material");
+ if (!(ob != NULL && ob->type == OB_GPENCIL)) {
+ ma = BKE_material_add(bmain, name);
}
else {
- ma = BKE_material_add_gpencil(bmain, DATA_("Material"));
+ ma = BKE_material_add_gpencil(bmain, name);
}
ED_node_shader_default(C, &ma->id);
ma->use_nodes = true;
}
- /* hook into UI */
- UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
if (prop) {
+ if (ob != NULL) {
+ /* Add slot follows user-preferences for creating new slots,
+ * RNA pointer assignment doesn't, see: T60014. */
+ if (give_current_material_p(ob, ob->actcol) == NULL) {
+ BKE_object_material_slot_add(bmain, ob);
+ }
+ }
+
/* when creating new ID blocks, use is already 1, but RNA
* pointer use also increases user, so this compensates it */
id_us_min(&ma->id);
@@ -707,6 +714,12 @@ void SCENE_OT_view_layer_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
+static bool view_layer_remove_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ return (scene->view_layers.first != scene->view_layers.last);
+}
+
static int view_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
@@ -731,6 +744,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_layer_remove_exec;
+ ot->poll = view_layer_remove_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -854,7 +868,7 @@ void SCENE_OT_light_cache_bake(wmOperatorType *ot)
{LIGHTCACHE_SUBSET_DIRTY, "DIRTY", 0, "Dirty Only", "Only bake lightprobes that are marked as dirty"},
{LIGHTCACHE_SUBSET_CUBE, "CUBEMAPS", 0, "Cubemaps Only", "Try to only bake reflection cubemaps if irradiance "
"grids are up to date"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -909,9 +923,9 @@ static int light_cache_free_exec(bContext *C, wmOperator *UNUSED(op))
void SCENE_OT_light_cache_free(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free Light Cache";
+ ot->name = "Delete Light Cache";
ot->idname = "SCENE_OT_light_cache_free";
- ot->description = "Free cached indirect lighting";
+ ot->description = "Delete cached indirect lighting";
/* api callbacks */
ot->exec = light_cache_free_exec;
@@ -1083,7 +1097,7 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1241,7 +1255,7 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1610,7 +1624,7 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1713,7 +1727,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
static const EnumPropertyItem slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1758,7 +1772,8 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
ot->exec = copy_material_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the material */
+ /* no undo needed since no changes are made to the material */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
}
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1770,6 +1785,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
paste_matcopybuf(CTX_data_main(C), ma);
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
@@ -1890,7 +1906,8 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot)
ot->poll = copy_mtex_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the mtex */
+ /* no undo needed since no changes are made to the mtex */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
}
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1899,7 +1916,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
if (id == NULL) {
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- Lamp *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data;
+ Light *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data;
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
ParticleSystem *psys = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
FreestyleLineStyle *linestyle = CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data;
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index c42eda678ba..6e6154e638a 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,20 +14,16 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_update.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
#include <string.h>
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
@@ -150,7 +144,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
.view_layer = view_layer,
.ar = ar,
.v3d = (View3D *)sa->spacedata.first,
- .engine_type = engine_type
+ .engine_type = engine_type,
}));
}
}
@@ -210,39 +204,15 @@ void ED_render_engine_changed(Main *bmain)
* editor level updates when the ID changes. when these ID blocks are in *
* the dependency graph, we can get rid of the manual dependency checks */
-static void render_engine_flag_changed(Main *bmain, int update_flag)
-{
- bScreen *sc;
- ScrArea *sa;
- ARegion *ar;
-
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- if (sa->spacetype != SPACE_VIEW3D)
- continue;
-
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- RegionView3D *rv3d;
-
- if (ar->regiontype != RGN_TYPE_WINDOW)
- continue;
-
- rv3d = ar->regiondata;
- if (rv3d->render_engine)
- rv3d->render_engine->update_flag |= update_flag;
-
- }
- }
- }
-}
-
static void material_changed(Main *UNUSED(bmain), Material *ma)
{
+ BKE_texpaint_slot_refresh_cache(ma);
+
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&ma->id));
}
-static void lamp_changed(Main *UNUSED(bmain), Lamp *la)
+static void lamp_changed(Main *UNUSED(bmain), Light *la)
{
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&la->id));
@@ -298,7 +268,7 @@ static void scene_changed(Main *bmain, Scene *scene)
/* glsl */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
- BKE_texpaint_slots_refresh_object(scene, ob);
+ BKE_texpaint_slots_refresh_object(ob);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
}
}
@@ -317,7 +287,6 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
switch (GS(id->name)) {
case ID_MA:
material_changed(bmain, (Material *)id);
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_MA);
break;
case ID_TE:
texture_changed(bmain, (Tex *)id);
@@ -326,17 +295,15 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
world_changed(bmain, (World *)id);
break;
case ID_LA:
- lamp_changed(bmain, (Lamp *)id);
+ lamp_changed(bmain, (Light *)id);
break;
case ID_IM:
image_changed(bmain, (Image *)id);
break;
case ID_SCE:
scene_changed(bmain, (Scene *)id);
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
break;
default:
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
break;
}
}
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 12f9c8f40c1..1d7022c5263 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_view.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <string.h>
@@ -66,7 +61,7 @@ static ScrArea *biggest_non_image_area(bContext *C)
for (sa = sc->areabase.first; sa; sa = sa->next) {
if (sa->winx > 30 && sa->winy > 30) {
size = sa->winx * sa->winy;
- if (!sa->full && sa->spacetype == SPACE_BUTS) {
+ if (!sa->full && sa->spacetype == SPACE_PROPERTIES) {
if (foundwin == 0 && size > bwmaxsize) {
bwmaxsize = size;
big = sa;
diff --git a/source/blender/editors/scene/CMakeLists.txt b/source/blender/editors/scene/CMakeLists.txt
index 9fbebbc58cc..7f496cad060 100644
--- a/source/blender/editors/scene/CMakeLists.txt
+++ b/source/blender/editors/scene/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index 0553e223c55..b226af46757 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/scene/scene_edit.c
- * \ingroup edscene
+/** \file
+ * \ingroup edscene
*/
#include <stdio.h>
@@ -78,7 +74,7 @@ Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod me
ED_object_single_users(bmain, scene_new, false, true);
}
else if (method == SCE_COPY_FULL) {
- ED_editors_flush_edits(C, false);
+ ED_editors_flush_edits(bmain, false);
ED_object_single_users(bmain, scene_new, true, true);
}
}
@@ -115,7 +111,7 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene)
id_us_clear_real(&scene->id);
if (scene->id.us == 0) {
- BKE_libblock_free(bmain, scene);
+ BKE_id_free(bmain, scene);
}
return true;
@@ -219,7 +215,7 @@ static void SCENE_OT_new(wmOperatorType *ot)
{SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene"},
{SCE_COPY_LINK_DATA, "LINK_OBJECT_DATA", 0, "Link Object Data", "Copy objects linked to data from the current scene"},
{SCE_COPY_FULL, "FULL_COPY", 0, "Full Copy", "Make a full copy of the current scene"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -238,6 +234,12 @@ static void SCENE_OT_new(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
+static bool scene_delete_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ return (scene->id.prev || scene->id.next);
+}
+
static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
@@ -263,6 +265,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->exec = scene_delete_exec;
+ ot->poll = scene_delete_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index e01be2ed709..810adba3288 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index a01eaa2b5a4..27b97776503 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/area.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -43,6 +36,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_image.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@@ -187,52 +181,6 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
}
/**
- * Action zones are only updated if the mouse is inside of them, but in some cases (currently only fullscreen icon)
- * it might be needed to update their properties and redraw if the mouse isn't inside.
- */
-void ED_area_azones_update(ScrArea *sa, const int mouse_xy[2])
-{
- AZone *az;
- bool changed = false;
-
- for (az = sa->actionzones.first; az; az = az->next) {
- if (az->type == AZONE_FULLSCREEN) {
- /* only if mouse is not hovering the azone */
- if (BLI_rcti_isect_pt_v(&az->rect, mouse_xy) == false) {
- az->alpha = 0.0f;
- changed = true;
-
- /* can break since currently only this is handled here */
- break;
- }
- }
- else if (az->type == AZONE_REGION_SCROLL) {
- /* only if mouse is not hovering the azone */
- if (BLI_rcti_isect_pt_v(&az->rect, mouse_xy) == false) {
- View2D *v2d = &az->ar->v2d;
-
- if (az->direction == AZ_SCROLL_VERT) {
- az->alpha = v2d->alpha_vert = 0;
- changed = true;
- }
- else if (az->direction == AZ_SCROLL_HOR) {
- az->alpha = v2d->alpha_hor = 0;
- changed = true;
- }
- else {
- BLI_assert(0);
- }
- }
- }
- }
-
- if (changed) {
- sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
- ED_area_tag_redraw_no_rebuild(sa);
- }
-}
-
-/**
* \brief Corner widget use for quitting fullscreen.
*/
static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, float alpha)
@@ -256,7 +204,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f
* The click_rect is the same as defined in fullscreen_click_rcti_init
* Keep them both in sync */
- if (G.debug_value == 1) {
+ if (G.debug_value == 101) {
rcti click_rect;
float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
@@ -412,18 +360,11 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
}
else if (az->type == AZONE_FULLSCREEN) {
area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, az->alpha);
-
- if (az->alpha != 0.0f) {
- area_azone_tag_update(sa);
- }
- }
- else if (az->type == AZONE_REGION_SCROLL) {
- if (az->alpha != 0.0f) {
- area_azone_tag_update(sa);
- }
- /* Don't draw this azone. */
}
}
+ if (!IS_EQF(az->alpha, 0.0f) && ELEM(az->type, AZONE_FULLSCREEN, AZONE_REGION_SCROLL)) {
+ area_azone_tag_update(sa);
+ }
}
GPU_matrix_pop();
@@ -811,25 +752,25 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
float coords[4][4] = {
/* Bottom-left. */
- {sa->totrct.xmin,
- sa->totrct.ymin,
- sa->totrct.xmin + (AZONESPOT - 1),
- sa->totrct.ymin + (AZONESPOT - 1)},
+ {sa->totrct.xmin - U.pixelsize,
+ sa->totrct.ymin - U.pixelsize,
+ sa->totrct.xmin + AZONESPOTW,
+ sa->totrct.ymin + AZONESPOTH},
/* Bottom-right. */
- {sa->totrct.xmax - (AZONESPOT - 1),
- sa->totrct.ymin,
- sa->totrct.xmax,
- sa->totrct.ymin + (AZONESPOT - 1)},
+ {sa->totrct.xmax - AZONESPOTW,
+ sa->totrct.ymin - U.pixelsize,
+ sa->totrct.xmax + U.pixelsize,
+ sa->totrct.ymin + AZONESPOTH},
/* Top-left. */
- {sa->totrct.xmin,
- sa->totrct.ymax - (AZONESPOT - 1),
- sa->totrct.xmin + (AZONESPOT - 1),
- sa->totrct.ymax},
+ {sa->totrct.xmin - U.pixelsize,
+ sa->totrct.ymax - AZONESPOTH,
+ sa->totrct.xmin + AZONESPOTW,
+ sa->totrct.ymax + U.pixelsize},
/* Top-right. */
- {sa->totrct.xmax - (AZONESPOT - 1),
- sa->totrct.ymax - (AZONESPOT - 1),
- sa->totrct.xmax,
- sa->totrct.ymax}};
+ {sa->totrct.xmax - AZONESPOTW,
+ sa->totrct.ymax - AZONESPOTH,
+ sa->totrct.xmax + U.pixelsize,
+ sa->totrct.ymax + U.pixelsize}};
for (int i = 0; i < 4; i++) {
/* can't click on bottom corners on OS X, already used for resizing */
@@ -957,12 +898,26 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
+static bool region_azone_edge_poll(const ARegion *ar, const bool is_fullscreen)
+{
+ const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
+
+ if (is_hidden && is_fullscreen) {
+ return false;
+ }
+ if (!is_hidden && ar->regiontype == RGN_TYPE_HEADER) {
+ return false;
+ }
+
+ return true;
+}
+
static void region_azone_edge_initialize(ScrArea *sa, ARegion *ar, AZEdge edge, const bool is_fullscreen)
{
AZone *az = NULL;
const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
- if (is_hidden && is_fullscreen) {
+ if (!region_azone_edge_poll(ar, is_fullscreen)) {
return;
}
@@ -975,7 +930,7 @@ static void region_azone_edge_initialize(ScrArea *sa, ARegion *ar, AZEdge edge,
if (is_hidden) {
region_azone_tab_plus(sa, az, ar);
}
- else if (!is_hidden && (ar->regiontype != RGN_TYPE_HEADER)) {
+ else {
region_azone_edge(az, ar);
}
}
@@ -1150,7 +1105,7 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
return true;
}
}
- else if (ELEM(spacetype, SPACE_VIEW3D, SPACE_SEQ, SPACE_IMAGE)) {
+ else if (ELEM(spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
if (ELEM(regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS)) {
return true;
}
@@ -1236,8 +1191,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
max_ii(0, BLI_rcti_size_y(overlap_remainder) - UI_UNIT_Y / 2));
ar->winrct.xmin = overlap_remainder_margin.xmin;
ar->winrct.ymin = overlap_remainder_margin.ymin;
- ar->winrct.xmax = ar->winrct.xmin + ar->sizex - 1;
- ar->winrct.ymax = ar->winrct.ymin + ar->sizey - 1;
+ ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
+ ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, &ar->winrct);
@@ -1519,6 +1474,9 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ARegion *ar, L
WM_gizmomap_add_handlers(ar, ar->gizmo_map);
}
}
+ if (flag & ED_KEYMAP_TOOL) {
+ WM_event_add_keymap_handler_dynamic(&ar->handlers, WM_event_get_keymap_from_toolsystem, sa);
+ }
if (flag & ED_KEYMAP_VIEW2D) {
/* 2d-viewport handling+manipulation */
wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "View2D", 0, 0);
@@ -1591,6 +1549,7 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
if (!(area->flag & AREA_FLAG_REGION_SIZE_UPDATE)) {
return;
}
+ const bScreen *screen = WM_window_get_active_screen(win);
WM_window_rect_calc(win, &window_rect);
area_calc_totrct(area, &window_rect);
@@ -1600,6 +1559,9 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
overlap_rect = rect;
region_rect_recursive(area, area->regionbase.first, &rect, &overlap_rect, 0);
+ /* Dynamically sized regions may have changed region sizes, so we have to force azone update. */
+ area_azone_initialize(win, screen, area);
+
for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
region_subwindow(ar);
@@ -1607,7 +1569,11 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
if (ar->type->init) {
ar->type->init(wm, ar);
}
+
+ /* Some AZones use View2D data which is only updated in region init, so call that first! */
+ region_azones_add(screen, area, ar, ar->alignment & ~RGN_SPLIT_PREV);
}
+ ED_area_azones_update(area, &win->eventstate->x);
area->flag &= ~AREA_FLAG_REGION_SIZE_UPDATE;
}
@@ -2294,8 +2260,8 @@ void ED_region_panels_layout_ex(
Panel *panel = ar->panels.last;
if (panel != NULL) {
int size_dyn[2] = {
- UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14),
- UI_panel_size_y(panel),
+ UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14) / UI_DPI_FAC,
+ UI_panel_size_y(panel) / UI_DPI_FAC,
};
/* region size is layout based and needs to be updated */
if ((ar->sizex != size_dyn[0]) ||
@@ -2305,7 +2271,7 @@ void ED_region_panels_layout_ex(
ar->sizey = size_dyn[1];
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
- y = ABS(ar->sizey - 1);
+ y = ABS(ar->sizey * UI_DPI_FAC - 1);
}
}
else if (vertical) {
@@ -2372,6 +2338,9 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
/* set the view */
UI_view2d_view_ortho(v2d);
+ /* View2D matrix might have changed due to dynamic sized regions. */
+ UI_blocklist_update_window_matrix(C, &ar->uiblocks);
+
/* draw panels */
UI_panels_draw(C, ar);
@@ -2535,10 +2504,10 @@ void ED_region_header_init(ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
-/* UI_UNIT_Y is defined as U variable now, depending dpi */
int ED_area_headersize(void)
{
- return (int)(HEADERY * UI_DPI_FAC);
+ /* Accomodate widget and padding. */
+ return U.widget_unit + (int)(UI_DPI_FAC * HEADER_PADDING_Y);
}
int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback)
@@ -2706,7 +2675,7 @@ static const char *meta_data_list[] =
"Time",
"Frame",
"Camera",
- "Scene"
+ "Scene",
};
BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int offset)
@@ -2714,6 +2683,45 @@ BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int off
return (IMB_metadata_get_field(ibuf->metadata, meta_data_list[index], r_str + offset, MAX_METADATA_STR - offset) && r_str[0]);
}
+BLI_INLINE bool metadata_is_custom_drawable(const char *field)
+{
+ /* Metadata field stored by Blender for multilayer EXR images. Is rather
+ * useless to be viewed all the time. Can still be seen in the Metadata
+ * panel. */
+ if (STREQ(field, "BlenderMultiChannel")) {
+ return false;
+ }
+ /* Is almost always has value "scanlineimage", also useless to be seen
+ * all the time. */
+ if (STREQ(field, "type")) {
+ return false;
+ }
+ return !BKE_stamp_is_known_field(field);
+}
+
+typedef struct MetadataCustomDrawContext {
+ int fontid;
+ int xmin, ymin;
+ int vertical_offset;
+ int current_y;
+} MetadataCustomDrawContext;
+
+static void metadata_custom_draw_fields(
+ const char *field,
+ const char *value,
+ void *ctx_v)
+{
+ if (!metadata_is_custom_drawable(field)) {
+ return;
+ }
+ MetadataCustomDrawContext *ctx = (MetadataCustomDrawContext *)ctx_v;
+ char temp_str[MAX_METADATA_STR];
+ BLI_snprintf(temp_str, MAX_METADATA_STR, "%s: %s", field, value);
+ BLF_position(ctx->fontid, ctx->xmin, ctx->ymin + ctx->current_y, 0.0f);
+ BLF_draw(ctx->fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
+ ctx->current_y += ctx->vertical_offset;
+}
+
static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const bool is_top)
{
char temp_str[MAX_METADATA_STR];
@@ -2788,11 +2796,20 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
}
}
else {
+ MetadataCustomDrawContext ctx;
+ ctx.fontid = fontid;
+ ctx.xmin = xmin;
+ ctx.ymin = ymin;
+ ctx.vertical_offset = vertical_offset;
+ ctx.current_y = ofs_y;
+ ctx.vertical_offset = vertical_offset;
+ IMB_metadata_foreach(ibuf, metadata_custom_draw_fields, &ctx);
int ofs_x = 0;
+ ofs_y = ctx.current_y;
for (i = 5; i < 10; i++) {
len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i]);
if (metadata_is_valid(ibuf, temp_str, i, len)) {
- BLF_position(fontid, xmin + ofs_x, ymin, 0.0f);
+ BLF_position(fontid, xmin + ofs_x, ymin + ofs_y, 0.0f);
BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X;
@@ -2801,6 +2818,23 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
}
}
+typedef struct MetadataCustomCountContext {
+ int count;
+} MetadataCustomCountContext;
+
+static void metadata_custom_count_fields(
+ const char *field,
+ const char *UNUSED(value),
+ void *ctx_v)
+{
+ if (!metadata_is_custom_drawable(field)) {
+ return;
+ }
+ MetadataCustomCountContext *ctx = (MetadataCustomCountContext *)ctx_v;
+ ctx->count++;
+}
+
+
static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
{
const float height = BLF_height_max(fontid);
@@ -2838,8 +2872,13 @@ static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
for (i = 5; i < 10; i++) {
if (metadata_is_valid(ibuf, str, i, 0)) {
count = 1;
+ break;
}
}
+ MetadataCustomCountContext ctx;
+ ctx.count = 0;
+ IMB_metadata_foreach(ibuf, metadata_custom_count_fields, &ctx);
+ count += ctx.count;
}
if (count) {
@@ -2922,6 +2961,28 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
GPU_matrix_pop();
}
+typedef struct MetadataPanelDrawContext {
+ uiLayout *layout;
+} MetadataPanelDrawContext;
+
+static void metadata_panel_draw_field(
+ const char *field,
+ const char *value,
+ void *ctx_v)
+{
+ MetadataPanelDrawContext *ctx = (MetadataPanelDrawContext *)ctx_v;
+ uiLayout *row = uiLayoutRow(ctx->layout, false);
+ uiItemL(row, field, ICON_NONE);
+ uiItemL(row, value, ICON_NONE);
+}
+
+void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
+{
+ MetadataPanelDrawContext ctx;
+ ctx.layout = layout;
+ IMB_metadata_foreach(ibuf, metadata_panel_draw_field, &ctx);
+}
+
void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
{
float gridsize, gridstep = 1.0f / 32.0f;
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c
index 53e2f96d6c4..2137d98d226 100644
--- a/source/blender/editors/screen/area_utils.c
+++ b/source/blender/editors/screen/area_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/area_utils.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*
* Helper functions for area/region API.
*/
@@ -29,8 +25,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BKE_context.h"
-
#include "RNA_access.h"
#include "RNA_types.h"
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 728df79fbbd..c96b7f04284 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/glutil.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -36,13 +30,11 @@
#include "DNA_userdef_types.h"
#include "DNA_vec_types.h"
-#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "IMB_colormanagement.h"
@@ -147,7 +139,7 @@ static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
/* To be used before calling immDrawPixelsTex
* Default shader is GPU_SHADER_2D_IMAGE_COLOR
* You can still set uniforms with :
- * GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);
+ * GPU_shader_uniform_int(shader, GPU_shader_get_uniform_ensure(shader, "name"), 0);
* */
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
{
@@ -241,7 +233,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
/* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
* it does not need color.
*/
- if (state->shader != NULL && GPU_shader_get_uniform(state->shader, "color") != -1) {
+ if (state->shader != NULL && GPU_shader_get_uniform_ensure(state->shader, "color") != -1) {
immUniformColor4fv((color) ? color : white);
}
@@ -349,6 +341,34 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
/* *************** glPolygonOffset hack ************* */
+float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist)
+{
+ if (winmat[15] > 0.5f) {
+#if 1
+ return 0.00001f * dist * viewdist; // ortho tweaking
+#else
+ static float depth_fac = 0.0f;
+ if (depth_fac == 0.0f) {
+ int depthbits;
+ glGetIntegerv(GL_DEPTH_BITS, &depthbits);
+ depth_fac = 1.0f / (float)((1 << depthbits) - 1);
+ }
+ offs = (-1.0 / winmat[10]) * dist * depth_fac;
+
+ UNUSED_VARS(viewdist);
+#endif
+ }
+ else {
+ /* This adjustment effectively results in reducing the Z value by 0.25%.
+ *
+ * winmat[14] actually evaluates to `-2 * far * near / (far - near)`,
+ * is very close to -0.2 with default clip range, and is used as the coefficient multiplied by `w / z`,
+ * thus controlling the z dependent part of the depth value.
+ */
+ return winmat[14] * -0.0025f * dist;
+ }
+}
+
/**
* \note \a viewdist is only for ortho at the moment.
*/
@@ -357,8 +377,6 @@ void bglPolygonOffset(float viewdist, float dist)
static float winmat[16], offset = 0.0f;
if (dist != 0.0f) {
- float offs;
-
// glEnable(GL_POLYGON_OFFSET_FILL);
// glPolygonOffset(-1.0, -1.0);
@@ -367,30 +385,7 @@ void bglPolygonOffset(float viewdist, float dist)
/* dist is from camera to center point */
- if (winmat[15] > 0.5f) {
-#if 1
- offs = 0.00001f * dist * viewdist; // ortho tweaking
-#else
- static float depth_fac = 0.0f;
- if (depth_fac == 0.0f) {
- int depthbits;
- glGetIntegerv(GL_DEPTH_BITS, &depthbits);
- depth_fac = 1.0f / (float)((1 << depthbits) - 1);
- }
- offs = (-1.0 / winmat[10]) * dist * depth_fac;
-
- UNUSED_VARS(viewdist);
-#endif
- }
- else {
- /* This adjustment effectively results in reducing the Z value by 0.25%.
- *
- * winmat[14] actually evaluates to `-2 * far * near / (far - near)`,
- * is very close to -0.2 with default clip range, and is used as the coefficient multiplied by `w / z`,
- * thus controlling the z dependent part of the depth value.
- */
- offs = winmat[14] * -0.0025f * dist;
- }
+ float offs = bglPolygonOffsetCalc(winmat, viewdist, dist);
winmat[14] -= offs;
offset += offs;
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 15d9b3c5ccb..31b1be2d8b3 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_context.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdio.h>
@@ -51,10 +46,8 @@
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_paint.h"
-#include "BKE_main.h"
#include "BKE_gpencil.h"
#include "BKE_layer.h"
-#include "BKE_screen.h"
#include "BKE_sequencer.h"
#include "BKE_workspace.h"
@@ -111,26 +104,17 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_objects")) {
- FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_VISIBLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
+ }
}
- FOREACH_VISIBLE_BASE_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selectable_objects")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (v3d && v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_select & (1 << base->object->type)) != 0)) {
- continue;
- }
- if (((base->flag & BASE_VISIBLE) != 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
+ if (BASE_SELECTABLE(v3d, base)) {
CTX_data_id_list_add(result, &base->object->id);
}
}
@@ -138,58 +122,45 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_objects")) {
- FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_SELECTED(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
+ }
}
- FOREACH_SELECTED_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selected_editable_objects")) {
- FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- if (0 == BKE_object_is_libdata(ob)) {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
}
}
- FOREACH_SELECTED_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "editable_objects")) {
/* Visible + Editable, but not necessarily selected */
- FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- if (0 == BKE_object_is_libdata(ob)) {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_EDITABLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
}
}
- FOREACH_VISIBLE_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if ( CTX_data_equals(member, "visible_bases")) {
- FOREACH_VISIBLE_BASE_BEGIN(view_layer, v3d, base)
- {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_VISIBLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+ }
}
- FOREACH_VISIBLE_BASE_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selectable_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (v3d && v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_select & (1 << base->object->type)) != 0)) {
- continue;
- }
- if ((base->flag & BASE_VISIBLE) && (base->flag & BASE_SELECTABLE) != 0) {
+ if (BASE_SELECTABLE(v3d, base)) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
@@ -198,13 +169,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selected_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (v3d && v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
- continue;
- }
- if ((base->flag & BASE_SELECTED) != 0) {
+ if (BASE_SELECTED(v3d, base)) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
@@ -213,16 +178,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selected_editable_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (v3d && v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
- continue;
- }
- if ((base->flag & BASE_SELECTED) != 0) {
- if (0 == BKE_object_is_libdata(base->object)) {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
- }
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -231,16 +188,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
else if (CTX_data_equals(member, "editable_bases")) {
/* Visible + Editable, but not necessarily selected */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (v3d && v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- continue;
- }
- if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
- continue;
- }
- if ((base->flag & BASE_VISIBLE) != 0) {
- if (0 == BKE_object_is_libdata(base->object)) {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
- }
+ if (BASE_EDITABLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -295,7 +244,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
- /* if we're filtering for editable too, use the check for that instead, as it has selection check too */
+ /* if we're filtering for editable too, use the check for that instead,
+ * as it has selection check too */
if (editable_bones) {
/* only selected + editable */
if (EBONE_EDITABLE(ebone)) {
@@ -346,7 +296,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
- /* if we're filtering for editable too, use the check for that instead, as it has selection check too */
+ /* if we're filtering for editable too, use the check for that instead,
+ * as it has selection check too */
if (selected_editable_bones) {
/* only selected + editable */
if (EBONE_EDITABLE(ebone)) {
@@ -714,12 +665,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
else if (CTX_data_equals(member, "selected_editable_fcurves")) {
bAnimContext ac;
- if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_GRAPH)) {
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS | ANIMFILTER_SEL) |
- (ac.spacetype == SPACE_IPO ? ANIMFILTER_CURVE_VISIBLE : ANIMFILTER_LIST_VISIBLE);
+ (ac.spacetype == SPACE_GRAPH ? ANIMFILTER_CURVE_VISIBLE : ANIMFILTER_LIST_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index ca3707786dd..84eb723a43d 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_draw.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include "ED_screen.h"
@@ -564,7 +560,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2
.xmin = sa->totrct.xmin * scale[0] + ofs_h,
.xmax = sa->totrct.xmax * scale[0] - ofs_h,
.ymin = sa->totrct.ymin * scale[1] + ofs_h,
- .ymax = sa->totrct.ymax * scale[1] - ofs_h
+ .ymax = sa->totrct.ymax * scale[1] - ofs_h,
};
immBegin(GPU_PRIM_TRI_FAN, 4);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 62d60c39c0c..8bf1ca1a6c8 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -38,7 +33,6 @@
#include "DNA_workspace_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -48,7 +42,6 @@
#include "BKE_image.h"
#include "BKE_layer.h"
#include "BKE_library.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_screen.h"
@@ -477,7 +470,7 @@ void ED_screens_initialize(Main *bmain, wmWindowManager *wm)
for (win = wm->windows.first; win; win = win->next) {
if (BKE_workspace_active_get(win->workspace_hook) == NULL) {
- BKE_workspace_active_set(win->workspace_hook, bmain->workspaces.first);
+ BKE_workspace_active_set(win->workspace_hook, bmain->workspace.first);
}
ED_screen_refresh(wm, win);
@@ -485,6 +478,12 @@ void ED_screens_initialize(Main *bmain, wmWindowManager *wm)
ED_screen_set_active_region(NULL, win, &win->eventstate->x);
}
}
+
+ if (U.uiflag & USER_HEADER_FROM_PREF) {
+ for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ BKE_screen_header_alignment_reset(screen);
+ }
+ }
}
void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *screen)
@@ -639,7 +638,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
ED_screen_areas_iter(win, scr, area_iter) {
if (xy[0] > area_iter->totrct.xmin && xy[0] < area_iter->totrct.xmax) {
if (xy[1] > area_iter->totrct.ymin && xy[1] < area_iter->totrct.ymax) {
- if (ED_area_actionzone_refresh_xy(area_iter, xy) == NULL) {
+ if (ED_area_azones_update(area_iter, xy) == NULL) {
sa = area_iter;
break;
}
@@ -1251,7 +1250,7 @@ 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_TOOLS, RGN_TYPE_NAV_BAR)) {
+ if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_HEADER, RGN_TYPE_TOOLS, RGN_TYPE_NAV_BAR, RGN_TYPE_EXECUTE)) {
ar->flag |= RGN_FLAG_HIDDEN;
}
}
@@ -1347,7 +1346,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
if (sa)
spacetype = sa->spacetype;
- sad->from_anim_edit = (ELEM(spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA));
+ sad->from_anim_edit = (ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA));
screen->animtimer->customdata = sad;
diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c
index 5d87479e371..68fd28013f8 100644
--- a/source/blender/editors/screen/screen_geometry.c
+++ b/source/blender/editors/screen/screen_geometry.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_geometry.c
- * \ingroup edscr
- * \brief Functions for screen vertices and edges
+/** \file
+ * \ingroup edscr
+ * \brief Functions for screen vertices and edges
*
* Screen geometry refers to the vertices (ScrVert) and edges (ScrEdge) through
* which the flexible screen-layout system of Blender is established.
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 87bcd1b7006..cb400bb3734 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,34 +15,29 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_intern.h
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#ifndef __SCREEN_INTERN_H__
#define __SCREEN_INTERN_H__
+struct Main;
struct bContext;
struct bContextDataResult;
-struct Main;
/* internal exports only */
-#define AZONESPOT (0.4f * U.widget_unit)
+#define AZONESPOTW UI_HEADER_OFFSET /* width of corner azone - max */
+#define AZONESPOTH (0.6f * U.widget_unit) /* height of corner azone */
#define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally visible */
#define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */
/* area.c */
void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free);
void ED_area_data_swap(ScrArea *sa1, ScrArea *sa2);
-void screen_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *area);
void region_toggle_hidden(struct bContext *C, ARegion *ar, const bool do_fade);
/* screen_edit.c */
@@ -58,7 +51,6 @@ int screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, Scr
int area_getorientation(ScrArea *sa, ScrArea *sb);
struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
-struct AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2]);
/* screen_geometry.c */
int screen_geom_area_height(const ScrArea *area);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 185c0d1cc77..83004da0ce9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_ops.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -211,7 +206,7 @@ bool ED_operator_animview_active(bContext *C)
{
if (ED_operator_areaactive(C)) {
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO)))
+ if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)))
return true;
}
@@ -249,7 +244,7 @@ bool ED_operator_action_active(bContext *C)
bool ED_operator_buttons_active(bContext *C)
{
- return ed_spacetype_test(C, SPACE_BUTS);
+ return ed_spacetype_test(C, SPACE_PROPERTIES);
}
bool ED_operator_node_active(bContext *C)
@@ -274,7 +269,7 @@ bool ED_operator_node_editable(bContext *C)
bool ED_operator_graphedit_active(bContext *C)
{
- return ed_spacetype_test(C, SPACE_IPO);
+ return ed_spacetype_test(C, SPACE_GRAPH);
}
bool ED_operator_sequencer_active(bContext *C)
@@ -650,15 +645,17 @@ typedef struct sActionzoneData {
static bool actionzone_area_poll(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- ScrArea *sa = CTX_wm_area(C);
+ bScreen *screen = WM_window_get_active_screen(win);
- if (sa && win && win->eventstate) {
+ if (screen && win && win->eventstate) {
const int *xy = &win->eventstate->x;
AZone *az;
- for (az = sa->actionzones.first; az; az = az->next)
- if (BLI_rcti_isect_pt_v(&az->rect, xy))
- return 1;
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (az = sa->actionzones.first; az; az = az->next)
+ if (BLI_rcti_isect_pt_v(&az->rect, xy))
+ return 1;
+ }
}
return 0;
}
@@ -688,11 +685,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
for (az = sa->actionzones.first; az; az = az->next) {
if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
if (az->type == AZONE_AREA) {
- /* no triangle intersect but a hotspot circle based on corner */
- int radius_sq = SQUARE(xy[0] - az->x1) + SQUARE(xy[1] - az->y1);
- if (radius_sq <= SQUARE(AZONESPOT)) {
- break;
- }
+ break;
}
else if (az->type == AZONE_REGION) {
break;
@@ -713,7 +706,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
else {
const int mouse_sq = SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2);
- const int spot_sq = SQUARE(AZONESPOT);
+ const int spot_sq = SQUARE(AZONESPOTW);
const int fadein_sq = SQUARE(AZONEFADEIN);
const int fadeout_sq = SQUARE(AZONEFADEOUT);
@@ -802,17 +795,68 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
}
}
+ else if (!test_only && !IS_EQF(az->alpha, 0.0f)) {
+ bool changed = false;
+
+ if (az->type == AZONE_FULLSCREEN) {
+ az->alpha = 0.0f;
+ changed = true;
+ }
+ else if (az->type == AZONE_REGION_SCROLL) {
+ if (az->direction == AZ_SCROLL_VERT) {
+ az->alpha = az->ar->v2d.alpha_vert = 0;
+ changed = true;
+ }
+ else if (az->direction == AZ_SCROLL_HOR) {
+ az->alpha = az->ar->v2d.alpha_hor = 0;
+ changed = true;
+ }
+ else {
+ BLI_assert(0);
+ }
+ }
+
+ if (changed) {
+ sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
+ ED_area_tag_redraw_no_rebuild(sa);
+ }
+ }
}
return az;
}
+/* Finds an actionzone 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) {
+ AZone *az = area_actionzone_refresh_xy(sa, xy, true);
+ if (az != NULL) {
+ return az;
+ }
+ }
+ return NULL;
+}
+
+/* Returns the area that the azone belongs to */
+static ScrArea *screen_actionzone_area(bScreen *sc, const AZone *az)
+{
+ for (ScrArea *area = sc->areabase.first; area; area = area->next) {
+ for (AZone *zone = area->actionzones.first; zone; zone = zone->next) {
+ if (zone == az) {
+ return area;
+ }
+ }
+ }
+ return NULL;
+}
+
AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2])
{
return area_actionzone_refresh_xy(sa, xy, true);
}
-AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2])
+AZone *ED_area_azones_update(ScrArea *sa, const int xy[2])
{
return area_actionzone_refresh_xy(sa, xy, false);
}
@@ -852,8 +896,8 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ScrArea *sa = CTX_wm_area(C);
- AZone *az = ED_area_actionzone_find_xy(sa, &event->x);
+ bScreen *sc = CTX_wm_screen(C);
+ AZone *az = screen_actionzone_find_xy(sc, &event->x);
sActionzoneData *sad;
/* quick escape - Scroll azones only hide/unhide the scroll-bars, they have their own handling. */
@@ -862,7 +906,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* ok we do the actionzone */
sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
- sad->sa1 = sa;
+ sad->sa1 = screen_actionzone_area(sc, az);
sad->az = az;
sad->x = event->x; sad->y = event->y;
@@ -894,10 +938,18 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
const int delta_x = (event->x - sad->x);
const int delta_y = (event->y - sad->y);
- /* calculate gesture direction */
+ /* Movement in dominant direction. */
+ const int delta_max = max_ii(ABS(delta_x), ABS(delta_y));
+
+ /* Movement in dominant direction before action taken. */
+ const int join_threshold = (0.6 * U.widget_unit);
+ const int split_threshold = (1.2 * U.widget_unit);
+ const int area_threshold = (0.1 * U.widget_unit);
+
+ /* Calculate gesture cardinal direction. */
if (delta_y > ABS(delta_x))
sad->gesture_dir = 'n';
- else if (delta_x > ABS(delta_y))
+ else if (delta_x >= ABS(delta_y))
sad->gesture_dir = 'e';
else if (delta_y < -ABS(delta_x))
sad->gesture_dir = 's';
@@ -905,19 +957,42 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
sad->gesture_dir = 'w';
if (sad->az->type == AZONE_AREA) {
- const wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
rcti screen_rect;
WM_window_screen_rect_calc(win, &screen_rect);
- /* once we drag outside the actionzone, register a gesture
- * check we're not on an edge so join finds the other area */
- is_gesture = ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
- (screen_geom_area_map_find_active_scredge(
- AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL));
+
+ /* Have we dragged off the zone and are not on an edge? */
+ if ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
+ (screen_geom_area_map_find_active_scredge(
+ AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL))
+ {
+ /* Are we still in same area? */
+ if (BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y) == sad->sa1) {
+ /* Same area, so possible split. */
+ WM_cursor_set(win, (ELEM(sad->gesture_dir, 'n', 's')) ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
+ is_gesture = (delta_max > split_threshold);
+ }
+ else {
+ /* Different area, so posible join. */
+ if (sad->gesture_dir == 'n')
+ WM_cursor_set(win, BC_N_ARROWCURSOR);
+ else if (sad->gesture_dir == 's')
+ WM_cursor_set(win, BC_S_ARROWCURSOR);
+ else if (sad->gesture_dir == 'e')
+ WM_cursor_set(win, BC_E_ARROWCURSOR);
+ else
+ WM_cursor_set(win, BC_W_ARROWCURSOR);
+ is_gesture = (delta_max > join_threshold);
+ }
+ }
+ else {
+ WM_cursor_set(CTX_wm_window(C), BC_CROSSCURSOR);
+ is_gesture = false;
+ }
}
else {
- const int delta_min = 1;
- is_gesture = (ABS(delta_x) > delta_min || ABS(delta_y) > delta_min);
+ is_gesture = (delta_max > area_threshold);
}
/* gesture is large enough? */
@@ -1250,7 +1325,7 @@ static void area_move_set_limits(
int size_min = ED_area_global_min_size_y(area) - 1;
int size_max = ED_area_global_max_size_y(area) - 1;
- size_min = MAX2(size_min, 0);
+ size_min = max_ii(size_min, 0);
BLI_assert(size_min < size_max);
/* logic here is only tested for lower edge :) */
@@ -1867,7 +1942,7 @@ static void area_split_preview_update_cursor(bContext *C, wmOperator *op)
{
wmWindow *win = CTX_wm_window(C);
int dir = RNA_enum_get(op->ptr, "direction");
- WM_cursor_set(win, (dir == 'v') ? CURSOR_X_MOVE : CURSOR_Y_MOVE);
+ WM_cursor_set(win, (dir == 'n' || dir == 's') ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
}
/* UI callback, adds new handler */
@@ -2161,7 +2236,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
static const EnumPropertyItem prop_direction_items[] = {
{'h', "HORIZONTAL", 0, "Horizontal", ""},
{'v', "VERTICAL", 0, "Vertical", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void SCREEN_OT_area_split(wmOperatorType *ot)
@@ -2386,8 +2461,12 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
- else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
+ else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
+ }
+ else if (rmd->ar->flag & RGN_FLAG_DYNAMIC_SIZE) {
+ rmd->ar->sizex = rmd->origval;
+ }
}
else {
int maxsize = region_scale_get_maxsize(rmd);
@@ -2415,10 +2494,15 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
- else if (maxsize > 0 && (rmd->ar->sizey > maxsize))
+ else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) {
rmd->ar->sizey = maxsize;
- else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
+ }
+ else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
+ }
+ else if (rmd->ar->flag & RGN_FLAG_DYNAMIC_SIZE) {
+ rmd->ar->sizey = rmd->origval;
+ }
}
ED_area_tag_redraw(rmd->sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
@@ -2495,7 +2579,7 @@ static void areas_do_frame_follow(bContext *C, bool middle)
/* do follow here if editor type supports it */
if ((scr->redraws_flag & TIME_FOLLOW)) {
if ((ar->regiontype == RGN_TYPE_WINDOW &&
- ELEM(sa->spacetype, SPACE_SEQ, SPACE_IPO, SPACE_ACTION, SPACE_NLA)) ||
+ ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
(sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW))
{
float w = BLI_rctf_size_x(&ar->v2d.cur);
@@ -2958,7 +3042,6 @@ static int area_join_init(bContext *C, wmOperator *op)
sAreaJoinData *jd = NULL;
int x1, y1;
int x2, y2;
- int shared = 0;
/* required properties, make negative to get return 0 if not set by caller */
x1 = RNA_int_get(op->ptr, "min_x");
@@ -2982,16 +3065,6 @@ static int area_join_init(bContext *C, wmOperator *op)
return 0;
}
- /* do areas share an edge? */
- if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++;
- if (sa1->v2 == sa2->v1 || sa1->v2 == sa2->v2 || sa1->v2 == sa2->v3 || sa1->v2 == sa2->v4) shared++;
- if (sa1->v3 == sa2->v1 || sa1->v3 == sa2->v2 || sa1->v3 == sa2->v3 || sa1->v3 == sa2->v4) shared++;
- if (sa1->v4 == sa2->v1 || sa1->v4 == sa2->v2 || sa1->v4 == sa2->v3 || sa1->v4 == sa2->v4) shared++;
- if (shared != 2) {
- printf("areas don't share edge\n");
- return 0;
- }
-
jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
jd->sa1 = sa1;
@@ -3071,10 +3144,10 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
- RNA_int_set(op->ptr, "min_x", sad->x);
- RNA_int_set(op->ptr, "min_y", sad->y);
- RNA_int_set(op->ptr, "max_x", event->x);
- RNA_int_set(op->ptr, "max_y", event->y);
+ RNA_int_set(op->ptr, "min_x", sad->sa1->totrct.xmin);
+ RNA_int_set(op->ptr, "min_y", sad->sa1->totrct.ymin);
+ RNA_int_set(op->ptr, "max_x", sad->sa2->totrct.xmin);
+ RNA_int_set(op->ptr, "max_y", sad->sa2->totrct.ymin);
}
@@ -3098,6 +3171,7 @@ static void area_join_cancel(bContext *C, wmOperator *op)
static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
bScreen *sc = CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
/* execute the events */
@@ -3106,7 +3180,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MOUSEMOVE:
{
ScrArea *sa = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y);
- int dir;
+ int dir = -1;
if (sa) {
if (jd->sa1 != sa) {
@@ -3150,6 +3224,18 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
}
+
+ if (dir == 1)
+ WM_cursor_set(win, BC_N_ARROWCURSOR);
+ else if (dir == 3)
+ WM_cursor_set(win, BC_S_ARROWCURSOR);
+ else if (dir == 2)
+ WM_cursor_set(win, BC_E_ARROWCURSOR);
+ else if (dir == 0)
+ WM_cursor_set(win, BC_W_ARROWCURSOR);
+ else
+ WM_cursor_set(win, BC_STOPCURSOR);
+
break;
}
case LEFTMOUSE:
@@ -3320,7 +3406,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
if (lastop) {
WM_operator_free_all_after(wm, lastop);
- WM_operator_repeat(C, lastop);
+ WM_operator_repeat_interactive(C, lastop);
}
return OPERATOR_CANCELLED;
@@ -3828,7 +3914,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit)
return 1;
break;
- case SPACE_IPO:
+ case SPACE_GRAPH:
case SPACE_NLA:
if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit)
return 1;
@@ -3840,7 +3926,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit)
return 1;
break;
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
if (redraws & TIME_ALL_BUTS_WIN)
return 1;
break;
@@ -3865,7 +3951,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
}
else if (regiontype == RGN_TYPE_CHANNELS) {
switch (spacetype) {
- case SPACE_IPO:
+ case SPACE_GRAPH:
case SPACE_ACTION:
case SPACE_NLA:
if (redraws & TIME_ALL_ANIM_WIN)
@@ -4049,7 +4135,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
/* do follow here if editor type supports it */
if ((sad->redraws & TIME_FOLLOW)) {
if ((ar->regiontype == RGN_TYPE_WINDOW &&
- ELEM(sa->spacetype, SPACE_SEQ, SPACE_IPO, SPACE_ACTION, SPACE_NLA)) ||
+ ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
(sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW))
{
float w = BLI_rctf_size_x(&ar->v2d.cur);
@@ -4152,7 +4238,8 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
else {
- int refresh = SPACE_ACTION; /* these settings are currently only available from a menu in the TimeLine */
+ /* these settings are currently only available from a menu in the TimeLine */
+ int refresh = SPACE_ACTION;
if (mode == 1) /* XXX only play audio forwards!? */
BKE_sound_play_scene(scene);
@@ -4353,11 +4440,16 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int sizex = (800 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC;
- int sizey = 500 * UI_DPI_FAC;
+ int sizex = (500 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC;
+ int sizey = 520 * UI_DPI_FAC;
/* changes context! */
if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) {
+ /* The header only contains the editor switcher and looks empty.
+ * So hiding in the temp window makes sense. */
+ ScrArea *area = CTX_wm_area(C);
+ ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
+ region->flag |= RGN_FLAG_HIDDEN;
return OPERATOR_FINISHED;
}
else {
@@ -4660,6 +4752,12 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot)
/** \name Space Type Set or Cycle Operator
* \{ */
+static bool space_type_set_or_cycle_poll(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ return (sa && !ELEM(sa->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR));
+}
+
static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op)
{
const int space_type = RNA_enum_get(op->ptr, "space_type");
@@ -4703,12 +4801,12 @@ static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Cycle Space Type Set";
- ot->description = "Set the space type or cycle subtype";
+ ot->description = "Set the space type or cycle sub-type";
ot->idname = "SCREEN_OT_space_type_set_or_cycle";
/* api callbacks */
ot->exec = space_type_set_or_cycle_exec;
- ot->poll = ED_operator_areaactive;
+ ot->poll = space_type_set_or_cycle_poll;
ot->flag = 0;
@@ -4725,14 +4823,14 @@ static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
static const EnumPropertyItem space_context_cycle_direction[] = {
{SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""},
{SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool space_context_cycle_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
/* sa might be NULL if called out of window bounds */
- return (sa && ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF));
+ return (sa && ELEM(sa->spacetype, SPACE_PROPERTIES, SPACE_USERPREF));
}
/**
@@ -4746,7 +4844,7 @@ static void context_cycle_prop_get(
const char *propname;
switch (sa->spacetype) {
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr);
propname = "context";
break;
@@ -4815,7 +4913,7 @@ static int space_workspace_cycle_invoke(bContext *C, wmOperator *op, const wmEve
WorkSpace *workspace_dst = NULL;
ListBase ordered;
- BKE_id_ordered_list(&ordered, &bmain->workspaces);
+ BKE_id_ordered_list(&ordered, &bmain->workspace);
for (LinkData *link = ordered.first; link; link = link->next) {
if (link->data == workspace_src) {
@@ -4941,7 +5039,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
{KM_MODAL_APPLY, "APPLY", 0, "Apply", ""},
{KM_MODAL_SNAP_ON, "SNAP", 0, "Snap on", ""},
{KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap off", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap;
/* Standard Modal keymap ------------------------------------------------ */
diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c
index 45f82618d2e..4b8f210f1d9 100644
--- a/source/blender/editors/screen/screen_user_menu.c
+++ b/source/blender/editors/screen/screen_user_menu.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_user_menu.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -62,11 +55,24 @@
/** \name Menu Type
* \{ */
-bUserMenu *ED_screen_user_menu_find(bContext *C)
+bUserMenu **ED_screen_user_menus_find(const bContext *C, uint *r_len)
{
SpaceLink *sl = CTX_wm_space_data(C);
const char *context = CTX_data_mode_string(C);
- return BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context);
+
+ if (sl == NULL) {
+ *r_len = 0;
+ return NULL;
+ }
+
+ uint array_len = 3;
+ bUserMenu **um_array = MEM_calloc_arrayN(array_len, sizeof(*um_array), __func__);
+ um_array[0] = BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context);
+ um_array[1] = (sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL;
+ um_array[2] = (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_PROPERTIES, context) : NULL;
+
+ *r_len = array_len;
+ return um_array;
}
bUserMenu *ED_screen_user_menu_ensure(bContext *C)
@@ -182,15 +188,10 @@ void ED_screen_user_menu_item_remove(ListBase *lb, bUserMenuItem *umi)
static void screen_user_menu_draw(const bContext *C, Menu *menu)
{
- SpaceLink *sl = CTX_wm_space_data(C);
- const char *context = CTX_data_mode_string(C);
- bUserMenu *um_array[] = {
- BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context),
- (sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL,
- (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_BUTS, context) : NULL,
- };
+ uint um_array_len;
+ bUserMenu **um_array = ED_screen_user_menus_find(C, &um_array_len);
bool is_empty = true;
- for (int um_index = 0; um_index < ARRAY_SIZE(um_array); um_index++) {
+ for (int um_index = 0; um_index < um_array_len; um_index++) {
bUserMenu *um = um_array[um_index];
if (um == NULL) {
continue;
@@ -258,10 +259,13 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
}
}
+ if (um_array) {
+ MEM_freeN(um_array);
+ }
if (is_empty) {
- uiItemL(menu->layout, IFACE_("No menu items found."), ICON_NONE);
- uiItemL(menu->layout, IFACE_("Right click on buttons to add them to this menu."), ICON_NONE);
+ uiItemL(menu->layout, IFACE_("No menu items found"), ICON_NONE);
+ uiItemL(menu->layout, IFACE_("Right click on buttons to add them to this menu"), ICON_NONE);
}
}
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 8e3b32941e5..e49b42574a8 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
* Making screendumps.
*/
-/** \file blender/editors/screen/screendump.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -279,7 +273,8 @@ static bool screenshot_poll(bContext *C)
void SCREEN_OT_screenshot(wmOperatorType *ot)
{
- ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
+ /* weak: opname starting with 'save' makes filewindow give save-over */
+ ot->name = "Save Screenshot";
ot->idname = "SCREEN_OT_screenshot";
ot->description = "Capture a picture of the active area or whole Blender window";
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index d8e0945eb25..9f63bdff7c1 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/workspace_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdlib.h>
@@ -29,7 +25,6 @@
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
-#include "BLI_string.h"
#include "BKE_appdir.h"
#include "BKE_blendfile.h"
@@ -228,7 +223,7 @@ bool ED_workspace_delete(
{
ID *workspace_id = (ID *)workspace;
- if (BLI_listbase_is_single(&bmain->workspaces)) {
+ if (BLI_listbase_is_single(&bmain->workspace)) {
return false;
}
@@ -238,7 +233,7 @@ bool ED_workspace_delete(
ED_workspace_change((prev != NULL) ? prev : next, C, wm, win);
}
- BKE_libblock_free(bmain, workspace_id);
+ BKE_id_free(bmain, workspace_id);
return true;
}
@@ -360,11 +355,11 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", filepath);
if (workspace_append(C, filepath, idname) != OPERATOR_CANCELLED) {
- WorkSpace *appended_workspace = BLI_findstring(&bmain->workspaces, idname, offsetof(ID, name) + 2);
+ WorkSpace *appended_workspace = BLI_findstring(&bmain->workspace, idname, offsetof(ID, name) + 2);
BLI_assert(appended_workspace != NULL);
/* Reorder to last position. */
- BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
+ BKE_id_reorder(&bmain->workspace, &appended_workspace->id, NULL, true);
/* Changing workspace changes context. Do delayed! */
WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
@@ -459,7 +454,7 @@ static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
if (startup_config) {
for (WorkSpace *workspace = startup_config->workspaces.first; workspace; workspace = workspace->id.next) {
uiLayout *row = uiLayoutRow(layout, false);
- if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
+ if (BLI_findstring(&bmain->workspace, workspace->id.name, offsetof(ID, name))) {
uiLayoutSetActive(row, false);
}
@@ -484,7 +479,7 @@ static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
}
uiLayout *row = uiLayoutRow(layout, false);
- if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
+ if (BLI_findstring(&bmain->workspace, workspace->id.name, offsetof(ID, name))) {
uiLayoutSetActive(row, false);
}
@@ -547,7 +542,7 @@ static int workspace_reorder_to_back_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
WorkSpace *workspace = workspace_context_get(C);
- BKE_id_reorder(&bmain->workspaces, &workspace->id, NULL, true);
+ BKE_id_reorder(&bmain->workspace, &workspace->id, NULL, true);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_INTERFACE;
@@ -570,7 +565,7 @@ static int workspace_reorder_to_front_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
WorkSpace *workspace = workspace_context_get(C);
- BKE_id_reorder(&bmain->workspaces, &workspace->id, NULL, false);
+ BKE_id_reorder(&bmain->workspace, &workspace->id, NULL, false);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_INTERFACE;
diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c
index 6d504c05dd1..401f0323af6 100644
--- a/source/blender/editors/screen/workspace_layout_edit.c
+++ b/source/blender/editors/screen/workspace_layout_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/workspace_layout_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdlib.h>
@@ -31,7 +27,6 @@
#include "DNA_workspace_types.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@@ -70,13 +65,22 @@ WorkSpaceLayout *ED_workspace_layout_duplicate(
bScreen *screen_new;
WorkSpaceLayout *layout_new;
- if (BKE_screen_is_fullscreen_area(screen_old)) {
- return NULL; /* XXX handle this case! */
- }
-
layout_new = ED_workspace_layout_add(bmain, workspace, win, name);
screen_new = BKE_workspace_layout_screen_get(layout_new);
- screen_data_copy(screen_new, screen_old);
+
+ if (BKE_screen_is_fullscreen_area(screen_old)) {
+ for (ScrArea *area_old = screen_old->areabase.first; area_old; area_old = area_old->next) {
+ if (area_old->full) {
+ ScrArea *area_new = (ScrArea *)screen_new->areabase.first;
+ ED_area_data_copy(area_new, area_old, true);
+ ED_area_tag_redraw(area_new);
+ break;
+ }
+ }
+ }
+ else {
+ screen_data_copy(screen_new, screen_old);
+ }
return layout_new;
}
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 80c58e5b91d..704de3f7f9d 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -56,9 +53,9 @@ set(SRC
paint_vertex.c
paint_vertex_color_ops.c
paint_vertex_color_utils.c
+ paint_vertex_proj.c
paint_vertex_weight_ops.c
paint_vertex_weight_utils.c
- paint_vertex_proj.c
sculpt.c
sculpt_undo.c
sculpt_uv.c
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 6a2a374f87d..863afcf70aa 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_cursor.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -316,8 +309,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
pool = BKE_image_pool_new();
- if (mtex->tex && mtex->tex->nodetree)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
LoadTexData data = {
.br = br, .vc = vc, .mtex = mtex, .buffer = buffer, .col = col,
@@ -527,7 +522,7 @@ static int project_brush_radius(
cross_v3_v3v3(ortho, nonortho, view);
normalize_v3(ortho);
- /* make a point on the surface of the brush tagent to the view */
+ /* make a point on the surface of the brush tangent to the view */
mul_v3_fl(ortho, radius);
add_v3_v3v3(offset, location, ortho);
@@ -692,7 +687,7 @@ static void paint_draw_tex_overlay(
}
/* draw textured quad */
- immUniform1i("image", GL_TEXTURE0);
+ immUniform1i("image", 0);
immBegin(GPU_PRIM_TRI_FAN, 4);
immAttr2f(texCoord, 0.0f, 0.0f);
@@ -801,10 +796,11 @@ 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 colured 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();
- gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
+ gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
/* Translate to region. */
GPU_matrix_push();
@@ -829,7 +825,7 @@ static void paint_draw_alpha_overlay(
}
GPU_matrix_pop();
- gpuPopAttrib();
+ gpuPopAttr();
}
@@ -1079,8 +1075,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
float translation[2] = { x, y };
float final_radius = (BKE_brush_size_get(scene, brush) * zoomx);
- /* don't calculate rake angles while a stroke is active because the rake variables are global and
- * we may get interference with the stroke itself. For line strokes, such interference is visible */
+ /* don't calculate rake angles while a stroke is active because the rake variables are global
+ * and we may get interference with the stroke itself.
+ * For line strokes, such interference is visible */
if (!ups->stroke_active) {
paint_calculate_rake_rotation(ups, brush, translation);
}
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index e9918481408..bd2fea78a99 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_curve.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <string.h>
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index 77f06180df6..fb2f4b49f19 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_curve_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <string.h>
@@ -29,7 +25,6 @@
#include "DNA_brush_types.h"
#include "DNA_space_types.h"
-#include "BLI_string.h"
#include "BLI_array_utils.h"
#include "BKE_context.h"
@@ -99,7 +94,7 @@ static void paintcurve_undosys_step_encode_init(struct bContext *C, UndoStep *us
UNUSED_VARS(C, us_p);
}
-static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool paintcurve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
Paint *p = BKE_paint_get_active_from_context(C);
PaintCurve *pc = p ? (p->brush ? p->brush->paint_curve : NULL) : NULL;
@@ -116,7 +111,7 @@ static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p;
undocurve_to_paintcurve(&us->data, us->pc);
@@ -139,7 +134,6 @@ void ED_paintcurve_undosys_type(UndoType *ut)
ut->step_decode = paintcurve_undosys_step_decode;
ut->step_free = paintcurve_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = false;
ut->step_size = sizeof(PaintCurveUndoStep);
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 6faabe66462..b64c23ad0b6 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,19 +15,11 @@
*
* The Original Code is Copyright (C) 2010 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implements the PBVH node hiding operator
- *
*/
-/** \file blender/editors/sculpt_paint/paint_hide.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -453,7 +443,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
static const EnumPropertyItem action_items[] = {
{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem area_items[] = {
@@ -461,7 +451,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
{PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"},
{PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"},
{PARTIALVIS_MASKED, "MASKED", 0, "Masked", "Hide or show vertices that are masked (minimum mask value of 0.5)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 30efcd2cb9a..9d90b6fcd5f 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -18,15 +16,11 @@
* All rights reserved.
*
* The Original Code is: some of this file.
- *
- * Contributor(s): Jens Ole Wund (bjornmose), Campbell Barton (ideasman42)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image.c
- * \ingroup edsculpt
- * \brief Functions to paint images in 2D and 3D.
+/** \file
+ * \ingroup edsculpt
+ * \brief Functions to paint images in 2D and 3D.
*/
#include <float.h>
@@ -84,7 +78,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BIF_gl.h"
#include "IMB_colormanagement.h"
@@ -302,7 +295,7 @@ static bool image_paint_poll(bContext *C)
return image_paint_poll_ex(C, true);
}
-static bool image_paint_ignore_tool_poll(bContext *C)
+static bool image_paint_poll_ignore_tool(bContext *C)
{
return image_paint_poll_ex(C, false);
}
@@ -391,11 +384,14 @@ void paint_brush_init_tex(Brush *brush)
/* init mtex nodes */
if (brush) {
MTex *mtex = &brush->mtex;
- if (mtex->tex && mtex->tex->nodetree)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
mtex = &brush->mask_mtex;
- if (mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
}
}
@@ -493,7 +489,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
}
settings->imapaint.flag |= IMAGEPAINT_DRAWING;
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
return pop;
}
@@ -1022,6 +1018,11 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
+static bool sample_color_poll(bContext *C)
+{
+ return (image_paint_poll_ignore_tool(C) || vertex_paint_poll_ignore_tool(C));
+}
+
void PAINT_OT_sample_color(wmOperatorType *ot)
{
/* identifiers */
@@ -1033,7 +1034,7 @@ void PAINT_OT_sample_color(wmOperatorType *ot)
ot->exec = sample_color_exec;
ot->invoke = sample_color_invoke;
ot->modal = sample_color_modal;
- ot->poll = image_paint_ignore_tool_poll;
+ ot->poll = sample_color_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1094,13 +1095,14 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
/* This has to stay here to regenerate the texture paint
* cache in case we are loading a file */
- BKE_texpaint_slots_refresh_object(scene, ob);
+ BKE_texpaint_slots_refresh_object(ob);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
/* entering paint mode also sets image to editors */
if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) {
- Material *ma = give_current_material(ob, ob->actcol); /* set the current material active paint slot on image editor */
+ /* set the current material active paint slot on image editor */
+ Material *ma = give_current_material(ob, ob->actcol);
if (ma && ma->texpaintslot)
ima = ma->texpaintslot[ma->paint_active_slot].ima;
@@ -1172,20 +1174,12 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
+ Scene *scene = CTX_data_scene(C);
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- Object *ob = CTX_data_active_object(C);
- Brush *br;
- if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) {
- br = image_paint_brush(C);
- }
- else {
- /* At the moment, wpaint does not support the color flipper.
- * So for now we're only handling vpaint */
- ToolSettings *ts = CTX_data_tool_settings(C);
- VPaint *vp = ts->vpaint;
- br = BKE_paint_brush(&vp->paint);
- }
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
+ Brush *br = BKE_paint_brush(paint);
if (ups->flag & UNIFIED_PAINT_COLOR) {
swap_v3_v3(ups->rgb, ups->secondary_rgb);
@@ -1203,15 +1197,17 @@ static bool brush_colors_flip_poll(bContext *C)
if (image_paint_poll(C)) {
Brush *br = image_paint_brush(C);
if (br->imagepaint_tool == PAINT_TOOL_DRAW)
- return 1;
+ return true;
}
else {
Object *ob = CTX_data_active_object(C);
- if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) {
- return 1;
+ if (ob != NULL) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
+ return true;
+ }
}
}
- return 0;
+ return false;
}
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
@@ -1238,7 +1234,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
BKE_undosys_step_push_init_with_type(wm->undo_stack, C, op->type->name, BKE_UNDOSYS_TYPE_IMAGE);
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
paint_2d_bucket_fill(C, color, NULL, NULL, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 90aa13ab5c1..990017d3a20 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_2d.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
//#include <math.h>
#include <string.h>
@@ -1522,7 +1514,8 @@ void paint_2d_bucket_fill(
float image_init[2];
int minx = ibuf->x, miny = ibuf->y, maxx = 0, maxy = 0;
float pixel_color[4];
- /* We are comparing to sum of three squared values (assumed in range [0,1]), so need to multiply... */
+ /* We are comparing to sum of three squared values
+ * (assumed in range [0,1]), so need to multiply... */
float threshold_sq = br->fill_threshold * br->fill_threshold * 3;
UI_view2d_region_to_view(s->v2d, mouse_init[0], mouse_init[1], &image_init[0], &image_init[1]);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 5275d899a56..b4abab0fabd 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -18,15 +16,11 @@
* All rights reserved.
*
* The Original Code is: some of this file.
- *
- * Contributor(s): Jens Ole Wund (bjornmose), Campbell Barton (ideasman42)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_proj.c
- * \ingroup edsculpt
- * \brief Functions to paint images in 2D and 3D.
+/** \file
+ * \ingroup edsculpt
+ * \brief Functions to paint images in 2D and 3D.
*/
#include <float.h>
@@ -79,6 +73,7 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_texture.h"
#include "DEG_depsgraph.h"
@@ -172,7 +167,8 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define PROJ_SRC_VIEW_FILL 4
#define PROJ_VIEW_DATA_ID "view_data"
-#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3) /* viewmat + winmat + clipsta + clipend + is_ortho */
+/* viewmat + winmat + clip_start + clip_end + is_ortho */
+#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
#define PROJ_BUCKET_NULL 0
#define PROJ_BUCKET_INIT (1 << 0)
@@ -188,17 +184,20 @@ BLI_INLINE unsigned char f_to_char(const float val)
/* to avoid locking in tile initialization */
#define TILE_PENDING POINTER_FROM_INT(-1)
-/* This is mainly a convenience struct used so we can keep an array of images we use -
+/** This is mainly a convenience struct used so we can keep an array of images we use -
* their imbufs, etc, in 1 array, When using threads this array is copied for each thread
* because 'partRedrawRect' and 'touch' values would not be thread safe */
typedef struct ProjPaintImage {
Image *ima;
ImBuf *ibuf;
ImagePaintPartialRedraw *partRedrawRect;
- volatile void **undoRect; /* only used to build undo tiles during painting */
- unsigned short **maskRect; /* the mask accumulation must happen on canvas, not on space screen bucket.
- * Here we store the mask rectangle */
- bool **valid; /* store flag to enforce validation of undo rectangle */
+ /** Only used to build undo tiles during painting. */
+ volatile void **undoRect;
+ /** The mask accumulation must happen on canvas, not on space screen bucket.
+ * Here we store the mask rectangle. */
+ unsigned short **maskRect;
+ /** Store flag to enforce validation of undo rectangle. */
+ bool **valid;
bool touch;
} ProjPaintImage;
@@ -232,7 +231,8 @@ typedef struct ProjPaintState {
ARegion *ar;
Depsgraph *depsgraph;
Scene *scene;
- int source; /* PROJ_SRC_**** */
+ /* PROJ_SRC_**** */
+ int source;
/* the paint color. It can change depending of inverted mode or not */
float paint_color[3];
@@ -255,25 +255,38 @@ typedef struct ProjPaintState {
float stencil_value;
/* projection painting only */
- MemArena *arena_mt[BLENDER_MAX_THREADS]; /* for multithreading, the first item is sometimes used for non threaded cases too */
- LinkNode **bucketRect; /* screen sized 2D array, each pixel has a linked list of ProjPixel's */
- LinkNode **bucketFaces; /* bucketRect aligned array linkList of faces overlapping each bucket */
- unsigned char *bucketFlags; /* store if the bucks have been initialized */
-
- char *vertFlags; /* store options per vert, now only store if the vert is pointing away from the view */
- int buckets_x; /* The size of the bucket grid, the grid span's screenMin/screenMax so you can paint outsize the screen or with 2 brushes at once */
+ /** for multithreading, the first item is sometimes used for non threaded cases too. */
+ MemArena *arena_mt[BLENDER_MAX_THREADS];
+ /** screen sized 2D array, each pixel has a linked list of ProjPixel's */
+ LinkNode **bucketRect;
+ /** bucketRect aligned array linkList of faces overlapping each bucket. */
+ LinkNode **bucketFaces;
+ /** store if the bucks have been initialized. */
+ unsigned char *bucketFlags;
+
+ /** store options per vert, now only store if the vert is pointing away from the view. */
+ char *vertFlags;
+ /** The size of the bucket grid, the grid span's screenMin/screenMax
+ * so you can paint outsize the screen or with 2 brushes at once. */
+ int buckets_x;
int buckets_y;
- int pixel_sizeof; /* result of project_paint_pixel_sizeof(), constant per stroke */
+ /** result of project_paint_pixel_sizeof(), constant per stroke. */
+ int pixel_sizeof;
- int image_tot; /* size of projectImages array */
+ /** size of projectImages array. */
+ int image_tot;
- float (*screenCoords)[4]; /* verts projected into floating point screen space */
- float screenMin[2]; /* 2D bounds for mesh verts on the screen's plane (screenspace) */
+ /** verts projected into floating point screen space. */
+ float (*screenCoords)[4];
+ /** 2D bounds for mesh verts on the screen's plane (screenspace). */
+ float screenMin[2];
float screenMax[2];
- float screen_width; /* Calculated from screenMin & screenMax */
+ /** Calculated from screenMin & screenMax. */
+ float screen_width;
float screen_height;
- int winx, winy; /* from the carea or from the projection render */
+ /** from the carea or from the projection render. */
+ int winx, winy;
/* options for projection painting */
bool do_layer_clone;
@@ -282,33 +295,50 @@ typedef struct ProjPaintState {
bool do_stencil_brush;
bool do_material_slots;
- bool do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
- bool do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
- bool do_mask_normal; /* mask out pixels based on their normals */
- bool do_mask_cavity; /* mask out pixels based on cavity */
- float normal_angle; /* what angle to mask at */
- float normal_angle__cos; /* cos(normal_angle), faster to compare */
+ /** Use raytraced occlusion? - ortherwise will paint right through to the back. */
+ bool do_occlude;
+ /** ignore faces with normals pointing away,
+ * skips a lot of raycasts if your normals are correctly flipped. */
+ bool do_backfacecull;
+ /** mask out pixels based on their normals. */
+ bool do_mask_normal;
+ /** mask out pixels based on cavity. */
+ bool do_mask_cavity;
+ /** what angle to mask at. */
+ float normal_angle;
+ /** cos(normal_angle), faster to compare. */
+ float normal_angle__cos;
float normal_angle_inner;
float normal_angle_inner__cos;
- float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */
+ /** difference between normal_angle and normal_angle_inner, for easy access. */
+ float normal_angle_range;
- bool do_face_sel; /* quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */
+ /** quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */
+ bool do_face_sel;
bool is_ortho;
- bool is_flip_object; /* the object is negative scaled */
- bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */
- bool is_texbrush; /* only to avoid running */
- bool is_maskbrush; /* mask brush is applied before masking */
+ /** the object is negative scaled. */
+ bool is_flip_object;
+ /** use masking during painting. Some operations such as airbrush may disable. */
+ bool do_masking;
+ /** only to avoid running. */
+ bool is_texbrush;
+ /** mask brush is applied before masking. */
+ bool is_maskbrush;
#ifndef PROJ_DEBUG_NOSEAMBLEED
float seam_bleed_px;
#endif
/* clone vars */
float cloneOffset[2];
- float projectMat[4][4]; /* Projection matrix, use for getting screen coords */
- float projectMatInv[4][4]; /* inverse of projectMat */
- float viewDir[3]; /* View vector, use for do_backfacecull and for ray casting with an ortho viewport */
- float viewPos[3]; /* View location in object relative 3D space, so can compare to verts */
- float clipsta, clipend;
+ /** Projection matrix, use for getting screen coords. */
+ float projectMat[4][4];
+ /** inverse of projectMat. */
+ float projectMatInv[4][4];
+ /** View vector, use for do_backfacecull and for ray casting with an ortho viewport. */
+ float viewDir[3];
+ /** View location in object relative 3D space, so can compare to verts. */
+ float viewPos[3];
+ float clip_start, clip_end;
/* reproject vars */
Image *reproject_image;
@@ -320,7 +350,8 @@ typedef struct ProjPaintState {
int thread_tot;
int bucketMin[2];
int bucketMax[2];
- int context_bucket_x, context_bucket_y; /* must lock threads while accessing these */
+ /** must lock threads while accessing these. */
+ int context_bucket_x, context_bucket_y;
struct CurveMapping *cavity_curve;
BlurKernel *blurkernel;
@@ -343,13 +374,19 @@ typedef struct ProjPaintState {
bool is_shared_user;
ProjPaintImage *projImages;
- float *cavities; /* cavity amount for vertices */
+ /** cavity amount for vertices. */
+ float *cavities;
#ifndef PROJ_DEBUG_NOSEAMBLEED
- char *faceSeamFlags; /* store info about faces, if they are initialized etc*/
- char *faceWindingFlags; /* save the winding of the face in uv space, helps as an extra validation step for seam detection */
- float (*faceSeamUVs)[3][2]; /* expanded UVs for faces to use as seams */
- LinkNode **vertFaces; /* Only needed for when seam_bleed_px is enabled, use to find UV seams */
+ /** store info about faces, if they are initialized etc*/
+ char *faceSeamFlags;
+ /** save the winding of the face in uv space,
+ * helps as an extra validation step for seam detection. */
+ char *faceWindingFlags;
+ /** expanded UVs for faces to use as seams. */
+ float (*faceSeamUVs)[3][2];
+ /** Only needed for when seam_bleed_px is enabled, use to find UV seams. */
+ LinkNode **vertFaces;
#endif
SpinLock *tile_lock;
@@ -375,7 +412,8 @@ typedef struct ProjPaintState {
* so a loop indirection is needed as well.
*/
const MLoopUV **poly_to_loop_uv;
- const MLoopUV **poly_to_loop_uv_clone; /* other UV map, use for cloning between layers */
+ /** other UV map, use for cloning between layers. */
+ const MLoopUV **poly_to_loop_uv_clone;
/* Actual material for each index, either from object or Mesh datablock... */
Material **mat_array;
@@ -384,8 +422,10 @@ typedef struct ProjPaintState {
} ProjPaintState;
typedef union pixelPointer {
- float *f_pt; /* float buffer */
- unsigned int *uint_pt; /* 2 ways to access a char buffer */
+ /** float buffer. */
+ float *f_pt;
+ /** 2 ways to access a char buffer. */
+ unsigned int *uint_pt;
unsigned char *ch_pt;
} PixelPointer;
@@ -396,12 +436,14 @@ typedef union pixelStore {
} PixelStore;
typedef struct ProjPixel {
- float projCoSS[2]; /* the floating point screen projection of this pixel */
+ /** the floating point screen projection of this pixel. */
+ float projCoSS[2];
float worldCoSS[3];
short x_px, y_px;
- unsigned short image_index; /* if anyone wants to paint onto more than 65535 images they can bite me */
+ /** if anyone wants to paint onto more than 65535 images they can bite me. */
+ unsigned short image_index;
unsigned char bb_cell_index;
/* for various reasons we may want to mask out painting onto this pixel */
@@ -413,7 +455,8 @@ typedef struct ProjPixel {
* new mask value is lower then mask_accum */
unsigned short *mask_accum;
- /* horrible hack, store tile valid flag pointer here to re-validate tiles used for anchored and drag-dot strokes */
+ /* horrible hack, store tile valid flag pointer here to re-validate tiles
+ * used for anchored and drag-dot strokes */
bool *valid;
PixelPointer origColor;
@@ -438,7 +481,6 @@ typedef struct {
/* -------------------------------------------------------------------- */
-
/** \name MLoopTri accessor functions.
* \{ */
@@ -624,7 +666,8 @@ static int project_paint_PickFace(
}
}
- return best_tri_index; /* will be -1 or a valid face */
+ /** will be -1 or a valid face. */
+ return best_tri_index;
}
/* Converts a uv coord into a pixel location wrapping if the uv is outside 0-1 range */
@@ -641,7 +684,8 @@ static void uvco_to_wrapped_pxco(const float uv[2], int ibuf_x, int ibuf_y, floa
*y = *y * ibuf_y - 0.5f;
}
-/* Set the top-most face color that the screen space coord 'pt' touches (or return 0 if none touch) */
+/* Set the top-most face color that the screen space coord 'pt' touches
+ * (or return 0 if none touch) */
static bool project_paint_PickColor(
const ProjPaintState *ps, const float pt[2],
float *rgba_fp, unsigned char *rgba, const bool interp)
@@ -665,7 +709,8 @@ static bool project_paint_PickColor(
interp_v2_v2v2v2(uv, UNPACK3(lt_tri_uv), w);
ima = project_paint_face_paint_image(ps, tri_index);
- ibuf = BKE_image_get_first_ibuf(ima); /* we must have got the imbuf before getting here */
+ /** we must have got the imbuf before getting here. */
+ ibuf = BKE_image_get_first_ibuf(ima);
if (!ibuf) return 0;
if (interp) {
@@ -745,7 +790,7 @@ static int project_paint_occlude_ptv(
/* do a 2D point in try intersection */
if (!isect_point_tri_v2(pt, v1, v2, v3))
- return 0; /* we know there is */
+ return 0;
/* From here on we know there IS an intersection */
@@ -801,7 +846,8 @@ static int project_paint_occlude_ptv_clip(
/* Check if a screenspace location is occluded by any other faces
* check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison
- * and doesn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
+ * and doesn't need to be correct in relation to X and Y coords
+ * (this is the case in perspective view) */
static bool project_bucket_point_occluded(
const ProjPaintState *ps, LinkNode *bucketFace,
const int orig_face, const float pixelScreenCo[4])
@@ -859,16 +905,19 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
{
float y_diff;
- if (y_level == p1[1]) { /* are we touching the first point? - no interpolation needed */
+ /* are we touching the first point? - no interpolation needed */
+ if (y_level == p1[1]) {
*x_isect = p1[0];
return ISECT_TRUE_P1;
}
- if (y_level == p2[1]) { /* are we touching the second point? - no interpolation needed */
+ /* are we touching the second point? - no interpolation needed */
+ if (y_level == p2[1]) {
*x_isect = p2[0];
return ISECT_TRUE_P2;
}
- y_diff = fabsf(p1[1] - p2[1]); /* yuck, horizontal line, we cant do much here */
+ /** yuck, horizontal line, we cant do much here. */
+ y_diff = fabsf(p1[1] - p2[1]);
if (y_diff < 0.000001f) {
*x_isect = (p1[0] + p2[0]) * 0.5f;
@@ -876,11 +925,13 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
}
if (p1[1] > y_level && p2[1] < y_level) {
- *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff; /* (p1[1] - p2[1]); */
+ /* (p1[1] - p2[1]); */
+ *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
return ISECT_TRUE;
}
else if (p1[1] < y_level && p2[1] > y_level) {
- *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff; /* (p2[1] - p1[1]); */
+ /* (p2[1] - p1[1]); */
+ *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
return ISECT_TRUE;
}
else {
@@ -901,19 +952,23 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
return ISECT_TRUE_P2;
}
- x_diff = fabsf(p1[0] - p2[0]); /* yuck, horizontal line, we cant do much here */
+ /* yuck, horizontal line, we cant do much here */
+ x_diff = fabsf(p1[0] - p2[0]);
- if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */
+ /* yuck, vertical line, we cant do much here */
+ if (x_diff < 0.000001f) {
*y_isect = (p1[0] + p2[0]) * 0.5f;
return ISECT_TRUE;
}
if (p1[0] > x_level && p2[0] < x_level) {
- *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff; /* (p1[0] - p2[0]); */
+ /* (p1[0] - p2[0]); */
+ *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
return ISECT_TRUE;
}
else if (p1[0] < x_level && p2[0] > x_level) {
- *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff; /* (p2[0] - p1[0]); */
+ /* (p2[0] - p1[0]); */
+ *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
return ISECT_TRUE;
}
else {
@@ -954,7 +1009,8 @@ static bool pixel_bounds_uv(
const int ibuf_x, const int ibuf_y
)
{
- float min_uv[2], max_uv[2]; /* UV bounds */
+ /* UV bounds */
+ float min_uv[2], max_uv[2];
INIT_MINMAX2(min_uv, max_uv);
@@ -978,7 +1034,8 @@ static bool pixel_bounds_uv(
static bool pixel_bounds_array(float (*uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
{
- float min_uv[2], max_uv[2]; /* UV bounds */
+ /* UV bounds */
+ float min_uv[2], max_uv[2];
if (tot == 0) {
return 0;
@@ -1031,7 +1088,8 @@ static bool check_seam(
const unsigned int i1 = ps->mloop_eval[orig_lt->tri[orig_i1_fidx]].v;
const unsigned int i2 = ps->mloop_eval[orig_lt->tri[orig_i2_fidx]].v;
LinkNode *node;
- int i1_fidx = -1, i2_fidx = -1; /* index in face */
+ /* index in face */
+ int i1_fidx = -1, i2_fidx = -1;
for (node = ps->vertFaces[i1]; node; node = node->next) {
const int tri_index = POINTER_AS_INT(node->link);
@@ -1117,8 +1175,10 @@ static void uv_image_outset(
const float scale_clamp = 5.0f;
float a1, a2, a3;
- float puv[3][2]; /* pixelspace uv's */
- float no1[2], no2[2], no3[2]; /* normals */
+ /* pixelspace uv's */
+ float puv[3][2];
+ /* normals */
+ float no1[2], no2[2], no3[2];
float dir1[2], dir2[2], dir3[2];
float ibuf_inv[2];
@@ -1190,9 +1250,11 @@ static void uv_image_outset(
*/
static void project_face_seams_init(const ProjPaintState *ps, const int tri_index)
{
- int other_face, other_fidx; /* vars for the other face, we also set its flag */
+ /* vars for the other face, we also set its flag */
+ int other_face, other_fidx;
int fidx1 = 2;
- int fidx2 = 0; /* next fidx in the face (0,1,2,3) -> (1,2,3,0) or (0,1,2) -> (1,2,0) for a tri */
+ /* next fidx in the face (0,1,2,3) -> (1,2,3,0) or (0,1,2) -> (1,2,0) for a tri */
+ int fidx2 = 0;
/* initialize face winding if needed */
if ((ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_INIT) == 0)
@@ -1207,8 +1269,10 @@ static void project_face_seams_init(const ProjPaintState *ps, const int tri_inde
}
else {
ps->faceSeamFlags[tri_index] |= 16 << fidx1;
- if (other_face != -1)
- ps->faceSeamFlags[other_face] |= 16 << other_fidx; /* second 4 bits for disabled */
+ if (other_face != -1) {
+ /* second 4 bits for disabled */
+ ps->faceSeamFlags[other_face] |= 16 << other_fidx;
+ }
}
}
@@ -1261,7 +1325,8 @@ static void screen_px_from_persp(
}
else {
w[0] = w[1] = w[2] =
- w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f; /* dummy values for zero area face */
+ /* dummy values for zero area face */
+ w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
}
/* done re-weighting */
@@ -1372,8 +1437,10 @@ static float project_paint_uvpixel_mask(
BKE_image_release_ibuf(other_tpage, ibuf_other, NULL);
- if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
+ if (!ps->do_layer_stencil_inv) {
+ /* matching the gimps layer mask black/white rules, white==full opacity */
mask = (1.0f - mask);
+ }
if (mask == 0.0f) {
return 0.0f;
@@ -1467,7 +1534,8 @@ static float project_paint_uvpixel_mask(
}
if (angle_cos <= ps->normal_angle__cos) {
- return 0.0f; /* outsize the normal limit*/
+ /* outsize the normal limit*/
+ return 0.0f;
}
else if (angle_cos < ps->normal_angle_inner__cos) {
mask *= (ps->normal_angle - acosf(angle_cos)) / ps->normal_angle_range;
@@ -1686,12 +1754,14 @@ static ProjPixel *project_paint_uvpixel_init(
* the faces are already initialized in project_paint_delayed_face_init(...) */
if (ibuf->rect_float) {
if (!project_paint_PickColor(ps, co, ((ProjPixelClone *)projPixel)->clonepx.f, NULL, 1)) {
- ((ProjPixelClone *)projPixel)->clonepx.f[3] = 0; /* zero alpha - ignore */
+ /* zero alpha - ignore */
+ ((ProjPixelClone *)projPixel)->clonepx.f[3] = 0;
}
}
else {
if (!project_paint_PickColor(ps, co, NULL, ((ProjPixelClone *)projPixel)->clonepx.ch, 1)) {
- ((ProjPixelClone *)projPixel)->clonepx.ch[3] = 0; /* zero alpha - ignore */
+ /* zero alpha - ignore */
+ ((ProjPixelClone *)projPixel)->clonepx.ch[3] = 0;
}
}
}
@@ -1726,7 +1796,8 @@ static bool line_clip_rect2f(
}
- if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/
+ /* this is a single point (or close to)*/
+ if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
@@ -1754,7 +1825,8 @@ static bool line_clip_rect2f(
return 0;
}
- if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/
+ /* this is a single point (or close to)*/
+ if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
@@ -2131,7 +2203,8 @@ static void project_bucket_clip_face(
float bucket_bounds_ss[4][2];
/* detect pathological case where face the three vertices are almost collinear in screen space.
- * mostly those will be culled but when flood filling or with smooth shading it's a possibility */
+ * mostly those will be culled but when flood filling or with
+ * smooth shading it's a possibility */
if (min_fff(dist_squared_to_line_v2(v1coSS, v2coSS, v3coSS),
dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS),
dist_squared_to_line_v2(v3coSS, v1coSS, v2coSS)) < PROJ_PIXEL_TOLERANCE)
@@ -2165,7 +2238,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 tringle area is almost zero */
if (collinear) {
int flag;
@@ -2213,7 +2287,8 @@ static void project_bucket_clip_face(
}
/* get the UV space bounding box */
- /* use IsectPT2Df_limit here so we catch points are are touching the tri edge (or a small fraction over) */
+ /* use IsectPT2Df_limit here so we catch points are are touching the tri edge
+ * (or a small fraction over) */
bucket_bounds_ss[0][0] = bucket_bounds->xmax;
bucket_bounds_ss[0][1] = bucket_bounds->ymin;
inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0);
@@ -2249,22 +2324,25 @@ static void project_bucket_clip_face(
else {
/* The Complicated Case!
*
- * The 2 cases above are where the face is inside the bucket or the bucket is inside the face.
+ * The 2 cases above are where the face is inside the bucket
+ * or the bucket is inside the face.
*
* we need to make a convex polyline from the intersection between the screenspace face
* and the bucket bounds.
*
- * There are a number of ways this could be done, currently it just collects all intersecting verts,
- * and line intersections, then sorts them clockwise, this is a lot easier then evaluating the geometry to
- * do a correct clipping on both shapes. */
-
-
- /* add a bunch of points, we know must make up the convex hull which is the clipped rect and triangle */
+ * There are a number of ways this could be done, currently it just collects all
+ * intersecting verts, and line intersections, then sorts them clockwise, this is
+ * a lot easier then evaluating the geometry to do a correct clipping on both shapes.
+ */
+ /* Add a bunch of points, we know must make up the convex hull
+ * which is the clipped rect and triangle */
/* Maximum possible 6 intersections when using a rectangle and triangle */
- float isectVCosSS[8][3]; /* The 3rd float is used to store angle for qsort(), NOT as a Z location */
+
+ /* The 3rd float is used to store angle for qsort(), NOT as a Z location */
+ float isectVCosSS[8][3];
float v1_clipSS[2], v2_clipSS[2];
float w[3];
@@ -2332,7 +2410,8 @@ static void project_bucket_clip_face(
}
#endif
- v1_clipSS[0] = cent[0]; /* Abuse this var for the loop below */
+ /* Abuse this var for the loop below */
+ v1_clipSS[0] = cent[0];
v1_clipSS[1] = cent[1] + 1.0f;
for (i = 0; i < (*tot); i++) {
@@ -2358,7 +2437,8 @@ static void project_bucket_clip_face(
isectVCosSS[j][0] = isectVCosSS[j + 1][0];
isectVCosSS[j][1] = isectVCosSS[j + 1][1];
}
- doubles = true; /* keep looking for more doubles */
+ /* keep looking for more doubles */
+ doubles = true;
(*tot)--;
}
}
@@ -2515,7 +2595,7 @@ static void project_paint_face_init(
ps->do_masking,
IMAPAINT_TILE_NUMBER(ibuf->x),
tmpibuf,
- ps->projImages + image_index
+ ps->projImages + image_index,
};
const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
@@ -2523,29 +2603,36 @@ static void project_paint_face_init(
const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt) };
/* UV/pixel seeking data */
- int x; /* Image X-Pixel */
- int y; /* Image Y-Pixel */
+ /* Image X/Y-Pixel */
+ int x, y;
float mask;
- float uv[2]; /* Image floating point UV - same as x, y but from 0.0-1.0 */
+ /* Image floating point UV - same as x, y but from 0.0-1.0 */
+ float uv[2];
- const float *v1coSS, *v2coSS, *v3coSS; /* vert co screen-space, these will be assigned to lt_vtri[0-2] */
+ /* vert co screen-space, these will be assigned to lt_vtri[0-2] */
+ const float *v1coSS, *v2coSS, *v3coSS;
- const float *vCo[3]; /* vertex screenspace coords */
+ /* vertex screenspace coords */
+ const float *vCo[3];
float w[3], wco[3];
- float *uv1co, *uv2co, *uv3co; /* for convenience only, these will be assigned to lt_tri_uv[0],1,2 or lt_tri_uv[0],2,3 */
+ /* for convenience only, these will be assigned to lt_tri_uv[0],1,2 or lt_tri_uv[0],2,3 */
+ float *uv1co, *uv2co, *uv3co;
float pixelScreenCo[4];
bool do_3d_mapping = ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D;
- rcti bounds_px; /* ispace bounds */
+ /* ispace bounds */
+ rcti bounds_px;
/* vars for getting uvspace bounds */
- float lt_uv_pxoffset[3][2]; /* bucket bounds in UV space so we can init pixels only for this face, */
+ /* bucket bounds in UV space so we can init pixels only for this face, */
+ float lt_uv_pxoffset[3][2];
float xhalfpx, yhalfpx;
const float ibuf_xf = (float)ibuf->x, ibuf_yf = (float)ibuf->y;
- int has_x_isect = 0, has_isect = 0; /* for early loop exit */
+ /* for early loop exit */
+ int has_x_isect = 0, has_isect = 0;
float uv_clip[8][2];
int uv_clip_tot;
@@ -2619,12 +2706,14 @@ static void project_paint_face_init(
has_isect = 0;
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
//uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
- uv[1] = (float)y / ibuf_yf; /* use pixel offset UV coords instead */
+ /* use pixel offset UV coords instead */
+ uv[1] = (float)y / ibuf_yf;
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
//uv[0] = (((float)x) + 0.5f) / ibuf->x;
- uv[0] = (float)x / ibuf_xf; /* use pixel offset UV coords instead */
+ /* use pixel offset UV coords instead */
+ uv[0] = (float)x / ibuf_xf;
/* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesn't work,
* could check the poly direction but better to do this */
@@ -2646,7 +2735,8 @@ static void project_paint_face_init(
ps->mvert_eval[lt_vtri[2]].co,
w);
if (do_clip && ED_view3d_clipping_test(ps->rv3d, wco, true)) {
- continue; /* Watch out that no code below this needs to run */
+ /* Watch out that no code below this needs to run */
+ continue;
}
}
@@ -2679,7 +2769,8 @@ static void project_paint_face_init(
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -2693,8 +2784,10 @@ static void project_paint_face_init(
if (ps->seam_bleed_px > 0.0f) {
int face_seam_flag;
- if (threaded)
- BLI_thread_lock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ if (threaded) {
+ /* Other threads could be modifying these vars. */
+ BLI_thread_lock(LOCK_CUSTOM1);
+ }
face_seam_flag = ps->faceSeamFlags[tri_index];
@@ -2710,8 +2803,10 @@ static void project_paint_face_init(
if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2 | PROJ_FACE_SEAM3)) == 0) {
- if (threaded)
- BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ if (threaded) {
+ /* Other threads could be modifying these vars. */
+ BLI_thread_unlock(LOCK_CUSTOM1);
+ }
}
else {
@@ -2719,13 +2814,19 @@ static void project_paint_face_init(
/* Now create new UV's for the seam face */
float (*outset_uv)[2] = ps->faceSeamUVs[tri_index];
- float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */
+ /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */
+ float insetCos[3][3];
- const float *vCoSS[3]; /* vertex screenspace coords */
+ /* vertex screenspace coords */
+ const float *vCoSS[3];
- float bucket_clip_edges[2][2]; /* store the screenspace coords of the face, clipped by the bucket's screen aligned rectangle */
+ /* Store the screenspace coords of the face,
+ * clipped by the bucket's screen aligned rectangle. */
+ float bucket_clip_edges[2][2];
float edge_verts_inset_clip[2][3];
- int fidx1, fidx2; /* face edge pairs - loop throuh these ((0,1), (1,2), (2,3), (3,0)) or ((0,1), (1,2), (2,0)) for a tri */
+ /* face edge pairs - loop throuh these:
+ * ((0,1), (1,2), (2,3), (3,0)) or ((0,1), (1,2), (2,0)) for a tri */
+ int fidx1, fidx2;
float seam_subsection[4][2];
float fac1, fac2;
@@ -2735,9 +2836,11 @@ static void project_paint_face_init(
lt_uv_pxoffset, outset_uv, ps->seam_bleed_px,
ibuf->x, ibuf->y, (ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_CW) == 0);
- /* ps->faceSeamUVs cant be modified when threading, now this is done we can unlock */
- if (threaded)
- BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ /* ps->faceSeamUVs cant be modified when threading, now this is done we can unlock. */
+ if (threaded) {
+ /* Other threads could be modifying these vars */
+ BLI_thread_unlock(LOCK_CUSTOM1);
+ }
vCoSS[0] = ps->screenCoords[lt_vtri[0]];
vCoSS[1] = ps->screenCoords[lt_vtri[1]];
@@ -2752,12 +2855,14 @@ static void project_paint_face_init(
}
for (fidx1 = 0; fidx1 < 3; fidx1++) {
- fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1; /* next fidx in the face (0,1,2) -> (1,2,0) */
+ /* next fidx in the face (0,1,2) -> (1,2,0) */
+ fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
if ((face_seam_flag & (1 << fidx1)) && /* 1<<fidx1 -> PROJ_FACE_SEAM# */
line_clip_rect2f(clip_rect, bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1]))
{
- if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) { /* avoid div by zero */
+ /* Avoid div by zero. */
+ if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) {
if (is_ortho) {
fac1 = line_point_factor_v2(bucket_clip_edges[0], vCoSS[fidx1], vCoSS[fidx2]);
@@ -2786,37 +2891,43 @@ static void project_paint_face_init(
has_isect = 0;
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
// uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
- uv[1] = (float)y / ibuf_yf; /* use offset uvs instead */
+ /* use offset uvs instead */
+ uv[1] = (float)y / ibuf_yf;
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
//uv[0] = (((float)x) + 0.5f) / (float)ibuf->x;
- uv[0] = (float)x / ibuf_xf; /* use offset uvs instead */
+ /* use offset uvs instead */
+ uv[0] = (float)x / ibuf_xf;
/* test we're inside uvspace bucket and triangle bounds */
if (isect_point_quad_v2(uv, UNPACK4(seam_subsection))) {
float fac;
/* We need to find the closest point along the face edge,
- * getting the screen_px_from_*** wont work because our actual location
- * is not relevant, since we are outside the face, Use VecLerpf to find
- * our location on the side of the face's UV */
+ * getting the screen_px_from_*** wont work because our
+ * actual location is not relevant, since we are outside
+ * the face, Use VecLerpf to find our location on the side
+ * of the face's UV */
#if 0
if (is_ortho) screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
else screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
#endif
- /* Since this is a seam we need to work out where on the line this pixel is */
+ /* Since this is a seam we need to work out where on
+ * the line this pixel is */
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
fac = resolve_quad_u_v2(uv, UNPACK4(seam_subsection));
interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
if (!is_ortho) {
pixelScreenCo[3] = 1.0f;
- mul_m4_v4((float(*)[4])ps->projectMat, pixelScreenCo); /* cast because of const */
+ /* cast because of const */
+ mul_m4_v4((float(*)[4])ps->projectMat, pixelScreenCo);
pixelScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * pixelScreenCo[0] / pixelScreenCo[3];
pixelScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * pixelScreenCo[1] / pixelScreenCo[3];
- pixelScreenCo[2] = pixelScreenCo[2] / pixelScreenCo[3]; /* Use the depth for bucket point occlusion */
+ /* Use the depth for bucket point occlusion */
+ pixelScreenCo[2] = pixelScreenCo[2] / pixelScreenCo[3];
}
if ((ps->do_occlude == false) ||
@@ -2826,25 +2937,30 @@ static void project_paint_face_init(
if (ps->do_mask_normal || ps->poly_to_loop_uv_clone) {
const float uv_fac = fac1 + (fac * (fac2 - fac1));
#if 0
- /* get the UV on the line since we want to copy the pixels from there for bleeding */
+ /* get the UV on the line since we want to copy the
+ * pixels from there for bleeding */
float uv_close[2];
interp_v2_v2v2(uv_close, lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], uv_fac);
barycentric_weights_v2(lt_uv_pxoffset[0], lt_uv_pxoffset[1], lt_uv_pxoffset[2], uv_close, w);
#else
- /* Cheat, we know where we are along the edge so work out the weights from that */
+ /* Cheat, we know where we are along the edge
+ * so work out the weights from that */
w[0] = w[1] = w[2] = 0.0;
w[fidx1] = 1.0f - uv_fac;
w[fidx2] = uv_fac;
#endif
}
- /* a pity we need to get the worldspace pixel location here */
+ /* a pity we need to get the worldspace
+ * pixel location here */
if (do_clip || do_3d_mapping) {
interp_v3_v3v3v3(wco, vCo[0], vCo[1], vCo[2], w);
if (do_clip && ED_view3d_clipping_test(ps->rv3d, wco, true)) {
- continue; /* Watch out that no code below this needs to run */
+ /* Watch out that no code below
+ * this needs to run */
+ continue;
}
}
@@ -2862,13 +2978,15 @@ static void project_paint_face_init(
}
}
else if (has_x_isect) {
- /* assuming the face is not a bow-tie - we know we cant intersect again on the X */
+ /* assuming the face is not a bow-tie - we know
+ * we cant intersect again on the X */
break;
}
}
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -2886,12 +3004,22 @@ static void project_paint_face_init(
}
-/* takes floating point screenspace min/max and returns int min/max to be used as indices for ps->bucketRect, ps->bucketFlags */
-static void project_paint_bucket_bounds(const ProjPaintState *ps, const float min[2], const float max[2], int bucketMin[2], int bucketMax[2])
+/**
+ * Takes floating point screenspace min/max and
+ * returns int min/max to be used as indices for ps->bucketRect, ps->bucketFlags
+ */
+static void project_paint_bucket_bounds(
+ const ProjPaintState *ps,
+ const float min[2], const float max[2],
+ int bucketMin[2], int bucketMax[2])
{
/* divide by bucketWidth & bucketHeight so the bounds are offset in bucket grid units */
- /* XXX: the offset of 0.5 is always truncated to zero and the offset of 1.5f is always truncated to 1, is this really correct?? - jwilkins */
- bucketMin[0] = (int)((int)(((float)(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 0.5f); /* these offsets of 0.5 and 1.5 seem odd but they are correct */
+
+ /* XXX: the offset of 0.5 is always truncated to zero and the offset of 1.5f
+ * is always truncated to 1, is this really correct?? - jwilkins */
+
+ /* these offsets of 0.5 and 1.5 seem odd but they are correct */
+ bucketMin[0] = (int)((int)(((float)(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 0.5f);
bucketMin[1] = (int)((int)(((float)(min[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) + 0.5f);
bucketMax[0] = (int)((int)(((float)(max[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 1.5f);
@@ -2906,13 +3034,22 @@ static void project_paint_bucket_bounds(const ProjPaintState *ps, const float mi
}
/* set bucket_bounds to a screen space-aligned floating point bound-box */
-static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
+static void project_bucket_bounds(
+ const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
{
- bucket_bounds->xmin = ps->screenMin[0] + ((bucket_x) * (ps->screen_width / ps->buckets_x)); /* left */
- bucket_bounds->xmax = ps->screenMin[0] + ((bucket_x + 1) * (ps->screen_width / ps->buckets_x)); /* right */
-
- bucket_bounds->ymin = ps->screenMin[1] + ((bucket_y) * (ps->screen_height / ps->buckets_y)); /* bottom */
- bucket_bounds->ymax = ps->screenMin[1] + ((bucket_y + 1) * (ps->screen_height / ps->buckets_y)); /* top */
+ /* left */
+ bucket_bounds->xmin = (
+ ps->screenMin[0] + ((bucket_x) * (ps->screen_width / ps->buckets_x)));
+ /* right */
+ bucket_bounds->xmax = (
+ ps->screenMin[0] + ((bucket_x + 1) * (ps->screen_width / ps->buckets_x)));
+
+ /* bottom */
+ bucket_bounds->ymin = (
+ ps->screenMin[1] + ((bucket_y) * (ps->screen_height / ps->buckets_y)));
+ /* top */
+ bucket_bounds->ymax = (
+ ps->screenMin[1] + ((bucket_y + 1) * (ps->screen_height / ps->buckets_y)));
}
/* Fill this bucket with pixels from the faces that intersect it.
@@ -2973,13 +3110,14 @@ static void project_bucket_init(
/* We want to know if a bucket and a face overlap in screen-space
*
- * Note, if this ever returns false positives its not that bad, since a face in the bounding area will have its pixels
- * calculated when it might not be needed later, (at the moment at least)
+ * Note, if this ever returns false positives its not that bad, since a face in the bounding area
+ * will have its pixels calculated when it might not be needed later, (at the moment at least)
* obviously it shouldn't have bugs though */
static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MLoopTri *lt)
{
- /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */
+ /* TODO - replace this with a tricker method that uses sideofline for all
+ * screenCoords's edges against the closest bucket corner */
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
rctf bucket_bounds;
float p1[2], p2[2], p3[2], p4[2];
@@ -3024,15 +3162,19 @@ static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int buck
}
/* Add faces to the bucket but don't initialize its pixels
- * TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */
+ * TODO - when painting occluded, sort the faces on their min-Z
+ * and only add faces that faces that are not occluded */
static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *lt, const int tri_index)
{
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
float min[2], max[2], *vCoSS;
- int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */
+ /* for ps->bucketRect indexing */
+ int bucketMin[2], bucketMax[2];
int fidx, bucket_x, bucket_y;
- int has_x_isect = -1, has_isect = 0; /* for early loop exit */
- MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */
+ /* for early loop exit */
+ int has_x_isect = -1, has_isect = 0;
+ /* just use the first thread arena since threading has not started yet */
+ MemArena *arena = ps->arena_mt[0];
INIT_MINMAX2(min, max);
@@ -3051,7 +3193,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
int bucket_index = bucket_x + (bucket_y * ps->buckets_x);
BLI_linklist_prepend_arena(
&ps->bucketFaces[bucket_index],
- POINTER_FROM_INT(tri_index), /* cast to a pointer to shut up the compiler */
+ /* cast to a pointer to shut up the compiler */
+ POINTER_FROM_INT(tri_index),
arena
);
@@ -3063,7 +3206,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
}
}
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -3071,7 +3215,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
#ifndef PROJ_DEBUG_NOSEAMBLEED
if (ps->seam_bleed_px > 0.0f) {
- **ps->faceSeamUVs[tri_index] = FLT_MAX; /* set as uninitialized */
+ /* set as uninitialized */
+ **ps->faceSeamUVs[tri_index] = FLT_MAX;
}
#endif
}
@@ -3110,7 +3255,7 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
ED_view3d_ob_project_mat_get_from_obmat(ps->rv3d, ps->obmat, ps->projectMat);
- ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend, true);
+ ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clip_start, &ps->clip_end, true);
}
else {
/* re-projection */
@@ -3130,8 +3275,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
/* use image array, written when creating image */
memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float);
memcpy(viewmat, array, sizeof(viewmat)); array += sizeof(viewmat) / sizeof(float);
- ps->clipsta = array[0];
- ps->clipend = array[1];
+ ps->clip_start = array[0];
+ ps->clip_end = array[1];
ps->is_ortho = array[2] ? 1 : 0;
invert_m4_m4(viewinv, viewmat);
@@ -3152,8 +3297,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
BKE_camera_params_compute_matrix(&params);
copy_m4_m4(winmat, params.winmat);
- ps->clipsta = params.clipsta;
- ps->clipend = params.clipend;
+ ps->clip_start = params.clip_start;
+ ps->clip_end = params.clip_end;
ps->is_ortho = params.is_ortho;
}
else {
@@ -3214,11 +3359,12 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di
mul_m4_v4(ps->projectMat, projScreenCo);
- if (projScreenCo[3] > ps->clipsta) {
+ if (projScreenCo[3] > ps->clip_start) {
/* screen space, not clamped */
projScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
projScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
- projScreenCo[2] = projScreenCo[2] / projScreenCo[3]; /* Use the depth for bucket point occlusion */
+ /* Use the depth for bucket point occlusion */
+ projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
}
else {
@@ -3360,7 +3506,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
}
if (ps->is_ortho) {
- if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */
+ if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) {
+ /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
@@ -3370,7 +3517,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
if (UNLIKELY(ps->is_flip_object)) {
negate_v3(viewDirPersp);
}
- if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */
+ if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) {
+ /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
@@ -3434,7 +3582,8 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
}
/* Build final material array, we use this a lot here. */
- const int totmat = ob->totcol + 1; /* materials start from 1, default material is 0 */
+ /* materials start from 1, default material is 0 */
+ const int totmat = ob->totcol + 1;
ps->mat_array = MEM_malloc_arrayN(totmat, sizeof(*ps->mat_array), __func__);
/* We leave last material as empty - rationale here is being able to index
* the materials by using the mf->mat_nr directly and leaving the last
@@ -3704,7 +3853,8 @@ static void project_paint_prepare_all_faces(
/* don't allow using the same inage for painting and stencilling */
if (slot->ima == ps->stencil_ima) {
/* While this shouldn't be used, face-winding reads all polys.
- * It's less trouble to set all faces to valid UV's, avoiding NULL checks all over. */
+ * It's less trouble to set all faces to valid UV's,
+ * avoiding NULL checks all over. */
ps->poly_to_loop_uv[lt->poly] = mloopuv_base;
continue;
}
@@ -3779,7 +3929,8 @@ static void project_paint_prepare_all_faces(
image_index = BLI_linklist_index(image_LinkList.list, tpage);
- if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */
+ if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) {
+ /* MemArena dosnt have an append func */
BLI_linklist_append(&image_LinkList, tpage);
image_index = ps->image_tot;
ps->image_tot++;
@@ -3814,7 +3965,8 @@ static void project_paint_begin(
ProjPaintFaceLookup face_lookup;
const MLoopUV *mloopuv_base = NULL;
- MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
+ /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
+ MemArena *arena;
const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush);
@@ -3822,8 +3974,10 @@ static void project_paint_begin(
/* ---- end defines ---- */
- if (ps->source == PROJ_SRC_VIEW)
- ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */
+ if (ps->source == PROJ_SRC_VIEW) {
+ /* faster clipping lookups */
+ ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat);
+ }
ps->do_face_sel = ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) != 0);
ps->is_flip_object = (ps->ob->transflag & OB_NEG_SCALE) != 0;
@@ -4057,7 +4211,8 @@ static bool project_image_refresh_tagged(ProjPaintState *ps)
partial_redraw_single_init(pr);
}
- projIma->touch = 0; /* clear for reuse */
+ /* clear for reuse */
+ projIma->touch = 0;
}
}
@@ -4149,8 +4304,11 @@ typedef struct ProjectHandle {
float prevmval[2];
float mval[2];
- /* annoying but we need to have image bounds per thread, then merge into ps->projectPartialRedraws */
- ProjPaintImage *projImages; /* array of partial redraws */
+ /* Annoying but we need to have image bounds per thread,
+ * then merge into ps->projectPartialRedraws. */
+
+ /* array of partial redraws */
+ ProjPaintImage *projImages;
/* thread settings */
int thread_index;
@@ -4292,7 +4450,8 @@ static void do_projectpaint_soften(
float accum_tot = 0;
int xk, yk;
BlurKernel *kernel = ps->blurkernel;
- float rgba[4]; /* convert to byte after */
+ /* convert to byte after */
+ float rgba[4];
/* rather then painting, accumulate surrounding colors */
zero_v4(rgba);
@@ -4479,18 +4638,21 @@ static void *do_projectpaint_thread(void *ph_v)
unsigned short mask_short;
const float brush_alpha = BKE_brush_alpha_get(ps->scene, brush);
const float brush_radius = ps->brush_size;
- const float brush_radius_sq = brush_radius * brush_radius; /* avoid a square root with every dist comparison */
+ /* avoid a square root with every dist comparison */
+ const float brush_radius_sq = brush_radius * brush_radius;
const bool lock_alpha = ELEM(brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ?
0 : (brush->flag & BRUSH_LOCK_ALPHA) != 0;
LinkNode *smearPixels = NULL;
LinkNode *smearPixels_f = NULL;
- MemArena *smearArena = NULL; /* mem arena for this brush projection only */
+ /* mem arena for this brush projection only */
+ MemArena *smearArena = NULL;
LinkNode *softenPixels = NULL;
LinkNode *softenPixels_f = NULL;
- MemArena *softenArena = NULL; /* mem arena for this brush projection only */
+ /* mem arena for this brush projection only */
+ MemArena *softenArena = NULL;
if (tool == PAINT_TOOL_SMEAR) {
pos_ofs[0] = pos[0] - lastpos[0];
@@ -4502,7 +4664,8 @@ static void *do_projectpaint_thread(void *ph_v)
softenArena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "paint soften arena");
}
- /* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
+ /* printf("brush bounds %d %d %d %d\n",
+ * bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {
@@ -4701,7 +4864,8 @@ static void *do_projectpaint_thread(void *ph_v)
float samplecos[3];
float texrgba[4];
- /* taking 3d copy to account for 3D mapping too. It gets concatenated during sampling */
+ /* taking 3d copy to account for 3D mapping too.
+ * It gets concatenated during sampling */
if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
copy_v3_v3(samplecos, projPixel->worldCoSS);
}
@@ -4710,7 +4874,8 @@ static void *do_projectpaint_thread(void *ph_v)
samplecos[2] = 0.0f;
}
- /* note, for clone and smear, we only use the alpha, could be a special function */
+ /* note, for clone and smear,
+ * we only use the alpha, could be a special function */
BKE_brush_sample_tex_3d(ps->scene, brush, samplecos, texrgba, thread_index, pool);
copy_v3_v3(texrgb, texrgba);
@@ -5051,7 +5216,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
Brush *brush = ps->brush;
ps->tool = brush->imagepaint_tool;
ps->blend = brush->blend;
- /* only check for inversion for the soften tool, elsewhere, a resident brush inversion flag can cause issues */
+ /* only check for inversion for the soften tool, elsewhere,
+ * a resident brush inversion flag can cause issues */
if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
ps->mode = (((ps->mode == BRUSH_STROKE_INVERT) ^ ((brush->flag & BRUSH_DIR_IN) != 0)) ?
BRUSH_STROKE_INVERT : BRUSH_STROKE_NORMAL);
@@ -5082,7 +5248,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
ps->depsgraph = CTX_data_depsgraph(C);
ps->scene = scene;
- ps->ob = ob; /* allow override of active object */
+ /* allow override of active object */
+ ps->ob = ob;
ps->do_material_slots = (settings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
ps->stencil_ima = settings->imapaint.stencil;
@@ -5116,7 +5283,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
#ifndef PROJ_DEBUG_NOSEAMBLEED
- ps->seam_bleed_px = settings->imapaint.seam_bleed; /* pixel num to bleed */
+ /* pixel num to bleed */
+ ps->seam_bleed_px = settings->imapaint.seam_bleed;
#endif
if (ps->do_mask_normal) {
@@ -5131,8 +5299,10 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
ps->normal_angle *= (float)(M_PI_2 / 90);
ps->normal_angle_range = ps->normal_angle - ps->normal_angle_inner;
- if (ps->normal_angle_range <= 0.0f)
- ps->do_mask_normal = false; /* no need to do blending */
+ if (ps->normal_angle_range <= 0.0f) {
+ /* no need to do blending */
+ ps->do_mask_normal = false;
+ }
ps->normal_angle__cos = cosf(ps->normal_angle);
ps->normal_angle_inner__cos = cosf(ps->normal_angle_inner);
@@ -5368,13 +5538,15 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
ps.is_maskbrush = false;
ps.do_masking = false;
orig_brush_size = BKE_brush_size_get(scene, ps.brush);
- BKE_brush_size_set(scene, ps.brush, 32 * U.pixelsize); /* cover the whole image */
+ /* cover the whole image */
+ BKE_brush_size_set(scene, ps.brush, 32 * U.pixelsize);
- ps.tool = PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
+ /* so pixels are initialized with minimal info */
+ ps.tool = PAINT_TOOL_DRAW;
scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING;
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_3D);
/* allocate and initialize spatial data structures */
project_paint_begin(C, &ps, false, 0);
@@ -5429,6 +5601,15 @@ void PAINT_OT_project_image(wmOperatorType *ot)
ot->prop = prop;
}
+static bool texture_paint_image_from_view_poll(bContext *C)
+{
+ if (BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0) == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "No 3D viewport found to create image from");
+ return false;
+ }
+ return true;
+}
+
static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
{
Image *image;
@@ -5439,13 +5620,24 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings;
- View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = CTX_wm_region_view3d(C);
int w = settings->imapaint.screen_grab_size[0];
int h = settings->imapaint.screen_grab_size[1];
int maxsize;
char err_out[256] = "unknown";
+ ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
+ if (!sa) {
+ BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from");
+ return OPERATOR_CANCELLED;
+ }
+ View3D *v3d = sa->spacedata.first;
+ ARegion *ar = BKE_area_find_region_active_win(sa);
+ if (!ar) {
+ BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from");
+ return OPERATOR_CANCELLED;
+ }
+ RegionView3D *rv3d = ar->regiondata;
+
RNA_string_get(op->ptr, "filepath", filename);
maxsize = GPU_max_texture_size();
@@ -5455,7 +5647,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
ibuf = ED_view3d_draw_offscreen_imbuf(
depsgraph, scene, v3d->shading.type,
- v3d, CTX_wm_region(C),
+ v3d, ar,
w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL,
NULL, err_out);
if (!ibuf) {
@@ -5502,11 +5694,11 @@ void PAINT_OT_image_from_view(wmOperatorType *ot)
/* identifiers */
ot->name = "Image from View";
ot->idname = "PAINT_OT_image_from_view";
- ot->description = "Make an image from the current 3D view for re-projection";
+ ot->description = "Make an image from biggest 3D view for re-projection";
/* api callbacks */
ot->exec = texture_paint_image_from_view_exec;
- ot->poll = ED_operator_region_view3d_active;
+ ot->poll = texture_paint_image_from_view_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;
@@ -5529,7 +5721,8 @@ void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool
);
}
-/* Make sure that active object has a material, and assign UVs and image layers if they do not exist */
+/* Make sure that active object has a material,
+ * and assign UVs and image layers if they do not exist */
bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
{
Mesh *me;
@@ -5564,7 +5757,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m
hasmat = true;
if (!ma->texpaintslot) {
/* refresh here just in case */
- BKE_texpaint_slot_refresh_cache(scene, ma);
+ BKE_texpaint_slot_refresh_cache(ma);
/* if still no slots, we have to add */
if (ma->texpaintslot) {
@@ -5631,7 +5824,7 @@ enum {
LAYER_METALLIC,
LAYER_NORMAL,
LAYER_BUMP,
- LAYER_DISPLACEMENT
+ LAYER_DISPLACEMENT,
};
static const EnumPropertyItem layer_type_items[] = {
@@ -5642,7 +5835,7 @@ static const EnumPropertyItem layer_type_items[] = {
{LAYER_NORMAL, "NORMAL", 0, "Normal", ""},
{LAYER_BUMP, "BUMP", 0, "Bump", ""},
{LAYER_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static Image *proj_paint_image_create(wmOperator *op, Main *bmain)
@@ -5824,16 +6017,18 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
nodePositionPropagate(out_node);
if (ima) {
- BKE_texpaint_slot_refresh_cache(scene, ma);
+ BKE_texpaint_slot_refresh_cache(ma);
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE);
WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima);
- DEG_id_tag_update(&ma->id, 0);
- ED_area_tag_redraw(CTX_wm_area(C));
+ }
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ DEG_id_tag_update(&ntree->id, 0);
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE);
+ ED_area_tag_redraw(CTX_wm_area(C));
- return true;
- }
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+
+ return true;
}
return false;
@@ -5883,8 +6078,12 @@ static void get_default_texture_layer_name_for_object(Object *ob, int texture_ty
static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
+ /* Get material and default color to display in the popup. */
Object *ob = ED_object_active_context(C);
+ Material *ma = get_or_create_current_material(C, ob);
+
int type = get_texture_layer_type(op, "type");
+ proj_paint_default_color(op, type, ma);
char imagename[MAX_ID_NAME - 2];
get_default_texture_layer_name_for_object(ob, type, (char *)&imagename, sizeof(imagename));
@@ -5937,33 +6136,8 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
- Mesh *me = ob->data;
- bool synch_selection = (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
-
- BMesh *bm = BM_mesh_create(
- &bm_mesh_allocsize_default,
- &((struct BMeshCreateParams){.use_toolflags = false,}));
-
- /* turn synch selection off, since we are not in edit mode we need to ensure only the uv flags are tested */
- scene->toolsettings->uv_flag &= ~UV_SYNC_SELECTION;
-
- ED_mesh_uv_texture_ensure(me, NULL);
-
- BM_mesh_bm_from_me(
- bm, me, (&(struct BMeshFromMeshParams){
- .calc_face_normal = true,
- }));
- /* select all uv loops first - pack parameters needs this to make sure charts are registered */
- ED_uvedit_select_all(bm);
- ED_uvedit_unwrap_cube_project(bm, 1.0, false, NULL);
- /* set the margin really quickly before the packing operation*/
- scene->toolsettings->uvcalc_margin = 0.001f;
- ED_uvedit_pack_islands(scene, ob, bm, false, false, true);
- BM_mesh_bm_to_me(bmain, bm, me, (&(struct BMeshToMeshParams){0}));
- BM_mesh_free(bm);
-
- if (synch_selection)
- scene->toolsettings->uv_flag |= UV_SYNC_SELECTION;
+
+ ED_uvedit_add_simple_uvs(bmain, scene, ob);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index e26a4811afc..8c4bfe00654 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
*
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -40,13 +36,15 @@
#include "BKE_context.h"
#include "BKE_image.h"
-#include "BKE_main.h"
+#include "BKE_paint.h"
#include "BKE_undo_system.h"
#include "DEG_depsgraph.h"
#include "ED_paint.h"
#include "ED_undo.h"
+#include "ED_util.h"
+#include "ED_object.h"
#include "GPU_draw.h"
@@ -98,7 +96,7 @@ void image_undo_end_locks(void)
typedef enum {
COPY = 0,
RESTORE = 1,
- RESTORE_COPY = 2
+ RESTORE_COPY = 2,
} CopyMode;
static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, CopyMode mode)
@@ -346,26 +344,13 @@ static void image_undo_restore_list(ListBase *lb, struct UndoIDPtrMap *id_map)
static void image_undo_free_list(ListBase *lb)
{
- UndoImageTile *tile;
-
- for (tile = lb->first; tile; tile = tile->next) {
+ for (UndoImageTile *tile = lb->first, *tile_next; tile; tile = tile_next) {
+ tile_next = tile->next;
MEM_freeN(tile->rect.pt);
+ MEM_freeN(tile);
}
}
-void ED_image_undo_push_begin(const char *name)
-{
- UndoStack *ustack = ED_undo_stack_get();
- bContext *C = NULL; /* special case, we never read from this. */
- BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_IMAGE);
-}
-
-void ED_image_undo_push_end(void)
-{
- UndoStack *ustack = ED_undo_stack_get();
- BKE_undosys_step_push(ustack, NULL, NULL);
-}
-
static void image_undo_invalidate(void)
{
UndoImageTile *tile;
@@ -385,6 +370,8 @@ static void image_undo_invalidate(void)
typedef struct ImageUndoStep {
UndoStep step;
ListBase tiles;
+ bool is_encode_init;
+ ePaintMode paint_mode;
/* Use for all ID lookups (can be NULL). */
struct UndoIDPtrMap *id_map;
@@ -418,11 +405,13 @@ static bool image_undosys_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
if (sa && (sa->spacetype == SPACE_IMAGE)) {
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
- if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
+ if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) ||
+ (sima->mode == SI_MODE_PAINT))
+ {
return true;
}
}
- else if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+ else {
if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) {
return true;
}
@@ -434,10 +423,11 @@ static void image_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
{
ImageUndoStep *us = (ImageUndoStep *)us_p;
/* dummy, memory is cleared anyway. */
+ us->is_encode_init = true;
BLI_listbase_clear(&us->tiles);
}
-static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool image_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'ImageUndoStep' added by encode_init. */
@@ -447,33 +437,103 @@ static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p
int allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
-
- /* first dispose of invalid tiles (may happen due to drag dot for instance) */
- for (UndoImageTile *tile = us->tiles.first; tile;) {
- if (!tile->valid) {
- UndoImageTile *tmp_tile = tile->next;
- MEM_freeN(tile->rect.pt);
- BLI_freelinkN(&us->tiles, tile);
- tile = tmp_tile;
- }
- else {
- us->step.data_size += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
- tile = tile->next;
+ if (us->is_encode_init) {
+ /* first dispose of invalid tiles (may happen due to drag dot for instance) */
+ for (UndoImageTile *tile = us->tiles.first; tile;) {
+ if (!tile->valid) {
+ UndoImageTile *tmp_tile = tile->next;
+ MEM_freeN(tile->rect.pt);
+ BLI_freelinkN(&us->tiles, tile);
+ tile = tmp_tile;
+ }
+ else {
+ us->step.data_size += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
+ tile = tile->next;
+ }
}
}
+ else {
+ /* Happens when switching modes. */
+ ePaintMode paint_mode = BKE_paintmode_get_active_from_context(C);
+ BLI_assert(ELEM(paint_mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D));
+ us->paint_mode = paint_mode;
+ }
image_undosys_step_encode_store_ids(us);
+ us_p->is_applied = true;
+
return true;
}
-static void image_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+
+static void image_undosys_step_decode_undo_impl(ImageUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == true);
+ image_undo_restore_list(&us->tiles, us->id_map);
+ us->step.is_applied = false;
+}
+
+static void image_undosys_step_decode_redo_impl(ImageUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
+ image_undo_restore_list(&us->tiles, us->id_map);
+ us->step.is_applied = true;
+}
+
+static void image_undosys_step_decode_undo(ImageUndoStep *us)
+{
+ ImageUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ image_undosys_step_decode_undo_impl(us_iter);
+ us_iter = (ImageUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void image_undosys_step_decode_redo(ImageUndoStep *us)
+{
+ ImageUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ image_undosys_step_decode_redo_impl(us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.next;
+ }
+}
+
+static void image_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir)
{
ImageUndoStep *us = (ImageUndoStep *)us_p;
#if 0
paint_undosys_step_decode_restore_ids(us);
#endif
- image_undo_restore_list(&us->tiles, us->id_map);
+
+ if (dir < 0) {
+ image_undosys_step_decode_undo(us);
+ }
+ else {
+ image_undosys_step_decode_redo(us);
+ }
+
+ if (us->paint_mode == PAINT_MODE_TEXTURE_3D) {
+ ED_object_mode_set(C, OB_MODE_TEXTURE_PAINT);
+ }
+
+ /* Refresh texture slots. */
+ ED_editors_init_for_undo(bmain);
}
static void image_undosys_step_free(UndoStep *us_p)
@@ -504,7 +564,6 @@ void ED_image_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = image_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = true;
ut->step_size = sizeof(ImageUndoStep);
@@ -526,8 +585,17 @@ ListBase *ED_image_undosys_step_get_tiles(UndoStep *us_p)
ListBase *ED_image_undo_get_tiles(void)
{
UndoStack *ustack = ED_undo_stack_get();
- UndoStep *us = BKE_undosys_stack_init_or_active_with_type(ustack, BKE_UNDOSYS_TYPE_IMAGE);
- return ED_image_undosys_step_get_tiles(us);
+ UndoStep *us_prev = ustack->step_init;
+ UndoStep *us_p = BKE_undosys_stack_init_or_active_with_type(ustack, BKE_UNDOSYS_TYPE_IMAGE);
+ ImageUndoStep *us = (ImageUndoStep *)us_p;
+ /* We should always have an undo push started when accessing tiles,
+ * not doing this means we won't have paint_mode correctly set. */
+ BLI_assert(us_p == us_prev);
+ if (us_p != us_prev) {
+ /* Fallback value until we can be sure this never happens. */
+ us->paint_mode = PAINT_MODE_TEXTURE_2D;
+ }
+ return ED_image_undosys_step_get_tiles(us_p);
}
/* restore painting image to previous state. Used for anchored and drag-dot style brushes*/
@@ -538,4 +606,20 @@ void ED_image_undo_restore(UndoStep *us)
image_undo_invalidate();
}
+void ED_image_undo_push_begin(const char *name, int paint_mode)
+{
+ UndoStack *ustack = ED_undo_stack_get();
+ bContext *C = NULL; /* special case, we never read from this. */
+ UndoStep *us_p = BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_IMAGE);
+ ImageUndoStep *us = (ImageUndoStep *)us_p;
+ BLI_assert(ELEM(paint_mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D));
+ us->paint_mode = paint_mode;
+}
+
+void ED_image_undo_push_end(void)
+{
+ UndoStack *ustack = ED_undo_stack_get();
+ BKE_undosys_step_push(ustack, NULL, NULL);
+}
+
/** \} */
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index b991755325a..8363145ee07 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_intern.h
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -33,28 +26,28 @@
#define __PAINT_INTERN_H__
struct ARegion;
-struct bContext;
struct Brush;
-struct ImagePool;
-struct ColorSpace;
struct ColorManagedDisplay;
+struct ColorSpace;
+struct ImagePool;
struct ListBase;
struct MTex;
struct Object;
-struct PaintStroke;
struct Paint;
struct PaintCurve;
+struct PaintStroke;
struct PointerRNA;
-struct rcti;
-struct Scene;
struct RegionView3D;
+struct Scene;
+struct UndoStep;
struct VPaint;
struct ViewContext;
+struct bContext;
+struct rcti;
struct wmEvent;
struct wmOperator;
struct wmOperatorType;
struct wmWindowManager;
-struct UndoStep;
enum ePaintMode;
typedef struct CoNo {
@@ -113,7 +106,7 @@ void PAINT_OT_weight_set(struct wmOperatorType *ot);
enum {
WPAINT_GRADIENT_TYPE_LINEAR,
- WPAINT_GRADIENT_TYPE_RADIAL
+ WPAINT_GRADIENT_TYPE_RADIAL,
};
void PAINT_OT_weight_gradient(struct wmOperatorType *ot);
@@ -342,9 +335,6 @@ void PAINTCURVE_OT_slide(struct wmOperatorType *ot);
void PAINTCURVE_OT_draw(struct wmOperatorType *ot);
void PAINTCURVE_OT_cursor(struct wmOperatorType *ot);
-/* paint_curve_undo.c */
-void ED_paintcurve_undo_push(struct bContext *C, struct wmOperator *op, struct PaintCurve *pc);
-
/* image painting blur kernel */
typedef struct {
float *wdata; /* actual kernel */
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index b8175e3d368..2f9706db636 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_mask.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -484,7 +475,8 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
data.symmpass = symmpass;
- /* gather nodes inside lasso's enclosing rectangle (should greatly help with bigger meshes) */
+ /* gather nodes inside lasso's enclosing rectangle
+ * (should greatly help with bigger meshes) */
BKE_pbvh_search_gather(pbvh, BKE_pbvh_node_planes_contain_AABB, clip_planes_final, &nodes, &totnode);
data.task_data.ob = ob;
@@ -534,7 +526,7 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
ot->poll = sculpt_mode_poll;
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER;
/* properties */
WM_operator_properties_gesture_lasso(ot);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 80911cf202f..03f69750aca 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,22 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include <stdlib.h>
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
-#include "BLI_math_color.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
@@ -561,13 +555,13 @@ typedef enum {
typedef enum {
STENCIL_PRIMARY = 0,
- STENCIL_SECONDARY = 1
+ STENCIL_SECONDARY = 1,
} StencilTextureMode;
typedef enum {
STENCIL_CONSTRAINT_X = 1,
- STENCIL_CONSTRAINT_Y = 2
+ STENCIL_CONSTRAINT_Y = 2,
} StencilConstraint;
typedef struct {
@@ -799,13 +793,13 @@ static void BRUSH_OT_stencil_control(wmOperatorType *ot)
{STENCIL_TRANSLATE, "TRANSLATION", 0, "Translation", ""},
{STENCIL_SCALE, "SCALE", 0, "Scale", ""},
{STENCIL_ROTATE, "ROTATION", 0, "Rotation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem stencil_texture_items[] = {
{STENCIL_PRIMARY, "PRIMARY", 0, "Primary", ""},
{STENCIL_SECONDARY, "SECONDARY", 0, "Secondary", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
ot->name = "Stencil Brush Control";
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 15dd0438585..2af6a4db3ee 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_stroke.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -58,8 +49,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -494,8 +483,11 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
}
/* This can be removed once fixed properly in
- * BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
- * at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */
+ * BKE_brush_painter_paint(
+ * BrushPainter *painter, BrushFunc func,
+ * float *pos, double time, float pressure, void *user);
+ * at zero pressure we should do nothing 1/2^12 is 0.0002
+ * which is the sensitivity of the most sensitive pen tablet available */
if (tablet && (pressure < 0.0002f) &&
((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
@@ -980,7 +972,7 @@ static void paint_stroke_sample_average(
mul_v2_fl(average->mouse, 1.0f / stroke->num_samples);
average->pressure /= stroke->num_samples;
- /*printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);*/
+ // printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);
}
/**
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 923fc097f43..b8c067d61e7 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <math.h>
@@ -217,10 +209,10 @@ void paint_get_tex_pixel_col(
void paint_stroke_operator_properties(wmOperatorType *ot)
{
static const EnumPropertyItem stroke_mode_items[] = {
- {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
+ {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Regular", "Apply brush normally"},
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
{BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"},
- {0}
+ {0},
};
PropertyRNA *prop;
@@ -594,7 +586,8 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
{CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
{CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
ot->name = "Preset";
ot->description = "Set brush shape";
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f5c49c4b7e1..26da6d60051 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Used for vertex color & weight paint and mode switching.
*
@@ -246,7 +238,7 @@ bool vertex_paint_poll(bContext *C)
bool vertex_paint_poll_ignore_tool(bContext *C)
{
- return vertex_paint_poll_ex(C, true);
+ return vertex_paint_poll_ex(C, false);
}
bool weight_paint_mode_poll(bContext *C)
@@ -823,7 +815,8 @@ static void do_weight_paint_vertex_single(
dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->active.lock);
if (index_mirr != -1) {
- /* only normalize if this is not a center vertex, else we get a conflict, normalizing twice */
+ /* only normalize if this is not a center vertex,
+ * else we get a conflict, normalizing twice */
if (index != index_mirr) {
do_weight_paint_normalize_all_locked_try_active(
dv_mirr, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->mirror.lock);
@@ -2136,7 +2129,8 @@ static void wpaint_do_radial_symmetry(
}
}
-/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */
+/* near duplicate of: sculpt.c's,
+ * 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */
static void wpaint_do_symmetrical_brush_actions(
bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi)
{
@@ -2155,7 +2149,8 @@ static void wpaint_do_symmetrical_brush_actions(
cache->symmetry = symm;
- /* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
+ /* symm is a bit combination of XYZ - 1 is mirror
+ * X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
for (i = 1; i <= symm; i++) {
if ((symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
cache->mirror_symmetry_pass = i;
@@ -2820,7 +2815,8 @@ static void do_vpaint_brush_blur_task_cb_ex(
col[2] = round_fl_to_uchar(sqrtf(divide_round_i(blend[2], total_hit_loops)));
col[3] = round_fl_to_uchar(sqrtf(divide_round_i(blend[3], total_hit_loops)));
- /* For each poly owning this vert, paint each loop belonging to this vert. */
+ /* For each poly owning this vert,
+ * paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j];
@@ -2917,7 +2913,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
* to neighbor direction is 0.0, meaning orthogonal. */
float stroke_dot_max = 0.0f;
- /* Get the color of the loop in the opposite direction of the brush movement */
+ /* Get the color of the loop in the opposite
+ * direction of the brush movement */
uint color_final = 0;
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
@@ -2932,7 +2929,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
if (v_other_index != v_index) {
const MVert *mv_other = &data->me->mvert[v_other_index];
- /* Get the direction from the selected vert to the neighbor. */
+ /* Get the direction from the
+ * selected vert to the neighbor. */
float other_dir[3];
sub_v3_v3v3(other_dir, mv_curr->co, mv_other->co);
project_plane_v3_v3v3(other_dir, other_dir, cache->view_normal);
@@ -2956,7 +2954,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
255 * brush_fade * brush_strength *
brush_alpha_pressure * grid_alpha;
- /* For each poly owning this vert, paint each loop belonging to this vert. */
+ /* For each poly owning this vert,
+ * paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j];
@@ -3097,7 +3096,8 @@ static void vpaint_do_radial_symmetry(
}
}
-/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */
+/* near duplicate of: sculpt.c's,
+ * 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */
static void vpaint_do_symmetrical_brush_actions(
bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob)
{
@@ -3116,7 +3116,8 @@ static void vpaint_do_symmetrical_brush_actions(
cache->symmetry = symm;
- /* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
+ /* symm is a bit combination of XYZ - 1 is mirror
+ * X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
for (i = 1; i <= symm; i++) {
if (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) {
cache->mirror_symmetry_pass = i;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 1ce57868e3a..ae1736581fe 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_color_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
index f78588df0fa..4a5c72e5199 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_color_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Intended for use by `paint_vertex.c` & `paint_vertex_color_ops.c`.
*/
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 5fe96483044..ca26d2050e4 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_proj.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Utility functions for getting vertex locations while painting
* (since they may be instanced multiple times in an evaluated mesh)
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 fe326ad7337..5db01610886 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,22 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_weight_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_array_utils.h"
#include "BLI_bitmap.h"
-#include "BLI_task.h"
-#include "BLI_string_utils.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -147,7 +140,8 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
static const EnumPropertyItem type_items[] = {
{ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"},
{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Weight from Bones";
@@ -214,7 +208,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
const int vgroup_active = vc.obact->actdef - 1;
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
- /* use combined weight in multipaint mode, since that's what is displayed to the user in the colors */
+ /* use combined weight in multipaint mode,
+ * since that's what is displayed to the user in the colors */
if (ts->multipaint) {
int defbase_tot_sel;
const int defbase_tot = BLI_listbase_count(&vc.obact->defbase);
@@ -229,7 +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 autonormalize is enabled, but weights are not normalized,
+ * the value can exceed 1 */
CLAMP(vgroup_weight, 0.0f, 1.0f);
}
@@ -376,7 +372,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */
+/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active
+ * rather than its own operator */
void PAINT_OT_weight_sample_group(wmOperatorType *ot)
{
PropertyRNA *prop = NULL;
@@ -541,7 +538,7 @@ typedef struct WPGradient_vertStore {
float weight_orig;
enum {
VGRAD_STORE_NOP = 0,
- VGRAD_STORE_DW_EXIST = (1 << 0)
+ VGRAD_STORE_DW_EXIST = (1 << 0),
} flag;
} WPGradient_vertStore;
@@ -622,13 +619,13 @@ static void gradientVertUpdate__mapFunc(
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
{
WPGradient_userData *grad_data = userData;
- Mesh *me = grad_data->me;
- if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (vs->sco[0] != FLT_MAX) {
- gradientVert_update(grad_data, index);
- }
+ WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
+
+ if (vs->sco[0] == FLT_MAX) {
+ return;
}
+
+ gradientVert_update(grad_data, index);
}
static void gradientVertInit__mapFunc(
@@ -637,42 +634,41 @@ static void gradientVertInit__mapFunc(
{
WPGradient_userData *grad_data = userData;
Mesh *me = grad_data->me;
+ WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- /* run first pass only,
- * the screen coords of the verts need to be cached because
- * updating the mesh may move them about (entering feedback loop) */
-
- if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
- WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (ED_view3d_project_float_object(
- grad_data->ar,
- co, vs->sco,
- V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
- {
- /* ok */
- MDeformVert *dv = &me->dvert[index];
- const MDeformWeight *dw;
- dw = defvert_find_index(dv, grad_data->def_nr);
- if (dw) {
- vs->weight_orig = dw->weight;
- vs->flag = VGRAD_STORE_DW_EXIST;
- }
- else {
- vs->weight_orig = 0.0f;
- vs->flag = VGRAD_STORE_NOP;
- }
+ if (grad_data->use_select && !(me->mvert[index].flag & SELECT)) {
+ copy_v2_fl(vs->sco, FLT_MAX);
+ return;
+ }
- BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+ /* run first pass only,
+ * the screen coords of the verts need to be cached because
+ * updating the mesh may move them about (entering feedback loop) */
+ if (BLI_BITMAP_TEST(grad_data->vert_visit, index)) {
+ copy_v2_fl(vs->sco, FLT_MAX);
+ return;
+ }
- gradientVert_update(grad_data, index);
- }
- else {
- /* no go */
- copy_v2_fl(vs->sco, FLT_MAX);
- }
- }
+ if (ED_view3d_project_float_object(
+ grad_data->ar,
+ co, vs->sco,
+ V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != V3D_PROJ_RET_OK)
+ {
+ return;
+ }
+
+ MDeformVert *dv = &me->dvert[index];
+ const MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
+ if (dw) {
+ vs->weight_orig = dw->weight;
+ vs->flag = VGRAD_STORE_DW_EXIST;
+ }
+ else {
+ vs->weight_orig = 0.0f;
+ vs->flag = VGRAD_STORE_NOP;
}
+ BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+ gradientVert_update(grad_data, index);
}
static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -843,7 +839,7 @@ void PAINT_OT_weight_gradient(wmOperatorType *ot)
static const EnumPropertyItem gradient_types[] = {
{WPAINT_GRADIENT_TYPE_LINEAR, "LINEAR", 0, "Linear", ""},
{WPAINT_GRADIENT_TYPE_RADIAL, "RADIAL", 0, "Radial", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
index 0a1fc7c0b4e..38f9f1dfa9f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_weight_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Intended for use by `paint_vertex.c` & `paint_vertex_weight_ops.c`.
*/
@@ -151,7 +147,7 @@ int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
}
/* curdef should never be NULL unless this is
- * a lamp and BKE_object_defgroup_add_name fails */
+ * a light and BKE_object_defgroup_add_name fails */
return mirrdef;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a4605eddd79..f3b0b32c8d5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,19 +15,11 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implements the Sculpt Mode tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -56,7 +46,6 @@
#include "BKE_ccg.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_library.h"
@@ -68,7 +57,9 @@
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
+#include "BKE_particle.h"
#include "BKE_pbvh.h"
+#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_subsurf.h"
@@ -108,7 +99,8 @@
*
* \{ */
-/* Check if there are any active modifiers in stack (used for flushing updates at enter/exit sculpt mode) */
+/* Check if there are any active modifiers in stack
+ * (used for flushing updates at enter/exit sculpt mode) */
static bool sculpt_has_active_modifiers(Scene *scene, Object *ob)
{
ModifierData *md;
@@ -141,13 +133,22 @@ static bool sculpt_tool_is_proxy_used(const char sculpt_tool)
SCULPT_TOOL_LAYER);
}
+static bool sculpt_brush_use_topology_rake(
+ const SculptSession *ss, const Brush *brush)
+{
+ return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(brush->sculpt_tool) &&
+ (brush->topology_rake_factor > 0.0f) &&
+ (ss->bm != NULL);
+}
+
/**
* Test whether the #StrokeCache.sculpt_normal needs update in #do_brush_action
*/
-static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
+static int sculpt_brush_needs_normal(
+ const SculptSession *ss, const Brush *brush)
{
return ((SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool) &&
- (normal_weight > 0.0f)) ||
+ (ss->cache->normal_weight > 0.0f)) ||
ELEM(brush->sculpt_tool,
SCULPT_TOOL_BLOB,
@@ -158,7 +159,8 @@ static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_THUMB) ||
- (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA));
+ (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
+ sculpt_brush_use_topology_rake(ss, brush);
}
/** \} */
@@ -170,7 +172,7 @@ static bool sculpt_brush_needs_rake_rotation(const Brush *brush)
typedef enum StrokeFlags {
CLIP_X = 1,
CLIP_Y = 2,
- CLIP_Z = 4
+ CLIP_Z = 4,
} StrokeFlags;
/************** Access to original unmodified vertex data *************/
@@ -276,7 +278,7 @@ static void sculpt_rake_rotate(
sub_v3_v3v3(vec_rot, v_co, sculpt_co);
copy_qt_qt(q_interp, ss->cache->rake_rotation_symmetry);
- mul_fac_qt_fl(q_interp, factor);
+ pow_qt_fl_normalized(q_interp, factor);
mul_qt_v3(q_interp, vec_rot);
add_v3_v3(vec_rot, sculpt_co);
@@ -721,7 +723,6 @@ static bool sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float loca
#endif
/* ===== Sculpting =====
- *
*/
static void flip_v3(float v[3], const char symm)
{
@@ -1597,6 +1598,94 @@ static void bmesh_neighbor_average(float avg[3], BMVert *v)
copy_v3_v3(avg, v->co);
}
+/* For bmesh: average only the four most aligned (parallel and perpendicular) edges
+ * relative to a direction. Naturally converges to a quad-like tesselation. */
+static void bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v)
+{
+ /* Logic for 3 or more is identical. */
+ const int vfcount = BM_vert_face_count_at_most(v, 3);
+
+ /* Don't modify corner vertices. */
+ if (vfcount < 2) {
+ copy_v3_v3(avg, v->co);
+ return;
+ }
+
+ /* Project the direction to the vertex normal and create an aditional
+ * parallel vector. */
+ float dir_a[3], dir_b[3];
+ cross_v3_v3v3(dir_a, direction, v->no);
+ cross_v3_v3v3(dir_b, dir_a, v->no);
+
+ /* The four vectors which will be used for smoothing.
+ * Ocasionally less than 4 verts match the requirements in that case
+ * use v as fallback. */
+ BMVert *pos_a = v;
+ BMVert *neg_a = v;
+ BMVert *pos_b = v;
+ BMVert *neg_b = v;
+
+ float pos_score_a = 0.0f;
+ float neg_score_a = 0.0f;
+ float pos_score_b = 0.0f;
+ float neg_score_b = 0.0f;
+
+ BMIter liter;
+ BMLoop *l;
+
+ BM_ITER_ELEM(l, &liter, v, BM_LOOPS_OF_VERT) {
+ BMVert *adj_v[2] = { l->prev->v, l->next->v };
+
+ for (int i = 0; i < ARRAY_SIZE(adj_v); i++) {
+ BMVert *v_other = adj_v[i];
+
+ if (vfcount != 2 || BM_vert_face_count_at_most(v_other, 2) <= 2) {
+ float vec[3];
+ sub_v3_v3v3(vec, v_other->co, v->co);
+ normalize_v3(vec);
+
+ /* The score is a measure of how orthogonal the edge is. */
+ float score = dot_v3v3(vec, dir_a);
+
+ if (score >= pos_score_a) {
+ pos_a = v_other;
+ pos_score_a = score;
+ }
+ else if (score < neg_score_a) {
+ neg_a = v_other;
+ neg_score_a = score;
+ }
+ /* The same scoring but for the perpendicular direction. */
+ score = dot_v3v3(vec, dir_b);
+
+ if (score >= pos_score_b) {
+ pos_b = v_other;
+ pos_score_b = score;
+ }
+ else if (score < neg_score_b) {
+ neg_b = v_other;
+ neg_score_b = score;
+ }
+ }
+ }
+ }
+
+ /* Average everything together. */
+ zero_v3(avg);
+ add_v3_v3(avg, pos_a->co);
+ add_v3_v3(avg, neg_a->co);
+ add_v3_v3(avg, pos_b->co);
+ add_v3_v3(avg, neg_b->co);
+ mul_v3_fl(avg, 0.25f);
+
+ /* Preserve volume. */
+ float vec[3];
+ sub_v3_v3(avg, v->co);
+ mul_v3_v3fl(vec, v->no, dot_v3v3(avg, v->no));
+ sub_v3_v3(avg, vec);
+ add_v3_v3(avg, v->co);
+}
+
/* Same logic as neighbor_average_mask(), but for bmesh rather than mesh */
static float bmesh_neighbor_average_mask(BMVert *v, const int cd_vert_mask_offset)
{
@@ -1643,7 +1732,7 @@ typedef struct {
const float *ray_start, *ray_normal;
bool hit;
float depth;
- float detail;
+ float edge_length;
} SculptDetailRaycastData;
typedef struct {
@@ -1755,6 +1844,62 @@ static void do_smooth_brush_bmesh_task_cb_ex(
BKE_pbvh_vertex_iter_end;
}
+static void do_topology_rake_bmesh_task_cb_ex(
+ void *__restrict userdata,
+ const int n,
+ const ParallelRangeTLS *__restrict tls)
+{
+ SculptThreadedTaskData *data = userdata;
+ SculptSession *ss = data->ob->sculpt;
+ Sculpt *sd = data->sd;
+ const Brush *brush = data->brush;
+
+ float direction[3];
+ copy_v3_v3(direction, ss->cache->grab_delta_symmetry);
+
+ float tmp[3];
+ mul_v3_v3fl(
+ tmp, ss->cache->sculpt_normal_symm,
+ dot_v3v3(ss->cache->sculpt_normal_symm, direction));
+ sub_v3_v3(direction, tmp);
+
+ /* Cancel if there's no grab data. */
+ if (is_zero_v3(direction)) {
+ return;
+ }
+
+ float bstrength = data->strength;
+ CLAMP(bstrength, 0.0f, 1.0f);
+
+ SculptBrushTest test;
+ SculptBrushTestFn sculpt_brush_test_sq_fn =
+ sculpt_brush_test_init_with_falloff_shape(ss, &test, data->brush->falloff_shape);
+
+ PBVHVertexIter vd;
+ BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
+ if (sculpt_brush_test_sq_fn(&test, vd.co)) {
+ const float fade = bstrength * tex_strength(
+ ss, brush, vd.co, sqrtf(test.dist),
+ vd.no, vd.fno, *vd.mask, tls->thread_id) * ss->cache->pressure;
+
+ float avg[3], val[3];
+
+ bmesh_four_neighbor_average(avg, direction, vd.bm_vert);
+
+ sub_v3_v3v3(val, avg, vd.co);
+
+ madd_v3_v3v3fl(val, vd.co, val, fade);
+
+ sculpt_clip(sd, ss, vd.co, val);
+
+ if (vd.mvert)
+ vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ }
+ }
+ BKE_pbvh_vertex_iter_end;
+}
+
static void do_smooth_brush_multires_task_cb_ex(
void *__restrict userdata,
const int n,
@@ -1981,6 +2126,37 @@ static void smooth(
}
}
+static void bmesh_topology_rake(
+ Sculpt *sd, Object *ob, PBVHNode **nodes, const int totnode, float bstrength)
+{
+ Brush *brush = BKE_paint_brush(&sd->paint);
+ CLAMP(bstrength, 0.0f, 1.0f);
+
+ /* Interactions increase both strength and quality. */
+ const int iterations = 3;
+
+ int iteration;
+ const int count = iterations * bstrength + 1;
+ const float factor = iterations * bstrength / count;
+
+ for (iteration = 0; iteration <= count; ++iteration) {
+
+ SculptThreadedTaskData data = {
+ .sd = sd, .ob = ob, .brush = brush, .nodes = nodes,
+ .strength = factor,
+ };
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT);
+
+ BLI_task_parallel_range(
+ 0, totnode,
+ &data,
+ do_topology_rake_bmesh_task_cb_ex,
+ &settings);
+ }
+}
+
static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
@@ -2458,7 +2634,8 @@ static void do_snake_hook_brush_task_cb_ex(
project_plane_v3_v3v3(delta_pinch, delta_pinch, ss->cache->true_view_normal);
}
- /* important to calculate based on the grabbed location (intentionally ignore fade here). */
+ /* important to calculate based on the grabbed location
+ * (intentionally ignore fade here). */
add_v3_v3(delta_pinch, grab_delta);
sculpt_project_v3(spvc, delta_pinch, delta_pinch);
@@ -3605,7 +3782,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
do_brush_action_task_cb,
&settings);
- if (sculpt_brush_needs_normal(brush, ss->cache->normal_weight))
+ if (sculpt_brush_needs_normal(ss, brush))
update_sculpt_normal(sd, ob, nodes, totnode);
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)
@@ -3680,6 +3857,10 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
}
}
+ if (sculpt_brush_use_topology_rake(ss, brush)) {
+ bmesh_topology_rake(sd, ob, nodes, totnode, brush->topology_rake_factor);
+ }
+
if (ss->cache->supports_gravity)
do_gravity(sd, ob, nodes, totnode, sd->gravity_factor);
@@ -3914,7 +4095,7 @@ void sculpt_cache_calc_brushdata_symm(
/* XXX This reduces the length of the grab delta if it approaches the line of symmetry
* XXX However, a different approach appears to be needed */
#if 0
- if (sd->paint.symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
+ if (sd->paint.symmetry_flags & PAINT_SYMMETRY_FEATHER) {
float frac = 1.0f / max_overlap_count(sd);
float reduce = (feather - frac) / (1 - frac);
@@ -3960,7 +4141,8 @@ static void do_tiled(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
const float *step = sd->paint.tile_offset;
int dim;
- /* These are integer locations, for real location: multiply with step and add orgLoc. So 0,0,0 is at orgLoc. */
+ /* These are integer locations, for real location: multiply with step and add orgLoc.
+ * So 0,0,0 is at orgLoc. */
int start[3];
int end[3];
int cur[3];
@@ -4230,12 +4412,12 @@ static void sculpt_update_cache_invariants(
else {
max_scale = 0.0f;
for (i = 0; i < 3; i ++) {
- max_scale = max_ff(max_scale, fabsf(ob->size[i]));
+ max_scale = max_ff(max_scale, fabsf(ob->scale[i]));
}
}
- cache->scale[0] = max_scale / ob->size[0];
- cache->scale[1] = max_scale / ob->size[1];
- cache->scale[2] = max_scale / ob->size[2];
+ cache->scale[0] = max_scale / ob->scale[0];
+ cache->scale[1] = max_scale / ob->scale[1];
+ cache->scale[2] = max_scale / ob->scale[2];
cache->plane_trim_squared = brush->plane_trim * brush->plane_trim;
@@ -4352,7 +4534,8 @@ static void sculpt_update_cache_invariants(
if (ss->bm) {
/* Free any remaining layer displacements from nodes. If not and topology changes
- * from using another tool, then next layer toolstroke can access past disp array bounds */
+ * from using another tool, then next layer toolstroke
+ * can access past disp array bounds */
BKE_pbvh_free_layer_disp(ss->pbvh);
}
}
@@ -4383,14 +4566,15 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
StrokeCache *cache = ss->cache;
const float mouse[2] = {
cache->mouse[0],
- cache->mouse[1]
+ cache->mouse[1],
};
int tool = brush->sculpt_tool;
if (ELEM(tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE,
SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_SNAKE_HOOK,
- SCULPT_TOOL_THUMB))
+ SCULPT_TOOL_THUMB) ||
+ sculpt_brush_use_topology_rake(ss, brush))
{
float grab_location[3], imat[4][4], delta[3], loc[3];
@@ -4430,6 +4614,11 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
invert_m4_m4(imat, ob->obmat);
mul_mat3_m4_v3(imat, cache->grab_delta);
break;
+ default:
+ /* Use for 'Brush.topology_rake_factor'. */
+ sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
+ break;
+
}
}
else {
@@ -4680,7 +4869,7 @@ static void sculpt_raycast_detail_cb(PBVHNode *node, void *data_v, float *tmin)
if (BKE_pbvh_node_get_tmin(node) < *tmin) {
SculptDetailRaycastData *srd = data_v;
if (BKE_pbvh_bmesh_node_raycast_detail(node, srd->ray_start, srd->ray_normal,
- &srd->depth, &srd->detail))
+ &srd->depth, &srd->edge_length))
{
srd->hit = 1;
*tmin = srd->depth;
@@ -4805,8 +4994,10 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession
MTex *mtex = &brush->mtex;
/* init mtex nodes */
- if (mtex->tex && mtex->tex->nodetree)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
/* TODO: Shouldn't really have to do this at the start of every
* stroke, but sculpt would need some sort of notification when
@@ -4855,11 +5046,11 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob)
/* Copy the PBVH bounding box into the object's bounding box */
void sculpt_update_object_bounding_box(Object *ob)
{
- if (ob->bb) {
+ if (ob->runtime.bb) {
float bb_min[3], bb_max[3];
BKE_pbvh_bounding_box(ob->sculpt->pbvh, bb_min, bb_max);
- BKE_boundbox_init_from_minmax(ob->bb, bb_min, bb_max);
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, bb_min, bb_max);
}
}
@@ -4932,7 +5123,8 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
{
/* Don't start the stroke until mouse goes over the mesh.
* note: mouse will only be null when re-executing the saved stroke.
- * We have exception for 'exec' strokes since they may not set 'mouse', only 'location', see: T52195. */
+ * We have exception for 'exec' strokes since they may not set 'mouse',
+ * only 'location', see: T52195. */
if (((op->flag & OP_IS_INVOKE) == 0) ||
(mouse == NULL) || over_mesh(C, op, mouse[0], mouse[1]))
{
@@ -4965,7 +5157,8 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st
sculpt_restore_mesh(sd, ob);
if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL)) {
- BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail);
+ float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
}
else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * sd->detail_percent / 100.0f);
@@ -5177,7 +5370,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
"Clicks on the background do not start the stroke");
}
-/**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/
+/* Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) */
static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -5367,6 +5560,9 @@ void sculpt_dynamic_topology_disable_ex(
ss->bm_log = NULL;
}
+ BKE_particlesystem_reset_all(ob);
+ BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED);
+
/* Refresh */
sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob);
}
@@ -5593,7 +5789,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op))
BM_mesh_toolflags_set(ss->bm, true);
/* Symmetrize and re-triangulate */
- BMO_op_callf(ss->bm, BMO_FLAG_DEFAULTS,
+ BMO_op_callf(ss->bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"symmetrize input=%avef direction=%i dist=%f",
sd->symmetrize_direction, 0.00001f);
sculpt_dynamic_topology_triangulate(ss->bm);
@@ -5650,7 +5846,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult
void ED_object_sculptmode_enter_ex(
Main *bmain, Depsgraph *depsgraph,
- Scene *scene, Object *ob,
+ Scene *scene, Object *ob, const bool force_dyntopo,
ReportList *reports)
{
const int mode_flag = OB_MODE_SCULPT;
@@ -5685,7 +5881,7 @@ void ED_object_sculptmode_enter_ex(
BKE_sculpt_mask_layers_ensure(ob, mmd);
}
- if (!(fabsf(ob->size[0] - ob->size[1]) < 1e-4f && fabsf(ob->size[1] - ob->size[2]) < 1e-4f)) {
+ if (!(fabsf(ob->scale[0] - ob->scale[1]) < 1e-4f && fabsf(ob->scale[1] - ob->scale[2]) < 1e-4f)) {
BKE_report(reports, RPT_WARNING,
"Object has non-uniform scale, sculpting may be unpredictable");
}
@@ -5731,11 +5927,19 @@ void ED_object_sculptmode_enter_ex(
}
}
- if (message_unsupported == NULL) {
+ if ((message_unsupported == NULL) || force_dyntopo) {
+ /* Needed because we may be entering this mode before the undo system loads. */
+ wmWindowManager *wm = bmain->wm.first;
+ bool has_undo = wm->undo_stack != NULL;
/* undo push is needed to prevent memory leak */
- sculpt_undo_push_begin("Dynamic topology enable");
+ if (has_undo) {
+ sculpt_undo_push_begin("Dynamic topology enable");
+ }
sculpt_dynamic_topology_enable_ex(depsgraph, scene, ob);
- sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
+ if (has_undo) {
+ sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
+ sculpt_undo_push_end();
+ }
}
else {
BKE_reportf(reports, RPT_WARNING,
@@ -5756,7 +5960,7 @@ void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
- ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, reports);
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports);
}
void ED_object_sculptmode_exit_ex(
@@ -5838,7 +6042,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
else {
- ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, op->reports);
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports);
BKE_paint_toolslots_brush_validate(bmain, &ts->sculpt->paint);
}
@@ -5900,7 +6104,8 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op))
size = max_fff(dim[0], dim[1], dim[2]);
/* update topology size */
- BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail);
+ float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
sculpt_undo_push_begin("Dynamic topology flood fill");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS);
@@ -5973,14 +6178,14 @@ static void sample_detail(bContext *C, int mx, int my)
srd.ray_start = ray_start;
srd.ray_normal = ray_normal;
srd.depth = depth;
- srd.detail = sd->constant_detail;
+ srd.edge_length = 0.0f;
BKE_pbvh_raycast(ob->sculpt->pbvh, sculpt_raycast_detail_cb, &srd,
ray_start, ray_normal, false);
- if (srd.hit) {
- /* convert edge length to detail resolution */
- sd->constant_detail = 1.0f / srd.detail;
+ if (srd.hit && srd.edge_length > 0.0f) {
+ /* Convert edge length to world space detail resolution. */
+ sd->constant_detail = mat4_to_scale(ob->obmat) / srd.edge_length;
}
/* Restore context. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 2154061da1b..44ed680a916 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/sculpt_intern.h
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -42,11 +34,11 @@
#include "BKE_pbvh.h"
-struct bContext;
struct KeyBlock;
struct Object;
-struct SculptUndoNode;
struct SculptOrigVertData;
+struct SculptUndoNode;
+struct bContext;
bool sculpt_mode_poll(struct bContext *C);
bool sculpt_mode_poll_view3d(struct bContext *C);
@@ -66,7 +58,6 @@ void sculpt_update_after_dynamic_topology_toggle(
void sculpt_dynamic_topology_enable_ex(
struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob);
-void sculpt_dynamic_topology_enable(bContext *C);
void sculpt_dynamic_topology_disable_ex(
struct Depsgraph *depsgraph,
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 090bc335d66..53329c4cf78 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,19 +15,11 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implements the Sculpt Mode tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <stddef.h>
@@ -59,9 +49,12 @@
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
+#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_undo_system.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
#include "DEG_depsgraph.h"
@@ -1009,8 +1002,12 @@ void sculpt_undo_push_end(void)
BKE_pbvh_node_layer_disp_free(unode->node);
}
- UndoStack *ustack = ED_undo_stack_get();
- BKE_undosys_step_push(ustack, NULL, NULL);
+ /* We could remove this and enforce all callers run in an operator using 'OPTYPE_UNDO'. */
+ wmWindowManager *wm = G_MAIN->wm.first;
+ if (wm->op_undo_depth == 0) {
+ UndoStack *ustack = ED_undo_stack_get();
+ BKE_undosys_step_push(ustack, NULL, NULL);
+ }
}
/* -------------------------------------------------------------------- */
@@ -1025,10 +1022,8 @@ typedef struct SculptUndoStep {
static bool sculpt_undosys_poll(bContext *C)
{
- ScrArea *sa = CTX_wm_area(C);
- if (sa && (sa->spacetype == SPACE_VIEW3D)) {
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obact = OBACT(view_layer);
+ Object *obact = CTX_data_active_object(C);
+ if (obact && obact->type == OB_MESH) {
if (obact && (obact->mode & OB_MODE_SCULPT)) {
return true;
}
@@ -1043,23 +1038,105 @@ static void sculpt_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
BLI_listbase_clear(&us->data.nodes);
}
-static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'SculptUndoStep' added by encode_init. */
SculptUndoStep *us = (SculptUndoStep *)us_p;
us->step.data_size = us->data.undo_size;
+
+ SculptUndoNode *unode = us->data.nodes.last;
+ if (unode && unode->type == SCULPT_UNDO_DYNTOPO_END) {
+ us->step.use_memfile_step = true;
+ }
+ us->step.is_applied = true;
return true;
}
-static void sculpt_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void sculpt_undosys_step_decode_undo_impl(struct bContext *C, SculptUndoStep *us)
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_SCULPT);
- BLI_assert(sculpt_undosys_poll(C));
+ BLI_assert(us->step.is_applied == true);
+ sculpt_undo_restore_list(C, &us->data.nodes);
+ us->step.is_applied = false;
+}
- SculptUndoStep *us = (SculptUndoStep *)us_p;
+static void sculpt_undosys_step_decode_redo_impl(struct bContext *C, SculptUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
sculpt_undo_restore_list(C, &us->data.nodes);
+ us->step.is_applied = true;
+}
+
+static void sculpt_undosys_step_decode_undo(struct bContext *C, SculptUndoStep *us)
+{
+ SculptUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ sculpt_undosys_step_decode_undo_impl(C, us_iter);
+ us_iter = (SculptUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep *us)
+{
+ SculptUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ sculpt_undosys_step_decode_redo_impl(C, us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.next;
+ }
+}
+
+static void sculpt_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir)
+{
+ /* Ensure sculpt mode. */
+ {
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ /* Sculpt needs evaluated state. */
+ BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer);
+ Object *ob = OBACT(view_layer);
+ if (ob && (ob->type == OB_MESH)) {
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ if (ob->mode & OB_MODE_SCULPT) {
+ /* pass */
+ }
+ else {
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob);
+ Mesh *me = ob->data;
+ /* Don't add sculpt topology undo steps when reading back undo state.
+ * The undo steps must enter/exit for us. */
+ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY;
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, NULL);
+ }
+ BLI_assert(sculpt_undosys_poll(C));
+ }
+ else {
+ BLI_assert(0);
+ return;
+ }
+ }
+
+ SculptUndoStep *us = (SculptUndoStep *)us_p;
+ if (dir < 0) {
+ sculpt_undosys_step_decode_undo(C, us);
+ }
+ else {
+ sculpt_undosys_step_decode_redo(C, us);
+ }
}
static void sculpt_undosys_step_free(UndoStep *us_p)
@@ -1078,7 +1155,6 @@ void ED_sculpt_undosys_type(UndoType *ut)
ut->step_decode = sculpt_undosys_step_decode;
ut->step_free = sculpt_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = true;
ut->step_size = sizeof(SculptUndoStep);
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 7fa7c7f37b5..dde09bb0f45 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) Blender Foundation, 2002-2009
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* UV Sculpt tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt_uv.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -86,7 +78,8 @@ typedef struct UvAdjacencyElement {
typedef struct UvEdge {
unsigned int uv1;
unsigned int uv2;
- /* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */
+ /* general use flag
+ * (Used to check if edge is boundary here, and propagates to adjacency elements) */
char flag;
} UvEdge;
@@ -745,7 +738,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
edges[counter].uv1 = offset2;
edges[counter].uv2 = offset1;
}
- /* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */
+ /* Hack! Set the value of the key to its flag.
+ * Now we can set the flag when an edge exists twice :) */
flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
if (flag) {
*flag = 1;
@@ -908,10 +902,10 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, const wmEvent *ev
void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
{
static const EnumPropertyItem stroke_mode_items[] = {
- {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
+ {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Regular", "Apply brush normally"},
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
{BRUSH_STROKE_SMOOTH, "RELAX", 0, "Relax", "Switch brush to relax mode for duration of stroke"},
- {0}
+ {0},
};
/* identifiers */
diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt
index 9efdf11e8d7..67ec2359c5e 100644
--- a/source/blender/editors/sound/CMakeLists.txt
+++ b/source/blender/editors/sound/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h
index d95f473e4d9..f648c639eca 100644
--- a/source/blender/editors/sound/sound_intern.h
+++ b/source/blender/editors/sound/sound_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sound/sound_intern.h
- * \ingroup edsnd
+/** \file
+ * \ingroup edsnd
*/
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 3ce4965b284..1d3726c6f79 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sound/sound_ops.c
- * \ingroup edsnd
+/** \file
+ * \ingroup edsnd
*/
@@ -108,7 +101,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
if (sound->playback_handle == NULL) {
if (op->customdata) MEM_freeN(op->customdata);
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -116,7 +109,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) {
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
@@ -409,7 +402,7 @@ static const EnumPropertyItem container_items[] = {
#endif
{AUD_CONTAINER_OGG, "OGG", 0, "ogg", "Xiph.Org Ogg Container"},
{AUD_CONTAINER_WAV, "WAV", 0, "wav", "Waveform Audio File Format"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const char *snd_ext_sound[] = {
@@ -420,7 +413,7 @@ static const char *snd_ext_sound[] = {
".mp3",
".ogg",
".wav",
- NULL
+ NULL,
};
static bool sound_mixdown_check(bContext *UNUSED(C), wmOperator *op)
@@ -500,20 +493,20 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
{AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem mp3_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef WITH_SNDFILE
static const EnumPropertyItem flac_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -525,13 +518,13 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
{AUD_CODEC_MP3, "MP3", 0, "MP3", "MPEG-2 Audio Layer III"},
{AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ogg_codec_items[] = {
{AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
uiLayout *layout = op->layout;
@@ -648,7 +641,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
{AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem codec_items[] = {
@@ -663,7 +656,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
#endif
{AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif // WITH_AUDASPACE
@@ -766,7 +759,7 @@ static int sound_unpack_exec(bContext *C, wmOperator *op)
if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpackSound(bmain, op->reports, sound, method);
@@ -790,7 +783,7 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpack_menu(C, "SOUND_OT_unpack", sound->id.name + 2, sound->name, "sounds", sound->packedfile);
@@ -815,7 +808,8 @@ static void SOUND_OT_unpack(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
- RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */
+ /* XXX, weark!, will fail with library, name collisions */
+ RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack");
}
/* ******************************************************* */
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index 24c3ee9cd3d..92cf40248ff 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_action/action_buttons.c b/source/blender/editors/space_action/action_buttons.c
index 55ad773f4df..eaeeca6dfd1 100644
--- a/source/blender/editors/space_action/action_buttons.c
+++ b/source/blender/editors/space_action/action_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_buttons.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -40,8 +33,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index a3773110d0f..8ecf32a2c6c 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_data.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -34,8 +28,6 @@
#include <float.h>
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -647,7 +639,7 @@ static int action_unlink_exec(bContext *C, wmOperator *op)
static int action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt)
{
- /* NOTE: this is hardcoded to match the behaviour for the unlink button (in interface_templates.c) */
+ /* NOTE: this is hardcoded to match the behavior for the unlink button (in interface_templates.c) */
RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0);
return action_unlink_exec(C, op);
}
@@ -867,7 +859,8 @@ static bool action_layer_prev_poll(bContext *C)
AnimData *adt = ED_actedit_animdata_from_context(C);
if (adt) {
if (adt->flag & ADT_NLA_EDIT_ON) {
- /* Tweak Mode: We need to check if there are any tracks below the active one that we can move to */
+ /* Tweak Mode: We need to check if there are any tracks below the active one
+ * that we can move to */
if (adt->nla_tracks.first) {
NlaTrack *nlt = (NlaTrack *)adt->nla_tracks.first;
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 738c5e4d2e2..68d4e4f8ef0 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_draw.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -55,7 +47,6 @@
/* Everything from source (BIF, BDR, BSE) ------------------------------ */
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 09072bd195a..9fc6af7843b 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_edit.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -324,7 +316,8 @@ static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *min,
bAnimListElem *ale;
int filter;
- short found = 0; /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ short found = 0;
float y;
/* get all items - we need to do it this way */
@@ -544,8 +537,9 @@ static short paste_action_keys(bAnimContext *ac,
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
- if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0)
+ if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0) {
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ }
/* paste keyframes */
ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip);
@@ -673,7 +667,7 @@ static const EnumPropertyItem prop_actkeys_insertkey_types[] = {
{1, "ALL", 0, "All Channels", ""},
{2, "SEL", 0, "Only Selected Channels", ""},
{3, "GROUP", 0, "In Active Group", ""}, /* XXX not in all cases */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for inserting new keyframes */
@@ -692,8 +686,12 @@ static void insert_action_keys(bAnimContext *ac, short mode)
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
- if (mode == 2) filter |= ANIMFILTER_SEL;
- else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED;
+ if (mode == 2) {
+ filter |= ANIMFILTER_SEL;
+ }
+ else if (mode == 3) {
+ filter |= ANIMFILTER_ACTGROUPED;
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -831,10 +829,12 @@ static void duplicate_action_keys(bAnimContext *ac)
int filter;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -899,10 +899,12 @@ static bool delete_action_keys(bAnimContext *ac)
bool changed_final = false;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -1129,7 +1131,7 @@ static const EnumPropertyItem prop_actkeys_expo_types[] = {
{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for setting extrapolation mode for keyframes */
@@ -1572,7 +1574,7 @@ static const EnumPropertyItem prop_actkeys_snap_types[] = {
"Snap selected keyframes to the nearest second"},
{ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker",
"Snap selected keyframes to the nearest marker"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -1586,10 +1588,12 @@ static void snap_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
@@ -1679,7 +1683,7 @@ static const EnumPropertyItem prop_actkeys_mirror_types[] = {
"Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
{ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
"Flip times of selected keyframes using the first selected marker as the reference point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for mirroring keyframes */
@@ -1709,10 +1713,12 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
}
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 986afe96e11..74da8aafcc8 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,29 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_intern.h
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
#ifndef __ACTION_INTERN_H__
#define __ACTION_INTERN_H__
-struct bContext;
-struct bAnimContext;
-struct Scene;
-struct Object;
-struct SpaceAction;
-struct ScrArea;
struct ARegion;
struct ARegionType;
+struct Object;
+struct Scene;
+struct ScrArea;
+struct SpaceAction;
struct View2D;
+struct bAnimContext;
+struct bContext;
struct wmOperatorType;
/* internal exports only */
@@ -77,7 +70,7 @@ void ACTION_OT_clickselect(struct wmOperatorType *ot);
enum eActKeys_LeftRightSelect_Mode {
ACTKEYS_LRSEL_TEST = 0,
ACTKEYS_LRSEL_LEFT,
- ACTKEYS_LRSEL_RIGHT
+ ACTKEYS_LRSEL_RIGHT,
};
/* defines for column-select mode */
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index bbcba93370d..87b9ee4e1ef 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_ops.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 0c96560f6d5..c7b62af9d0b 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_select.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -96,10 +90,12 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel)
KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -310,11 +306,15 @@ static void box_select_action(bAnimContext *ac, const rcti rect, short mode, sho
break;
}
case ANIMTYPE_MASKLAYER:
+ {
ED_masklayer_frames_select_box(ale->data, rectf.xmin, rectf.xmax, selectmode);
break;
+ }
default:
+ {
ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
break;
+ }
}
}
@@ -676,7 +676,7 @@ static const EnumPropertyItem prop_column_select_types[] = {
{ACTKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""},
{ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""},
{ACTKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", 0, "Between Min/Max Selected Markers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -1049,7 +1049,7 @@ static const EnumPropertyItem prop_actkeys_leftright_select_types[] = {
{ACTKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{ACTKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{ACTKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* --------------------------------- */
@@ -1088,10 +1088,12 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
}
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys */
@@ -1288,7 +1290,8 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
}
}
-/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+/* Option 2) Selects all the keyframes on either side of the current frame
+ * (depends on which side the mouse is on) */
/* (see actkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
@@ -1308,10 +1311,12 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -1418,8 +1423,11 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
/* x-range to check is +/- 7px for standard keyframe under standard dpi/y-scale (in screen/region-space),
* on either side of mouse click (size of keyframe icon)
*/
- key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f; /* standard channel height (to allow for some slop) */
- key_hsize = roundf(key_hsize / 2.0f); /* half-size (for either side), but rounded up to nearest int (for easier targeting) */
+
+ /* standard channel height (to allow for some slop) */
+ key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f;
+ /* half-size (for either side), but rounded up to nearest int (for easier targeting) */
+ key_hsize = roundf(key_hsize / 2.0f);
UI_view2d_region_to_view(v2d, mval[0] - (int)key_hsize, mval[1], &rectf.xmin, &rectf.ymin);
UI_view2d_region_to_view(v2d, mval[0] + (int)key_hsize, mval[1], &rectf.xmax, &rectf.ymax);
@@ -1492,7 +1500,8 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
mask_to_keylist(ads, masklay, &anim_keys);
}
- /* start from keyframe at root of BST, traversing until we find one within the range that was clicked on */
+ /* start from keyframe at root of BST,
+ * traversing until we find one within the range that was clicked on */
for (ak = anim_keys.root; ak; ak = akn) {
if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) {
/* set the frame to use, and apply inverse-correction for NLA-mapping
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index b41b97923e2..3dffa6afb55 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/space_action.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
-
#include <string.h>
#include <stdio.h>
@@ -40,7 +32,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -54,8 +45,6 @@
#include "WM_types.h"
#include "WM_message.h"
-#include "BIF_gl.h"
-
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -254,6 +243,7 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_orthoSpecial(ar, v2d, 1);
marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | DRAW_MARKERS_MARGIN;
+ if (saction->flag & SACTION_SHOW_MARKER_LINES) marker_flag |= DRAW_MARKERS_LINES;
ED_markers_draw(C, marker_flag);
/* caches */
@@ -552,7 +542,8 @@ static void action_listener(
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
}
- /* autocolor only really needs to change when channels are added/removed, or previously hidden stuff appears
+ /* autocolor only really needs to change when channels are added/removed,
+ * or previously hidden stuff appears
* (assume for now that if just adding these works, that will be fine)
*/
else if (((wmn->data == ND_KEYFRAME) && ELEM(wmn->action, NA_ADDED, NA_REMOVED)) ||
@@ -560,7 +551,8 @@ static void action_listener(
{
ED_area_tag_refresh(sa);
}
- /* for simple edits to the curve data though (or just plain selections), a simple redraw should work
+ /* for simple edits to the curve data though (or just plain selections),
+ * a simple redraw should work
* (see T39851 for an example of how this can go wrong)
*/
else {
@@ -568,48 +560,39 @@ static void action_listener(
}
break;
case NC_SCENE:
- if (saction->mode == SACTCONT_TIMELINE) {
- switch (wmn->data) {
- case ND_RENDER_RESULT:
- ED_area_tag_redraw(sa);
- break;
- case ND_OB_ACTIVE:
- case ND_FRAME:
- ED_area_tag_refresh(sa);
- break;
- case ND_FRAME_RANGE:
- {
- ARegion *ar;
- Scene *scene = wmn->reference;
-
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.tot.xmin = (float)(SFRA - 4);
- ar->v2d.tot.xmax = (float)(EFRA + 4);
- break;
- }
+ switch (wmn->data) {
+ case ND_OB_ACTIVE:
+ case ND_OB_SELECT:
+ /* Selection changed, so force refresh to flush
+ * (needs flag set to do syncing). */
+ saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
+ ED_area_tag_refresh(sa);
+ break;
+ case ND_RENDER_RESULT:
+ ED_area_tag_redraw(sa);
+ break;
+ case ND_FRAME_RANGE:
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ Scene *scene = wmn->reference;
+ ar->v2d.tot.xmin = (float)(SFRA - 4);
+ ar->v2d.tot.xmax = (float)(EFRA + 4);
+ break;
}
- break;
}
- }
- }
- else {
- switch (wmn->data) {
- case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
- case ND_OB_SELECT:
- saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
- ED_area_tag_refresh(sa);
- break;
-
- default: /* just redrawing the view will do */
+ break;
+ default:
+ if (saction->mode != SACTCONT_TIMELINE) {
+ /* Just redrawing the view will do. */
ED_area_tag_redraw(sa);
- break;
- }
+ }
+ break;
}
break;
case NC_OBJECT:
switch (wmn->data) {
- case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_BONE_SELECT: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_BONE_ACTIVE:
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index bf3257389ce..34436ae9b4d 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index afaa3325f6b..0288d7888d8 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) Blender Foundation, 2008
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_api/spacetypes.c
- * \ingroup spapi
+/** \file
+ * \ingroup spapi
*/
@@ -61,6 +57,7 @@
#include "ED_space_api.h"
#include "ED_sound.h"
#include "ED_uvedit.h"
+#include "ED_userpref.h"
#include "ED_lattice.h"
#include "ED_mball.h"
#include "ED_logic.h"
@@ -103,6 +100,7 @@ void ED_spacetypes_init(void)
// ...
/* register operator types for screen and all spaces */
+ ED_operatortypes_userpref();
ED_operatortypes_workspace();
ED_operatortypes_scene();
ED_operatortypes_screen();
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 397d79e1dbe..90919fa793d 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 2de9f9b1a1b..f53aae6472e 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_context.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -40,7 +34,7 @@
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -120,7 +114,8 @@ static int buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
- /* View Layer may have already been resolved in a previous call (e.g. in buttons_context_path_linestyle). */
+ /* View Layer may have already been resolved in a previous call
+ * (e.g. in buttons_context_path_linestyle). */
if (RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) {
return 1;
}
@@ -471,7 +466,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
wmWindow *window = CTX_wm_window(C);
Scene *scene = WM_window_get_active_scene(window);
FreestyleConfig *config;
- SpaceButs *sbuts;
+ SpaceProperties *sbuts;
/* if Freestyle is disabled in the scene */
if ((scene->r.mode & R_EDGE_FRS) == 0) {
@@ -483,7 +478,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
return false;
}
/* if the scene has already been pinned */
- sbuts = CTX_wm_space_buts(C);
+ sbuts = CTX_wm_space_properties(C);
if (sbuts->pinid && sbuts->pinid == &scene->id) {
return false;
}
@@ -495,7 +490,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
{
/* Note we don't use CTX_data here, instead we get it from the window.
* Otherwise there is a loop reading the context that we are setting. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
wmWindow *window = CTX_wm_window(C);
Scene *scene = WM_window_get_active_scene(window);
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
@@ -625,7 +620,7 @@ static int buttons_shading_new_context(const bContext *C, int flag)
return BCONTEXT_RENDER;
}
-void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
+void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
{
ButsContextPath *path;
PointerRNA *ptr;
@@ -652,7 +647,10 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
ptr = &path->ptr[path->len - 1];
if (ptr->type) {
- sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
+ if (RNA_struct_is_a(ptr->type, &RNA_Light))
+ sbuts->dataicon = ICON_OUTLINER_DATA_LIGHT;
+ else
+ sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
}
else {
sbuts->dataicon = ICON_EMPTY_DATA;
@@ -710,12 +708,12 @@ const char *buttons_context_dir[] = {
"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint",
- "line_style", "collection", NULL
+ "line_style", "collection", NULL,
};
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts ? sbuts->path : NULL;
if (!path)
@@ -732,7 +730,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "scene")) {
- /* Do not return one here if scene not found in path, in this case we want to get default context scene! */
+ /* Do not return one here if scene not found in path,
+ * in this case we want to get default context scene! */
return set_pointer_type(path, result, &RNA_Scene);
}
else if (CTX_data_equals(member, "world")) {
@@ -1003,7 +1002,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
if (sbuts->flag & SB_PIN_CONTEXT) {
sbuts->pinid = buttons_context_id_path(C);
@@ -1016,7 +1015,7 @@ static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
void buttons_context_draw(const bContext *C, uiLayout *layout)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
uiLayout *row;
uiBlock *block;
@@ -1084,7 +1083,7 @@ static bool buttons_header_context_poll(const bContext *C, HeaderType *UNUSED(ht
static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
#endif
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
return (sbuts->mainb != BCONTEXT_TOOL);
}
@@ -1104,7 +1103,7 @@ void buttons_context_register(ARegionType *art)
ht = MEM_callocN(sizeof(HeaderType), "spacetype buttons context header");
strcpy(ht->idname, "BUTTONS_HT_context");
- ht->space_type = SPACE_BUTS;
+ ht->space_type = SPACE_PROPERTIES;
ht->region_type = art->regionid;
ht->poll = buttons_header_context_poll;
ht->draw = buttons_header_context_draw;
@@ -1114,7 +1113,7 @@ void buttons_context_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
strcpy(pt->idname, "BUTTONS_PT_context");
- strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->poll = buttons_panel_context_poll;
pt->draw = buttons_panel_context_draw;
@@ -1125,7 +1124,7 @@ void buttons_context_register(ARegionType *art)
ID *buttons_context_id_path(const bContext *C)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
PointerRNA *ptr;
int a;
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 65bcf7ef1c8..fa7f0408e15 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_intern.h
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
#ifndef __BUTTONS_INTERN_H__
@@ -36,7 +29,7 @@
struct ARegionType;
struct ID;
-struct SpaceButs;
+struct SpaceProperties;
struct Tex;
struct bContext;
struct bContextDataResult;
@@ -87,7 +80,7 @@ typedef struct ButsContextTexture {
/* internal exports only */
/* buttons_context.c */
-void buttons_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
+void buttons_context_compute(const struct bContext *C, struct SpaceProperties *sbuts);
int buttons_context(const struct bContext *C, const char *member, struct bContextDataResult *result);
void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
void buttons_context_register(struct ARegionType *art);
@@ -96,7 +89,7 @@ struct ID *buttons_context_id_path(const struct bContext *C);
extern const char *buttons_context_dir[]; /* doc access */
/* buttons_texture.c */
-void buttons_texture_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
+void buttons_texture_context_compute(const struct bContext *C, struct SpaceProperties *sbuts);
/* buttons_ops.c */
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 473deb35aac..7cec9c09767 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_ops.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -43,7 +37,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_report.h"
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 958b55526c3..bcf536e9d97 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_texture.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -166,7 +160,7 @@ static void buttons_texture_modifier_gpencil_foreach(void *userData, Object *ob,
N_("Grease Pencil Modifiers"), RNA_struct_ui_icon(ptr.type), md->name);
}
-static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceButs *sbuts)
+static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceProperties *sbuts)
{
Scene *scene = NULL;
Object *ob = NULL;
@@ -272,7 +266,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
}
}
-void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
+void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts)
{
/* gather available texture users in context. runs on every draw of
* properties editor, before the buttons are created. */
@@ -334,7 +328,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg))
{
/* callback when selecting a texture user in the menu */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user = (ButsTextureUser *)user_p;
PointerRNA texptr;
@@ -376,7 +370,7 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
/* callback when opening texture user selection menu, to create buttons. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = sbuts->texuser;
ButsTextureUser *user;
uiBlock *block = uiLayoutGetBlock(layout);
@@ -421,7 +415,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
/* texture user selection dropdown menu. the available users have been
* gathered before drawing in ButsContextTexture, we merely need to
* display the current item. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but;
@@ -461,7 +455,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
static void template_texture_show(bContext *C, void *data_p, void *prop_p)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user;
@@ -489,7 +483,7 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p)
void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
/* button to quickly show texture in texture tab */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index c9ba5722572..acba11ddec7 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/space_buttons.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
#include <string.h>
@@ -61,10 +54,10 @@
static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *ar;
- SpaceButs *sbuts;
+ SpaceProperties *sbuts;
- sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
- sbuts->spacetype = SPACE_BUTS;
+ sbuts = MEM_callocN(sizeof(SpaceProperties), "initbuts");
+ sbuts->spacetype = SPACE_PROPERTIES;
sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
@@ -102,7 +95,7 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
/* not spacelink itself */
static void buttons_free(SpaceLink *sl)
{
- SpaceButs *sbuts = (SpaceButs *) sl;
+ SpaceProperties *sbuts = (SpaceProperties *) sl;
if (sbuts->path)
MEM_freeN(sbuts->path);
@@ -121,7 +114,7 @@ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)
static SpaceLink *buttons_duplicate(SpaceLink *sl)
{
- SpaceButs *sbutsn = MEM_dupallocN(sl);
+ SpaceProperties *sbutsn = MEM_dupallocN(sl);
/* clear or remove stuff from old */
sbutsn->path = NULL;
@@ -137,11 +130,11 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_PROPERTIES, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *sbuts, ARegion *ar)
+static void buttons_main_region_layout_properties(const bContext *C, SpaceProperties *sbuts, ARegion *ar)
{
buttons_context_compute(C, sbuts);
@@ -318,7 +311,7 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
static void buttons_main_region_layout(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
if (sbuts->mainb == BCONTEXT_TOOL) {
buttons_main_region_layout_tool(C, ar);
@@ -353,7 +346,7 @@ static void buttons_operatortypes(void)
static void buttons_keymap(struct wmKeyConfig *keyconf)
{
- WM_keymap_ensure(keyconf, "Property Editor", SPACE_BUTS, 0);
+ WM_keymap_ensure(keyconf, "Property Editor", SPACE_PROPERTIES, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -371,7 +364,7 @@ static void buttons_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void buttons_header_region_draw(const bContext *C, ARegion *ar)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
/* Needed for RNA to get the good values! */
buttons_context_compute(C, sbuts);
@@ -385,14 +378,14 @@ static void buttons_header_region_message_subscribe(
bScreen *UNUSED(screen), ScrArea *sa, ARegion *ar,
struct wmMsgBus *mbus)
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
.notify = ED_region_do_msg_notify_tag_redraw,
};
- /* Don't check for SpaceButs.mainb here, we may toggle between view-layers
+ /* Don't check for SpaceProperties.mainb here, we may toggle between view-layers
* where one has no active object, so that available contexts changes. */
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
@@ -411,7 +404,7 @@ static void buttons_header_region_message_subscribe(
static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *ar)
{
- wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+ wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_PROPERTIES, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
ar->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN;
@@ -427,7 +420,8 @@ static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *ar)
}
ED_region_panels_layout(C, ar);
- ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL; /* ED_region_panels_layout adds vertical scrollbars, we don't want them. */
+ /* ED_region_panels_layout adds vertical scrollbars, we don't want them. */
+ ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL;
ED_region_panels_draw(C, ar);
}
@@ -450,7 +444,7 @@ static void buttons_navigation_bar_region_message_subscribe(
* showing that button set, to reduce unnecessary drawing. */
static void buttons_area_redraw(ScrArea *sa, short buttons)
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
/* if the area's current button set is equal to the one to redraw */
if (sbuts->mainb == buttons)
@@ -461,7 +455,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
static void buttons_area_listener(
wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
/* context changes */
switch (wmn->category) {
@@ -643,7 +637,7 @@ static void buttons_area_listener(
static void buttons_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceButs *sbuts = (SpaceButs *)slink;
+ SpaceProperties *sbuts = (SpaceProperties *)slink;
if (sbuts->pinid == old_id) {
sbuts->pinid = new_id;
@@ -700,7 +694,7 @@ void ED_spacetype_buttons(void)
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons");
ARegionType *art;
- st->spaceid = SPACE_BUTS;
+ st->spaceid = SPACE_PROPERTIES;
strncpy(st->name, "Buttons", BKE_ST_MAXNAME);
st->new = buttons_new;
@@ -743,7 +737,8 @@ void ED_spacetype_buttons(void)
/* regions: navigation bar */
art = MEM_callocN(sizeof(ARegionType), "spacetype nav buttons region");
art->regionid = RGN_TYPE_NAV_BAR;
- art->prefsizex = AREAMINX - 3; /* XXX Works and looks best, should we update AREAMINX accordingly? */
+ art->prefsizex = AREAMINX - 3; /* XXX Works and looks best,
+ * should we update AREAMINX accordingly? */
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
art->init = buttons_navigation_bar_region_init;
art->draw = buttons_navigation_bar_region_draw;
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 8fa4a0de53f..a40a1bf6d25 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -15,10 +15,6 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2011 Blender Foundation.
-#
-# Contributor(s): Blender Foundation,
-# Sergey Sharybin
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -58,8 +54,8 @@ set(SRC
tracking_ops_orient.c
tracking_ops_plane.c
tracking_ops_solve.c
- tracking_ops_track.c
tracking_ops_stabilize.c
+ tracking_ops_track.c
tracking_ops_utils.c
tracking_select.c
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index ebe8e802a37..6e4b98af93b 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_buttons.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
@@ -38,9 +30,9 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -53,7 +45,9 @@
#include "DEG_depsgraph.h"
+#include "ED_clip.h"
#include "ED_gpencil.h"
+#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -70,9 +64,39 @@
/* Panels */
-void ED_clip_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
{
+ return ED_space_clip_poll((bContext *)C);
+}
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
+{
+ SpaceClip *space_clip = CTX_wm_space_clip(C);
+ /* NOTE: This might not be exactly the same image buffer as shown in the
+ * clip editor itself, since that might be coming from proxy, or being
+ * postprocessed (stabilized or undistored).
+ * Ideally we need to query metadata from an original image or movie without
+ * reading actual pixels to speed up the process. */
+ ImBuf *ibuf = ED_space_clip_get_buffer(space_clip);
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ IMB_freeImBuf(ibuf);
+ }
+}
+
+void ED_clip_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel metadata");
+ strcpy(pt->idname, "CLIP_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->category, "Footage");
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
/********************* MovieClip Template ************************/
@@ -184,19 +208,27 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
#define B_MARKER_FLAG 8
typedef struct {
- int compact; /* compact mode */
+ /** compact mode */
+ int compact;
MovieClip *clip;
- MovieClipUser *user; /* user of clip */
+ /** user of clip */
+ MovieClipUser *user;
MovieTrackingTrack *track;
MovieTrackingMarker *marker;
- int framenr; /* current frame number */
- float marker_pos[2]; /* position of marker in pixel coords */
- float marker_pat[2]; /* position and dimensions of marker pattern in pixel coords */
- float track_offset[2]; /* offset of "parenting" point */
- float marker_search_pos[2], marker_search[2]; /* position and dimensions of marker search in pixel coords */
- int marker_flag; /* marker's flags */
+ /** current frame number */
+ int framenr;
+ /** position of marker in pixel coords */
+ float marker_pos[2];
+ /** position and dimensions of marker pattern in pixel coords */
+ float marker_pat[2];
+ /** offset of "parenting" point */
+ float track_offset[2];
+ /** position and dimensions of marker search in pixel coords */
+ float marker_search_pos[2], marker_search[2];
+ /** marker's flags */
+ int marker_flag;
} MarkerUpdateCb;
static void to_pixel_space(float r[2], float a[2], int width, int height)
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index c05a4c1b64c..ef2e5b4ea3a 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_dopesheet_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_movieclip_types.h"
@@ -310,7 +302,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
v2d->tot.ymin = (float)(-height);
}
- /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
+ /* need to do a view-sync here, so that the keys area doesn't jump around
+ * (it must copy this) */
UI_view2d_sync(NULL, sa, v2d, V2D_LOCK_COPY);
/* loop through channels, and set up drawing depending on their type
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index a12e8db6daf..e2689706452 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_dopesheet_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 9f4983a35b2..54830c14b85 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_gpencil_types.h"
@@ -329,14 +321,15 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, filter, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
+ if (ibuf->planes == 32) {
+ GPU_blend(false);
+ }
+
if (sc->flag & SC_SHOW_METADATA) {
rctf frame;
BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
}
-
- if (ibuf->planes == 32)
- GPU_blend(false);
}
static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
@@ -663,7 +656,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
GPU_line_width(1.0f);
- /* Since we are switching solid and dashed lines in rather complex logic here, just always go with dashed shader. */
+ /* Since we are switching solid and dashed lines in rather complex logic here,
+ * just always go with dashed shader. */
immUnbindProgram();
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 8308c781902..f6959dd593c 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_editor.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <stddef.h>
@@ -648,29 +640,29 @@ static unsigned char *prefetch_read_file_to_memory(
size_t *r_size)
{
MovieClipUser user = {0};
- char name[FILE_MAX];
- size_t size;
- int file;
- unsigned char *mem;
-
user.framenr = current_frame;
user.render_size = render_size;
user.render_flag = render_flag;
+ char name[FILE_MAX];
BKE_movieclip_filename_for_frame(clip, &user, name);
- file = BLI_open(name, O_BINARY | O_RDONLY, 0);
+ int file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file == -1) {
return NULL;
}
- size = BLI_file_descriptor_size(file);
+ const size_t size = BLI_file_descriptor_size(file);
if (size < 1) {
close(file);
return NULL;
}
- mem = MEM_mallocN(size, "movieclip prefetch memory file");
+ unsigned char *mem = MEM_mallocN(size, "movieclip prefetch memory file");
+ if (mem == NULL) {
+ close(file);
+ return NULL;
+ }
if (read(file, mem, size) != size) {
close(file);
@@ -781,7 +773,7 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
while ((mem = prefetch_thread_next_frame(queue, clip, &size, &current_frame))) {
ImBuf *ibuf;
MovieClipUser user = {0};
- int flag = IB_rect | IB_alphamode_detect;
+ int flag = IB_rect | IB_multilayer | IB_alphamode_detect | IB_metadata;
int result;
char *colorspace_name = NULL;
const bool use_proxy = (clip->flag & MCLIP_USE_PROXY) &&
@@ -797,6 +789,10 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
}
ibuf = IMB_ibImageFromMemory(mem, size, flag, colorspace_name, "prefetch frame");
+ if (ibuf == NULL) {
+ continue;
+ }
+ BKE_movieclip_convert_multilayer_ibuf(ibuf);
result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index cc8541d9fd7..63d9a45fa2e 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_graph_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_movieclip_types.h"
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 06233d64a36..8a8cb4b8dcb 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_graph_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
@@ -241,7 +233,8 @@ static bool mouse_select_curve(bContext *C, float co[2], bool extend)
if (userdata.track) {
if (extend) {
if (act_track == userdata.track) {
- /* currently only single curve can be selected (selected curve represents active track) */
+ /* currently only single curve can be selected
+ * (selected curve represents active track) */
act_track = NULL;
}
}
@@ -706,7 +699,7 @@ void CLIP_OT_graph_disable_markers(wmOperatorType *ot)
{0, "DISABLE", 0, "Disable", "Disable selected markers"},
{1, "ENABLE", 0, "Enable", "Enable selected markers"},
{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index b407056ea96..e85d68431d4 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,22 +15,15 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __CLIP_INTERN_H__
#define __CLIP_INTERN_H__
-struct bContext;
struct ARegion;
struct MovieClip;
struct MovieTrackingMarker;
@@ -40,6 +31,7 @@ struct MovieTrackingTrack;
struct Scene;
struct ScrArea;
struct SpaceClip;
+struct bContext;
struct wmOperatorType;
/* channel heights */
@@ -120,7 +112,6 @@ void CLIP_OT_cursor_set(struct wmOperatorType *ot);
struct ARegion *ED_clip_has_properties_region(struct ScrArea *sa);
void CLIP_OT_tools(struct wmOperatorType *ot);
void CLIP_OT_properties(struct wmOperatorType *ot);
-void ED_clip_tool_props_register(struct ARegionType *art);
/* clip_utils.c */
void clip_graph_tracking_values_iterate_track(struct SpaceClip *sc, struct MovieTrackingTrack *track, void *userdata,
@@ -145,8 +136,6 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y);
void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
-void clip_on_marker_selection_changed(struct bContext *C);
-
/* tracking_ops.c */
struct MovieTrackingTrack *tracking_marker_check_slide(struct bContext *C, const struct wmEvent *event,
int *area_r, int *action_r, int *corner_r);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index e907fdfc570..a86dd7ceb2d 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <errno.h>
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 304954b56e3..3f16982e2c6 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_toolbar.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 7dd5816794f..882cafae5f6 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_utils.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
@@ -35,7 +27,6 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index af7843a01a5..b84a5fc90ed 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/space_clip.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
@@ -227,6 +219,12 @@ static void clip_scopes_check_gpencil_change(ScrArea *sa)
}
}
+static void clip_area_sync_frame_from_scene(ScrArea *sa, Scene *scene)
+{
+ SpaceClip *space_clip = (SpaceClip *)sa->spacedata.first;
+ BKE_movieclip_user_set_frame(&space_clip->user, scene->r.cfra);
+}
+
/* ******************** default callbacks for clip space ***************** */
static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene)
@@ -324,7 +322,7 @@ static SpaceLink *clip_duplicate(SpaceLink *sl)
return (SpaceLink *)scn;
}
-static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
+static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *scene)
{
/* context changes */
switch (wmn->category) {
@@ -389,6 +387,9 @@ static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, S
case ND_ANIMPLAY:
ED_area_tag_redraw(sa);
break;
+ case ND_LAYOUTSET:
+ clip_area_sync_frame_from_scene(sa, scene);
+ break;
}
break;
case NC_SPACE:
@@ -553,6 +554,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
}
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
+extern const char *clip_context_dir[]; /* quiet warning. */
const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -581,9 +583,12 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
/* dropboxes */
static bool clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
- if (drag->type == WM_DRAG_PATH)
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type == WM_DRAG_PATH) {
+ /* rule might not work? */
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
return true;
+ }
+ }
return false;
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 42077280cca..68d13b63804 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -1135,7 +1127,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
{TRACK_CLEAR_UPTO, "UPTO", 0, "Clear up-to", "Clear path up to current frame"},
{TRACK_CLEAR_REMAINED, "REMAINED", 0, "Clear remained", "Clear path at remaining frames (after current)"},
{TRACK_CLEAR_ALL, "ALL", 0, "Clear all", "Clear the whole path"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1210,7 +1202,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
"Enable selected markers"},
{MARKER_OP_TOGGLE, "TOGGLE", 0, "Toggle",
"Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1428,7 +1420,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
sc->user.framenr += delta;
}
}
- else { /* to to failed frame */
+ else { /* to failed frame */
if (tracking->reconstruction.flag & TRACKING_RECONSTRUCTED) {
int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
@@ -1475,7 +1467,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
{1, "PATHEND", 0, "Path End", "Jump to end of current path"},
{2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"},
{2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1643,7 +1635,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
{TRACK_ACTION_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock selected tracks"},
{TRACK_ACTION_TOGGLE, "TOGGLE", 0, "Toggle",
"Toggle locked flag for selected tracks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1697,7 +1689,7 @@ void CLIP_OT_set_solver_keyframe(wmOperatorType *ot)
static const EnumPropertyItem keyframe_items[] = {
{SOLVER_KEYFRAME_A, "KEYFRAME_A", 0, "Keyframe A", ""},
{SOLVER_KEYFRAME_B, "KEYFRAME_B", 0, "Keyframe B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1976,7 +1968,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
"Delete unclean tracks"},
{TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments",
"Delete unclean segments of tracks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/tracking_ops_detect.c b/source/blender/editors/space_clip/tracking_ops_detect.c
index 77f7e8d112c..131ccc05d35 100644
--- a/source/blender/editors/space_clip/tracking_ops_detect.c
+++ b/source/blender/editors/space_clip/tracking_ops_detect.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_detect.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -135,7 +127,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
"Place markers only inside areas outlined with Grease Pencil"},
{2, "OUTSIDE_GPENCIL", 0, "Outside Grease Pencil",
"Place markers only outside areas outlined with Grease Pencil"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/tracking_ops_intern.h b/source/blender/editors/space_clip/tracking_ops_intern.h
index b53799b88d8..adf0285540a 100644
--- a/source/blender/editors/space_clip/tracking_ops_intern.h
+++ b/source/blender/editors/space_clip/tracking_ops_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __TRACKING_OPS_INTERN_H__
#define __TRACKING_OPS_INTERN_H__
-struct bContext;
struct ListBase;
struct MovieClip;
struct SpaceClip;
+struct bContext;
/* tracking_utils.c */
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 76421cde8f8..2df74240241 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_orient.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -509,7 +501,7 @@ void CLIP_OT_set_plane(wmOperatorType *ot)
static const EnumPropertyItem plane_items[] = {
{0, "FLOOR", 0, "Floor", "Set floor plane"},
{1, "WALL", 0, "Wall", "Set wall plane"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -583,7 +575,7 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
static const EnumPropertyItem axis_actions[] = {
{0, "X", 0, "X", "Align bundle align X axis"},
{1, "Y", 0, "Y", "Align bundle align Y axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -678,18 +670,18 @@ static int do_set_scale(bContext *C,
}
else {
if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
- mul_v3_fl(object->size, scale);
+ mul_v3_fl(object->scale, scale);
mul_v3_fl(object->loc, scale);
}
else if (!scale_solution) {
Object *solver_camera = object_solver_camera(scene, object);
- object->size[0] = object->size[1] = object->size[2] = 1.0f / scale;
+ object->scale[0] = object->scale[1] = object->scale[2] = 1.0f / scale;
if (solver_camera) {
- object->size[0] /= solver_camera->size[0];
- object->size[1] /= solver_camera->size[1];
- object->size[2] /= solver_camera->size[2];
+ object->scale[0] /= solver_camera->scale[0];
+ object->scale[1] /= solver_camera->scale[1];
+ object->scale[2] /= solver_camera->scale[2];
}
}
else {
diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c
index 6c85bdfc4ec..a12e03a252c 100644
--- a/source/blender/editors/space_clip/tracking_ops_plane.c
+++ b/source/blender/editors/space_clip/tracking_ops_plane.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_plane.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 4148b3a0070..03e03f94a66 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_solve.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_stabilize.c b/source/blender/editors/space_clip/tracking_ops_stabilize.c
index 2888607a049..ab7585cbf57 100644
--- a/source/blender/editors/space_clip/tracking_ops_stabilize.c
+++ b/source/blender/editors/space_clip/tracking_ops_stabilize.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_stabilize.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index cd8e92c9b9c..4c14049865b 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,23 +15,16 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_track.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
#include "BKE_main.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_utils.c b/source/blender/editors/space_clip/tracking_ops_utils.c
index 4fbee51407d..8974f6f7ee0 100644
--- a/source/blender/editors/space_clip/tracking_ops_utils.c
+++ b/source/blender/editors/space_clip/tracking_ops_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_utils.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index c9901bd81bb..920c984676f 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_select.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -990,7 +982,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
{4, "DISABLED", 0, "Disabled tracks", "Select all disabled tracks"},
{5, "COLOR", 0, "Tracks with same color", "Select all tracks with same color as active track"},
{6, "FAILED", 0, "Failed Tracks", "Select all tracks which failed to be reconstructed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index ecfb1f0e0df..bed1b7dce96 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 789194c21b9..b7e4133e073 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_console/console_draw.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#include <math.h>
@@ -39,7 +33,6 @@
#include "MEM_guardedalloc.h"
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "UI_interface.h"
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index c0ef6e95d2e..1e4a90ca71a 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_console/console_intern.h
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#ifndef __CONSOLE_INTERN_H__
@@ -30,12 +24,13 @@
/* internal exports only */
struct ConsoleLine;
-struct wmOperatorType;
struct bContext;
+struct wmOperatorType;
/* console_draw.c */
void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar);
-int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar); /* needed to calculate the scrollbar */
+/* needed to calculate the scrollbar */
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar);
int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, const int mval[2]);
void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 32cf5ea2055..46d22df2609 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_console/console_ops.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
@@ -306,7 +300,7 @@ static const EnumPropertyItem console_move_type_items[] = {
{NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int console_move_exec(bContext *C, wmOperator *op)
@@ -575,7 +569,7 @@ static const EnumPropertyItem console_delete_type_items[] = {
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int console_delete_exec(bContext *C, wmOperator *op)
@@ -747,7 +741,8 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
- ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */
+ /* TODO - stupid, just prevents crashes when no command line */
+ ConsoleLine *ci = console_history_verify(C);
const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
int prev_len = ci->len;
@@ -814,7 +809,8 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
ConsoleLine *ci = console_history_verify(C);
- char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
+ /* own this text in the new line, don't free */
+ char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int cursor = RNA_int_get(op->ptr, "current_character");
const bool rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates");
int prev_len = ci->len;
@@ -871,7 +867,8 @@ static int console_scrollback_append_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
ConsoleLine *ci;
- char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
+ /* own this text in the new line, don't free */
+ char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int type = RNA_enum_get(op->ptr, "type");
console_history_verify(C);
@@ -900,7 +897,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
{CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
{CONSOLE_LINE_INFO, "INFO", 0, "Information", ""},
{CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index ece29bcd721..65f1fe36fec 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_console/space_console.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#include <string.h>
@@ -38,8 +32,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "WM_api.h"
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index fd701a8be4c..07ba1cc7a64 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 2ae432fbc4e..17ee7726f45 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_draw.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -35,7 +28,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_math.h"
#ifdef WIN32
@@ -45,7 +37,6 @@
#include "BIF_glutil.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
@@ -291,8 +282,9 @@ static void file_draw_icon(uiBlock *block, const char *path, int sx, int sy, int
}
-static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align,
- const unsigned char col[4])
+static void file_draw_string(
+ int sx, int sy, const char *string, float width, int height, eFontStyle_Align align,
+ const uchar col[4])
{
uiStyle *style;
uiFontStyle fs;
@@ -306,18 +298,19 @@ static void file_draw_string(int sx, int sy, const char *string, float width, in
style = UI_style_get();
fs = style->widgetlabel;
- fs.align = align;
-
BLI_strncpy(fname, string, FILE_MAXFILE);
UI_text_clip_middle_ex(&fs, fname, width, UI_DPI_ICON_SIZE, sizeof(fname), '\0');
- /* no text clipping needed, UI_fontstyle_draw does it but is a bit too strict (for buttons it works) */
+ /* no text clipping needed, UI_fontstyle_draw does it but is a bit too strict
+ * (for buttons it works) */
rect.xmin = sx;
rect.xmax = (int)(sx + ceil(width + 5.0f / UI_DPI_FAC));
rect.ymin = sy - height;
rect.ymax = sy;
- UI_fontstyle_draw(&fs, &rect, fname, col);
+ UI_fontstyle_draw(
+ &fs, &rect, fname, col,
+ &(struct uiFontStyleDraw_Params) { .align = align, });
}
void file_calc_previews(const bContext *C, ARegion *ar)
@@ -378,8 +371,6 @@ static void file_draw_preview(
xco = sx + (int)dx;
yco = sy - layout->prv_h + (int)dy;
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
-
/* shadow */
if (use_dropshadow) {
UI_draw_box_shadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
@@ -392,10 +383,17 @@ static void file_draw_preview(
UI_GetThemeColor4fv(TH_TEXT, col);
}
+ if (!is_icon && typeflags & FILE_TYPE_BLENDERLIB) {
+ /* Datablock preview images use premultiplied alpha. */
+ GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ }
+
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTexScaled(&state, (float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect,
scale, scale, 1.0f, 1.0f, col);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+
if (icon) {
UI_icon_draw_aspect((float)xco, (float)yco, icon, icon_aspect, 1.0f, NULL);
}
@@ -550,7 +548,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
int textwidth, textheight;
int i;
bool is_icon;
- short align;
+ eFontStyle_Align align;
bool do_drag;
int column_space = 0.6f * UI_UNIT_X;
unsigned char text_col[4];
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 710aa472a8b..44711fd12dc 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_intern.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#ifndef __FILE_INTERN_H__
@@ -59,8 +52,8 @@ void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
bool file_draw_check_exists(SpaceFile *sfile);
/* file_ops.h */
-struct wmOperatorType;
struct wmOperator;
+struct wmOperatorType;
typedef enum WalkSelectDirection {
FILE_SELECT_WALK_UP,
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index ea73026020d..a6d52b8fb45 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Andrea Weikert (c) 2008 Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_ops.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_linklist.h"
#include "BLO_readfile.h"
@@ -108,7 +100,7 @@ static void file_deselect_all(SpaceFile *sfile, unsigned int flag)
typedef enum FileSelect {
FILE_SELECT_NOTHING = 0,
FILE_SELECT_DIR = 1,
- FILE_SELECT_FILE = 2
+ FILE_SELECT_FILE = 2,
} FileSelect;
static void clamp_to_filelist(int numfiles, FileSelection *sel)
@@ -443,7 +435,8 @@ static int file_box_select_exec(bContext *C, wmOperator *op)
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, false, false);
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more than
+ * one file is selected */
filelist_entry_select_index_set(sfile->files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
if (FILE_SELECT_DIR == ret) {
@@ -507,7 +500,8 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill, do_diropen);
if (extend) {
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more
+ * than one file is selected */
filelist_entry_select_index_set(sfile->files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
}
@@ -571,10 +565,11 @@ static bool file_walk_select_selection_set(
deselect = (fill || other_site == -1 ||
!filelist_entry_select_index_get(files, other_site, CHECK_ALL));
- /* don't change highlight_file here since we either want to deselect active or we want to
- * walk through a block of selected files without selecting/deselecting anything */
+ /* don't change highlight_file here since we either want to deselect active or we want
+ * to walk through a block of selected files without selecting/deselecting anything */
params->active_file = active_new;
- /* but we want to change active if we use fill (needed to get correct selection bounds) */
+ /* but we want to change active if we use fill
+ * (needed to get correct selection bounds) */
if (deselect && fill) {
active = active_new;
}
@@ -606,7 +601,8 @@ static bool file_walk_select_selection_set(
/* highlight the active walker file for extended selection for better visual feedback */
params->highlight_file = params->active_file;
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more
+ * than one file is selected */
filelist_entry_select_index_set(files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
}
else {
@@ -746,7 +742,7 @@ void FILE_OT_select_walk(wmOperatorType *ot)
{FILE_SELECT_WALK_DOWN, "DOWN", 0, "Next", ""},
{FILE_SELECT_WALK_LEFT, "LEFT", 0, "Left", ""},
{FILE_SELECT_WALK_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -824,7 +820,8 @@ void FILE_OT_select_all(wmOperatorType *ot)
/* ---------- BOOKMARKS ----------- */
-/* Note we could get rid of this one, but it's used by some addon so... Does not hurt keeping it around for now. */
+/* Note we could get rid of this one, but it's used by some addon so...
+ * Does not hurt keeping it around for now. */
static int bookmark_select_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -1207,7 +1204,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
Main *bmain = CTX_data_main(C);
PropertyRNA *prop;
- BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
+ /* XXX, not real length */
+ BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file);
if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) {
if (RNA_property_boolean_get(op->ptr, prop)) {
@@ -1243,7 +1241,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
num_files++;
}
}
- /* make sure the file specified in the filename button is added even if no files selected */
+ /* make sure the file specified in the filename button is added even if no
+ * files selected */
if (0 == num_files) {
RNA_property_collection_add(op->ptr, prop, &itemptr);
RNA_string_set(&itemptr, "name", sfile->params->file);
@@ -1263,7 +1262,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
}
}
- /* make sure the directory specified in the button is added even if no directory selected */
+ /* make sure the directory specified in the button is added even if no
+ * directory selected */
if (0 == num_dirs) {
RNA_property_collection_add(op->ptr, prop, &itemptr);
RNA_string_set(&itemptr, "name", sfile->params->dir);
@@ -1804,7 +1804,8 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
/* set timer to smoothly view newly generated file */
- sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0);
sfile->scroll_offset = 0;
/* reload dir to make sure we're seeing what's in the directory */
@@ -2001,7 +2002,8 @@ void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg
BLI_filename_make_safe(sfile->params->file);
if (matches) {
- /* replace the pattern (or filename that the user typed in, with the first selected file of the match */
+ /* replace the pattern (or filename that the user typed in,
+ * with the first selected file of the match */
BLI_strncpy(sfile->params->file, matched_file, sizeof(sfile->params->file));
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index cbf685e6ed8..058ba9bfef3 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Andrea Weikert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_panels.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include "BLI_blenlib.h"
diff --git a/source/blender/editors/space_file/file_utils.c b/source/blender/editors/space_file/file_utils.c
index fc870399696..0294b635910 100644
--- a/source/blender/editors/space_file/file_utils.c
+++ b/source/blender/editors/space_file/file_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,18 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_utils.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include "BLI_rect.h"
-#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLO_readfile.h"
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 218c7dcdb42..eec30adff10 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filelist.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -51,7 +43,6 @@
#include "BLI_fileops_types.h"
#include "BLI_fnmatch.h"
#include "BLI_ghash.h"
-#include "BLI_hash_md5.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_stack.h"
@@ -165,7 +156,8 @@ int folderlist_clear_next(struct SpaceFile *sfile)
if (!sfile->folders_next)
return 0;
- /* if previous_folder, next_folder or refresh_folder operators are executed it doesn't clear folder_next */
+ /* if previous_folder, next_folder or refresh_folder operators are executed
+ * it doesn't clear folder_next */
folder = sfile->folders_prev->last;
if ((!folder) || (BLI_path_cmp(folder->foldername, sfile->params->dir) == 0))
return 0;
@@ -208,19 +200,24 @@ ListBase *folderlist_duplicate(ListBase *folderlist)
typedef struct FileListInternEntry {
struct FileListInternEntry *next, *prev;
- char uuid[16]; /* ASSET_UUID_LENGTH */
+ /** ASSET_UUID_LENGTH */
+ char uuid[16];
- int typeflag; /* eFileSel_File_Types */
- int blentype; /* ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ /** eFileSel_File_Types */
+ int typeflag;
+ /** ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ int blentype;
char *relpath;
- char *name; /* not strictly needed, but used during sorting, avoids to have to recompute it there... */
+ /** not strictly needed, but used during sorting, avoids to have to recompute it there... */
+ char *name;
BLI_stat_t st;
} FileListInternEntry;
typedef struct FileListIntern {
- ListBase entries; /* FileListInternEntry items. */
+ /** FileListInternEntry items. */
+ ListBase entries;
FileListInternEntry **filtered;
char curr_uuid[16]; /* Used to generate uuid during internal listing. */
@@ -235,7 +232,8 @@ typedef struct FileListEntryCache {
/* This one gathers all entries from both block and misc caches. Used for easy bulk-freing. */
ListBase cached_entries;
- /* Block cache: all entries between start and end index. used for part of the list on display. */
+ /* Block cache: all entries between start and end index.
+ * used for part of the list on display. */
FileDirEntry **block_entries;
int block_start_index, block_end_index, block_center_index, block_cursor;
@@ -347,7 +345,7 @@ enum {
SPECIAL_IMG_UNKNOWNFILE = 9,
SPECIAL_IMG_LOADING = 10,
SPECIAL_IMG_BACKUP = 11,
- SPECIAL_IMG_MAX
+ SPECIAL_IMG_MAX,
};
static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
@@ -910,7 +908,8 @@ static int filelist_geticon_ex(
return ICON_FILE_BLEND;
}
else if (is_main) {
- /* Do not return icon for folders if icons are not 'main' draw type (e.g. when used over previews). */
+ /* Do not return icon for folders if icons are not 'main' draw type
+ * (e.g. when used over previews). */
return ICON_FILE_FOLDER;
}
}
@@ -1002,7 +1001,8 @@ static void filelist_entry_clear(FileDirEntry *entry)
if (entry->image) {
IMB_freeImBuf(entry->image);
}
- /* For now, consider FileDirEntryRevision::poin as not owned here, so no need to do anything about it */
+ /* For now, consider FileDirEntryRevision::poin as not owned here,
+ * so no need to do anything about it */
if (!BLI_listbase_is_empty(&entry->variants)) {
FileDirEntryVariant *var;
@@ -1348,7 +1348,8 @@ void filelist_free(struct FileList *filelist)
return;
}
- filelist_clear_ex(filelist, false, false); /* No need to clear cache & selection_state, we free them anyway. */
+ /* No need to clear cache & selection_state, we free them anyway. */
+ filelist_clear_ex(filelist, false, false);
filelist_cache_free(&filelist->filelist_cache);
if (filelist->selection_state) {
@@ -1561,7 +1562,8 @@ int filelist_file_findpath(struct FileList *filelist, const char *filename)
}
/* XXX TODO Cache could probably use a ghash on paths too? Not really urgent though.
- * This is only used to find again renamed entry, annoying but looks hairy to get rid of it currently. */
+ * This is only used to find again renamed entry,
+ * annoying but looks hairy to get rid of it currently. */
for (fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
@@ -1602,7 +1604,8 @@ FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid
void filelist_file_cache_slidingwindow_set(FileList *filelist, size_t window_size)
{
- /* Always keep it power of 2, in [256, 8192] range for now, cache being app. twice bigger than requested window. */
+ /* Always keep it power of 2, in [256, 8192] range for now,
+ * cache being app. twice bigger than requested window. */
size_t size = 256;
window_size *= 2;
@@ -1723,8 +1726,9 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
else {
// printf("Partial Recaching!\n");
- /* At this point, we know we keep part of currently cached entries, so update previews if needed,
- * and remove everything from working queue - we'll add all newly needed entries at the end. */
+ /* At this point, we know we keep part of currently cached entries, so update previews
+ * if needed, and remove everything from working queue - we'll add all newly needed
+ * entries at the end. */
if (cache->flags & FLC_PREVIEWS_ACTIVE) {
filelist_cache_previews_update(filelist);
filelist_cache_previews_clear(cache);
@@ -1737,7 +1741,9 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
int size2 = 0;
int idx1 = cache->block_cursor, idx2 = 0;
-// printf("\tcache releasing: [%d:%d] (%d, %d)\n", cache->block_start_index, cache->block_start_index + size1, cache->block_cursor, size1);
+// printf("\tcache releasing: [%d:%d] (%d, %d)\n",
+// cache->block_start_index, cache->block_start_index + size1,
+// cache->block_cursor, size1);
if (idx1 + size1 > cache_size) {
size2 = idx1 + size1 - cache_size;
@@ -1754,7 +1760,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
int size2 = 0;
int idx1, idx2 = 0;
-// printf("\tcache releasing: [%d:%d] (%d)\n", cache->block_end_index - size1, cache->block_end_index, cache->block_cursor);
+// printf("\tcache releasing: [%d:%d] (%d)\n",
+// cache->block_end_index - size1, cache->block_end_index, cache->block_cursor);
idx1 = (cache->block_cursor + end_index - cache->block_start_index) % cache_size;
if (idx1 + size1 > cache_size) {
@@ -1771,7 +1778,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
if (start_index < cache->block_start_index) {
/* Add (request) needed entries before already cached ones. */
- /* Note: We need some index black magic to wrap around (cycle) inside our cache_size array... */
+ /* Note: We need some index black magic to wrap around (cycle)
+ * inside our cache_size array... */
int size1 = cache->block_start_index - start_index;
int size2 = 0;
int idx1, idx2;
@@ -1802,7 +1810,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
// printf("\tstart-extended...\n");
if (end_index > cache->block_end_index) {
/* Add (request) needed entries after already cached ones. */
- /* Note: We need some index black magic to wrap around (cycle) inside our cache_size array... */
+ /* Note: We need some index black magic to wrap around (cycle)
+ * inside our cache_size array... */
int size1 = end_index - cache->block_end_index;
int size2 = 0;
int idx1, idx2;
@@ -1899,11 +1908,13 @@ bool filelist_cache_previews_update(FileList *filelist)
FileListEntryPreview *preview = BLI_thread_queue_pop(cache->previews_done);
FileDirEntry *entry;
- /* Paranoid (should never happen currently since we consume this queue from a single thread), but... */
+ /* Paranoid (should never happen currently
+ * since we consume this queue from a single thread), but... */
if (!preview) {
continue;
}
- /* entry might have been removed from cache in the mean time, we do not want to cache it again here. */
+ /* entry might have been removed from cache in the mean time,
+ * we do not want to cache it again here. */
entry = filelist_file_ex(filelist, preview->index, false);
// printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img);
@@ -1921,7 +1932,8 @@ bool filelist_cache_previews_update(FileList *filelist)
}
else if (entry) {
/* We want to avoid re-processing this entry continuously!
- * Note that, since entries only live in cache, preview will be retried quite often anyway. */
+ * Note that, since entries only live in cache,
+ * preview will be retried quite often anyway. */
entry->flags |= FILE_ENTRY_INVALID_PREVIEW;
}
@@ -1964,7 +1976,8 @@ static bool file_is_blend_backup(const char *str)
return (retval);
}
-/* TODO: Maybe we should move this to BLI? On the other hand, it's using defines from spacefile area, so not sure... */
+/* TODO: Maybe we should move this to BLI?
+ * On the other hand, it's using defines from spacefile area, so not sure... */
int ED_path_extension_type(const char *path)
{
if (BLO_has_bfile_extension(path)) {
@@ -2268,7 +2281,8 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const
return nbr_entries;
}
- /* memory for strings is passed into filelist[i].entry->relpath and freed in filelist_entry_free. */
+ /* memory for strings is passed into filelist[i].entry->relpath
+ * and freed in filelist_entry_free. */
if (group) {
idcode = groupname_to_code(group);
names = BLO_blendhandle_get_datablock_names(libfiledata, idcode, &nnames);
@@ -2311,7 +2325,8 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const
}
#if 0
-/* Kept for reference here, in case we want to add back that feature later. We do not need it currently. */
+/* Kept for reference here, in case we want to add back that feature later.
+ * We do not need it currently. */
/* Code ***NOT*** updated for job stuff! */
static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
{
@@ -2385,7 +2400,8 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
}
}
- /* XXX TODO: if databrowse F4 or append/link filelist->flags & FLF_HIDE_PARENT has to be set */
+ /* XXX TODO: if databrowse F4 or append/link
+ * filelist->flags & FLF_HIDE_PARENT has to be set */
if (!(filelist->filter_data.flags & FLF_HIDE_PARENT))
filelist->filelist.nbr_entries++;
@@ -2499,10 +2515,11 @@ static void filelist_readjob_do(
BLI_stack_discard(todo_dirs);
- /* ARRRG! We have to be very careful *not to use* common BLI_path_util helpers over entry->relpath itself
- * (nor any path containing it), since it may actually be a datablock name inside .blend file,
- * which can have slashes and backslashes! See T46827.
- * Note that in the end, this means we 'cache' valid relative subdir once here, this is actually better. */
+ /* ARRRG! We have to be very careful *not to use* common BLI_path_util helpers over
+ * entry->relpath itself (nor any path containing it), since it may actually be a datablock
+ * name inside .blend file, which can have slashes and backslashes! See T46827.
+ * Note that in the end, this means we 'cache' valid relative subdir once here,
+ * this is actually better. */
BLI_strncpy(rel_subdir, subdir, sizeof(rel_subdir));
BLI_cleanup_dir(root, rel_subdir);
BLI_path_rel(rel_subdir, root);
@@ -2521,13 +2538,15 @@ static void filelist_readjob_do(
/* Generate our entry uuid. Abusing uuid as an uint32, shall be more than enough here,
* things would crash way before we overflow that counter!
* Using an atomic operation to avoid having to lock thread...
- * Note that we do not really need this here currently, since there is a single listing thread, but better
+ * Note that we do not really need this here currently,
+ * since there is a single listing thread, but better
* remain consistent about threading! */
*((uint32_t *)entry->uuid) = atomic_add_and_fetch_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1);
/* Only thing we change in direntry here, so we need to free it first. */
MEM_freeN(entry->relpath);
- entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//' added by BLI_path_rel to rel_subdir */
+ entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//'
+ * added by BLI_path_rel to rel_subdir */
entry->name = BLI_strdup(fileentry_uiname(root, entry->relpath, entry->typeflag, dir));
/* Here we decide whether current filedirentry is to be listed too, or not. */
@@ -2568,7 +2587,8 @@ static void filelist_readjob_do(
MEM_freeN(subdir);
}
- /* If we were interrupted by stop, stack may not be empty and we need to free pending dir paths. */
+ /* If we were interrupted by stop, stack may not be empty and we need to free
+ * pending dir paths. */
while (!BLI_stack_is_empty(todo_dirs)) {
td_dir = BLI_stack_peek(todo_dirs);
MEM_freeN(td_dir->dir);
@@ -2601,7 +2621,8 @@ typedef struct FileListReadJob {
ThreadMutex lock;
char main_name[FILE_MAX];
struct FileList *filelist;
- struct FileList *tmp_filelist; /* XXX We may use a simpler struct here... just a linked list and root path? */
+ /** XXX We may use a simpler struct here... just a linked list and root path? */
+ struct FileList *tmp_filelist;
} FileListReadJob;
static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update, float *progress)
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 6d898ee2fe9..0cfef16c00d 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filelist.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -47,13 +39,13 @@ struct FileDirEntry;
typedef enum FileSelType {
FILE_SEL_REMOVE = 0,
FILE_SEL_ADD = 1,
- FILE_SEL_TOGGLE = 2
+ FILE_SEL_TOGGLE = 2,
} FileSelType;
typedef enum FileCheckType {
CHECK_DIRS = 1,
CHECK_FILES = 2,
- CHECK_ALL = 3
+ CHECK_ALL = 3,
} FileCheckType;
struct ListBase *folderlist_new(void);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index cb014f30d95..cc81982bfad 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filesel.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -55,27 +48,24 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_fnmatch.h"
#include "BKE_appdir.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BLF_api.h"
-
#include "ED_fileselect.h"
#include "WM_api.h"
#include "WM_types.h"
-
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
+#include "UI_view2d.h"
#include "file_intern.h"
#include "filelist.h"
@@ -547,7 +537,9 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->prv_border_y = 0;
layout->tile_h = textheight * 3 / 2;
layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * layout->tile_border_y);
- layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
+ /* Padding by full scrollbar H is too much, can overlap tile border Y. */
+ layout->rows = (layout->height - V2D_SCROLL_HEIGHT + layout->tile_border_y) /
+ (layout->tile_h + 2 * layout->tile_border_y);
column_widths(params, layout);
@@ -627,7 +619,8 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
*/
for (i = 0; i < n; i++) {
file = filelist_file(sfile->files, i);
- /* Do not check whether file is a file or dir here! Causes T44243 (we do accept dirs at this stage). */
+ /* Do not check whether file is a file or dir here! Causes T44243
+ * (we do accept dirs at this stage). */
if (fnmatch(pattern, file->relpath, 0) == 0) {
filelist_entry_select_set(sfile->files, file, FILE_SEL_ADD, FILE_SEL_SELECTED, CHECK_ALL);
if (!match) {
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 9b1aae03219..c3c85600121 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andrea Weikert (c) 2008 Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/fsmenu.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -45,9 +37,11 @@
#include "ED_fileselect.h"
#ifdef WIN32
-# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
-# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
- * because 'near' is disabled through BLI_windstuff */
+ /* Need to include windows.h so _WIN32_IE is defined. */
+# include <windows.h>
+ /* For SHGetSpecialFolderPath, has to be done before BLI_winstuff
+ * because 'near' is disabled through BLI_windstuff. */
+# include <shlobj.h>
# include "BLI_winstuff.h"
#endif
@@ -510,7 +504,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
{
/* Get mounted volumes better method OSX 10.6 and higher, see: */
/*https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html*/
- /* we get all volumes sorted including network and do not relay on user-defined finder visibility, less confusing */
+
+ /* we get all volumes sorted including network and do not relay
+ * on user-defined finder visibility, less confusing */
CFURLRef cfURL = NULL;
CFURLEnumeratorResult result = kCFURLEnumeratorSuccess;
@@ -644,7 +640,8 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
* Assuming every entry ends with the share name */
const char *label = strstr(dirname, "share=");
if (label != NULL) {
- /* Move pointer so "share=" is trimmed off or use full dirname as label. */
+ /* Move pointer so "share=" is trimmed off
+ * or use full dirname as label. */
const char *label_test = label + 6;
label = *label_test ? label_test : dirname;
}
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index e5a59e356eb..f20016e6895 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/space_file/fsmenu.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index fb6dfdad4db..d857955d340 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/space_file.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include <string.h>
@@ -33,11 +26,9 @@
#include "MEM_guardedalloc.h"
-#include "BIF_gl.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BKE_appdir.h"
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 2840324e65e..20e2ebc0936 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index c3d6c1f6435..a4d7b5e9fc9 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_buttons.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -116,7 +109,7 @@ static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
static void graph_panel_view(const bContext *C, Panel *pa)
{
bScreen *sc = CTX_wm_screen(C);
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
Scene *scene = CTX_data_scene(C);
PointerRNA spaceptr, sceneptr;
uiLayout *col, *sub, *row;
@@ -584,7 +577,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE
/* drivers panel poll */
static bool graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
if (sipo->mode != SIPO_MODE_DRIVERS)
return 0;
@@ -687,7 +680,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
- uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ uiLayoutSetRedAlert(col, false);
+
uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
/* Object 2 */
@@ -702,7 +697,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
- uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ uiLayoutSetRedAlert(col, false);
+
uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
@@ -821,7 +818,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL);
}
else if (!BKE_driver_has_simple_expression(driver)) {
- if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
+ if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) {
/* TODO: Add button to enable? */
uiItemL(col, IFACE_("WARNING: Python expressions limited for security"), ICON_ERROR);
}
@@ -922,14 +919,22 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
subrow = uiLayoutRow(row, true);
/* 1.1.1) variable type */
- sub = uiLayoutRow(subrow, true); /* HACK: special group just for the enum, otherwise we */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ /* HACK: special group just for the enum,
+ * otherwise we get ugly layout with text included too... */
+ sub = uiLayoutRow(subrow, true);
+
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemR(sub, &dvar_ptr, "type", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* 1.1.2) variable name */
- sub = uiLayoutRow(subrow, true); /* HACK: special group to counteract the effects of the previous */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ /* HACK: special group to counteract the effects of the previous enum,
+ * which now pushes everything too far right */
+ sub = uiLayoutRow(subrow, true);
+
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemR(sub, &dvar_ptr, "name", 0, "", ICON_NONE);
@@ -993,7 +998,8 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
uiItemS(layout);
uiItemS(layout);
- /* XXX: This should become redundant. But sometimes the flushing fails, so keep this around for a while longer as a "last resort" */
+ /* XXX: This should become redundant. But sometimes the flushing fails,
+ * so keep this around for a while longer as a "last resort" */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"),
@@ -1020,7 +1026,8 @@ static void graph_panel_driven_property(const bContext *C, Panel *pa)
MEM_freeN(ale);
}
-/* driver settings for active F-Curve (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */
+/* driver settings for active F-Curve
+ * (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */
static void graph_panel_drivers(const bContext *C, Panel *pa)
{
bAnimListElem *ale;
@@ -1142,7 +1149,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
col = uiLayoutColumn(pa->layout, true);
uiLayoutSetActive(col, active);
- ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, ale->fcurve_owner_id, &fcu->modifiers, fcm);
}
MEM_freeN(ale);
@@ -1198,7 +1205,9 @@ void graph_buttons_register(ARegionType *art)
pt->draw = graph_panel_drivers_popover;
pt->poll = graph_panel_drivers_popover_poll;
BLI_addtail(&art->paneltypes, pt);
- WM_paneltype_add(pt); /* This panel isn't used in this region. Add explicitly to global list (so popovers work). */
+ /* This panel isn't used in this region.
+ * Add explicitly to global list (so popovers work). */
+ WM_paneltype_add(pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
strcpy(pt->idname, "GRAPH_PT_modifiers");
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d4f6824ccdf..535ec6e8da9 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) Blender Foundation
- *
- * Contributor(s): Joshua Leung (2009 Recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_draw.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -46,7 +40,6 @@
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#include "BIF_glutil.h"
#include "GPU_draw.h"
#include "GPU_immediate.h"
@@ -245,13 +238,19 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool
*/
if (!sel_handle_only || BEZT_ISSEL_ANY(bezt)) {
if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
- if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
+ if ((bezt->f1 & SELECT) == sel
+ /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax) */ )
+ {
immVertex2fv(pos, bezt->vec[0]);
+ }
}
if (bezt->ipo == BEZT_IPO_BEZ) {
- if ((bezt->f3 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/
+ if ((bezt->f3 & SELECT) == sel
+ /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax) */ )
+ {
immVertex2fv(pos, bezt->vec[2]);
+ }
}
}
}
@@ -291,7 +290,8 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
GPU_blend(true);
GPU_enable_program_point_size();
- /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
+ /* draw the two handles first (if they're shown, the curve doesn't
+ * have just a single keyframe, and the curve is being edited) */
if (do_handles) {
draw_fcurve_handle_vertices(fcu, v2d, sel_handle_only, pos);
}
@@ -305,16 +305,23 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
/* Handles ---------------- */
-static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
+static bool draw_fcurve_handles_check(SpaceGraph *sipo, FCurve *fcu)
{
/* don't draw handle lines if handles are not to be shown */
- if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
- (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
+ if (
+ /* handles shouldn't be shown anywhere */
+ (sipo->flag & SIPO_NOHANDLES) ||
+ /* keyframes aren't editable */
+ (fcu->flag & FCURVE_PROTECTED) ||
#if 0 /* handles can still be selected and handle types set, better draw - campbell */
- (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
+ /* editing the handles here will cause weird/incorrect interpolation issues */
+ (fcu->flag & FCURVE_INT_VALUES) ||
#endif
- ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
- (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
+ /* group that curve belongs to is not editable */
+ ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
+ /* do not show handles if there is only 1 keyframe,
+ * otherwise they all clump together in an ugly ball */
+ (fcu->totvert <= 1)
)
{
return false;
@@ -326,7 +333,7 @@ static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
/* draw lines for F-Curve handles only (this is only done in EditMode)
* note: draw_fcurve_handles_check must be checked before running this. */
-static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
+static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
{
int sel, b;
@@ -440,7 +447,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@@ -477,10 +484,9 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* Curve ---------------- */
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
-static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid, unsigned int pos)
+static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, View2DGrid *grid, unsigned int pos)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
- ChannelDriver *driver;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
float samplefreq;
float stime, etime;
float unitFac, offset;
@@ -495,12 +501,12 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
return;
- /* disable any drivers temporarily */
- driver = fcu->driver;
- fcu->driver = NULL;
+ /* disable any drivers */
+ FCurve fcurve_for_draw = *fcu_;
+ fcurve_for_draw.driver = NULL;
/* compute unit correction factor */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, &fcurve_for_draw, mapping_flag, &offset);
/* Note about sampling frequency:
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
@@ -514,7 +520,8 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
* loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value
* chosen here is just the coarsest value which still looks reasonable...
*/
- /* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */
+ /* grid->dx represents the number of 'frames' between gridlines,
+ * but we divide by U.v2d_min_gridsize to get pixels-steps */
/* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */
samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize);
@@ -555,14 +562,11 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
for (i = 0; i <= n; i++) {
float ctime = stime + i * samplefreq;
- immVertex2f(pos, ctime, (evaluate_fcurve(fcu, ctime) + offset) * unitFac);
+ immVertex2f(pos, ctime, (evaluate_fcurve(&fcurve_for_draw, ctime) + offset) * unitFac);
}
immEnd();
}
-
- /* restore driver */
- fcu->driver = driver;
}
/* helper func - draw a samples-based F-Curve */
@@ -726,7 +730,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
/* TODO: optimize this to not have to calc stuff out of view too? */
while (b--) {
if (prevbezt->ipo == BEZT_IPO_CONST) {
- /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
+ /* Constant-Interpolation: draw segment between previous keyframe and next,
+ * but holding same value */
v1[0] = prevbezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
immVertex2fv(pos, v1);
@@ -746,7 +751,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
* - resol determines number of points to sample in between keyframes
*/
- /* resol depends on distance between points (not just horizontal) OR is a fixed high res */
+ /* resol depends on distance between points
+ * (not just horizontal) OR is a fixed high res */
/* TODO: view scale should factor into this someday too... */
if (fcu->driver) {
resol = 32;
@@ -956,7 +962,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
-void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
+void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
{
FCurve *fcu;
@@ -1004,7 +1010,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_region_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, View2DGrid *grid, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 00418d6482a..a85e638e6d8 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_edit.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -58,7 +50,6 @@
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_report.h"
@@ -279,7 +270,8 @@ void GRAPH_OT_view_all(wmOperatorType *ot)
/* api callbacks */
ot->exec = graphkeys_viewall_exec;
- ot->poll = ED_operator_graphedit_active; /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ ot->poll = ED_operator_graphedit_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -298,7 +290,8 @@ void GRAPH_OT_view_selected(wmOperatorType *ot)
/* api callbacks */
ot->exec = graphkeys_view_selected_exec;
- ot->poll = ED_operator_graphedit_active; /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ ot->poll = ED_operator_graphedit_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -340,7 +333,7 @@ void GRAPH_OT_view_frame(wmOperatorType *ot)
/* Bake each F-Curve into a set of samples, and store as a ghost curve */
static void create_ghost_curves(bAnimContext *ac, int start, int end)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -456,12 +449,12 @@ void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- SpaceIpo *sipo;
+ SpaceGraph *sipo;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- sipo = (SpaceIpo *)ac.sl;
+ sipo = (SpaceGraph *)ac.sl;
/* if no ghost curves, don't do anything */
if (BLI_listbase_is_empty(&sipo->runtime.ghost_curves)) {
@@ -515,7 +508,7 @@ static const EnumPropertyItem prop_graphkeys_insertkey_types[] = {
"Active Channels At Cursor", "Insert a keyframe for the active F-Curve at the cursor point"},
{GRAPHKEYS_INSERTKEY_SEL | GRAPHKEYS_INSERTKEY_CURSOR, "CURSOR_SEL", 0,
"Selected Channels At Cursor", "Insert a keyframe for selected F-Curves at the cursor point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -528,7 +521,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
size_t num_items;
ReportList *reports = ac->reports;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
struct Depsgraph *depsgraph = ac->depsgraph;
Scene *scene = ac->scene;
ToolSettings *ts = scene->toolsettings;
@@ -615,7 +608,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
else if (adt)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
- const float curval = evaluate_fcurve(fcu, cfra);
+ const float curval = evaluate_fcurve_only_curve(fcu, cfra);
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
}
@@ -1479,7 +1472,7 @@ static const EnumPropertyItem prop_graphkeys_expo_types[] = {
{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for setting extrapolation mode for keyframes */
@@ -1801,9 +1794,12 @@ void GRAPH_OT_handle_type(wmOperatorType *ot)
typedef struct tEulerFilter {
struct tEulerFilter *next, *prev;
- ID *id; /* ID-block which owns the channels */
- FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */
- const char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */
+ /** ID-block which owns the channels */
+ ID *id;
+ /** 3 Pointers to F-Curves */
+ FCurve *(fcurves[3]);
+ /** Pointer to one of the RNA Path's used by one of the F-Curves */
+ const char *rna_path;
} tEulerFilter;
static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
@@ -1864,7 +1860,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
groups++;
euf->id = ale->id;
- euf->rna_path = fcu->rna_path; /* this should be safe, since we're only using it for a short time */
+ /* this should be safe, since we're only using it for a short time */
+ euf->rna_path = fcu->rna_path;
euf->fcurves[fcu->array_index] = fcu;
}
@@ -1884,7 +1881,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
int f;
/* sanity check: ensure that there are enough F-Curves to work on in this group */
- /* TODO: also enforce assumption that there be a full set of keyframes at each position by ensuring that totvert counts are same? */
+ /* TODO: also enforce assumption that there be a full set of keyframes
+ * at each position by ensuring that totvert counts are same? */
if (ELEM(NULL, euf->fcurves[0], euf->fcurves[1], euf->fcurves[2])) {
/* report which components are missing */
BKE_reportf(op->reports, RPT_WARNING,
@@ -1917,7 +1915,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
/* > 180 degree flip? */
if ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
- /* 360 degrees to add/subtract frame value until difference is acceptably small that there's no more flip */
+ /* 360 degrees to add/subtract frame value until difference
+ * is acceptably small that there's no more flip */
const float fac = sign * 2.0f * (float)M_PI;
while ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
@@ -2032,7 +2031,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
/* set the new current frame and cursor values, based on the average time and value */
if (ked.i1) {
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
Scene *scene = ac.scene;
/* take the average values, rounding to the nearest int as necessary for int results */
@@ -2086,7 +2085,7 @@ static const EnumPropertyItem prop_graphkeys_snap_types[] = {
"Snap selected keyframes to the nearest marker"},
{GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles",
"Flatten handles for a smoother transition"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -2096,7 +2095,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
@@ -2213,7 +2212,7 @@ static const EnumPropertyItem prop_graphkeys_mirror_types[] = {
"Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
{GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
"Flip times of selected keyframes using the first selected marker as the reference point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for mirroring keyframes */
@@ -2223,7 +2222,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
@@ -2817,7 +2816,7 @@ static bool graph_driver_delete_invalid_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
/* firstly, check if in Graph Editor */
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 286d3cea59c..617233f2a20 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,28 +15,23 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_intern.h
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
#ifndef __GRAPH_INTERN_H__
#define __GRAPH_INTERN_H__
-struct bContext;
-struct bAnimContext;
-struct bAnimListElem;
-struct SpaceIpo;
-struct ScrArea;
struct ARegion;
struct ARegionType;
+struct ScrArea;
+struct SpaceGraph;
struct View2DGrid;
+struct bAnimContext;
+struct bAnimListElem;
+struct bContext;
/* internal exports only */
@@ -50,8 +43,8 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa);
/* graph_draw.c */
void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
-void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
-void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
+void graph_draw_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
+void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar);
/* ***************************************** */
/* graph_select.c */
@@ -73,7 +66,7 @@ void GRAPH_OT_clickselect(struct wmOperatorType *ot);
enum eGraphKeys_LeftRightSelect_Mode {
GRAPHKEYS_LRSEL_TEST = 0,
GRAPHKEYS_LRSEL_LEFT,
- GRAPHKEYS_LRSEL_RIGHT
+ GRAPHKEYS_LRSEL_RIGHT,
};
/* defines for column-select mode */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 4ed6a980fcb..1c9bbbcdae5 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_ops.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -83,8 +76,9 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- SpaceIpo *sipo = CTX_wm_space_graph(C);
- float frame = RNA_float_get(op->ptr, "frame"); /* this isn't technically "frame", but it'll do... */
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
+ /* this isn't technically "frame", but it'll do... */
+ float frame = RNA_float_get(op->ptr, "frame");
/* adjust the frame or the cursor x-value */
if (sipo->mode == SIPO_MODE_DRIVERS) {
@@ -265,7 +259,8 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those will always flush everything,
+ * but they are always included */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -291,7 +286,9 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those
+ * will always flush everything, but they are always included */
+
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -359,7 +356,8 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those will always flush everything,
+ * but they are always included. */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -491,7 +489,7 @@ void ED_operatormacros_graph(void)
void graphedit_keymap(wmKeyConfig *keyconf)
{
/* keymap for all regions */
- WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
+ WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_GRAPH, 0);
/* channels */
/* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
@@ -500,5 +498,5 @@ void graphedit_keymap(wmKeyConfig *keyconf)
*/
/* keyframes */
- WM_keymap_ensure(keyconf, "Graph Editor", SPACE_IPO, 0);
+ WM_keymap_ensure(keyconf, "Graph Editor", SPACE_GRAPH, 0);
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index cbea292c4ec..85afd70e083 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_select.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -90,7 +84,7 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
@@ -242,7 +236,7 @@ static void box_select_graphkeys(
bAnimListElem *ale;
int filter, mapping_flag;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
View2D *v2d = &ac->ar->v2d;
@@ -460,7 +454,7 @@ static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
selectmode = SELECT_SUBTRACT;
{
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
@@ -537,7 +531,7 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
rect_fl.ymax = y + radius;
{
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
@@ -589,7 +583,7 @@ static const EnumPropertyItem prop_column_select_types[] = {
{GRAPHKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""},
{GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""},
{GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", 0, "Between Min/Max Selected Markers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -933,7 +927,7 @@ static const EnumPropertyItem prop_graphkeys_leftright_select_types[] = {
{GRAPHKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{GRAPHKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{GRAPHKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* --------------------------------- */
@@ -1120,7 +1114,7 @@ typedef enum eGraphVertIndex {
/* check if its ok to select a handle */
// XXX also need to check for int-values only?
-static bool fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
+static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
{
if (sipo->flag & SIPO_NOHANDLES) return 0;
if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZT_ISSEL_ANY(bezt) == 0) return 0;
@@ -1190,7 +1184,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
View2D *v2d = &ac->ar->v2d;
short mapping_flag = 0;
@@ -1314,7 +1308,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mv
/* option 1) select keyframe directly under mouse */
static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
tNearestVertInfo *nvi;
BezTriple *bezt = NULL;
@@ -1421,7 +1415,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
}
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
- /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */
+ /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY)
+ * otherwise the active flag won't be set T26452. */
if (nvi->fcu->flag & FCURVE_SELECTED) {
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype);
@@ -1431,7 +1426,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
MEM_freeN(nvi);
}
-/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+/* Option 2) Selects all the keyframes on either side of the current frame
+ * (depends on which side the mouse is on) */
/* (see graphkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 912b5ceed58..6bef5072a78 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_utils.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -64,7 +57,7 @@
/* NOTE: Currently called from windowmanager (new drivers editor window) and RNA (mode switching) */
void ED_drivers_editor_init(bContext *C, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* Set mode */
sipo->mode = SIPO_MODE_DRIVERS;
@@ -147,7 +140,7 @@ bool graphop_visible_keyframes_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -196,7 +189,7 @@ bool graphop_editable_keyframes_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -243,7 +236,7 @@ bool graphop_active_fcurve_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -284,7 +277,7 @@ bool graphop_selected_fcurve_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 27e401c8948..9892660c59c 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/space_graph.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -43,8 +36,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_fcurve.h"
#include "BKE_screen.h"
@@ -102,11 +93,11 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
{
ARegion *ar;
- SpaceIpo *sipo;
+ SpaceGraph *sipo;
/* Graph Editor - general stuff */
- sipo = MEM_callocN(sizeof(SpaceIpo), "init graphedit");
- sipo->spacetype = SPACE_IPO;
+ sipo = MEM_callocN(sizeof(SpaceGraph), "init graphedit");
+ sipo->spacetype = SPACE_GRAPH;
sipo->autosnap = SACTSNAP_FRAME;
@@ -172,7 +163,7 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
/* not spacelink itself */
static void graph_free(SpaceLink *sl)
{
- SpaceIpo *si = (SpaceIpo *)sl;
+ SpaceGraph *si = (SpaceGraph *)sl;
if (si->ads) {
BLI_freelistN(&si->ads->chanbase);
@@ -188,7 +179,7 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
@@ -206,10 +197,10 @@ static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
static SpaceLink *graph_duplicate(SpaceLink *sl)
{
- SpaceIpo *sipon = MEM_dupallocN(sl);
+ SpaceGraph *sipon = MEM_dupallocN(sl);
/* clear or remove stuff from old */
- BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceIpo *)sl)->runtime.ghost_curves);
+ BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceGraph *)sl)->runtime.ghost_curves);
sipon->ads = MEM_dupallocN(sipon->ads);
return (SpaceLink *)sipon;
@@ -223,16 +214,16 @@ static void graph_main_region_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_GRAPH, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
static void graph_main_region_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
View2D *v2d = &ar->v2d;
@@ -306,7 +297,8 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* cursor x-value */
float x = sipo->cursorTime;
- /* to help differentiate this from the current frame, draw slightly darker like the horizontal one */
+ /* to help differentiate this from the current frame,
+ * draw slightly darker like the horizontal one */
immUniformThemeColorShadeAlpha(TH_CFRAME, -40, -50);
GPU_blend(true);
GPU_line_width(2.0);
@@ -330,7 +322,11 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (sipo->flag & SIPO_MARKER_LINES) {
+ marker_draw_flag |= DRAW_MARKERS_LINES;
+ }
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
@@ -362,7 +358,10 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
/* make sure we keep the hide flags */
ar->v2d.scroll |= V2D_SCROLL_RIGHT;
- ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); /* prevent any noise of past */
+
+ /* prevent any noise of past */
+ ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM);
+
ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
@@ -371,7 +370,7 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -421,7 +420,7 @@ static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -571,12 +570,13 @@ static void graph_region_message_subscribe(
/* editor level listener */
static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- /* for selection changes of animation data, we can just redraw... otherwise autocolor might need to be done again */
+ /* for selection changes of animation data, we can just redraw...
+ * otherwise autocolor might need to be done again */
if (ELEM(wmn->data, ND_KEYFRAME, ND_ANIMCHAN) && (wmn->action == NA_SELECTED))
ED_area_tag_redraw(sa);
else
@@ -584,7 +584,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn,
break;
case NC_SCENE:
switch (wmn->data) {
- case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_OB_ACTIVE: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_OB_SELECT:
sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
@@ -597,7 +598,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn,
break;
case NC_OBJECT:
switch (wmn->data) {
- case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_BONE_SELECT: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_BONE_ACTIVE:
sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
@@ -649,7 +651,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
if (ANIM_animdata_get_context(C, &ac) == false)
return;
- UI_SetTheme(SPACE_IPO, RGN_TYPE_WINDOW);
+ UI_SetTheme(SPACE_GRAPH, RGN_TYPE_WINDOW);
/* build list of F-Curves which will be visible as channels in channel-region
* - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
@@ -758,7 +760,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
static void graph_refresh(const bContext *C, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* updates to data needed depends on Graph Editor mode... */
switch (sipo->mode) {
@@ -800,7 +802,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceIpo *sgraph = (SpaceIpo *)slink;
+ SpaceGraph *sgraph = (SpaceGraph *)slink;
if (sgraph->ads) {
if ((ID *)sgraph->ads->filter_grp == old_id) {
@@ -814,13 +816,13 @@ static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID
static int graph_space_subtype_get(ScrArea *sa)
{
- SpaceIpo *sgraph = sa->spacedata.first;
+ SpaceGraph *sgraph = sa->spacedata.first;
return sgraph->mode;
}
static void graph_space_subtype_set(ScrArea *sa, int value)
{
- SpaceIpo *sgraph = sa->spacedata.first;
+ SpaceGraph *sgraph = sa->spacedata.first;
sgraph->mode = value;
}
@@ -836,7 +838,7 @@ void ED_spacetype_ipo(void)
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo");
ARegionType *art;
- st->spaceid = SPACE_IPO;
+ st->spaceid = SPACE_GRAPH;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
st->new = graph_new;
@@ -877,7 +879,8 @@ void ED_spacetype_ipo(void)
/* regions: channels */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ art->prefsizex = 200 + V2D_SCROLL_WIDTH;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->listener = graph_region_listener;
art->message_subscribe = graph_region_message_subscribe;
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 0bc09981ba5..77abfebc662 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 26162266441..b77c08736dc 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_buttons.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include <string.h>
@@ -151,7 +145,6 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
* otherwise refresh preview
*
* XXX if you put this back, also check XXX in image_main_region_draw() */
- * /
void image_preview_event(int event)
{
int exec = 0;
@@ -181,7 +174,8 @@ void image_preview_event(int event)
BIF_store_spare();
- ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings); /* 1 is do_previews */
+ /* 1 is do_previews */
+ ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings);
G.scene->nodetree->timecursor = NULL;
G.scene->nodetree->test_break = NULL;
@@ -863,7 +857,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
ima = imaptr.data;
iuser = userptr->data;
- BKE_image_user_check_frame_calc(iuser, (int)scene->r.cfra);
+ BKE_image_user_frame_calc(iuser, (int)scene->r.cfra);
cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr = *ptr;
@@ -938,17 +932,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
}
- // XXX what was this for?
-#if 0
- /* check for re-render, only buttons */
- if (imagechanged == B_IMAGECHANGED) {
- if (iuser->flag & IMA_ANIM_REFRESHED) {
- iuser->flag &= ~IMA_ANIM_REFRESHED;
- WM_event_add_notifier(C, NC_IMAGE, ima);
- }
- }
-#endif
-
/* multilayer? */
if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
const float dpi_fac = UI_DPI_FAC;
@@ -1259,6 +1242,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
{
+ Scene *scene = CTX_data_scene(C);
ImBuf *ibuf;
char str[MAX_IMAGE_INFO_LEN];
void *lock;
@@ -1268,16 +1252,44 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
- image_info(CTX_data_scene(C), iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
+ BKE_image_user_frame_calc(iuser, (int)scene->r.cfra);
+ image_info(scene, iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
BKE_image_release_ibuf(ima, ibuf, lock);
uiItemL(layout, str, ICON_NONE);
}
#undef MAX_IMAGE_INFO_LEN
-void image_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ SpaceImage *space_image = CTX_wm_space_image(C);
+ return space_image != NULL && space_image->image != NULL;
+}
+
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
{
+ void *lock;
+ SpaceImage *space_image = CTX_wm_space_image(C);
+ Image *image = space_image->image;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock);
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ }
+ BKE_image_release_ibuf(image, ibuf, lock);
+}
+void image_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype image panel metadata");
+ strcpy(pt->idname, "IMAGE_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index a46767495dd..760068d9641 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_draw.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -56,7 +50,6 @@
#include "IMB_moviecache.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_paint.h"
@@ -434,7 +427,7 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GL_RED, GL_INT, GL_NEAREST, recti, zoomx, zoomy, NULL);
@@ -444,24 +437,24 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int
static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty,
float *rect_float, float zoomx, float zoomy)
{
- float bias, scale, *rectf, clipend;
+ float bias, scale, *rectf, clip_end;
int a;
float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
if (scene->camera && scene->camera->type == OB_CAMERA) {
- bias = ((Camera *)scene->camera->data)->clipsta;
- clipend = ((Camera *)scene->camera->data)->clipend;
- scale = 1.0f / (clipend - bias);
+ bias = ((Camera *)scene->camera->data)->clip_start;
+ clip_end = ((Camera *)scene->camera->data)->clip_end;
+ scale = 1.0f / (clip_end - bias);
}
else {
bias = 0.1f;
scale = 0.01f;
- clipend = 100.0f;
+ clip_end = 100.0f;
}
rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
for (a = rectx * recty - 1; a >= 0; a--) {
- if (rect_float[a] > clipend)
+ if (rect_float[a] > clip_end)
rectf[a] = 0.0f;
else if (rect_float[a] < bias)
rectf[a] = 1.0f;
@@ -472,7 +465,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GL_RED, GL_FLOAT, GL_NEAREST, rectf, zoomx, zoomy, NULL);
@@ -531,7 +524,7 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
shuffle[3] = 1.0f;
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, shuffle);
IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 96c3f55df92..35ac63d59f6 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_edit.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include "DNA_brush_types.h"
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 5d9c496d584..55ae664decd 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_intern.h
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -33,13 +26,13 @@
#define __IMAGE_INTERN_H__
/* internal exports only */
-struct bContext;
struct ARegion;
struct ARegionType;
struct ScrArea;
struct SpaceImage;
-struct wmOperatorType;
+struct bContext;
struct bNodeTree;
+struct wmOperatorType;
/* space_image.c */
struct ARegion *image_has_buttons_region(struct ScrArea *sa);
@@ -70,7 +63,6 @@ void IMAGE_OT_view_ndof(struct wmOperatorType *ot);
void IMAGE_OT_new(struct wmOperatorType *ot);
void IMAGE_OT_open(struct wmOperatorType *ot);
-void IMAGE_OT_unlink(struct wmOperatorType *ot);
void IMAGE_OT_match_movie_length(struct wmOperatorType *ot);
void IMAGE_OT_replace(struct wmOperatorType *ot);
void IMAGE_OT_reload(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 87d2f439ad7..07470bce899 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009, Xavier Thomas
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_ops.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -44,7 +38,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utf8.h"
#include "BLT_translation.h"
@@ -526,7 +519,7 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
enum {
VIEW_PASS = 0,
VIEW_APPLY,
- VIEW_CONFIRM
+ VIEW_CONFIRM,
};
static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1511,7 +1504,8 @@ void IMAGE_OT_match_movie_length(wmOperatorType *ot)
ot->exec = image_match_len_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL/* | OPTYPE_UNDO */; /* Don't think we need undo for that. */
+ /* Don't think we need undo for that. */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL/* | OPTYPE_UNDO */;
}
/******************** replace image operator ********************/
@@ -1640,7 +1634,8 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
simopts->im_format = scene->r.im_format;
is_depth_set = true;
if (!BKE_image_is_multiview(ima)) {
- /* In case multiview is disabled, render settings would be invalid for render result in this area. */
+ /* In case multiview is disabled,
+ * render settings would be invalid for render result in this area. */
simopts->im_format.stereo3d_format = *ima->stereo3d_format;
simopts->im_format.views_format = ima->views_format;
}
@@ -1660,7 +1655,8 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
simopts->im_format.views_format = ima->views_format;
}
- //simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+ ///* XXX - this is lame, we need to make these available too! */
+ //simopts->subimtype = scene->r.subimtype;
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -2350,7 +2346,6 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
/* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
- // XXX other users?
BKE_image_signal(bmain, ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_RELOAD);
DEG_id_tag_update(&ima->id, 0);
@@ -2379,7 +2374,7 @@ void IMAGE_OT_reload(wmOperatorType *ot)
enum {
GEN_CONTEXT_NONE = 0,
GEN_CONTEXT_PAINT_CANVAS = 1,
- GEN_CONTEXT_PAINT_STENCIL = 2
+ GEN_CONTEXT_PAINT_STENCIL = 2,
};
typedef struct ImageNewData {
@@ -2607,13 +2602,16 @@ static int image_invert_exec(bContext *C, wmOperator *op)
size_t i;
- if (ibuf == NULL) /* TODO: this should actually never happen, but does for render-results -> cleanup */
+ if (ibuf == NULL) {
+ /* TODO: this should actually never happen, but does for render-results -> cleanup */
return OPERATOR_CANCELLED;
+ }
if (support_undo) {
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
- * but better do this right in case someone copies this for a tool that uses partial redraw better */
+ * but better do this right in case someone copies this for a tool that uses partial
+ * redraw better */
ED_imapaint_clear_partial_redraw();
ED_imapaint_dirty_region(ima, ibuf, 0, 0, ibuf->x, ibuf->y, false);
}
@@ -2811,7 +2809,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
/* XXX unpackImage frees image buffers */
@@ -2839,7 +2837,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpack_menu(C, "IMAGE_OT_unpack", ima->id.name + 2, ima->name, "textures", BKE_image_has_packedfile(ima) ? ((ImagePackedFile *)ima->packedfiles.first)->packedfile : NULL);
@@ -2863,7 +2861,8 @@ void IMAGE_OT_unpack(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
- RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */
+ /* XXX, weak!, will fail with library, name collisions */
+ RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack");
}
/******************** sample image operator ********************/
@@ -3251,7 +3250,7 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
static const EnumPropertyItem point_items[] = {
{0, "BLACK_POINT", 0, "Black Point", ""},
{1, "WHITE_POINT", 0, "White Point", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3755,6 +3754,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
scene->r.mode |= R_BORDER;
}
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 3c850ae1689..6ae4eb9767b 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/space_image.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include "DNA_gpencil_types.h"
@@ -71,7 +64,6 @@
#include "ED_uvedit.h"
#include "ED_transform.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -83,6 +75,12 @@
#include "image_intern.h"
#include "GPU_framebuffer.h"
+#include "GPU_batch_presets.h"
+#include "GPU_viewport.h"
+
+/* TODO(fclem) remove bad level calls */
+#include "../draw/DRW_engine.h"
+#include "wm_draw.h"
/**************************** common state *****************************/
@@ -93,7 +91,7 @@ static void image_scopes_tag_refresh(ScrArea *sa)
/* only while histogram is visible */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_TOOLS && ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN)
return;
}
@@ -302,9 +300,12 @@ static void image_keymap(struct wmKeyConfig *keyconf)
/* dropboxes */
static bool image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
- if (drag->type == WM_DRAG_PATH)
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type == WM_DRAG_PATH) {
+ /* rule might not work? */
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
return 1;
+ }
+ }
return 0;
}
@@ -334,7 +335,7 @@ static void image_refresh(const bContext *C, ScrArea *sa)
ima = ED_space_image(sima);
- BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra);
+ BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra);
/* check if we have to set the image from the editmesh */
if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
@@ -397,7 +398,8 @@ static void image_listener(wmWindow *win, ScrArea *sa, wmNotifier *wmn, Scene *U
case NC_MASK:
{
// Scene *scene = wmn->window->screen->scene;
- /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima) but we cant get the scene */
+ /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima)
+ * but we cant get the scene */
if (sima->mode == SI_MODE_MASK) {
switch (wmn->data) {
case ND_SELECT:
@@ -620,6 +622,15 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
//View2DScrollers *scrollers;
float col[3];
+ /* XXX This is in order to draw UI batches with the DRW
+ * olg context since we now use it for drawing the entire area */
+ gpu_batch_presets_reset();
+
+ /* TODO(fclem) port to draw manager and remove the depth buffer allocation. */
+ GPUViewport *viewport = ar->draw_buffer->viewport[ar->draw_buffer->stereo ? sima->iuser.multiview_eye : 0];
+ DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport);
+ GPU_framebuffer_bind(fbl->color_only_fb);
+
/* XXX not supported yet, disabling for now */
scene->r.scemode &= ~R_COMP_CROP;
@@ -775,6 +786,27 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
{
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Scene *scene = CTX_data_scene(C);
+ void *lock;
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+ /* XXX performance regression if name of scopes category changes! */
+ PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
+
+ /* only update scopes if scope category is active */
+ if (category) {
+ if (ibuf) {
+ if (!sima->scopes.ok) {
+ BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
+ }
+ if (sima->image->flag & IMA_VIEW_AS_RENDER)
+ ED_space_image_scopes_update(C, sima, ibuf, true);
+ else
+ ED_space_image_scopes_update(C, sima, ibuf, false);
+ }
+ }
+ ED_space_image_release_buffer(sima, ibuf, lock);
+
ED_region_panels(C, ar);
}
@@ -829,27 +861,6 @@ static void image_tools_region_init(wmWindowManager *wm, ARegion *ar)
static void image_tools_region_draw(const bContext *C, ARegion *ar)
{
- SpaceImage *sima = CTX_wm_space_image(C);
- Scene *scene = CTX_data_scene(C);
- void *lock;
- ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
- /* XXX performance regression if name of scopes category changes! */
- PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
-
- /* only update scopes if scope category is active */
- if (category) {
- if (ibuf) {
- if (!sima->scopes.ok) {
- BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
- }
- if (sima->image->flag & IMA_VIEW_AS_RENDER)
- ED_space_image_scopes_update(C, sima, ibuf, true);
- else
- ED_space_image_scopes_update(C, sima, ibuf, false);
- }
- }
- ED_space_image_release_buffer(sima, ibuf, lock);
-
ED_region_panels(C, ar);
}
@@ -1017,13 +1028,13 @@ void ED_spacetype_image(void)
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
art->init = image_main_region_init;
art->draw = image_main_region_draw;
art->listener = image_main_region_listener;
BLI_addhead(&st->regiontypes, art);
- /* regions: listview/buttons */
+ /* regions: listview/buttons/scopes */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_UI;
art->prefsizex = 220; // XXX
@@ -1036,7 +1047,7 @@ void ED_spacetype_image(void)
ED_uvedit_buttons_register(art);
image_buttons_register(art);
- /* regions: statistics/scope buttons */
+ /* regions: tool(bar) */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_TOOLS;
art->prefsizex = 58; /* XXX */
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 4896515182e..f54e4921e6b 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -41,12 +38,12 @@ set(INC_SYS
)
set(SRC
- info_ops.c
- info_stats.c
info_draw.c
+ info_ops.c
info_report.c
- textview.c
+ info_stats.c
space_info.c
+ textview.c
info_intern.h
textview.h
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index ecd0b082df6..39d255427cc 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_draw.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#include <math.h>
@@ -33,7 +27,6 @@
#include <sys/stat.h>
#include <limits.h>
-
#include "BLI_utildefines.h"
#include "DNA_space_types.h"
@@ -42,9 +35,6 @@
// #include "BKE_suggestions.h"
#include "BKE_report.h"
-#include "BIF_gl.h"
-
-
#include "UI_resources.h"
#include "UI_interface.h"
#include "UI_view2d.h"
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 37d3c73f705..83a132e6db8 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_intern.h
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#ifndef __INFO_INTERN_H__
@@ -33,9 +26,9 @@
/* internal exports only */
+struct ReportList;
struct SpaceInfo;
struct wmOperatorType;
-struct ReportList;
void FILE_OT_autopack_toggle(struct wmOperatorType *ot);
void FILE_OT_pack_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index ec0084931eb..21139418c3d 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_ops.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -130,12 +123,12 @@ static int autopack_toggle_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- if (G.fileflags & G_AUTOPACK) {
- G.fileflags &= ~G_AUTOPACK;
+ if (G.fileflags & G_FILE_AUTOPACK) {
+ G.fileflags &= ~G_FILE_AUTOPACK;
}
else {
packAll(bmain, op->reports, true);
- G.fileflags |= G_AUTOPACK;
+ G.fileflags |= G_FILE_AUTOPACK;
}
return OPERATOR_FINISHED;
@@ -218,7 +211,8 @@ static const EnumPropertyItem unpack_all_method_items[] = {
{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write files to original location (overwrite existing files)", ""},
{PF_KEEP, "KEEP", 0, "Disable Auto-pack, keep all packed files", ""},
/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int unpack_all_exec(bContext *C, wmOperator *op)
{
@@ -226,7 +220,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
int method = RNA_enum_get(op->ptr, "method");
if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_FINISHED;
}
@@ -243,7 +237,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
if (!count) {
BKE_report(op->reports, RPT_WARNING, "No packed files to unpack");
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_CANCELLED;
}
@@ -289,7 +283,8 @@ static const EnumPropertyItem unpack_item_method_items[] = {
{PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use file in original location (create when necessary)", ""},
{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write file to original location (overwrite existing file)", ""},
/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int unpack_item_exec(bContext *C, wmOperator *op)
@@ -311,7 +306,7 @@ static int unpack_item_exec(bContext *C, wmOperator *op)
if (method != PF_KEEP)
BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index d512ac8b32b..c8d21bd3061 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_report.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index de406ccdc59..e788af1507e 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_stats.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -38,6 +32,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_scene_types.h"
+#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
@@ -52,6 +47,7 @@
#include "BKE_displist.h"
#include "BKE_key.h"
#include "BKE_layer.h"
+#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_editmesh.h"
@@ -96,7 +92,7 @@ typedef struct SceneStatsFmt {
char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN];
} SceneStatsFmt;
-static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats)
+static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats)
{
if (me_eval == NULL) {
return false;
@@ -115,32 +111,37 @@ static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats)
totloop = me_eval->totloop;
}
- stats->totvert += totvert * totob;
- stats->totedge += totedge * totob;
- stats->totface += totface * totob;
- stats->tottri += poly_to_tri_count(totface, totloop) * totob;
+ stats->totvert += totvert;
+ stats->totedge += totedge;
+ stats->totface += totface;
+ stats->tottri += poly_to_tri_count(totface, totloop);
- if (sel) {
+ if (is_selected) {
stats->totvertsel += totvert;
stats->totfacesel += totface;
}
return true;
}
-static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
+static void stats_object(Object *ob, SceneStats *stats)
{
+ const bool is_selected = (ob->base_flag & BASE_SELECTED) != 0;
+
+ stats->totobj++;
+ if (is_selected) stats->totobjsel++;
+
switch (ob->type) {
case OB_MESH:
{
/* we assume evaluated mesh is already built, this strictly does stats now. */
Mesh *me_eval = ob->runtime.mesh_eval;
- stats_mesheval(me_eval, sel, totob, stats);
+ stats_mesheval(me_eval, is_selected, stats);
break;
}
case OB_LAMP:
- stats->totlamp += totob;
- if (sel) {
- stats->totlampsel += totob;
+ stats->totlamp++;
+ if (is_selected) {
+ stats->totlampsel++;
}
break;
case OB_SURF:
@@ -148,7 +149,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
case OB_FONT:
{
Mesh *me_eval = ob->runtime.mesh_eval;
- if (stats_mesheval(me_eval, sel, totob, stats)) {
+ if (stats_mesheval(me_eval, is_selected, stats)) {
break;
}
ATTR_FALLTHROUGH; /* Falltrough to displist. */
@@ -160,15 +161,11 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first)
BKE_displist_count(&ob->runtime.curve_cache->disp, &totv, &totf, &tottri);
- totv *= totob;
- totf *= totob;
- tottri *= totob;
-
stats->totvert += totv;
stats->totface += totf;
stats->tottri += tottri;
- if (sel) {
+ if (is_selected) {
stats->totvertsel += totv;
stats->totfacesel += totf;
}
@@ -176,7 +173,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
}
case OB_GPENCIL:
{
- if (sel) {
+ if (is_selected) {
bGPdata *gpd = (bGPdata *)ob->data;
/* GPXX Review if we can move to other place when object change
* maybe to depsgraph evaluation
@@ -318,92 +315,6 @@ static void stats_object_sculpt_dynamic_topology(Object *ob, SceneStats *stats)
stats->tottri = ob->sculpt->bm->totface;
}
-static void stats_dupli_object_group_count(Collection *collection, int *count)
-{
- *count += BLI_listbase_count(&collection->gobject);
-
- for (CollectionChild *child = collection->children.first; child; child = child->next) {
- stats_dupli_object_group_count(child->collection, count);
- }
-}
-
-static void stats_dupli_object_group_doit(Collection *collection, SceneStats *stats, ParticleSystem *psys,
- const int totgroup, int *cur)
-{
- for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
- int tot = count_particles_mod(psys, totgroup, *cur);
- stats_object(cob->ob, 0, tot, stats);
- (*cur)++;
- }
-
- for (CollectionChild *child = collection->children.first; child; child = child->next) {
- stats_dupli_object_group_doit(child->collection, stats, psys, totgroup, cur);
- }
-}
-
-static void stats_dupli_object(Object *ob, SceneStats *stats)
-{
- const bool is_selected = (ob->base_flag & BASE_SELECTED) != 0;
- if (is_selected) stats->totobjsel++;
-
- if (ob->transflag & OB_DUPLIPARTS) {
- /* Dupli Particles */
- ParticleSystem *psys;
- ParticleSettings *part;
-
- for (psys = ob->particlesystem.first; psys; psys = psys->next) {
- part = psys->part;
-
- if (part->draw_as == PART_DRAW_OB && part->dup_ob) {
- int tot = count_particles(psys);
- stats_object(part->dup_ob, 0, tot, stats);
- }
- else if (part->draw_as == PART_DRAW_GR && part->dup_group) {
- int totgroup = 0, cur = 0;
-
- Collection *collection = part->dup_group;
- stats_dupli_object_group_count(collection, &totgroup);
- stats_dupli_object_group_doit(collection, stats, psys, totgroup, &cur);
- }
- }
-
- stats_object(ob, is_selected, 1, stats);
- stats->totobj++;
- }
- else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES))) {
- /* Dupli Verts/Faces */
- int tot;
-
- /* metaball dupli-instances are tessellated once */
- if (ob->type == OB_MBALL) {
- tot = 1;
- }
- else {
- tot = count_duplilist(ob->parent);
- }
-
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else if (ob->transflag & OB_DUPLIFRAMES) {
- /* Dupli Frames */
- int tot = count_duplilist(ob);
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else if ((ob->transflag & OB_DUPLICOLLECTION) && ob->dup_group) {
- /* Dupli Group */
- int tot = count_duplilist(ob);
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else {
- /* No Dupli */
- stats_object(ob, is_selected, 1, stats);
- stats->totobj++;
- }
-}
-
static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMode object_mode)
{
return (ob &&
@@ -438,7 +349,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer)
/* Objects */
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob_iter)
{
- stats_dupli_object(ob_iter, &stats);
+ stats_object(ob_iter, &stats);
}
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
}
@@ -597,8 +508,15 @@ void ED_info_stats_clear(ViewLayer *view_layer)
}
}
-const char *ED_info_stats_string(Scene *scene, ViewLayer *view_layer)
+const char *ED_info_stats_string(Main *bmain, Scene *scene, ViewLayer *view_layer)
{
+ /* Loopin through dependency graph when interface is locked in not safe.
+ * Thew interface is marked as locked when jobs wants to modify the
+ * dependency graph. */
+ wmWindowManager *wm = bmain->wm.first;
+ if (wm->is_interface_locked) {
+ return "";
+ }
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
if (!view_layer->stats) {
stats_update(depsgraph, view_layer);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 076b66ef012..68554aebbf5 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/space_info.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -40,14 +33,11 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index c94aaf6e861..a335d6d0bfb 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/textview.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -42,7 +36,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BIF_gl.h"
#include "BKE_text.h"
@@ -58,13 +51,16 @@ typedef struct ConsoleDrawContext {
int font_id;
int cwidth;
int lheight;
- int lofs; /* text vertical offset */
- int console_width; /* number of characters that fit into the width of the console (fixed width) */
+ /** text vertical offset */
+ int lofs;
+ /** number of characters that fit into the width of the console (fixed width) */
+ int console_width;
int winx;
int ymin, ymax;
int *xy; // [2]
int *sel; // [2]
- int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start.
+ /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */
+ int *pos_pick;
const int *mval; // [2]
int draw;
} ConsoleDrawContext;
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
index 55f69fbf444..40478e30f37 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/textview.h
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#ifndef __TEXTVIEW_H__
@@ -48,7 +42,8 @@ typedef struct TextViewContext {
int (*step)(struct TextViewContext *tvc);
int (*line_get)(struct TextViewContext *tvc, const char **, int *);
int (*line_color)(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]);
- void (*const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4]); /* constant theme colors */
+ /* constant theme colors */
+ void (*const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4]);
void *iter;
int iter_index;
int iter_char; /* char intex, used for multi-line report display */
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index a6b80a9a587..eb0d92e2e69 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index d5d50c86851..049342b0244 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_buttons.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -156,7 +149,8 @@ bool nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_p
id = ale->id;
}
else {
- /* ale->data is always the proper ID block we need, but ale->id may not be (i.e. for textures) */
+ /* ale->data is always the proper ID block we need,
+ * but ale->id may not be (i.e. for textures) */
id = (ID *)ale->data;
}
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 0dae0e20319..ae3888f6ae0 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_channels.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -68,7 +61,8 @@
#include "nla_intern.h" // own include
/* *********************************************** */
-/* Operators for NLA channels-list which need to be different from the standard Animation Editor ones */
+/* Operators for NLA channels-list which need to be different
+ * from the standard Animation Editor ones */
/* ******************** Mouse-Click Operator *********************** */
/* Depending on the channel that was clicked on, the mouse click will activate whichever
@@ -260,7 +254,8 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
nlt->flag |= NLATRACK_SELECTED;
}
- /* if NLA-Track is selected now, make NLA-Track the 'active' one in the visible list */
+ /* if NLA-Track is selected now,
+ * make NLA-Track the 'active' one in the visible list */
if (nlt->flag & NLATRACK_SELECTED)
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
@@ -557,7 +552,8 @@ static int nla_action_unlink_exec(bContext *C, wmOperator *op)
static int nla_action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt)
{
- /* NOTE: this is hardcoded to match the behaviour for the unlink button (in interface_templates.c) */
+ /* NOTE: this is hardcoded to match the behavior for the unlink button
+ * (in interface_templates.c) */
RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0);
return nla_action_unlink_exec(C, op);
}
@@ -614,7 +610,8 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
added = true;
}
else if ((lastAdt == NULL) || (adt != lastAdt)) {
- /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */
+ /* add one track to the top of the owning AnimData's stack,
+ * then don't add anymore to this stack */
BKE_nlatrack_add(adt, NULL);
lastAdt = adt;
ale->update = ANIM_UPDATE_DEPS;
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 2cba6cf2fb2..c73fd768075 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_draw.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -53,7 +46,6 @@
#include "ED_anim_api.h"
#include "ED_keyframes_draw.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -95,7 +87,8 @@ void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
}
}
- /* when an NLA track is tagged "solo", action doesn't contribute, so shouldn't be as prominent */
+ /* when an NLA track is tagged "solo", action doesn't contribute,
+ * so shouldn't be as prominent */
if (adt && (adt->flag & ADT_NLA_SOLO_TRACK))
color[3] *= 0.15f;
}
@@ -339,7 +332,8 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) {
immBeginAtMost(GPU_PRIM_LINE_STRIP, 4);
- /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */
+ /* start of strip - if no blendin, start straight at 1,
+ * otherwise from 0 to 1 over blendin frames */
if (IS_EQF(strip->blendin, 0.0f) == 0) {
immVertex2f(pos, strip->start, yminc);
immVertex2f(pos, strip->start + strip->blendin, ymaxc);
@@ -417,7 +411,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
GPU_blend(true);
switch (strip->extendmode) {
- /* since this does both sides, only do the 'before' side, and leave the rest to the next case */
+ /* since this does both sides,
+ * only do the 'before' side, and leave the rest to the next case */
case NLASTRIP_EXTEND_HOLD:
/* only need to draw here if there's no strip before since
* it only applies in such a situation
@@ -479,7 +474,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
immUnbindProgram();
- /* draw markings indicating locations of local markers (useful for lining up different actions) */
+ /* draw markings indicating locations of local markers
+ * (useful for lining up different actions) */
if ((snla->flag & SNLA_NOLOCALMARKERS) == 0)
nla_strip_draw_markers(strip, yminc, ymaxc);
@@ -532,11 +528,13 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
}
immEnd();
}
- /* or if meta-strip, draw lines delimiting extents of sub-strips (in same color as outline, if more than 1 exists) */
+ /* or if meta-strip, draw lines delimiting extents of sub-strips
+ * (in same color as outline, if more than 1 exists) */
else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) {
const float y = (ymaxc - yminc) * 0.5f + yminc;
- immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */
+ /* up to 2 lines per strip */
+ immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips));
/* only draw first-level of child-strips, but don't draw any lines on the endpoints */
for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) {
@@ -603,7 +601,7 @@ static void nla_draw_strip_text(
.xmin = xminc,
.ymin = yminc,
.xmax = xmaxc,
- .ymax = ymaxc
+ .ymax = ymaxc,
};
/* add this string to the cache of texts to draw */
@@ -798,7 +796,8 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
v2d->tot.ymin = (float)(-height);
- /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
+ /* need to do a view-sync here, so that the keys area doesn't jump around
+ * (it must copy this) */
UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
/* draw channels */
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 3cab4cfefca..739a180d1d8 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_edit.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -418,7 +411,8 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *min, floa
SpaceNla *snla = (SpaceNla *)ac->sl;
const float half_height = NLACHANNEL_HEIGHT_HALF(snla);
- short found = 0; /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ short found = 0;
float y;
/* get all items - we need to do it this way */
@@ -480,7 +474,8 @@ static int nlaedit_viewall(bContext *C, const bool only_sel)
/* set vertical range */
if (only_sel == false) {
- /* view all -> the summary channel is usually the shows everything, and resides right at the top... */
+ /* view all -> the summary channel is usually the shows everything,
+ * and resides right at the top... */
v2d->cur.ymax = 0.0f;
v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
}
@@ -580,7 +575,8 @@ void NLA_OT_view_frame(wmOperatorType *ot)
/* NLA Editing Operations (Constructive/Destructive) */
/* ******************** Add Action-Clip Operator ***************************** */
-/* Add a new Action-Clip strip to the active track (or the active block if no space in the track) */
+/* Add a new Action-Clip strip to the active track
+ * (or the active block if no space in the track) */
/* add the specified action as new strip */
@@ -614,7 +610,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else if (act->idroot == 0) {
- /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
+ /* hopefully in this case (i.e. library of userless actions),
+ * the user knows what they're doing... */
BKE_reportf(op->reports, RPT_WARNING,
"Action '%s' does not specify what data-blocks it can be used on "
"(try setting the 'ID Root Type' setting from the data-blocks editor "
@@ -639,7 +636,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* for every active track, try to add strip to free space in track or to the top of the stack if no space */
+ /* for every active track,
+ * try to add strip to free space in track or to the top of the stack if no space */
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
AnimData *adt = ale->adt;
@@ -1078,7 +1076,8 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* make a copy (assume that this is possible) */
nstrip = BKE_nlastrip_copy(ac.bmain, strip, linked, 0);
- /* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */
+ /* in case there's no space in the track above,
+ * or we haven't got a reference to it yet, try adding */
if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) {
/* need to add a new track above the one above the current one
* - if the current one is the last one, nlt->next will be NULL, which defaults to adding
@@ -1509,7 +1508,8 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
nlt->name);
}
else if (sa == NULL) {
- /* no warning as this is just a common case, and it may get annoying when doing multiple tracks */
+ /* no warning as this is just a common case,
+ * and it may get annoying when doing multiple tracks */
}
else if (sb == NULL) {
/* too few selected warning */
@@ -1520,7 +1520,8 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
else {
float nsa[2], nsb[2];
- /* remove these strips from the track, so that we can test if they can fit in the proposed places */
+ /* remove these strips from the track,
+ * so that we can test if they can fit in the proposed places */
BLI_remlink(&nlt->strips, sa);
BLI_remlink(&nlt->strips, sb);
@@ -1633,7 +1634,8 @@ static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track above has room for this strip */
if (BKE_nlatrack_has_space(nltn, strip->start, strip->end)) {
- /* remove from its current track, and add to the one above (it 'should' work, so no need to worry) */
+ /* remove from its current track, and add to the one above
+ * (it 'should' work, so no need to worry) */
BLI_remlink(&nlt->strips, strip);
BKE_nlatrack_add_strip(nltn, strip);
}
@@ -1707,7 +1709,8 @@ static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track below has room for this strip */
if (BKE_nlatrack_has_space(nltp, strip->start, strip->end)) {
- /* remove from its current track, and add to the one above (it 'should' work, so no need to worry) */
+ /* remove from its current track, and add to the one above
+ * (it 'should' work, so no need to worry) */
BLI_remlink(&nlt->strips, strip);
BKE_nlatrack_add_strip(nltp, strip);
}
@@ -1953,23 +1956,27 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
- /* strip must be selected, and must be action-clip only (transitions don't have scale) */
+ /* strip must be selected, and must be action-clip only
+ * (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
- /* if the referenced action is used by other strips, make this strip use its own copy */
+ /* if the referenced action is used by other strips,
+ * make this strip use its own copy */
if (strip->act == NULL)
continue;
if (strip->act->id.us > 1) {
/* make a copy of the Action to work on */
bAction *act = BKE_action_copy(bmain, strip->act);
- /* set this as the new referenced action, decrementing the users of the old one */
+ /* set this as the new referenced action,
+ * decrementing the users of the old one */
id_us_min(&strip->act->id);
strip->act = act;
copied = true;
}
- /* setup iterator, and iterate over all the keyframes in the action, applying this scaling */
+ /* setup iterator, and iterate over all the keyframes in the action,
+ * applying this scaling */
ked.data = strip;
ANIM_animchanneldata_keyframes_loop(&ked, ac.ads, strip->act, ALE_ACT, NULL, bezt_apply_nlamapping, calchandles_fcurve);
@@ -2040,7 +2047,8 @@ static int nlaedit_clear_scale_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
- /* strip must be selected, and must be action-clip only (transitions don't have scale) */
+ /* strip must be selected, and must be action-clip only
+ * (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
PointerRNA strip_ptr;
@@ -2087,7 +2095,7 @@ static const EnumPropertyItem prop_nlaedit_snap_types[] = {
{NLAEDIT_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", ""}, // XXX as single entry?
{NLAEDIT_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", ""}, // XXX as single entry?
{NLAEDIT_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int nlaedit_snap_exec(bContext *C, wmOperator *op)
@@ -2182,7 +2190,8 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
track = BKE_nlatrack_add(adt, nlt);
BKE_nlatrack_add_strip(track, strip);
- /* clear temp meta-strips on this new track, as we may not be able to get back to it */
+ /* clear temp meta-strips on this new track,
+ * as we may not be able to get back to it */
BKE_nlastrips_clear_metas(&track->strips, 0, 1);
}
}
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 59844f31447..bb52d9d7f76 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_intern.h
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
#ifndef __NLA_INTERN_H__
@@ -60,7 +53,7 @@ enum eNlaEdit_LeftRightSelect_Mode {
NLAEDIT_LRSEL_TEST = -1,
NLAEDIT_LRSEL_NONE,
NLAEDIT_LRSEL_LEFT,
- NLAEDIT_LRSEL_RIGHT
+ NLAEDIT_LRSEL_RIGHT,
};
/* --- */
@@ -78,7 +71,7 @@ enum eNlaEdit_Snap_Mode {
NLAEDIT_SNAP_CFRA = 1,
NLAEDIT_SNAP_NEAREST_FRAME,
NLAEDIT_SNAP_NEAREST_SECOND,
- NLAEDIT_SNAP_NEAREST_MARKER
+ NLAEDIT_SNAP_NEAREST_MARKER,
};
/* --- */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 0122306f709..6653c3995b5 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_ops.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
#include <string.h>
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index db7f5d707d2..0c9cd069265 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_select.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -370,7 +363,7 @@ static const EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
{NLAEDIT_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{NLAEDIT_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{NLAEDIT_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -536,7 +529,8 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
float x, y;
- /* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */
+ /* use View2D to determine the index of the channel
+ * (i.e a row in the list) where keyframe was */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
@@ -563,14 +557,16 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
if (ale->type == ANIMTYPE_NLATRACK) {
NlaTrack *nlt = (NlaTrack *)ale->data;
- /* loop over NLA-strips in this track, trying to find one which occurs in the necessary bounds */
+ /* loop over NLA-strips in this track,
+ * trying to find one which occurs in the necessary bounds */
for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax))
break;
}
}
- /* remove active channel from list of channels for separate treatment (since it's needed later on) */
+ /* remove active channel from list of channels for separate treatment
+ * (since it's needed later on) */
BLI_remlink(&anim_data, ale);
/* free list of channels, since it's not used anymore */
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 1a7793fadb9..84b8a64bc62 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/space_nla.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -42,8 +35,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
@@ -51,7 +42,6 @@
#include "ED_markers.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -311,7 +301,9 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (snla->flag & SNLA_SHOW_MARKER_LINES) marker_draw_flag |= DRAW_MARKERS_LINES;
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 06a00945452..0950e738e3e 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -47,8 +44,8 @@ set(SRC
node_buttons.c
node_draw.c
node_edit.c
- node_group.c
node_gizmo.c
+ node_group.c
node_ops.c
node_relationships.c
node_select.c
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 10ec293082f..60dcdaebb08 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Bob Holcomb, Thomas Dinges
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/drawnode.c
- * \ingroup spnode
- * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
+/** \file
+ * \ingroup spnode
+ * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
*/
#include "BLI_blenlib.h"
@@ -162,7 +154,8 @@ static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA
}
#define SAMPLE_FLT_ISNONE FLT_MAX
-static float _sample_col[4] = {SAMPLE_FLT_ISNONE}; /* bad bad, 2.5 will do better?... no it won't... */
+/* bad bad, 2.5 will do better?... no it won't... */
+static float _sample_col[4] = {SAMPLE_FLT_ISNONE};
void ED_node_sample_set(const float col[4])
{
if (col) {
@@ -270,7 +263,7 @@ static int node_resize_area_default(bNode *node, int x, int y)
return 0;
}
else {
- const float size = 10.0f;
+ const float size = NODE_RESIZE_MARGIN;
rctf totr = node->totr;
int dir = 0;
@@ -362,7 +355,8 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp
BLF_enable(fontid, BLF_ASPECT);
BLF_aspect(fontid, aspect, aspect, 1.0f);
- BLF_size(fontid, MIN2(24, font_size), U.dpi); /* clamp otherwise it can suck up a LOT of memory */
+ /* clamp otherwise it can suck up a LOT of memory */
+ BLF_size(fontid, MIN2(24, font_size), U.dpi);
/* title color */
UI_GetThemeColorBlendShade3ubv(TH_TEXT, color_id, 0.4f, 10, color);
@@ -652,7 +646,8 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr,
source = RNA_enum_get(imaptr, "source");
if (source == IMA_SRC_SEQUENCE) {
- /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
+ /* don't use iuser->framenr directly
+ * because it may not be updated if auto-refresh is off */
Scene *scene = CTX_data_scene(C);
ImageUser *iuser = iuserptr->data;
/* Image *ima = imaptr->data; */ /* UNUSED */
@@ -1795,17 +1790,18 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
/* using different collection properties if multilayer format is enabled */
if (multilayer) {
uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "layer_slots", ptr, "active_input_index",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"),
active_index, &active_input_ptr);
}
else {
uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "file_slots", ptr, "active_input_index",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"),
active_index, &active_input_ptr);
}
- /* XXX collection lookup does not return the ID part of the pointer, setting this manually here */
+ /* XXX collection lookup does not return the ID part of the pointer,
+ * setting this manually here */
active_input_ptr.id.data = ptr->id.data;
col = uiLayoutColumn(row, true);
@@ -2903,7 +2899,7 @@ static void node_texture_set_butfunc(bNodeType *ntype)
}
}
-/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
+/* ****** init draw callbacks for all tree types, only called in usiblender.c, once ************ */
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
@@ -2967,9 +2963,6 @@ void ED_node_init_butfuncs(void)
/* Fallback types for undefined tree, nodes, sockets
* Defined in blenkernel, but not registered in type hashes.
*/
- /*extern bNodeTreeType NodeTreeTypeUndefined;*/
- extern bNodeType NodeTypeUndefined;
- extern bNodeSocketType NodeSocketTypeUndefined;
/* default ui functions */
NodeTypeUndefined.draw_nodetype = node_draw_default;
@@ -3054,7 +3047,8 @@ static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA
copy_v4_v4(r_color, std_node_socket_colors[type]);
}
-/* draw function for file output node sockets, displays only sub-path and format, no value button */
+/* draw function for file output node sockets,
+ * displays only sub-path and format, no value button */
static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeTree *ntree = ptr->id.data;
@@ -3250,7 +3244,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
shuffle[3] = 1.0f;
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, shuffle);
immDrawPixelsTex(&state, x, y, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST,
display_buffer, snode->zoom, snode->zoom, NULL);
@@ -3532,7 +3526,8 @@ static void nodelink_batch_init(void)
g_batch_link.p3_id = GPU_vertformat_attr_add(&format_inst, "P3", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
g_batch_link.colid_id = GPU_vertformat_attr_add(&format_inst, "colid_doarrow", GPU_COMP_U8, 4, GPU_FETCH_INT);
g_batch_link.inst_vbo = GPU_vertbuf_create_with_format_ex(&format_inst, GPU_USAGE_STREAM);
- GPU_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE); /* Alloc max count but only draw the range we need. */
+ /* Alloc max count but only draw the range we need. */
+ GPU_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE);
GPU_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true);
@@ -3565,7 +3560,7 @@ static void nodelink_batch_draw(SpaceNode *snode)
UI_GetThemeColor4fv(TH_EDGE_SELECT, colors[nodelink_get_color_id(TH_EDGE_SELECT)]);
UI_GetThemeColor4fv(TH_REDALERT, colors[nodelink_get_color_id(TH_REDALERT)]);
- GPU_vertbuf_vertex_count_set(g_batch_link.inst_vbo, g_batch_link.count);
+ GPU_vertbuf_data_len_set(g_batch_link.inst_vbo, g_batch_link.count);
GPU_vertbuf_use(g_batch_link.inst_vbo); /* force update. */
GPU_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST);
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 8f6a0f5c4e2..fd433b48a66 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_add.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 0a913bcbea8..da0be280f2c 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_buttons.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
@@ -150,14 +143,14 @@ static void node_tree_interface_panel(const bContext *C, Panel *pa)
ot = WM_operatortype_find("NODE_OT_tree_socket_add", false);
uiItemL(col, IFACE_("Inputs:"), ICON_NONE);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "inputs", &ptr, "inputs", &ptr, "active_input",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
uiItemFullO_ptr(col, ot, "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_enum_set(&opptr, "in_out", SOCK_IN);
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Outputs:"), ICON_NONE);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "outputs", &ptr, "outputs", &ptr, "active_output",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
uiItemFullO_ptr(col, ot, "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_enum_set(&opptr, "in_out", SOCK_OUT);
@@ -188,6 +181,7 @@ void node_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel node sockets");
strcpy(pt->idname, "NODE_PT_sockets");
+ strcpy(pt->category, N_("Node"));
strcpy(pt->label, N_("Sockets"));
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = node_sockets_panel;
@@ -197,6 +191,7 @@ void node_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel tree interface");
strcpy(pt->idname, "NODE_PT_node_tree_interface");
+ strcpy(pt->category, N_("Node"));
strcpy(pt->label, N_("Interface"));
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = node_tree_interface_panel;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 8ec6d9332d3..0a33e5ebf12 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,19 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- * Contributor(s): Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_draw.c
- * \ingroup spnode
- * \brief higher level node drawing for the node editor.
+/** \file
+ * \ingroup spnode
+ * \brief higher level node drawing for the node editor.
*/
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_node_types.h"
#include "DNA_material_types.h"
#include "DNA_screen_types.h"
@@ -109,7 +102,7 @@ static bNodeTree *node_tree_from_ID(ID *id)
case ID_MA:
return ((Material *)id)->nodetree;
case ID_LA:
- return ((Lamp *)id)->nodetree;
+ return ((Light *)id)->nodetree;
case ID_WO:
return ((World *)id)->nodetree;
case ID_SCE:
@@ -195,7 +188,8 @@ static bool compare_nodes(const bNode *a, const bNode *b)
bool a_active = (a->flag & NODE_ACTIVE) != 0, b_active = (b->flag & NODE_ACTIVE) != 0;
/* if one is an ancestor of the other */
- /* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
+ /* XXX there might be a better sorting algorithm for stable topological sort,
+ * this is O(n^2) worst case */
for (parent = a->parent; parent; parent = parent->parent) {
/* if b is an ancestor, it is always behind a */
if (parent == b)
@@ -713,7 +707,8 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
node_draw_preview_background(BLI_rctf_size_x(prv) / 10.0f, &draw_rect);
GPU_blend(true);
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* premul graphics */
+ /* premul graphics */
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state, draw_rect.xmin, draw_rect.ymin, preview->xsize, preview->ysize, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, preview->rect,
@@ -898,11 +893,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* header uses color from backdrop, but we make it opaque */
if (color_id == TH_NODE) {
UI_GetThemeColorShade3fv(color_id, -20, color);
- color[3] = 1.0f;
}
else {
- UI_GetThemeColor4fv(color_id, color);
+ UI_GetThemeColor3fv(color_id, color);
}
+ color[3] = 1.0f;
}
GPU_line_width(1.0f);
@@ -967,8 +962,9 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
nodeLabel(ntree, node, showname, sizeof(showname));
+ /* XXX - don't print into self! */
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname);
uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X)), (int)(rct->ymax - NODE_DY),
@@ -976,8 +972,10 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
NULL, 0, 0, 0, 0, "");
/* body */
- if (!nodeIsRegistered(node))
- UI_GetThemeColor4fv(TH_REDALERT, color); /* use warning color to indicate undefined types */
+ if (!nodeIsRegistered(node)) {
+ /* use warning color to indicate undefined types */
+ UI_GetThemeColor4fv(TH_REDALERT, color);
+ }
else if (node->flag & NODE_CUSTOM_COLOR) {
rgba_float_args_set(color, node->color[0], node->color[1], node->color[2], 1.0f);
}
@@ -1092,8 +1090,9 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
if (node->miniwidth > 0.0f) {
nodeLabel(ntree, node, showname, sizeof(showname));
+ /* XXX - don't print into self! */
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname);
uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname,
round_fl_to_int(rct->xmin + NODE_MARGIN_X), round_fl_to_int(centy - NODE_DY * 0.5f),
@@ -1309,7 +1308,7 @@ static void draw_group_overlay(const bContext *C, ARegion *ar)
/* shade node groups to separate them visually */
GPU_blend(true);
- UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, -70, color);
+ UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color);
UI_draw_roundbox_corner_set(UI_CNR_NONE);
UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color);
GPU_blend(false);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index b8921ba6521..038ab62af78 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_edit.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_text_types.h"
@@ -84,7 +76,7 @@
enum {
COM_RECALC_COMPOSITE = 1,
- COM_RECALC_VIEWER = 2
+ COM_RECALC_VIEWER = 2,
};
typedef struct CompoJob {
@@ -421,7 +413,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
}
case ID_LA:
{
- Lamp *la = (Lamp *)id;
+ Light *la = (Light *)id;
la->nodetree = ntree;
output_type = SH_NODE_OUTPUT_LIGHT;
@@ -1121,15 +1113,10 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
lastnode = ntree->nodes.last;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- newnode = nodeCopyNode(ntree, node);
-
- if (newnode->id) {
- /* simple id user adjustment, node internal functions don't touch this
- * but operators and readfile.c do. */
- id_us_plus(newnode->id);
- /* to ensure redraws or rerenders happen */
- ED_node_tag_update_id(snode->id);
- }
+ newnode = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT);
+
+ /* to ensure redraws or rerenders happen */
+ ED_node_tag_update_id(snode->id);
}
/* make sure we don't copy new nodes again! */
@@ -1935,8 +1922,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- bNode *new_node;
- new_node = nodeCopyNode(NULL, node);
+ /* No ID refcounting, this node is virtual, detached from any actual Blender data currently. */
+ bNode *new_node = BKE_node_copy_ex(NULL, node, LIB_ID_CREATE_NO_USER_REFCOUNT);
BKE_node_clipboard_add_node(new_node);
}
}
@@ -1947,7 +1934,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
/* ensure valid pointers */
if (new_node->parent) {
- /* parent pointer must be redirected to new node or detached if parent is not copied */
+ /* parent pointer must be redirected to new node or detached if parent is
+ * not copied */
if (new_node->parent->flag & NODE_SELECT) {
new_node->parent = new_node->parent->new_node;
}
@@ -2055,10 +2043,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
/* copy nodes from clipboard */
for (node = clipboard_nodes_lb->first; node; node = node->next) {
- bNode *new_node = nodeCopyNode(ntree, node);
-
- /* needed since nodeCopyNode() doesn't increase ID's */
- id_us_plus(node->id);
+ bNode *new_node = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT);
/* pasted nodes are selected */
nodeSetSelected(new_node, true);
@@ -2629,7 +2614,7 @@ void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Cryptomatte Socket";
- ot->description = "Remove layer from a Crytpomatte node";
+ ot->description = "Remove layer from a Cryptomatte node";
ot->idname = "NODE_OT_cryptomatte_layer_remove";
/* callbacks */
diff --git a/source/blender/editors/space_node/node_gizmo.c b/source/blender/editors/space_node/node_gizmo.c
index 303962138a8..a511d6b9bd4 100644
--- a/source/blender/editors/space_node/node_gizmo.c
+++ b/source/blender/editors/space_node/node_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_gizmo.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <math.h>
@@ -49,7 +45,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Local Utilities
* \{ */
@@ -78,7 +73,6 @@ static void node_gizmo_calc_matrix_space_with_image_dims(
/* -------------------------------------------------------------------- */
-
/** \name Backdrop Gizmo
* \{ */
@@ -201,7 +195,6 @@ void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Crop Gizmo
* \{ */
@@ -293,7 +286,7 @@ static void gizmo_node_crop_prop_matrix_set(
const bool ny = rct.ymin > rct.ymax;
BLI_rctf_resize(&rct, fabsf(matrix[0][0]), fabsf(matrix[1][1]));
BLI_rctf_recenter(&rct, (matrix[3][0] / dims[0]) + 0.5f, (matrix[3][1] / dims[1]) + 0.5f);
- BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, &rct, &rct);
+ BLI_rctf_isect(&(rctf){ .xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1, }, &rct, &rct);
if (nx) {
SWAP(float, rct.xmin, rct.xmax);
}
@@ -404,7 +397,6 @@ void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Sun Beams
* \{ */
@@ -509,7 +501,6 @@ void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
/* -------------------------------------------------------------------- */
-
/** \name Corner Pin
* \{ */
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index c7c856d95c4..8c5bf60bc5d 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_group.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <stdlib.h>
@@ -45,7 +37,6 @@
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -258,7 +249,8 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
LinkData *ld, *ldn = NULL;
bAction *waction;
- /* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
+ /* firstly, wgroup needs to temporary dummy action
+ * that can be destroyed, as it shares copies */
waction = wgroup->adt->action = BKE_action_copy(bmain, wgroup->adt->action);
/* now perform the moving */
@@ -274,13 +266,13 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* free temp action too */
if (waction) {
- BKE_libblock_free(bmain, waction);
+ BKE_id_free(bmain, waction);
wgroup->adt->action = NULL;
}
}
/* free the group tree (takes care of user count) */
- BKE_libblock_free(bmain, wgroup);
+ BKE_id_free(bmain, wgroup);
/* restore external links to and from the gnode */
/* note: the nodes have been copied to intermediate wgroup first (so need to use new_node),
@@ -307,7 +299,9 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* XXX TODO bNodeSocket *sock = node_group_find_input_socket(gnode, identifier);
BLI_assert(sock);*/
- /* XXX TODO nodeSocketCopy(ntree, link->tosock->new_sock, link->tonode->new_node, ntree, sock, gnode);*/
+ /* XXX TODO
+ * nodeSocketCopy(ntree, link->tosock->new_sock, link->tonode->new_node,
+ * ntree, sock, gnode);*/
}
}
}
@@ -335,7 +329,8 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* XXX TODO bNodeSocket *sock = node_group_find_output_socket(gnode, identifier);
BLI_assert(sock);*/
- /* XXX TODO nodeSocketCopy(ntree, link->tosock, link->tonode, ntree, sock, gnode); */
+ /* XXX TODO
+ * nodeSocketCopy(ntree, link->tosock, link->tonode, ntree, sock, gnode); */
}
}
}
@@ -410,7 +405,7 @@ static int node_group_separate_selected(
for (node = ntree->nodes.first; node; node = node->next)
nodeSetSelected(node, false);
- /* clear new pointers, set in nodeCopyNode */
+ /* clear new pointers, set in BKE_node_copy_ex(). */
for (node = ngroup->nodes.first; node; node = node->next)
node->new_node = NULL;
@@ -428,7 +423,7 @@ static int node_group_separate_selected(
if (make_copy) {
/* make a copy */
- newnode = nodeCopyNode(ngroup, node);
+ newnode = BKE_node_copy_ex(ngroup, node, LIB_ID_COPY_DEFAULT);
}
else {
/* use the existing node */
@@ -522,7 +517,7 @@ typedef enum eNodeGroupSeparateType {
static const EnumPropertyItem node_group_separate_types[] = {
{NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
{NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int node_group_separate_exec(bContext *C, wmOperator *op)
@@ -547,13 +542,13 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
switch (type) {
case NODE_GS_COPY:
- if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 1)) {
+ if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, true)) {
BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
return OPERATOR_CANCELLED;
}
break;
case NODE_GS_MOVE:
- if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 0)) {
+ if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, false)) {
BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
return OPERATOR_CANCELLED;
}
@@ -963,7 +958,9 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
snode_notify(C, snode);
snode_dag_update(C, snode);
- DEG_relations_tag_update(bmain); /* We broke relations in node tree, need to rebuild them in the grahes. */
+
+ /* We broke relations in node tree, need to rebuild them in the grahes. */
+ DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 78d01123d0c..dbd6ef163e3 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_intern.h
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#ifndef __NODE_INTERN_H__
@@ -39,14 +32,14 @@
struct ARegion;
struct ARegionType;
+struct Main;
struct View2D;
struct bContext;
-struct Main;
-struct wmWindow;
struct bNode;
-struct bNodeSocket;
struct bNodeLink;
+struct bNodeSocket;
struct wmKeyConfig;
+struct wmWindow;
/* temp data to pass on to modal */
typedef struct bNodeLinkDrag {
@@ -64,7 +57,8 @@ typedef struct bNodeLinkDrag {
ARegion *node_has_buttons_region(ScrArea *sa);
ARegion *node_has_tools_region(ScrArea *sa);
-void snode_group_offset(struct SpaceNode *snode, float *x, float *y); /* transform between View2Ds in the tree path */
+/* transform between View2Ds in the tree path */
+void snode_group_offset(struct SpaceNode *snode, float *x, float *y);
/* node_draw.c */
int node_get_colorid(struct bNode *node);
@@ -245,6 +239,7 @@ extern const char *node_context_dir[];
#define NODE_HEIGHT(node) (node->height * UI_DPI_FAC)
#define NODE_MARGIN_X (0.75f * U.widget_unit)
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
+#define NODE_RESIZE_MARGIN (0.20f * U.widget_unit)
#define NODE_LINK_RESOL 12
// XXX button events (butspace)
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 1eead941c97..ed3190b06fe 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_ops.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 8f3d3d8a4b3..87e6a7b82a8 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_relationships.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
@@ -40,7 +32,6 @@
#include "BKE_animsys.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
@@ -1179,7 +1170,8 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op))
bNodeTree *ntree = snode->edittree;
bNode *node, *frame;
- /* XXX save selection: node_add_node call below sets the new frame as single active+selected node */
+ /* XXX save selection: node_add_node call below sets the new frame as single
+ * active+selected node */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT)
node->flag |= NODE_TEST;
@@ -1455,11 +1447,13 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
float dist = FLT_MAX;
int i;
- /* loop over link coords to find shortest dist to upper left node edge of a intersected line segment */
+ /* loop over link coords to find shortest dist to
+ * upper left node edge of a intersected line segment */
for (i = 0; i < NODE_LINK_RESOL; i++) {
/* 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 */
+ /* store the shortest distance to the upper left edge
+ * of all intersetctions found so far */
const float node_xy[] = {select->totr.xmin, select->totr.ymax};
/* to be precise coord_array should be clipped by select->totr,
@@ -1645,10 +1639,12 @@ static void node_link_insert_offset_ntree(
/* NODE_TEST will be used later, so disable for all nodes */
ntreeNodeFlagSet(ntree, NODE_TEST, false);
- /* insert->totr isn't updated yet, so totr_insert is used to get the correct worldspace coords */
+ /* insert->totr isn't updated yet,
+ * so totr_insert is used to get the correct worldspace coords */
node_to_updated_rect(insert, &totr_insert);
- /* frame attachment wasn't handled yet so we search the frame that the node will be attached to later */
+ /* frame attachment wasn't handled yet
+ * so we search the frame that the node will be attached to later */
insert->parent = node_find_frame_to_attach(ar, ntree, mouse_xy);
/* this makes sure nodes are also correctly offset when inserting a node on top of a frame
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 1c92c153b11..143ca1ffd32 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_select.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <stdlib.h>
@@ -363,7 +356,7 @@ void NODE_OT_select_grouped(wmOperatorType *ot)
{NODE_SELECT_GROUPED_COLOR, "COLOR", 0, "Color", ""},
{NODE_SELECT_GROUPED_PREFIX, "PREFIX", 0, "Prefix", ""},
{NODE_SELECT_GROUPED_SUFIX, "SUFFIX", 0, "Suffix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index e7a9db20103..206b32582e5 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_templates.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <stdlib.h>
@@ -39,7 +33,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_scene.h"
@@ -499,7 +492,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (num > 1) {
if (!cur_node_name || !STREQ(cur_node_name, items[i].node_name)) {
cur_node_name = items[i].node_name;
- /* XXX Do not use uiItemL here, it would add an empty icon as we are in a menu! */
+ /* XXX Do not use uiItemL here,
+ * it would add an empty icon as we are in a menu! */
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_(cur_node_name), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, "");
}
diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c
index b4e7e853330..e2effc84870 100644
--- a/source/blender/editors/space_node/node_toolbar.c
+++ b/source/blender/editors/space_node/node_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_toolbar.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 22df2586a7b..d0e6c45bb07 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_view.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "DNA_node_types.h"
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index cbd67bfb722..fc8d880080d 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,19 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/space_node.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "DNA_gpencil_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_world_types.h"
@@ -538,7 +531,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_LA) {
- Lamp *la = (Lamp *)snode->id;
+ Light *la = (Light *)snode->id;
if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
@@ -670,7 +663,8 @@ static void node_main_region_draw(const bContext *C, ARegion *ar)
static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
if (drag->type == WM_DRAG_PATH) {
- return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); /* rule might not work? */
+ /* rule might not work? */
+ return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
}
else {
return WM_drag_ID(drag, ID_IM) != NULL;
@@ -981,7 +975,7 @@ void ED_spacetype_node(void)
art->regionid = RGN_TYPE_WINDOW;
art->init = node_main_region_init;
art->draw = node_main_region_draw;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_GIZMO | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = true;
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 796e8732fca..207a5c194bd 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index d219457aeac..750c78d76b9 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_collections.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -48,6 +42,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -140,10 +135,15 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom
bool ED_outliner_collections_editor_poll(bContext *C)
{
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so != NULL) && ELEM(so->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
}
+static bool outliner_view_layer_collections_editor_poll(bContext *C)
+{
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
+ return (so != NULL) && (so->outlinevis == SO_VIEW_LAYER);
+}
/********************************* New Collection ****************************/
@@ -173,7 +173,7 @@ static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void
static int collection_new_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -235,7 +235,7 @@ void OUTLINER_OT_collection_new(wmOperatorType *ot)
struct CollectionEditData {
Scene *scene;
- SpaceOops *soops;
+ SpaceOutliner *soops;
GSet *collections_to_edit;
};
@@ -248,7 +248,7 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c
return TRAVERSE_SKIP_CHILDS;
}
- if (collection == BKE_collection_master(data->scene)) {
+ if (collection->flag & COLLECTION_IS_MASTER) {
/* skip - showing warning/error message might be misleading
* when deleting multiple collections, so just do nothing */
}
@@ -264,10 +264,13 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c
static int collection_delete_exec(bContext *C, wmOperator *op)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
bool hierarchy = RNA_boolean_get(op->ptr, "hierarchy");
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -293,6 +296,10 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
+
return OPERATOR_FINISHED;
}
@@ -342,7 +349,7 @@ static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeEle
static LayerCollection *outliner_active_layer_collection(bContext *C)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct CollectionObjectsSelectData data = {
.layer_collection = NULL,
@@ -426,7 +433,7 @@ static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *
static TreeElement *outliner_active_collection(bContext *C)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct CollectionDuplicateData data = {
.te = NULL,
@@ -439,9 +446,15 @@ static TreeElement *outliner_active_collection(bContext *C)
static int collection_duplicate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_active_collection(C);
- BLI_assert(te != NULL);
+ bool linked = strstr(op->idname, "linked") != NULL;
+
+ /* Can happen when calling from a key binding. */
+ if (te == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active collection");
+ return OPERATOR_CANCELLED;
+ }
Collection *collection = outliner_collection_from_tree_element(te);
Collection *parent = (te->parent) ? outliner_collection_from_tree_element(te->parent) : NULL;
@@ -455,7 +468,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
case SO_SCENES:
case SO_VIEW_LAYER:
case SO_LIBRARIES:
- BKE_collection_copy(bmain, parent, collection);
+ BKE_collection_duplicate(bmain, parent, collection, true, !linked);
break;
}
@@ -470,7 +483,22 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
/* identifiers */
ot->name = "Duplicate Collection";
ot->idname = "OUTLINER_OT_collection_duplicate";
- ot->description = "Duplicate selected collections";
+ ot->description = "Duplicate all objects and collections and make them single user";
+
+ /* api callbacks */
+ ot->exec = collection_duplicate_exec;
+ ot->poll = ED_outliner_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_duplicate_linked(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Duplicate Linked Collection";
+ ot->idname = "OUTLINER_OT_collection_duplicate_linked";
+ ot->description = "Duplicate all objects and collections with linked object data";
/* api callbacks */
ot->exec = collection_duplicate_exec;
@@ -487,8 +515,8 @@ static int collection_link_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Collection *active_collection = CTX_data_layer_collection(C)->collection;
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -535,8 +563,8 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -559,7 +587,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, NULL, false, 0);
- ob->dup_group = collection;
+ ob->instance_collection = collection;
ob->transflag |= OB_DUPLICOLLECTION;
id_lib_extern(&collection->id);
}
@@ -617,13 +645,13 @@ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, v
static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
{
/* Poll function so the right click menu show current state of selected collections. */
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
if (!(soops && soops->outlinevis == SO_VIEW_LAYER)) {
return false;
}
Scene *scene = CTX_data_scene(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
bool result = false;
@@ -694,8 +722,8 @@ static int collection_view_layer_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);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
bool clear = strstr(op->idname, "clear") != NULL;
int flag = strstr(op->idname, "holdout") ? LAYER_COLLECTION_HOLDOUT :
strstr(op->idname, "indirect_only") ? LAYER_COLLECTION_INDIRECT_ONLY :
@@ -709,16 +737,14 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
LayerCollection *lc = BLI_gsetIterator_getKey(&collections_to_edit_iter);
- if (!(lc->collection->flag & COLLECTION_IS_MASTER)) {
- if (clear) {
- lc->flag &= ~flag;
- }
- else {
- lc->flag |= flag;
- }
-
- layer_collection_flag_recursive_set(lc, flag);
+ if (clear) {
+ lc->flag &= ~flag;
}
+ else {
+ lc->flag |= flag;
+ }
+
+ layer_collection_flag_recursive_set(lc, flag);
}
BLI_gset_free(data.collections_to_edit, NULL);
@@ -821,6 +847,478 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/************************** Visibility Operators ******************************/
+
+static int collection_isolate_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool depsgraph_changed = false;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+
+ /* Hide all collections before the isolate function - needed in order to support multiple selected collections. */
+ if (!extend) {
+ LayerCollection *lc_master = view_layer->layer_collections.first;
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ lc_iter->flag |= LAYER_COLLECTION_RESTRICT_VIEW;
+ layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
+ }
+ }
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, layer_collection, true);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+static int collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "extend");
+ if (!RNA_property_is_set(op->ptr, prop) && (event->shift)) {
+ RNA_property_boolean_set(op->ptr, prop, true);
+ }
+ return collection_isolate_exec(C, op);
+}
+
+void OUTLINER_OT_collection_isolate(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Isolate Collection";
+ ot->idname = "OUTLINER_OT_collection_isolate";
+ ot->description = "Hide all but this collection and its parents";
+
+ /* api callbacks */
+ ot->exec = collection_isolate_exec;
+ ot->invoke = collection_isolate_invoke;
+ ot->poll = ED_outliner_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ PropertyRNA *prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend current visible collections");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+}
+
+static bool collection_show_poll(bContext *C)
+{
+ return collections_view_layer_poll(C, true, LAYER_COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_hide_poll(bContext *C)
+{
+ return collections_view_layer_poll(C, false, LAYER_COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_inside_poll(bContext *C)
+{
+ if (!ED_outliner_collections_editor_poll(C)) {
+ return false;
+ }
+ return outliner_active_layer_collection(C) != NULL;
+}
+
+static int collection_visibility_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool is_inside = strstr(op->idname, "inside") != NULL;
+ const bool show = strstr(op->idname, "show") != NULL;
+ bool depsgraph_changed = false;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, layer_collection, show, is_inside);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_collection_show(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Show Collection";
+ ot->idname = "OUTLINER_OT_collection_show";
+ ot->description = "Show the collection in this view layer";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_show_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_hide(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide Collection";
+ ot->idname = "OUTLINER_OT_collection_hide";
+ ot->description = "Hide the collection in this view layer";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_hide_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_show_inside(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Show Inside Collection";
+ ot->idname = "OUTLINER_OT_collection_show_inside";
+ ot->description = "Show all the objects and collections inside the collection";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_inside_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide Inside Collection";
+ ot->idname = "OUTLINER_OT_collection_hide_inside";
+ ot->description = "Hide all the objects and collections inside the collection";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_inside_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static bool collection_flag_poll(bContext *C, bool clear, int flag)
+{
+ if (!ED_outliner_collections_editor_poll(C)) {
+ return false;
+ }
+
+ TreeElement *te = outliner_active_collection(C);
+ if (te == NULL) {
+ return false;
+ }
+
+ Collection *collection = outliner_collection_from_tree_element(te);
+ if (collection == NULL) {
+ return false;
+ }
+
+ if (clear && (collection->flag & flag)) {
+ return true;
+ }
+ else if (!clear && !(collection->flag & flag)) {
+ return true;
+ }
+
+ return false;
+}
+
+static bool collection_enable_poll(bContext *C)
+{
+ return collection_flag_poll(C, true, COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_disable_poll(bContext *C)
+{
+ return collection_flag_poll(C, false, COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_enable_render_poll(bContext *C)
+{
+ return collection_flag_poll(C, true, COLLECTION_RESTRICT_RENDER);
+}
+
+static bool collection_disable_render_poll(bContext *C)
+{
+ return collection_flag_poll(C, false, COLLECTION_RESTRICT_RENDER);
+}
+
+static int collection_flag_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool is_render = strstr(op->idname, "render");
+ const bool clear = strstr(op->idname, "show") || strstr(op->idname, "enable");
+ int flag = is_render ? COLLECTION_RESTRICT_RENDER : COLLECTION_RESTRICT_VIEW;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+ const bool has_layer_collection = soops->outlinevis == SO_VIEW_LAYER;
+
+ if (has_layer_collection) {
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ Collection *collection = layer_collection->collection;
+ if (ID_IS_LINKED(collection)) {
+ continue;
+ }
+ if (clear) {
+ collection->flag &= ~flag;
+ }
+ else {
+ collection->flag |= flag;
+ }
+
+ /* Make sure (at least for this view layer) the collection is visible. */
+ if (clear && !is_render) {
+ layer_collection->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ }
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+ }
+ else {
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+
+ if (clear) {
+ collection->flag &= ~flag;
+ }
+ else {
+ collection->flag |= flag;
+ }
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+ }
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (!is_render) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_collection_enable(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Enable Collection";
+ ot->idname = "OUTLINER_OT_collection_enable";
+ ot->description = "Enable viewport drawing in the view layers";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_enable_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_disable(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Disable Collection";
+ ot->idname = "OUTLINER_OT_collection_disable";
+ ot->description = "Disable viewport drawing in the view layers";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_disable_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_enable_render(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Enable Collection in Render";
+ ot->idname = "OUTLINER_OT_collection_enable_render";
+ ot->description = "Render the collection";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_enable_render_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_disable_render(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Disable Collection in Render";
+ ot->idname = "OUTLINER_OT_collection_disable_render";
+ ot->description = "Do not render this collection";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_disable_render_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+struct OutlinerHideEditData {
+ Scene *scene;
+ ViewLayer *view_layer;
+ SpaceOutliner *soops;
+ GSet *collections_to_edit;
+ GSet *bases_to_edit;
+};
+
+static TreeTraversalAction outliner_hide_find_data_to_edit(TreeElement *te, void *customdata)
+{
+ struct OutlinerHideEditData *data = customdata;
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ if (tselem == NULL) {
+ return TRAVERSE_CONTINUE;
+ }
+
+ if (tselem->type == TSE_LAYER_COLLECTION) {
+ LayerCollection *lc = te->directdata;
+
+ if (lc->collection->flag & COLLECTION_IS_MASTER) {
+ /* Skip - showing warning/error message might be misleading
+ * when deleting multiple collections, so just do nothing. */
+ }
+ else {
+ /* Delete, duplicate and link don't edit children,
+ * those will come along with the parents. */
+ BLI_gset_add(data->collections_to_edit, lc);
+ }
+ }
+ else if (tselem->type == 0 && te->idcode == ID_OB) {
+ Object *ob = (Object *)tselem->id;
+ Base *base = BKE_view_layer_base_find(data->view_layer, ob);
+ BLI_gset_add(data->bases_to_edit, base);
+ }
+
+ return TRAVERSE_CONTINUE;
+}
+
+static int outliner_hide_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct OutlinerHideEditData data = {.scene = scene, .view_layer = view_layer, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new("outliner_hide_exec__collections_to_edit");
+ data.bases_to_edit = BLI_gset_ptr_new("outliner_hide_exec__bases_to_edit");
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, outliner_hide_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ BKE_layer_collection_set_visible(view_layer, layer_collection, false, false);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ GSetIterator bases_to_edit_iter;
+ GSET_ITER(bases_to_edit_iter, data.bases_to_edit) {
+ Base *base = BLI_gsetIterator_getKey(&bases_to_edit_iter);
+ base->flag |= BASE_HIDDEN;
+ }
+ BLI_gset_free(data.bases_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_hide(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide";
+ ot->idname = "OUTLINER_OT_hide";
+ ot->description = "Hide selected objects and collections";
+
+ /* api callbacks */
+ ot->exec = outliner_hide_exec;
+ ot->poll = outliner_view_layer_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ /* Unhide all the collections. */
+ LayerCollection *lc_master = view_layer->layer_collections.first;
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ lc_iter->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
+ }
+
+ /* Unhide all objects. */
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ base->flag &= ~BASE_HIDDEN;
+ }
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_unhide_all(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Unhide All";
+ ot->idname = "OUTLINER_OT_unhide_all";
+ ot->description = "Unhide all objects and collections";
+
+ /* api callbacks */
+ ot->exec = outliner_unhide_all_exec;
+ ot->poll = outliner_view_layer_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/**
* Populates the \param objects: ListBase with all the outliner selected objects
* We store it as (Object *)LinkData->data
@@ -828,7 +1326,7 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
*/
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct IDsSelectedData data = {{NULL}};
outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &data);
LISTBASE_FOREACH (LinkData *, link, &data.selected_array) {
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 6dd12571448..d9dc0d182c7 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_dragdrop.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -96,7 +88,7 @@ static TreeElement *outliner_dropzone_element(TreeElement *te, const float fmval
}
/* Find tree element to drop into. */
-static TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2], const bool children)
+static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops, const float fmval[2], const bool children)
{
TreeElement *te;
@@ -111,7 +103,7 @@ static TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float f
static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
float fmval[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
@@ -136,7 +128,7 @@ static TreeElement *outliner_drop_insert_find(
bContext *C, const wmEvent *event,
TreeElementInsertType *r_insert_type)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
@@ -232,7 +224,7 @@ static TreeElement *outliner_drop_insert_collection_find(
/* ******************** Parent Drop Operator *********************** */
-static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *potential_child)
+static bool parent_drop_allowed(SpaceOutliner *soops, TreeElement *te, Object *potential_child)
{
TreeStoreElem *tselem = TREESTORE(te);
if (te->idcode != ID_OB || tselem->type != 0) {
@@ -249,9 +241,8 @@ static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *poten
Scene *scene = (Scene *)outliner_search_back(soops, te, ID_SCE);
/* currently outliner organized in a way that if there's no parent scene
- * element for object it means that all displayed objects belong to
- * active scene and parenting them is allowed (sergey)
- */
+ * element for object it means that all displayed objects belong to
+ * active scene and parenting them is allowed (sergey) */
if (scene) {
for (ViewLayer *view_layer = scene->view_layers.first;
view_layer;
@@ -268,7 +259,7 @@ static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *poten
}
}
-static bool allow_parenting_without_modifier_key(SpaceOops *soops)
+static bool allow_parenting_without_modifier_key(SpaceOutliner *soops)
{
switch (soops->outlinevis) {
case SO_VIEW_LAYER:
@@ -282,7 +273,7 @@ static bool allow_parenting_without_modifier_key(SpaceOops *soops)
static bool parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(tooltip))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
bool changed = outliner_flag_set(&soops->tree, TSE_DRAG_ANY, false);
if (changed) ED_region_tag_redraw_no_rebuild(CTX_wm_region(C));
@@ -337,7 +328,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_drop_find(C, event);
TreeStoreElem *tselem = te ? TREESTORE(te) : NULL;
@@ -482,7 +473,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
static bool parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(tooltip))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
if (!allow_parenting_without_modifier_key(soops)) {
if (!event->shift) return false;
@@ -683,7 +674,7 @@ static Collection *collection_parent_from_ID(ID *id)
static bool collection_drop_init(bContext *C, wmDrag *drag, const wmEvent *event, CollectionDrop *data)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
/* Get collection to drop into. */
TreeElementInsertType insert_type;
@@ -739,7 +730,7 @@ static bool collection_drop_init(bContext *C, wmDrag *drag, const wmEvent *event
static bool collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **tooltip)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
bool changed = outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
@@ -812,7 +803,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
bool relative_after = false;
if (ELEM(data.insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
relative = data.to;
relative_after = (data.insert_type == TE_INSERT_AFTER);
@@ -883,7 +874,7 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
/* ********************* Outliner Drag Operator ******************** */
-static TreeElement *outliner_item_drag_element_find(SpaceOops *soops, ARegion *ar, const wmEvent *event)
+static TreeElement *outliner_item_drag_element_find(SpaceOutliner *soops, ARegion *ar, const wmEvent *event)
{
/* note: using EVT_TWEAK_ events to trigger dragging is fine,
* it sends coordinates from where dragging was started */
@@ -894,7 +885,7 @@ static TreeElement *outliner_item_drag_element_find(SpaceOops *soops, ARegion *a
static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_item_drag_element_find(soops, ar, event);
if (!te) {
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index ed8c2232ce0..1cef755180f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_draw.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "DNA_anim_types.h"
@@ -34,7 +26,7 @@
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -51,7 +43,6 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_idcode.h"
#include "BKE_layer.h"
@@ -91,7 +82,7 @@
/* ****************************************************** */
/* Tree Size Functions */
-static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
+static void outliner_height(SpaceOutliner *soops, ListBase *lb, int *h)
{
TreeElement *te = lb->first;
while (te) {
@@ -105,7 +96,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
}
#if 0 // XXX this is currently disabled until te->xend is set correctly
-static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
+static void outliner_width(SpaceOutliner *soops, ListBase *lb, int *w)
{
TreeElement *te = lb->first;
while (te) {
@@ -122,7 +113,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
}
#endif
-static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
+static void outliner_rna_width(SpaceOutliner *soops, ListBase *lb, int *w, int startx)
{
TreeElement *te = lb->first;
while (te) {
@@ -255,8 +246,11 @@ static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin),
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
-static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2))
+static void restrictbutton_gp_layer_flag_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
+ ID *id = (ID *)poin;
+
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
@@ -274,48 +268,131 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
}
}
+static int base_pushed_state_cb(bContext *UNUSED(C), void *poin)
+{
+ Base *base = poin;
+ Object *ob = base->object;
+
+ const bool is_visible = ((base->flag & BASE_HIDDEN) == 0) &&
+ ((ob->restrictflag & OB_RESTRICT_VIEW) == 0);
+ return !is_visible;
+}
+
static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
{
+ wmWindow *win = CTX_wm_window(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = poin;
Base *base = poin2;
- bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
+ Object *ob = base->object;
+ bool do_disable = (CTX_wm_window(C)->eventstate->alt != 0);
+ bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
+ bool extend = (win->eventstate->shift != 0);
+ bool depsgraph_changed = false;
+ const bool is_linked = ID_IS_LINKED(ob);
+
+ if (do_disable) {
+ if (!is_linked) {
+ ob->restrictflag |= OB_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+ }
+ else if (do_isolate) {
+ depsgraph_changed = (!is_linked) && ((ob->restrictflag & OB_RESTRICT_VIEW) != 0);
- /* Undo button toggle, let function do it. */
- base->flag ^= BASE_HIDDEN;
+ if (!extend) {
+ /* Make only one base visible. */
+ for (Base *other = view_layer->object_bases.first; other; other = other->next) {
+ other->flag |= BASE_HIDDEN;
+ }
- BKE_base_set_visible(scene, view_layer, base, extend);
+ base->flag &= ~BASE_HIDDEN;
+ }
+ else {
+ /* Toggle visibility of one base. */
+ base->flag ^= BASE_HIDDEN;
+ }
- if (!extend && (base->flag & BASE_VISIBLE)) {
- /* Auto select solo-ed object. */
- ED_object_base_select(base, BA_SELECT);
- view_layer->basact = base;
+ if (!is_linked) {
+ ob->restrictflag &= ~OB_RESTRICT_VIEW;
+ }
+ }
+ else if (ob->restrictflag & OB_RESTRICT_VIEW) {
+ if (!is_linked) {
+ ob->restrictflag &= ~OB_RESTRICT_VIEW;
+ base->flag &= ~BASE_HIDDEN;
+ }
+ depsgraph_changed = true;
+ }
+ else {
+ base->flag ^= BASE_HIDDEN;
}
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (depsgraph_changed) {
+ BKE_main_collection_sync_remap(bmain);
+ DEG_id_tag_update(&ob->id, LIB_TAG_COPIED_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
+ }
+
+ if (!do_disable) {
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ }
+}
+
+static int layer_collection_pushed_state_cb(bContext *UNUSED(C), void *poin)
+{
+ LayerCollection *lc = poin;
+ Collection *collection = lc->collection;
+
+ const bool is_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) == 0) &&
+ ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0);
+ return !is_visible;
}
static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2)
{
+ wmWindow *win = CTX_wm_window(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = poin;
LayerCollection *lc = poin2;
- bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
-
- /* Undo button toggle, let function do it. */
- lc->runtime_flag ^= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
-
- BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
+ Collection *collection = lc->collection;
+ bool do_disable = (win->eventstate->alt != 0);
+ bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
+ bool extend = (win->eventstate->shift != 0);
+ bool depsgraph_changed = false;
+
+ if (do_disable) {
+ if (!ID_IS_LINKED(collection)) {
+ collection->flag |= COLLECTION_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+ }
+ else if (do_isolate) {
+ depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, lc, extend);
+ }
+ else {
+ bool make_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0) ||
+ ((collection->flag & COLLECTION_RESTRICT_VIEW) != 0);
+ depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, lc, make_visible, extend);
+ }
+ BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
Object *obedit = CTX_data_edit_object(C);
BLI_mempool *ts = soops->treestore;
TreeStoreElem *tselem = tsep;
@@ -341,6 +418,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (ob->type == OB_MBALL) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break;
}
default:
@@ -481,7 +559,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
}
static void outliner_draw_restrictbuts(
- uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOops *soops, ListBase *lb)
+ uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOutliner *soops, ListBase *lb)
{
/* Get RNA properties (once for speed). */
static struct RestrictProperties {
@@ -524,27 +602,35 @@ static void outliner_draw_restrictbuts(
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
else if (tselem->type == 0 && te->idcode == ID_OB) {
+ PointerRNA ptr;
Object *ob = (Object *)tselem->id;
+ RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
Base *base = BKE_view_layer_base_find(view_layer, ob);
if (base) {
- bt = uiDefIconButBitS(
- block, UI_BTYPE_ICON_TOGGLE, BASE_HIDDEN, 0, ICON_HIDE_OFF,
- (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
- TIP_("Hide object in viewport (Ctrl to isolate)"));
+ int icon = ICON_RESTRICT_VIEW_ON;
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0) {
+ icon = (base->flag & BASE_HIDDEN) != 0 ?
+ ICON_HIDE_ON :
+ ICON_HIDE_OFF;
+ }
+ bt = uiDefIconBut(
+ block, UI_BTYPE_ICON_TOGGLE, 0, icon,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Hide object in viewport\n"
+ "* Alt to disable for all viewports\n"
+ "* Ctrl to isolate visibility"));
UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base);
+ UI_but_func_pushed_state_set(bt, base_pushed_state_cb, base);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+ else {
+ bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
- UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
-
- PointerRNA ptr;
- RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
-
- bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
- &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y,
@@ -620,6 +706,7 @@ static void outliner_draw_restrictbuts(
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
else if (tselem->type == TSE_GP_LAYER) {
+ ID *id = tselem->id;
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
bt = uiDefIconButBitS(
@@ -627,7 +714,7 @@ static void outliner_draw_restrictbuts(
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
@@ -636,10 +723,8 @@ static void outliner_draw_restrictbuts(
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow editing of strokes and keyframes in this layer"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
- /* TODO: visibility in renders */
}
else if (outliner_is_collection_tree_element(te)) {
LayerCollection *lc = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata : NULL;
@@ -648,25 +733,35 @@ static void outliner_draw_restrictbuts(
if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
!(collection->flag & COLLECTION_IS_MASTER))
{
- if (lc && (lc->runtime_flag & LAYER_COLLECTION_HAS_ENABLED_OBJECTS)) {
- bt = uiDefIconButBitS(
- block, UI_BTYPE_ICON_TOGGLE_N, LAYER_COLLECTION_HAS_VISIBLE_OBJECTS, 0, ICON_HIDE_OFF,
- (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &lc->runtime_flag, 0, 0, 0, 0,
- TIP_("Hide collection in viewport (Ctrl to isolate)"));
- UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
- UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
- }
-
PointerRNA collection_ptr;
RNA_id_pointer_create(&collection->id, &collection_ptr);
- bt = uiDefIconButR_prop(
- block, UI_BTYPE_ICON_TOGGLE, 0, 0,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ if (lc != NULL) {
+ int icon = ICON_RESTRICT_VIEW_ON;
+ if ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0) {
+ icon = (lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0 ?
+ ICON_HIDE_ON :
+ ICON_HIDE_OFF;
+ }
+ bt = uiDefIconBut(
+ block, UI_BTYPE_TOGGLE, 0, icon,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Hide collection in viewport\n"
+ "* Alt to disable for all viewports\n"
+ "* Ctrl to isolate visibility\n"
+ "* Shift to hide inside objects and collections"));
+ UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
+ UI_but_func_pushed_state_set(bt, layer_collection_pushed_state_cb, lc);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+ else {
+ bt = uiDefIconButR_prop(
+ block, UI_BTYPE_ICON_TOGGLE, 0, 0,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
+ UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
bt = uiDefIconButR_prop(
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
@@ -689,7 +784,7 @@ static void outliner_draw_restrictbuts(
}
}
-static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops, ListBase *lb)
+static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, ListBase *lb)
{
for (TreeElement *te = lb->first; te; te = te->next) {
@@ -774,7 +869,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
immUnbindProgram();
}
-static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
+static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, int sizex, ListBase *lb)
{
PointerRNA *ptr;
PropertyRNA *prop;
@@ -891,7 +986,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_CONSTRAINT;
break;
case TSE_MODIFIER_BASE:
- data.icon = ICON_MODIFIER;
+ data.icon = ICON_MODIFIER_DATA;
break;
case TSE_LINKED_OB:
data.icon = ICON_OBJECT_DATA;
@@ -1233,7 +1328,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
case OB_LIGHTPROBE:
data.icon = ICON_OUTLINER_OB_LIGHTPROBE; break;
case OB_EMPTY:
- if (ob->dup_group) {
+ if (ob->instance_collection) {
data.icon = ICON_OUTLINER_OB_GROUP_INSTANCE;
}
else if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
@@ -1265,7 +1360,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_OUTLINER_DATA_LATTICE; break;
case ID_LA:
{
- Lamp *la = (Lamp *)tselem->id;
+ Light *la = (Light *)tselem->id;
switch (la->type) {
case LA_LOCAL:
data.icon = ICON_LIGHT_POINT; break;
@@ -1340,6 +1435,10 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
case ID_SCR:
case ID_WS:
data.icon = ICON_WORKSPACE; break;
+ case ID_MSK:
+ data.icon = ICON_MOD_MASK; break;
+ case ID_MC:
+ data.icon = ICON_SEQUENCE; break;
default:
break;
}
@@ -1491,7 +1590,7 @@ typedef struct MergedIconRow {
} MergedIconRow;
static void outliner_draw_iconrow(
- bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac, MergedIconRow *merged)
{
eOLDrawState active;
@@ -1588,7 +1687,7 @@ static void outliner_set_coord_tree_element(TreeElement *te, int startx, int sta
static void outliner_draw_tree_element(
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer,
- ARegion *ar, SpaceOops *soops, TreeElement *te, bool draw_grayed_out,
+ ARegion *ar, SpaceOutliner *soops, TreeElement *te, bool draw_grayed_out,
int startx, int *starty, TreeElement **te_edit)
{
TreeStoreElem *tselem;
@@ -1628,7 +1727,7 @@ static void outliner_draw_tree_element(
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
if (ob == obact || is_selected) {
- char col[4] = {0, 0, 0, 0};
+ uchar col[4] = {0, 0, 0, 0};
/* outliner active ob: always white text, circle color now similar to view3d */
@@ -1824,7 +1923,7 @@ static void outliner_draw_tree_element(
}
static void outliner_draw_hierarchy_lines_recursive(
- unsigned pos, SpaceOops *soops, ListBase *lb, int startx,
+ unsigned pos, SpaceOutliner *soops, ListBase *lb, int startx,
const unsigned char col[4], bool draw_grayed_out,
int *starty)
{
@@ -1883,7 +1982,7 @@ static void outliner_draw_hierarchy_lines_recursive(
}
}
-static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty)
+static void outliner_draw_hierarchy_lines(SpaceOutliner *soops, ListBase *lb, int startx, int *starty)
{
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -1900,7 +1999,7 @@ static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int st
immUnbindProgram();
}
-static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *lb, int *starty)
+static void outliner_draw_struct_marks(ARegion *ar, SpaceOutliner *soops, ListBase *lb, int *starty)
{
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -1938,7 +2037,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
}
static void outliner_draw_highlights_recursive(
- unsigned pos, const ARegion *ar, const SpaceOops *soops, const ListBase *lb,
+ unsigned pos, const ARegion *ar, const SpaceOutliner *soops, const ListBase *lb,
const float col_selection[4], const float col_highlight[4], const float col_searchmatch[4],
int start_x, int *io_start_y)
{
@@ -2004,7 +2103,7 @@ static void outliner_draw_highlights_recursive(
}
}
-static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, int *starty)
+static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int startx, int *starty)
{
const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
float col_selection[4], col_searchmatch[4];
@@ -2027,7 +2126,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
static void outliner_draw_tree(
bContext *C, uiBlock *block, Scene *scene, ViewLayer *view_layer,
- ARegion *ar, SpaceOops *soops, const bool has_restrict_icons,
+ ARegion *ar, SpaceOutliner *soops, const bool has_restrict_icons,
TreeElement **te_edit)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
@@ -2121,10 +2220,7 @@ static void outliner_draw_restrictcols(ARegion *ar)
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(GPU_PRIM_LINES, 8);
-
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymax);
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymin);
+ immBegin(GPU_PRIM_LINES, 6);
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
@@ -2149,7 +2245,7 @@ void draw_outliner(const bContext *C)
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBlock *block;
int sizey = 0, sizex = 0, sizex_rna = 0;
TreeElement *te_edit = NULL;
@@ -2160,6 +2256,9 @@ void draw_outliner(const bContext *C)
/* get extents of data */
outliner_height(soops, &soops->tree, &sizey);
+ /* extend size to allow for horizontal scrollbar */
+ sizey += V2D_SCROLL_HEIGHT;
+
if (soops->outlinevis == SO_DATA_API) {
/* RNA has two columns:
* - column 1 is (max_width + OL_RNA_COL_SPACEX) or
@@ -2178,7 +2277,8 @@ void draw_outliner(const bContext *C)
has_restrict_icons = false;
}
else {
- /* width must take into account restriction columns (if visible) so that entries will still be visible */
+ /* width must take into account restriction columns (if visible)
+ * so that entries will still be visible */
//outliner_width(soops, &soops->tree, &sizex);
// XXX should use outliner_width instead when te->xend will be set correctly...
outliner_rna_width(soops, &soops->tree, &sizex, 0);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index b5059cf6bb3..3742a1ad912 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_edit.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -41,11 +33,9 @@
#include "DNA_material_types.h"
#include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
-#include "BLI_mempool.h"
-#include "BLI_stack.h"
-#include "BLI_string.h"
#include "BLT_translation.h"
@@ -103,7 +93,7 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
}
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const float my = UI_view2d_region_to_view_y(&ar->v2d, event->mval[1]);
TreeElement *hovered_te = outliner_find_item_at_y(soops, &soops->tree, my);
@@ -137,7 +127,7 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
/* Toggle Open/Closed ------------------------------------------- */
-static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, const bool all, const float mval[2])
+static int do_outliner_item_openclose(bContext *C, SpaceOutliner *soops, TreeElement *te, const bool all, const float mval[2])
{
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
@@ -168,7 +158,7 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement
static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
const bool all = RNA_boolean_get(op->ptr, "all");
@@ -324,7 +314,7 @@ static int do_outliner_item_rename(ReportList *reports, ARegion *ar, TreeElement
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
bool changed = false;
@@ -379,7 +369,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
}
- BKE_libblock_delete(bmain, id);
+ BKE_id_delete(bmain, id);
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
@@ -421,7 +411,7 @@ static int outliner_id_delete_invoke_do(bContext *C, ReportList *reports, TreeEl
static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -455,7 +445,7 @@ void OUTLINER_OT_id_delete(wmOperatorType *ot)
static int outliner_id_remap_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const short id_type = (short)RNA_enum_get(op->ptr, "id_type");
ID *old_id = BLI_findlink(which_libbase(CTX_data_main(C), id_type), RNA_enum_get(op->ptr, "old_id"));
@@ -486,7 +476,8 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
/* recreate dependency graph to include new objects */
DEG_relations_tag_update(bmain);
- /* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */
+ /* Free gpu materials, some materials depend on existing objects,
+ * such as lights so freeing correctly refreshes. */
GPU_materials_free(bmain);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -520,7 +511,7 @@ static bool outliner_id_remap_find_tree_element(bContext *C, wmOperator *op, Lis
static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
float fmval[2];
@@ -675,7 +666,7 @@ static int outliner_lib_relocate_invoke_do(
static int outliner_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -705,7 +696,8 @@ void OUTLINER_OT_lib_relocate(wmOperatorType *ot)
}
/* XXX This does not work with several items
- * (it is only called once in the end, due to the 'deferred' filebrowser invocation through event system...). */
+ * (it is only called once in the end, due to the 'deferred'
+ * filebrowser invocation through event system...). */
void lib_relocate_cb(
bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te,
TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
@@ -719,7 +711,7 @@ void lib_relocate_cb(
static int outliner_lib_reload_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -870,7 +862,7 @@ int common_restrict_check(bContext *C, Object *ob)
static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
if (outliner_flag_is_any_test(&soops->tree, TSE_CLOSED, 1))
@@ -901,7 +893,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
static int outliner_select_all_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int action = RNA_enum_get(op->ptr, "action");
@@ -950,7 +942,7 @@ void OUTLINER_OT_select_all(wmOperatorType *ot)
/* Show Active --------------------------------------------------- */
-static void outliner_set_coordinates_element_recursive(SpaceOops *soops, TreeElement *te, int startx, int *starty)
+static void outliner_set_coordinates_element_recursive(SpaceOutliner *soops, TreeElement *te, int startx, int *starty)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -968,7 +960,7 @@ static void outliner_set_coordinates_element_recursive(SpaceOops *soops, TreeEle
}
/* to retrieve coordinates with redrawing the entire tree */
-void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
+void outliner_set_coordinates(ARegion *ar, SpaceOutliner *soops)
{
TreeElement *te;
int starty = (int)(ar->v2d.tot.ymax) - UI_UNIT_Y;
@@ -996,7 +988,7 @@ static int outliner_open_back(TreeElement *te)
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
@@ -1111,7 +1103,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
#if 0
/* find next element that has this name */
-static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *name, int flags,
+static TreeElement *outliner_find_name(SpaceOutliner *soops, ListBase *lb, char *name, int flags,
TreeElement *prev, int *prevFound)
{
TreeElement *te, *tes;
@@ -1140,7 +1132,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
return NULL;
}
-static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
+static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOutliner *soops, int again, int flags)
{
ReportList *reports = NULL; // CTX_wm_reports(C);
TreeElement *te = NULL;
@@ -1239,7 +1231,7 @@ static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int
static int outliner_one_level_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
const bool add = RNA_boolean_get(op->ptr, "open");
int level;
@@ -1295,7 +1287,7 @@ static int subtree_has_objects(ListBase *lb)
}
/* recursive helper function for Show Hierarchy operator */
-static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase *lb)
+static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, ListBase *lb)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1327,7 +1319,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
/* show entire object level hierarchy */
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -1362,7 +1354,7 @@ static bool ed_operator_outliner_datablocks_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so->outlinevis == SO_DATA_API);
}
return 0;
@@ -1520,7 +1512,7 @@ enum {
/* Utilities ---------------------------------- */
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportList *reports, short mode)
+static void do_outliner_drivers_editop(SpaceOutliner *soops, ListBase *tree, ReportList *reports, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1598,7 +1590,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (soutliner == NULL)
@@ -1633,7 +1625,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (soutliner == NULL)
@@ -1701,7 +1693,7 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
}
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBase *tree, short mode)
+static void do_outliner_keyingset_editop(SpaceOutliner *soops, KeyingSet *ks, ListBase *tree, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1769,7 +1761,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
@@ -1810,7 +1802,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
@@ -1850,7 +1842,7 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so->outlinevis == SO_ID_ORPHANS);
}
return 0;
@@ -1858,24 +1850,98 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C)
/* Purge Orphans Operator --------------------------------------- */
+static void outliner_orphans_purge_tag(ID *id, int *num_tagged)
+{
+ if (id->us == 0) {
+ id->tag |= LIB_TAG_DOIT;
+ num_tagged[INDEX_ID_NULL]++;
+ num_tagged[BKE_idcode_to_index(GS(id->name))]++;
+ }
+ else {
+ id->tag &= ~LIB_TAG_DOIT;
+ }
+}
+
static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt))
{
- /* present a prompt to informing users that this change is irreversible */
- return WM_operator_confirm_message(C, op,
- "Purging unused data-blocks cannot be undone and saves to current .blend file. "
- "Click here to proceed...");
+ Main *bmain = CTX_data_main(C);
+ int num_tagged[INDEX_ID_MAX] = {0};
+
+ /* Tag all IDs having zero users. */
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ outliner_orphans_purge_tag(id, num_tagged);
+ }
+ FOREACH_MAIN_ID_END;
+ RNA_int_set(op->ptr, "num_deleted", num_tagged[INDEX_ID_NULL]);
+
+ if (num_tagged[INDEX_ID_NULL] == 0) {
+ BKE_report(op->reports, RPT_INFO, "No orphanned data-blocks to purge");
+ return OPERATOR_CANCELLED;
+ }
+
+ DynStr *dyn_str = BLI_dynstr_new();
+ BLI_dynstr_append(dyn_str, "Purging unused data-blocks (");
+ bool is_first = true;
+ for (int i = 0; i < INDEX_ID_MAX - 2; i++) {
+ if (num_tagged[i] != 0) {
+ if (!is_first) {
+ BLI_dynstr_append(dyn_str, ", ");
+ }
+ else {
+ is_first = false;
+ }
+ BLI_dynstr_appendf(
+ dyn_str, "%d %s",
+ num_tagged[i], TIP_(BKE_idcode_to_name_plural(BKE_idcode_from_index(i))));
+ }
+ }
+ BLI_dynstr_append(dyn_str, TIP_("). Click here to proceed..."));
+
+ char *message = BLI_dynstr_get_cstring(dyn_str);
+ int ret = WM_operator_confirm_message(C, op, message);
+
+ MEM_freeN(message);
+ BLI_dynstr_free(dyn_str);
+ return ret;
}
-static int outliner_orphans_purge_exec(bContext *C, wmOperator *UNUSED(op))
+static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
{
- /* Firstly, ensure that the file has been saved,
- * so that the latest changes since the last save
- * are retained...
- */
- WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, NULL);
+ Main *bmain = CTX_data_main(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ int num_tagged[INDEX_ID_MAX] = {0};
+
+ if ((num_tagged[INDEX_ID_NULL] = RNA_int_get(op->ptr, "num_deleted")) == 0) {
+ /* Tag all IDs having zero users. */
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ outliner_orphans_purge_tag(id, num_tagged);
+ }
+ FOREACH_MAIN_ID_END;
- /* Now, reload the file to get rid of the orphans... */
- WM_operator_name_call(C, "WM_OT_revert_mainfile", WM_OP_EXEC_DEFAULT, NULL);
+ if (num_tagged[INDEX_ID_NULL] == 0) {
+ BKE_report(op->reports, RPT_INFO, "No orphanned data-blocks to purge");
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ BKE_id_multi_tagged_delete(bmain);
+
+ BKE_reportf(op->reports, RPT_INFO, "Deleted %d data-blocks", num_tagged[INDEX_ID_NULL]);
+
+ /* XXX: tree management normally happens from draw_outliner(), but when
+ * you're clicking to fast on Delete object from context menu in
+ * outliner several mouse events can be handled in one cycle without
+ * handling notifiers/redraw which leads to deleting the same object twice.
+ * cleanup tree here to prevent such cases. */
+ outliner_cleanup_tree(soops);
+
+ DEG_relations_tag_update(bmain);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -1884,8 +1950,7 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot)
/* identifiers */
ot->idname = "OUTLINER_OT_orphans_purge";
ot->name = "Purge All";
- ot->description = "Clear all orphaned data-blocks without any users from the file "
- "(cannot be undone, saves to current .blend file)";
+ ot->description = "Clear all orphaned data-blocks without any users from the file";
/* callbacks */
ot->invoke = outliner_orphans_purge_invoke;
@@ -1894,4 +1959,8 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ PropertyRNA *prop = RNA_def_int(ot->srna, "num_deleted", 0, 0, INT_MAX, "", "", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 41a0dce7a38..0e215c595c1 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_intern.h
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
@@ -37,20 +30,20 @@
/* internal exports only */
struct ARegion;
+struct EditBone;
+struct ID;
struct ListBase;
-struct wmOperatorType;
-struct TreeElement;
-struct TreeStoreElem;
struct Main;
-struct bContext;
+struct Object;
struct Scene;
+struct TreeElement;
+struct TreeStoreElem;
struct ViewLayer;
-struct ID;
-struct Object;
+struct bContext;
struct bPoseChannel;
-struct EditBone;
struct wmEvent;
struct wmKeyConfig;
+struct wmOperatorType;
typedef enum TreeElementInsertType {
TE_INSERT_BEFORE,
@@ -92,7 +85,8 @@ typedef struct TreeElementIcon {
#define TREESTORE_ID_TYPE(_id) \
(ELEM(GS((_id)->name), ID_SCE, ID_LI, ID_OB, ID_ME, ID_CU, ID_MB, ID_NT, ID_MA, ID_TE, ID_IM, ID_LT, ID_LA, ID_CA) || \
ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS, ID_LP) || \
- ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_MC, ID_WS)) /* Only in 'blendfile' mode ... :/ */
+ /* Only in 'blendfile' mode ... :/ */ \
+ ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_MC, ID_WS, ID_MSK))
/* TreeElement->flag */
enum {
@@ -129,12 +123,11 @@ typedef enum {
/* size constants */
#define OL_Y_OFFSET 2
-#define OL_TOG_HIDEX (UI_UNIT_X * 4.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X + V2D_SCROLL_WIDTH)
-#define OL_TOGW OL_TOG_HIDEX
+#define OL_TOGW OL_TOG_RESTRICT_SELECTX
#define OL_RNA_COLX (UI_UNIT_X * 15)
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
@@ -168,13 +161,13 @@ typedef enum {
/* outliner_tree.c ----------------------------------------------- */
void outliner_free_tree(ListBase *tree);
-void outliner_cleanup_tree(struct SpaceOops *soops);
+void outliner_cleanup_tree(struct SpaceOutliner *soops);
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree);
void outliner_build_tree(
struct Main *mainvar,
struct Scene *scene, struct ViewLayer *view_layer,
- struct SpaceOops *soops, struct ARegion *ar);
+ struct SpaceOutliner *soops, struct ARegion *ar);
typedef struct IDsSelectedData {
struct ListBase selected_array;
@@ -186,15 +179,14 @@ TreeTraversalAction outliner_find_selected_objects(struct TreeElement *te, void
/* outliner_draw.c ---------------------------------------------- */
void draw_outliner(const struct bContext *C);
-void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te);
/* outliner_select.c -------------------------------------------- */
eOLDrawState tree_element_type_active(
- struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOops *soops,
+ struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive);
-eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, SpaceOops *soops,
+eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set, const bool handle_all_types);
void outliner_item_do_activate_from_tree_element(
@@ -205,7 +197,7 @@ int outliner_item_do_activate_from_cursor(
bool extend, bool recursive);
void outliner_item_select(
- struct SpaceOops *soops, const struct TreeElement *te,
+ struct SpaceOutliner *soops, const struct TreeElement *te,
const bool extend, const bool toggle);
void outliner_object_mode_toggle(
@@ -218,10 +210,10 @@ typedef void (*outliner_operation_cb)(
struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *);
void outliner_do_object_operation_ex(
- struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops,
- struct ListBase *lb, outliner_operation_cb operation_cb, bool recurse_selected);
+ struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOutliner *soops,
+ struct ListBase *lb, outliner_operation_cb operation_cb, void *user_data, bool recurse_selected);
void outliner_do_object_operation(
- struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops,
+ struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOutliner *soops,
struct ListBase *lb, outliner_operation_cb operation_cb);
int common_restrict_check(struct bContext *C, struct Object *ob);
@@ -230,17 +222,6 @@ int outliner_flag_is_any_test(ListBase *lb, short flag, const int curlevel);
bool outliner_flag_set(ListBase *lb, short flag, short set);
bool outliner_flag_flip(ListBase *lb, short flag);
-void object_toggle_visibility_cb(
- struct bContext *C, struct ReportList *reports, struct Scene *scene,
- TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
-void object_toggle_selectability_cb(
- struct bContext *C, struct ReportList *reports, struct Scene *scene,
- TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
-void object_toggle_renderability_cb(
- struct bContext *C, struct ReportList *reports, struct Scene *scene,
- TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
-
-
void item_rename_cb(
struct bContext *C, struct ReportList *reports, struct Scene *scene,
TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
@@ -265,7 +246,7 @@ void item_object_mode_exit_cb(
struct bContext *C, struct ReportList *reports, struct Scene *scene,
TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
-void outliner_set_coordinates(struct ARegion *ar, struct SpaceOops *soops);
+void outliner_set_coordinates(struct ARegion *ar, struct SpaceOutliner *soops);
/* outliner_dragdrop.c */
void outliner_dropboxes(void);
@@ -335,6 +316,7 @@ struct Collection *outliner_collection_from_tree_element(const TreeElement *te);
void OUTLINER_OT_collection_new(struct wmOperatorType *ot);
void OUTLINER_OT_collection_duplicate(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_duplicate_linked(struct wmOperatorType *ot);
void OUTLINER_OT_collection_delete(struct wmOperatorType *ot);
void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot);
void OUTLINER_OT_collection_objects_deselect(struct wmOperatorType *ot);
@@ -347,18 +329,30 @@ void OUTLINER_OT_collection_holdout_clear(struct wmOperatorType *ot);
void OUTLINER_OT_collection_indirect_only_set(struct wmOperatorType *ot);
void OUTLINER_OT_collection_indirect_only_clear(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_isolate(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_show(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_hide(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_show_inside(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_hide_inside(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_enable(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_disable(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_enable_render(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_disable_render(struct wmOperatorType *ot);
+void OUTLINER_OT_hide(struct wmOperatorType *ot);
+void OUTLINER_OT_unhide_all(struct wmOperatorType *ot);
+
/* outliner_utils.c ---------------------------------------------- */
-TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y);
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x);
-TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse);
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops, const ListBase *tree, float view_co_y);
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops, const TreeElement *parent_te, float view_co_x);
+TreeElement *outliner_find_tse(struct SpaceOutliner *soops, const TreeStoreElem *tse);
TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem);
TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te, const TreeElement *child_te);
-TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, const struct ID *id);
+TreeElement *outliner_find_id(struct SpaceOutliner *soops, ListBase *lb, const struct ID *id);
TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan);
TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone);
-struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode);
-bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
+struct ID *outliner_search_back(SpaceOutliner *soops, TreeElement *te, short idcode);
+bool outliner_tree_traverse(const SpaceOutliner *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
TreeTraversalFunc func, void *customdata);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 87c9827a15a..eea06fc0b0c 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_ops.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
#include "DNA_collection_types.h"
#include "BLT_translation.h"
-#include "BKE_context.h"
-#include "BKE_main.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -105,6 +94,7 @@ void outliner_operatortypes(void)
/* collections */
WM_operatortype_append(OUTLINER_OT_collection_new);
WM_operatortype_append(OUTLINER_OT_collection_duplicate);
+ WM_operatortype_append(OUTLINER_OT_collection_duplicate_linked);
WM_operatortype_append(OUTLINER_OT_collection_delete);
WM_operatortype_append(OUTLINER_OT_collection_objects_select);
WM_operatortype_append(OUTLINER_OT_collection_objects_deselect);
@@ -116,6 +106,18 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_collection_holdout_clear);
WM_operatortype_append(OUTLINER_OT_collection_indirect_only_set);
WM_operatortype_append(OUTLINER_OT_collection_indirect_only_clear);
+
+ WM_operatortype_append(OUTLINER_OT_collection_isolate);
+ WM_operatortype_append(OUTLINER_OT_collection_disable);
+ WM_operatortype_append(OUTLINER_OT_collection_enable);
+ WM_operatortype_append(OUTLINER_OT_collection_hide);
+ WM_operatortype_append(OUTLINER_OT_collection_show);
+ WM_operatortype_append(OUTLINER_OT_collection_disable_render);
+ WM_operatortype_append(OUTLINER_OT_collection_enable_render);
+ WM_operatortype_append(OUTLINER_OT_collection_hide_inside);
+ WM_operatortype_append(OUTLINER_OT_collection_show_inside);
+ WM_operatortype_append(OUTLINER_OT_hide);
+ WM_operatortype_append(OUTLINER_OT_unhide_all);
}
void outliner_keymap(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index d9e069f75c2..1f59658b8ab 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_select.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <stdlib.h>
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -61,6 +53,7 @@
#include "ED_armature.h"
#include "ED_object.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "ED_sequencer.h"
#include "ED_undo.h"
#include "ED_gpencil.h"
@@ -77,84 +70,138 @@
#include "outliner_intern.h"
-static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base)
+static bool do_outliner_activate_common(
+ bContext *C,
+ Main *bmain,
+ Depsgraph *depsgraph,
+ Scene *scene,
+ ViewLayer *view_layer,
+ Base *base,
+ const bool extend,
+ const bool do_exit)
+{
+ bool use_all = false;
+
+ if (do_exit) {
+ FOREACH_OBJECT_BEGIN(view_layer, ob_iter)
+ {
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob_iter);
+ }
+ FOREACH_OBJECT_END;
+ }
+
+ /* Just like clicking in the object changes the active object,
+ * clicking on the object data should change it as well. */
+ ED_object_base_activate(C, base);
+
+ if (extend) {
+ use_all = true;
+ }
+ else {
+ ED_object_base_deselect_all(view_layer, NULL, SEL_DESELECT);
+ }
+
+ return use_all;
+}
+
+/**
+ * Bring the newly selected object into edit mode.
+ *
+ * If extend is used, we try to have the other compatible selected objects in the new mode as well.
+ * Otherwise only the new object will be active, selected and in the edit mode.
+ */
+static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base, const bool extend)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = OBACT(view_layer);
+ Object *ob = base->object;
bool use_all = false;
if (obact == NULL) {
ED_object_base_activate(C, base);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- obact = base->object;
+ obact = ob;
use_all = true;
}
- else if (obact->data == base->object->data) {
+ else if (obact->data == ob->data) {
use_all = true;
}
+ else if (obact->mode == OB_MODE_OBJECT) {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, false);
+ }
+ else if ((ob->type != obact->type) ||
+ ((obact->mode & OB_MODE_EDIT) == 0) ||
+ ((obact->mode & OB_MODE_POSE) && ELEM(OB_ARMATURE, ob->type, obact->type)) ||
+ !extend)
+ {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, true);
+ }
if (use_all) {
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
}
else {
- Object *ob = base->object;
- if (ob->type == obact->type) {
- bool ok;
- if (BKE_object_is_in_editmode(ob)) {
- ok = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
- }
- else {
- ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
- }
- if (ok) {
- ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : BA_DESELECT);
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- }
+ bool ok;
+ if (BKE_object_is_in_editmode(ob)) {
+ ok = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
+ }
+ else {
+ ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_NO_CONTEXT);
+ }
+ if (ok) {
+ ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : BA_DESELECT);
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
}
-static void do_outliner_activate_pose(bContext *C, ViewLayer *view_layer, Base *base)
+static void do_outliner_activate_pose(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base, const bool extend)
{
+ Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = OBACT(view_layer);
+ Object *ob = base->object;
bool use_all = false;
if (obact == NULL) {
ED_object_base_activate(C, base);
- Scene *scene = CTX_data_scene(C);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- obact = base->object;
+ obact = ob;
use_all = true;
}
- else if (obact->data == base->object->data) {
+ else if (obact->data == ob->data) {
use_all = true;
}
+ else if (obact->mode == OB_MODE_OBJECT) {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, false);
+ }
+ else if ((!ELEM(ob->type, obact->type)) ||
+ ((obact->mode & OB_MODE_EDIT) && ELEM(OB_ARMATURE, ob->type, obact->type)))
+ {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, true);
+ }
if (use_all) {
WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
}
else {
- Object *ob = base->object;
- if (ob->type == obact->type) {
- struct Main *bmain = CTX_data_main(C);
- bool ok = false;
- if (ob->mode & OB_MODE_POSE) {
- ok = ED_object_posemode_exit_ex(bmain, ob);
- }
- else {
- ok = ED_object_posemode_enter_ex(bmain, ob);
- }
- if (ok) {
- ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);
+ bool ok = false;
+ if (ob->mode & OB_MODE_POSE) {
+ ok = ED_object_posemode_exit_ex(bmain, ob);
+ }
+ else {
+ ok = ED_object_posemode_enter_ex(bmain, ob);
+ }
+ if (ok) {
+ ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);
- Scene *scene = CTX_data_scene(C);
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- }
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
}
@@ -166,10 +213,10 @@ void outliner_object_mode_toggle(
{
Object *obact = OBACT(view_layer);
if (obact->mode & OB_MODE_EDIT) {
- do_outliner_activate_obdata(C, scene, view_layer, base);
+ do_outliner_activate_obdata(C, scene, view_layer, base, true);
}
else if (obact->mode & OB_MODE_POSE) {
- do_outliner_activate_pose(C, view_layer, base);
+ do_outliner_activate_pose(C, scene, view_layer, base, true);
}
}
@@ -243,7 +290,7 @@ static void do_outliner_ebone_select_recursive(bArmature *arm, EditBone *ebone_p
}
static eOLDrawState tree_element_set_active_object(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set, bool recursive)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -304,7 +351,8 @@ static eOLDrawState tree_element_set_active_object(
/* Only in object mode so we can switch the active object,
* keeping all objects in the current 'mode' selected, useful for multi-pose/edit mode.
- * This keeps the convention that all objects in the current mode are also selected. see T55246. */
+ * This keeps the convention that all objects in the current mode are also selected.
+ * see T55246. */
if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) ? (ob->mode == OB_MODE_OBJECT) : true) {
BKE_view_layer_base_deselect_all(view_layer);
}
@@ -323,14 +371,14 @@ static eOLDrawState tree_element_set_active_object(
}
if (ob != OBEDIT_FROM_VIEW_LAYER(view_layer)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
}
return OL_DRAWSEL_NORMAL;
}
static eOLDrawState tree_element_active_material(
- bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
TreeElement *tes;
@@ -382,8 +430,8 @@ static eOLDrawState tree_element_active_material(
return OL_DRAWSEL_NONE;
}
-static eOLDrawState tree_element_active_lamp(
- bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOops *soops,
+static eOLDrawState tree_element_active_light(
+ bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob;
@@ -406,7 +454,7 @@ static eOLDrawState tree_element_active_lamp(
}
static eOLDrawState tree_element_active_camera(
- bContext *UNUSED(C), Scene *scene, ViewLayer *UNUSED(sl), SpaceOops *soops,
+ bContext *UNUSED(C), Scene *scene, ViewLayer *UNUSED(sl), SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -419,7 +467,7 @@ static eOLDrawState tree_element_active_camera(
}
static eOLDrawState tree_element_active_world(
- bContext *C, Scene *scene, ViewLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
+ bContext *C, Scene *scene, ViewLayer *UNUSED(sl), SpaceOutliner *UNUSED(soops),
TreeElement *te, const eOLSetState set)
{
TreeElement *tep;
@@ -548,7 +596,7 @@ static eOLDrawState tree_element_active_posechannel(
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
-
+ DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
}
}
else {
@@ -712,7 +760,7 @@ static int tree_element_active_constraint(
}
static eOLDrawState tree_element_active_text(
- bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
+ bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *UNUSED(sl), SpaceOutliner *UNUSED(soops),
TreeElement *UNUSED(te), int UNUSED(set))
{
// XXX removed
@@ -720,7 +768,7 @@ static eOLDrawState tree_element_active_text(
}
static eOLDrawState tree_element_active_pose(
- bContext *C, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
+ bContext *C, Scene *scene, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
Object *ob = (Object *)tselem->id;
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -731,7 +779,7 @@ static eOLDrawState tree_element_active_pose(
}
if (set != OL_SETSEL_NONE) {
- do_outliner_activate_pose(C, view_layer, base);
+ do_outliner_activate_pose(C, scene, view_layer, base, (set == OL_SETSEL_EXTEND));
}
else {
if (ob->mode & OB_MODE_POSE) {
@@ -864,7 +912,7 @@ static eOLDrawState tree_element_active_layer_collection(
/* ---------------------------------------------- */
/* generic call for ID data check or make/check active in UI */
-eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops, TreeElement *te,
+eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, TreeElement *te,
const eOLSetState set, const bool handle_all_types)
{
switch (te->idcode) {
@@ -880,7 +928,7 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_laye
case ID_WO:
return tree_element_active_world(C, scene, view_layer, soops, te, set);
case ID_LA:
- return tree_element_active_lamp(C, scene, view_layer, soops, te, set);
+ return tree_element_active_light(C, scene, view_layer, soops, te, set);
case ID_TXT:
return tree_element_active_text(C, scene, view_layer, soops, te, set);
case ID_CA:
@@ -893,7 +941,7 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_laye
* Generic call for non-id data to make/check active in UI
*/
eOLDrawState tree_element_type_active(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
{
switch (tselem->type) {
@@ -916,7 +964,7 @@ eOLDrawState tree_element_type_active(
case TSE_LINKED_PSYS:
return tree_element_active_psys(C, scene, te, tselem, set);
case TSE_POSE_BASE:
- return tree_element_active_pose(C, view_layer, te, tselem, set);
+ return tree_element_active_pose(C, scene, view_layer, te, tselem, set);
case TSE_POSE_CHANNEL:
return tree_element_active_posechannel(C, scene, view_layer, te, tselem, set, recursive);
case TSE_CONSTRAINT:
@@ -951,7 +999,7 @@ eOLDrawState tree_element_type_active(
* Needed to run from operators accessed from a menu.
*/
static void do_outliner_item_activate_tree_element(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem,
const bool extend, const bool recursive)
{
@@ -1028,7 +1076,7 @@ static void do_outliner_item_activate_tree_element(
if ((ob != NULL) && (ob->data == tselem->id)) {
Base *base = BKE_view_layer_base_find(view_layer, ob);
if ((base != NULL) && (base->flag & BASE_VISIBLE)) {
- do_outliner_activate_obdata(C, scene, view_layer, base);
+ do_outliner_activate_obdata(C, scene, view_layer, base, extend);
}
}
}
@@ -1052,7 +1100,7 @@ static void do_outliner_item_activate_tree_element(
* \param extend: Don't deselect other items, only modify \a te.
* \param toggle: Select \a te when not selected, deselect when selected.
*/
-void outliner_item_select(SpaceOops *soops, const TreeElement *te, const bool extend, const bool toggle)
+void outliner_item_select(SpaceOutliner *soops, const TreeElement *te, const bool extend, const bool toggle)
{
TreeStoreElem *tselem = TREESTORE(te);
const short new_flag = toggle ? (tselem->flag ^ TSE_SELECTED) : (tselem->flag | TSE_SELECTED);
@@ -1082,7 +1130,7 @@ static bool outliner_item_is_co_within_close_toggle(TreeElement *te, float view_
return ((te->flag & TE_ICONROW) == 0) && (view_co_x > te->xs) && (view_co_x < te->xs + UI_UNIT_X);
}
-static bool outliner_is_co_within_restrict_columns(const SpaceOops *soops, const ARegion *ar, float view_co_x)
+static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *soops, const ARegion *ar, float view_co_x)
{
return ((soops->outlinevis != SO_DATA_API) &&
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
@@ -1101,7 +1149,7 @@ void outliner_item_do_activate_from_tree_element(
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
do_outliner_item_activate_tree_element(
C, scene, view_layer, soops,
@@ -1119,7 +1167,7 @@ int outliner_item_do_activate_from_cursor(
bool extend, bool recursive)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float view_mval[2];
bool changed = false, rebuild_tree = false;
@@ -1188,7 +1236,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
/* ****************************************************** */
/* **************** Box Select Tool ****************** */
-static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te, bool select)
+static void outliner_item_box_select(SpaceOutliner *soops, Scene *scene, rctf *rectf, TreeElement *te, bool select)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -1202,9 +1250,9 @@ static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te,
}
/* Look at its children. */
- if ((tselem->flag & TSE_CLOSED) == 0) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (te = te->subtree.first; te; te = te->next) {
- outliner_item_box_select(scene, rectf, te, select);
+ outliner_item_box_select(soops, scene, rectf, te, select);
}
}
}
@@ -1212,7 +1260,7 @@ static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te,
static int outliner_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te;
rctf rectf;
@@ -1222,7 +1270,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
for (te = soops->tree.first; te; te = te->next) {
- outliner_item_box_select(scene, &rectf, te, select);
+ outliner_item_box_select(soops, scene, &rectf, te, select);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 5806cf28fa8..4b67c835e7f 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_tools.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +27,7 @@
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -55,11 +47,11 @@
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_library_override.h"
#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -78,6 +70,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -94,7 +87,7 @@
/* ************ SELECTION OPERATIONS ********* */
-static void set_operation_types(SpaceOops *soops, ListBase *lb,
+static void set_operation_types(SpaceOutliner *soops, ListBase *lb,
int *scenelevel,
int *objectlevel,
int *idlevel,
@@ -229,7 +222,7 @@ static void unlink_collection_cb(
if (tsep) {
if (GS(tsep->id->name) == ID_OB) {
Object *ob = (Object *)tsep->id;
- ob->dup_group = NULL;
+ ob->instance_collection = NULL;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
DEG_relations_tag_update(bmain);
}
@@ -288,7 +281,7 @@ static void unlink_world_cb(
}
static void outliner_do_libdata_operation(
- bContext *C, ReportList *reports, Scene *scene, SpaceOops *soops, ListBase *lb,
+ bContext *C, ReportList *reports, Scene *scene, SpaceOutliner *soops, ListBase *lb,
outliner_operation_cb operation_cb,
void *user_data)
{
@@ -311,12 +304,12 @@ static void outliner_do_libdata_operation(
/* ******************************************** */
typedef enum eOutliner_PropSceneOps {
- OL_SCENE_OP_DELETE = 1
+ OL_SCENE_OP_DELETE = 1,
} eOutliner_PropSceneOps;
static const EnumPropertyItem prop_scene_op_types[] = {
{OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool outliner_do_scene_operation(
@@ -357,7 +350,7 @@ static bool scene_cb(bContext *C, eOutliner_PropSceneOps event, TreeElement *UNU
static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const eOutliner_PropSceneOps event = RNA_enum_get(op->ptr, "type");
if (outliner_do_scene_operation(C, event, &soops->tree, scene_cb) == false) {
@@ -451,7 +444,7 @@ static void object_delete_cb(
// check also library later
if (ob == CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
ED_object_base_free_and_unlink(CTX_data_main(C), scene, ob);
/* leave for ED_outliner_id_unref to handle */
@@ -560,8 +553,8 @@ static void singleuser_world_cb(
* \param select_recurse: Set to false for operations which are already recursively operating on their children.
*/
void outliner_do_object_operation_ex(
- bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb,
- outliner_operation_cb operation_cb, bool select_recurse)
+ bContext *C, ReportList *reports, Scene *scene_act, SpaceOutliner *soops, ListBase *lb,
+ outliner_operation_cb operation_cb, void *user_data, bool select_recurse)
{
TreeElement *te;
@@ -578,24 +571,24 @@ void outliner_do_object_operation_ex(
/* important to use 'scene_owner' not scene_act else deleting objects can crash.
* only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
* outliner isn't showing scenes: Visible Layer draw mode for eg. */
- operation_cb(C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, NULL);
+ operation_cb(C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, user_data);
select_handled = true;
}
}
if (TSELEM_OPEN(tselem, soops)) {
if ((select_handled == false) || select_recurse) {
outliner_do_object_operation_ex(
- C, reports, scene_act, soops, &te->subtree, operation_cb, select_recurse);
+ C, reports, scene_act, soops, &te->subtree, operation_cb, NULL, select_recurse);
}
}
}
}
void outliner_do_object_operation(
- bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb,
+ bContext *C, ReportList *reports, Scene *scene_act, SpaceOutliner *soops, ListBase *lb,
outliner_operation_cb operation_cb)
{
- outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_cb, true);
+ outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_cb, NULL, true);
}
/* ******************************************** */
@@ -752,7 +745,7 @@ static void constraint_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
{
bContext *C = C_v;
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
bConstraint *constraint = (bConstraint *)te->directdata;
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -779,7 +772,10 @@ static void constraint_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
if (BKE_constraint_remove_ex(lb, ob, constraint, true)) {
/* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL);
- ED_object_constraint_update(bmain, ob); /* needed to set the flags on posebones correctly */
+
+ /* needed to set the flags on posebones correctly */
+ ED_object_constraint_update(bmain, ob);
+
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
te->store_elem->flag &= ~TSE_SELECTED;
}
@@ -790,7 +786,7 @@ static void modifier_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
{
bContext *C = (bContext *)Carg;
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ModifierData *md = (ModifierData *)te->directdata;
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -811,7 +807,7 @@ static void modifier_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
}
}
-static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
+static void outliner_do_data_operation(SpaceOutliner *soops, int type, int event, ListBase *lb,
void (*operation_cb)(int, TreeElement *, TreeStoreElem *, void *),
void *arg)
{
@@ -883,7 +879,7 @@ static void object_delete_hierarchy_cb(
/* Check also library later. */
for (; obedit && (obedit != base->object); obedit = obedit->parent);
if (obedit == base->object) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
outline_delete_hierarchy(C, reports, scene, base);
@@ -898,6 +894,77 @@ static void object_delete_hierarchy_cb(
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
+static Base *outline_batch_delete_hierarchy(
+ ReportList *reports, Main *bmain, ViewLayer *view_layer, Scene *scene, Base *base)
+{
+ Base *child_base, *base_next;
+ Object *object, *parent;
+
+ if (!base) {
+ return NULL;
+ }
+
+ object = base->object;
+ for (child_base = view_layer->object_bases.first; child_base; child_base = base_next) {
+ base_next = child_base->next;
+ for (parent = child_base->object->parent; parent && (parent != object); parent = parent->parent);
+ if (parent) {
+ base_next = outline_batch_delete_hierarchy(reports, bmain, view_layer, scene, child_base);
+ }
+ }
+
+ base_next = base->next;
+
+ if (object->id.tag & LIB_TAG_INDIRECT) {
+ BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", base->object->id.name + 2);
+ return base_next;
+ }
+ else if (BKE_library_ID_is_indirectly_used(bmain, object) &&
+ ID_REAL_USERS(object) <= 1 && ID_EXTRA_USERS(object) == 0)
+ {
+ BKE_reportf(reports, RPT_WARNING,
+ "Cannot delete object '%s' from scene '%s', indirectly used objects need at least one user",
+ object->id.name + 2, scene->id.name + 2);
+ return base_next;
+ }
+
+ DEG_id_tag_update_ex(bmain, &object->id, ID_RECALC_BASE_FLAGS);
+ BKE_scene_collections_object_remove(bmain, scene, object, false);
+
+ if (object->id.us == 0) {
+ object->id.tag |= LIB_TAG_DOIT;
+ }
+
+ return base_next;
+}
+
+static void object_batch_delete_hierarchy_cb(
+ bContext *C, ReportList *reports, Scene *scene,
+ TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
+{
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Base *base = (Base *)te->directdata;
+ Object *obedit = CTX_data_edit_object(C);
+
+ if (!base) {
+ base = BKE_view_layer_base_find(view_layer, (Object *)tselem->id);
+ }
+ if (base) {
+ /* Check also library later. */
+ for (; obedit && (obedit != base->object); obedit = obedit->parent);
+ if (obedit == base->object) {
+ ED_object_editmode_exit(C, EM_FREEDATA);
+ }
+
+ outline_batch_delete_hierarchy(reports, CTX_data_main(C), view_layer, scene, base);
+ /* leave for ED_outliner_id_unref to handle */
+#if 0
+ te->directdata = NULL;
+ tselem->id = NULL;
+#endif
+ }
+}
+
/* **************************************** */
enum {
@@ -917,25 +984,26 @@ enum {
};
static const EnumPropertyItem prop_object_op_types[] = {
- {OL_OP_SELECT, "SELECT", 0, "Select", ""},
+ {OL_OP_SELECT, "SELECT", ICON_RESTRICT_SELECT_OFF, "Select", ""},
{OL_OP_DESELECT, "DESELECT", 0, "Deselect", ""},
{OL_OP_SELECT_HIERARCHY, "SELECT_HIERARCHY", 0, "Select Hierarchy", ""},
- {OL_OP_DELETE, "DELETE", 0, "Delete", ""},
+ {OL_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
{OL_OP_DELETE_HIERARCHY, "DELETE_HIERARCHY", 0, "Delete Hierarchy", ""},
{OL_OP_REMAP, "REMAP", 0, "Remap Users",
"Make all users of selected data-blocks to use instead a new chosen one"},
{OL_OP_RENAME, "RENAME", 0, "Rename", ""},
{OL_OP_OBJECT_MODE_ENTER, "OBJECT_MODE_ENTER", 0, "Enter Mode", ""},
{OL_OP_OBJECT_MODE_EXIT, "OBJECT_MODE_EXIT", 0, "Exit Mode", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
wmWindow *win = CTX_wm_window(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
@@ -958,7 +1026,8 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
else if (event == OL_OP_SELECT_HIERARCHY) {
Scene *sce = scene; // to be able to delete, scenes are set...
- outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, false);
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, NULL, false);
if (scene != sce) {
WM_window_set_active_scene(bmain, C, win, sce);
}
@@ -973,6 +1042,9 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_DELETE) {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+
outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_delete_cb);
/* XXX: tree management normally happens from draw_outliner(), but when
@@ -985,10 +1057,29 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
str = "Delete Objects";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
}
else if (event == OL_OP_DELETE_HIERARCHY) {
- outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_delete_hierarchy_cb, false);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+
+ /* Keeping old 'safe and slow' code for a bit (new one enabled on 28/01/2019). */
+ if (G.debug_value == 666) {
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_delete_hierarchy_cb, NULL, false);
+ }
+ else {
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_batch_delete_hierarchy_cb, NULL, false);
+
+ BKE_id_multi_tagged_delete(bmain);
+ }
/* XXX: See OL_OP_DELETE comment above. */
outliner_cleanup_tree(soops);
@@ -996,7 +1087,11 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
str = "Delete Object Hierarchy";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
}
else if (event == OL_OP_REMAP) {
outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL);
@@ -1071,7 +1166,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_STATIC_OVERRIDE, "STATIC_OVERRIDE", 0, "Add Static Override",
"Add a local static override of this data-block"},
{OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
- {OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"},
+ {OUTLINER_IDOP_DELETE, "DELETE", ICON_X, "Delete", "WARNING: no undo"},
{OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users",
"Make all users of selected data-blocks to use instead current (clicked) one"},
{OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User",
@@ -1079,7 +1174,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""},
{OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""},
{OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem *outliner_id_operation_itemf(
@@ -1108,7 +1203,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(
static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerIdOpTypes event;
@@ -1302,16 +1397,16 @@ typedef enum eOutlinerLibOpTypes {
static const EnumPropertyItem outliner_lib_op_type_items[] = {
{OL_LIB_RENAME, "RENAME", 0, "Rename", ""},
- {OL_LIB_DELETE, "DELETE", 0, "Delete", "Delete this library and all its item from Blender - WARNING: no undo"},
+ {OL_LIB_DELETE, "DELETE", ICON_X, "Delete", "Delete this library and all its item from Blender - WARNING: no undo"},
{OL_LIB_RELOCATE, "RELOCATE", 0, "Relocate", "Select a new path for this library, and reload all its data"},
- {OL_LIB_RELOAD, "RELOAD", 0, "Reload", "Reload all data from this library"},
- {0, NULL, 0, NULL, NULL}
+ {OL_LIB_RELOAD, "RELOAD", ICON_FILE_REFRESH, "Reload", "Reload all data from this library"},
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerLibOpTypes event;
@@ -1383,7 +1478,7 @@ void OUTLINER_OT_lib_operation(wmOperatorType *ot)
/* **************************************** */
-static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *lb, ID *newid,
+static void outliner_do_id_set_operation(SpaceOutliner *soops, int type, ListBase *lb, ID *newid,
void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
{
TreeElement *te;
@@ -1425,7 +1520,7 @@ static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, Tree
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
bAction *act;
@@ -1517,12 +1612,12 @@ static const EnumPropertyItem prop_animdata_op_types[] = {
//{OUTLINER_ANIMOP_COPY_DRIVERS, "COPY_DRIVERS", 0, "Copy Drivers", ""},
//{OUTLINER_ANIMOP_PASTE_DRIVERS, "PASTE_DRIVERS", 0, "Paste Drivers", ""},
{OUTLINER_ANIMOP_CLEAR_DRV, "CLEAR_DRIVERS", 0, "Clear Drivers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_AnimDataOps event;
short updateDeps = 0;
@@ -1612,12 +1707,12 @@ static const EnumPropertyItem prop_constraint_op_types[] = {
{OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_HIDE_OFF, "Enable", ""},
{OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_HIDE_ON, "Disable", ""},
{OL_CONSTRAINTOP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_constraint_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropConstraintOps event;
@@ -1657,12 +1752,12 @@ static const EnumPropertyItem prop_modifier_op_types[] = {
{OL_MODIFIER_OP_TOGVIS, "TOGVIS", ICON_RESTRICT_VIEW_OFF, "Toggle viewport use", ""},
{OL_MODIFIER_OP_TOGREN, "TOGREN", ICON_RESTRICT_RENDER_OFF, "Toggle render use", ""},
{OL_MODIFIER_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_modifier_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropModifierOps event;
@@ -1705,12 +1800,12 @@ static const EnumPropertyItem prop_data_op_types[] = {
{OL_DOP_HIDE, "HIDE", 0, "Hide", ""},
{OL_DOP_UNHIDE, "UNHIDE", 0, "Unhide", ""},
{OL_DOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropDataOps event;
@@ -1817,7 +1912,7 @@ static int outliner_operator_menu(bContext *C, const char *opname)
return OPERATOR_INTERFACE;
}
-static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soops,
+static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOutliner *soops,
TreeElement *te, const float mval[2])
{
ReportList *reports = CTX_wm_reports(C); // XXX...
@@ -1927,7 +2022,7 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBut *but = UI_context_active_but_get(C);
TreeElement *te;
float fmval[2];
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index f7f0d441138..f98913c34ed 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_tree.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <math.h>
@@ -42,7 +34,7 @@
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
@@ -92,13 +84,13 @@
/* prototypes */
static TreeElement *outliner_add_collection_recursive(
- SpaceOops *soops, Collection *collection, TreeElement *ten);
+ SpaceOutliner *soops, Collection *collection, TreeElement *ten);
static void outliner_make_object_parent_hierarchy(ListBase *lb);
/* ********************************************************* */
/* Persistent Data */
-static void outliner_storage_cleanup(SpaceOops *soops)
+static void outliner_storage_cleanup(SpaceOutliner *soops)
{
BLI_mempool *ts = soops->treestore;
@@ -159,7 +151,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
}
}
-static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
+static void check_persistent(SpaceOutliner *soops, TreeElement *te, ID *id, short type, short nr)
{
TreeStoreElem *tselem;
@@ -203,7 +195,7 @@ void outliner_free_tree(ListBase *tree)
}
}
-void outliner_cleanup_tree(SpaceOops *soops)
+void outliner_cleanup_tree(SpaceOutliner *soops)
{
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
@@ -232,13 +224,13 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
/* ********************************************************* */
/* Prototype, see functions below */
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
TreeElement *parent, short type, short index);
/* -------------------------------------------------------- */
/* special handling of hierarchical non-lib data */
-static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone,
+static void outliner_add_bone(SpaceOutliner *soops, ListBase *lb, ID *id, Bone *curBone,
TreeElement *parent, int *a)
{
TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
@@ -260,7 +252,7 @@ static bool outliner_animdata_test(AnimData *adt)
}
#ifdef WITH_FREESTYLE
-static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
+static void outliner_add_line_styles(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
ViewLayer *view_layer;
FreestyleLineSet *lineset;
@@ -287,7 +279,7 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
}
#endif
-static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
+static void outliner_add_scene_contents(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
/* View layers */
TreeElement *ten = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
@@ -322,7 +314,7 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
}
// can be inlined if necessary
-static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
+static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
{
if (outliner_animdata_test(ob->adt))
outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
@@ -487,13 +479,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
}
/* duplicated group */
- if (ob->dup_group)
- outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
+ if (ob->instance_collection)
+ outliner_add_element(soops, &te->subtree, ob->instance_collection, te, 0, 0);
}
// can be inlined if necessary
-static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
+static void outliner_add_id_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
{
/* tuck pointer back in object, to construct hierarchy */
if (GS(id->name) == ID_OB) id->newid = (ID *)te;
@@ -592,7 +584,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
}
case ID_LA:
{
- Lamp *la = (Lamp *)id;
+ Light *la = (Light *)id;
if (outliner_animdata_test(la->adt))
outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
@@ -728,7 +720,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
// TODO: this function needs to be split up! It's getting a bit too large...
// Note: "ID" is not always a real ID
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
TreeElement *parent, short type, short index)
{
TreeElement *te;
@@ -1128,7 +1120,7 @@ static int need_add_seq_dup(Sequence *seq)
return(1);
}
-static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
+static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElement *te, short index)
{
/* TreeElement *ch; */ /* UNUSED */
Sequence *p;
@@ -1182,7 +1174,7 @@ static bool outliner_library_id_show(Library *lib, ID *id, short filter_id_type)
return true;
}
-static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soops, ListBase *lb, Library *lib)
+static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOutliner *soops, ListBase *lb, Library *lib)
{
TreeElement *ten, *tenlib = NULL;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1240,7 +1232,7 @@ static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soop
return tenlib;
}
-static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
+static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops)
{
TreeElement *ten;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1287,7 +1279,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
}
static void outliner_add_layer_collection_objects(
- SpaceOops *soops, ListBase *tree, ViewLayer *layer,
+ SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
LayerCollection *lc, TreeElement *ten)
{
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
@@ -1302,7 +1294,7 @@ static void outliner_add_layer_collection_objects(
}
static void outliner_add_layer_collections_recursive(
- SpaceOops *soops, ListBase *tree, ViewLayer *layer,
+ SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects)
{
@@ -1313,10 +1305,15 @@ static void outliner_add_layer_collections_recursive(
ten->name = id->name + 2;
ten->directdata = lc;
+ /* Open by default. */
+ TreeStoreElem *tselem = TREESTORE(ten);
+ if (!tselem->used) {
+ tselem->flag &= ~TSE_CLOSED;
+ }
+
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
if (exclude ||
- ((layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)))
+ ((lc->runtime_flag & LAYER_COLLECTION_VISIBLE) == 0))
{
ten->flag |= TE_DISABLED;
}
@@ -1328,7 +1325,7 @@ static void outliner_add_layer_collections_recursive(
}
}
-static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElement *parent,
+static void outliner_add_view_layer(SpaceOutliner *soops, ListBase *tree, TreeElement *parent,
ViewLayer *layer, const bool show_objects)
{
/* First layer collection is for master collection, don't show it. */
@@ -1350,7 +1347,7 @@ BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collec
}
BLI_INLINE void outliner_add_collection_objects(
- SpaceOops *soops, ListBase *tree, Collection *collection, TreeElement *parent)
+ SpaceOutliner *soops, ListBase *tree, Collection *collection, TreeElement *parent)
{
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
outliner_add_element(soops, tree, cob->ob, parent, 0, 0);
@@ -1358,7 +1355,7 @@ BLI_INLINE void outliner_add_collection_objects(
}
static TreeElement *outliner_add_collection_recursive(
- SpaceOops *soops, Collection *collection, TreeElement *ten)
+ SpaceOutliner *soops, Collection *collection, TreeElement *ten)
{
outliner_add_collection_init(ten, collection);
@@ -1553,7 +1550,7 @@ typedef struct OutlinerTreeElementFocus {
* Bring the outliner scrolling back to where it was in relation to the original focus element
* Caller is expected to handle redrawing of ARegion.
*/
-static void outliner_restore_scrolling_position(SpaceOops *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
+static void outliner_restore_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
{
View2D *v2d = &ar->v2d;
int ytop;
@@ -1596,7 +1593,7 @@ static bool test_object_callback(TreeElement *te)
* See if TreeElement or any of its children pass the callback_test.
*/
static TreeElement *outliner_find_first_desired_element_at_y_recursive(
- const SpaceOops *soops,
+ const SpaceOutliner *soops,
TreeElement *te,
const float limit,
bool (*callback_test)(TreeElement *))
@@ -1629,7 +1626,7 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
* we return NULL.
*/
static TreeElement *outliner_find_first_desired_element_at_y(
- const SpaceOops *soops,
+ const SpaceOutliner *soops,
const float view_co,
const float view_co_limit)
{
@@ -1685,7 +1682,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(
* Finds the top-most collection visible in the outliner and populates the OutlinerTreeElementFocus
* struct to retrieve this element later to make sure it is in the same original position as before filtering
*/
-static void outliner_store_scrolling_position(SpaceOops *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
+static void outliner_store_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
{
TreeElement *te;
float limit = ar->v2d.cur.ymin;
@@ -1703,7 +1700,7 @@ static void outliner_store_scrolling_position(SpaceOops *soops, ARegion *ar, Out
}
}
-static int outliner_exclude_filter_get(SpaceOops *soops)
+static int outliner_exclude_filter_get(SpaceOutliner *soops)
{
int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
@@ -1846,7 +1843,7 @@ static bool outliner_filter_has_name(TreeElement *te, const char *name, int flag
}
static int outliner_filter_subtree(
- SpaceOops *soops, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
+ SpaceOutliner *soops, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
{
TreeElement *te, *te_next;
TreeStoreElem *tselem;
@@ -1897,9 +1894,9 @@ static int outliner_filter_subtree(
return (BLI_listbase_is_empty(lb) == false);
}
-static void outliner_filter_tree(SpaceOops *soops, ViewLayer *view_layer)
+static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
{
- char search_buff[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
+ char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2];
char *search_string;
const int exclude_filter = outliner_exclude_filter_get(soops);
@@ -1925,11 +1922,12 @@ static void outliner_filter_tree(SpaceOops *soops, ViewLayer *view_layer)
/* Main entry point for building the tree data-structure that the outliner represents */
// TODO: split each mode into its own function?
-void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOops *soops, ARegion *ar)
+void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *ar)
{
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
- int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore); /* on first view, we open scenes */
+ /* on first view, we open scenes */
+ int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore);
/* Are we looking for something - we want to tag parents to filter child matches
* - NOT in datablocks view - searching all datablocks takes way too long to be useful
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index 6b7035dd326..3afb4f4d75a 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_utils.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "BLI_utildefines.h"
@@ -44,7 +38,7 @@
* Try to find an item under y-coordinate \a view_co_y (view-space).
* \note Recursive
*/
-TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y)
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops, const ListBase *tree, float view_co_y)
{
for (TreeElement *te_iter = tree->first; te_iter; te_iter = te_iter->next) {
if (view_co_y < (te_iter->ys + UI_UNIT_Y)) {
@@ -71,12 +65,15 @@ TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tre
*
* \return a hovered child item or \a parent_te (if no hovered child found).
*/
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x)
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops, const TreeElement *parent_te, float view_co_x)
{
- if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) { /* if parent_te is opened, it doesn't show childs in row */
+ /* if parent_te is opened, it doesn't show childs in row */
+ if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) {
/* no recursion, items can only display their direct children in the row */
for (TreeElement *child_te = parent_te->subtree.first;
- child_te && view_co_x >= child_te->xs; /* don't look further if co_x is smaller than child position*/
+ /* don't look further if co_x is smaller than child position*/
+ child_te && view_co_x >= child_te->xs;
+
child_te = child_te->next)
{
if ((child_te->flag & TE_ICONROW) && (view_co_x > child_te->xs) && (view_co_x < child_te->xend)) {
@@ -119,7 +116,7 @@ TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te,
}
/* tse is not in the treestore, we use its contents to find a match */
-TreeElement *outliner_find_tse(SpaceOops *soops, const TreeStoreElem *tse)
+TreeElement *outliner_find_tse(SpaceOutliner *soops, const TreeStoreElem *tse)
{
TreeStoreElem *tselem;
@@ -134,7 +131,7 @@ TreeElement *outliner_find_tse(SpaceOops *soops, const TreeStoreElem *tse)
}
/* Find treestore that refers to given ID */
-TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, const ID *id)
+TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id)
{
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -188,7 +185,7 @@ TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone)
return NULL;
}
-ID *outliner_search_back(SpaceOops *UNUSED(soops), TreeElement *te, short idcode)
+ID *outliner_search_back(SpaceOutliner *UNUSED(soops), TreeElement *te, short idcode)
{
TreeStoreElem *tselem;
te = te->parent;
@@ -209,7 +206,7 @@ ID *outliner_search_back(SpaceOops *UNUSED(soops), TreeElement *te, short idcode
* \param filter_tselem_flag: Same as \a filter_te_flag, but for the TreeStoreElem.
* \param func: Custom callback to execute for each visited item.
*/
-bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
+bool outliner_tree_traverse(const SpaceOutliner *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
TreeTraversalFunc func, void *customdata)
{
for (TreeElement *te = tree->first, *te_next; te; te = te_next) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 95225774ddf..3d79a15a5a0 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/space_outliner.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
@@ -51,8 +44,6 @@
#include "WM_message.h"
#include "WM_types.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "DNA_scene_types.h"
@@ -180,7 +171,7 @@ static void outliner_main_region_listener(
ED_region_tag_redraw(ar);
break;
case NC_LAMP:
- /* For updating lamp icons, when changing lamp type */
+ /* For updating light icons, when changing light type */
if (wmn->data == ND_LIGHTING_DRAW)
ED_region_tag_redraw(ar);
break;
@@ -228,6 +219,11 @@ static void outliner_main_region_listener(
ED_region_tag_redraw(ar);
}
break;
+ case NC_MASK:
+ if (ELEM(wmn->action, NA_ADDED)) {
+ ED_region_tag_redraw(ar);
+ }
+ break;
}
}
@@ -238,7 +234,7 @@ static void outliner_main_region_message_subscribe(
struct bScreen *UNUSED(screen), struct ScrArea *sa, struct ARegion *ar,
struct wmMsgBus *mbus)
{
- SpaceOops *soops = sa->spacedata.first;
+ SpaceOutliner *soops = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
@@ -290,9 +286,9 @@ static void outliner_header_region_listener(
static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *ar;
- SpaceOops *soutliner;
+ SpaceOutliner *soutliner;
- soutliner = MEM_callocN(sizeof(SpaceOops), "initoutliner");
+ soutliner = MEM_callocN(sizeof(SpaceOutliner), "initoutliner");
soutliner->spacetype = SPACE_OUTLINER;
soutliner->filter_id_type = ID_GR;
@@ -315,7 +311,7 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
/* not spacelink itself */
static void outliner_free(SpaceLink *sl)
{
- SpaceOops *soutliner = (SpaceOops *)sl;
+ SpaceOutliner *soutliner = (SpaceOutliner *)sl;
outliner_free_tree(&soutliner->tree);
if (soutliner->treestore) {
@@ -334,8 +330,8 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static SpaceLink *outliner_duplicate(SpaceLink *sl)
{
- SpaceOops *soutliner = (SpaceOops *)sl;
- SpaceOops *soutlinern = MEM_dupallocN(soutliner);
+ SpaceOutliner *soutliner = (SpaceOutliner *)sl;
+ SpaceOutliner *soutlinern = MEM_dupallocN(soutliner);
BLI_listbase_clear(&soutlinern->tree);
soutlinern->treestore = NULL;
@@ -346,7 +342,7 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
static void outliner_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceOops *so = (SpaceOops *)slink;
+ SpaceOutliner *so = (SpaceOutliner *)slink;
/* Some early out checks. */
if (!TREESTORE_ID_TYPE(old_id)) {
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 2eb31576c57..5d950a3558d 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index ee8dcf0ca9a..4b5cd6b7166 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_edit.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
@@ -33,10 +26,10 @@
#include <stdio.h>
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
#include "BKE_context.h"
#include "BKE_report.h"
-#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -96,13 +89,14 @@ static bool script_test_modal_operators(bContext *C)
wm = CTX_wm_manager(C);
for (win = wm->windows.first; win; win = win->next) {
- wmEventHandler *handler;
-
- for (handler = win->modalhandlers.first; handler; handler = handler->next) {
- if (handler->op) {
- wmOperatorType *ot = handler->op->type;
- if (ot->ext.srna) {
- return true;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op != NULL) {
+ wmOperatorType *ot = handler->op->type;
+ if (ot->ext.srna) {
+ return true;
+ }
}
}
}
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index 649992fec4f..c6f72784b05 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_intern.h
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
#ifndef __SCRIPT_INTERN_H__
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 90eb38db7f7..3f800117346 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_ops.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index e3ae8accb67..45d6151e7b2 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/space_script.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
@@ -43,7 +36,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 6b8108a1265..7d76fa1af5c 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index a9ae158d162..ba4ff6e82d7 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_add.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <stdlib.h>
@@ -45,7 +39,6 @@
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
@@ -93,18 +86,26 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
{
PropertyRNA *prop;
- if (flag & SEQPROP_STARTFRAME)
- RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
+ if (flag & SEQPROP_STARTFRAME) {
+ RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX,
+ "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
+ }
- if (flag & SEQPROP_ENDFRAME)
- RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */
+ if (flag & SEQPROP_ENDFRAME) {
+ /* not usual since most strips have a fixed length */
+ RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX,
+ "End Frame", "End frame for the color strip", INT_MIN, INT_MAX);
+ }
- RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
+ RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ,
+ "Channel", "Channel to place this strip into", 1, MAXSEQ);
- RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection");
+ RNA_def_boolean(ot->srna, "replace_sel", 1,
+ "Replace Selection", "Replace the current selection");
/* only for python scripts which import strips and place them after */
- prop = RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
+ prop = RNA_def_boolean(ot->srna, "overlap", 0,
+ "Allow Overlap", "Don't correct overlap on new sequence strips");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -190,11 +191,13 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
seq_load->len = 1; // images only, if endframe isn't set!
if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) {
- RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */
+ /* full path, file is set by the caller */
+ RNA_property_string_get(op->ptr, prop, seq_load->path);
is_file = 1;
}
else if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
- RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */
+ /* full path, file is set by the caller */
+ RNA_property_string_get(op->ptr, prop, seq_load->path);
is_file = 0;
}
@@ -249,7 +252,8 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
seq_load->views_format = imf->views_format;
seq_load->flag |= SEQ_USE_VIEWS;
- /* operator custom data is always released after the SeqLoadInfo, no need to handle the memory here */
+ /* operator custom data is always released after the SeqLoadInfo,
+ * no need to handle the memory here */
seq_load->stereo3d_format = &imf->stereo3d_format;
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index a4bca555490..c1b70a7f14a 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_buttons.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <string.h>
@@ -31,12 +27,13 @@
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
#include "BLT_translation.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_screen.h"
@@ -46,6 +43,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
#include "sequencer_intern.h"
@@ -61,11 +60,51 @@ static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNU
}
#endif
-void sequencer_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
+ if (space_sequencer == NULL) {
+ return false;
+ }
+ return ED_space_sequencer_check_show_imbuf(space_sequencer);
+}
+
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
+{
+ /* Image buffer can not be acquired during render, similar to
+ * draw_image_seq(). */
+ if (G.is_rendering) {
+ return;
+ }
+ struct Main *bmain = CTX_data_main(C);
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct Scene *scene = CTX_data_scene(C);
+ SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
+ /* NOTE: We can only reliably show metadata for the original (current)
+ * frame when split view is used. */
+ const bool show_split = (
+ scene->ed &&
+ (scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) &&
+ (space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF));
+ if (show_split &&
+ space_sequencer->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)
+ {
+ return;
+ }
+ /* NOTE: We disable multiview for drawing, since we don't know what is the
+ * from the panel (is kind of all the views?). */
+ ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, space_sequencer, scene->r.cfra, 0, "");
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ IMB_freeImBuf(ibuf);
+ }
+}
+
+void sequencer_buttons_register(ARegionType *art)
{
-#if 0
PanelType *pt;
+#if 0
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
strcpy(pt->idname, "SEQUENCER_PT_gpencil");
strcpy(pt->label, N_("Grease Pencil"));
@@ -75,6 +114,15 @@ void sequencer_buttons_register(ARegionType *UNUSED(art))
pt->poll = sequencer_grease_pencil_panel_poll;
BLI_addtail(&art->paneltypes, pt);
#endif
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel metadata");
+ strcpy(pt->idname, "SEQUENCER_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
/* **************** operator to open/close properties view ************* */
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index d91ade75807..aed5f338d39 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_draw.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -48,7 +42,6 @@
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_sequencer.h"
#include "BKE_sound.h"
#include "BKE_scene.h"
@@ -56,7 +49,6 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -257,7 +249,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample - startsample) * stepsize / (x2 - x1);
- length = min_ii(floor((waveform->length - startsample) / samplestep), length);
+ length = min_ii(floor((waveform->length - startsample) / samplestep - (x1_offset - x1) / stepsize), length);
if (length < 2) {
return;
@@ -285,7 +277,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
value2 = waveform->data[j * 3 + 1];
}
}
- else {
+ else if (p + 1 < waveform->length) {
/* use simple linear interpolation */
float f = sampleoffset - p;
value1 = (1.0f - f) * value1 + f * waveform->data[p * 3 + 3];
@@ -396,7 +388,9 @@ static float draw_seq_handle_size_get_clamped(Sequence *seq, const float pixelx)
}
/* draw a handle, for each end of a sequence strip */
-static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, const short direction, unsigned int pos)
+static void draw_seq_handle(
+ View2D *v2d, Sequence *seq, const float handsize_clamped,
+ const short direction, unsigned int pos)
{
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
float x1, x2, y1, y2;
@@ -486,7 +480,10 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
}
/* draw info text on a sequence strip */
-static void draw_seq_text(View2D *v2d, SpaceSeq *sseq, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
+static void draw_seq_text(
+ View2D *v2d, SpaceSeq *sseq, Sequence *seq,
+ float x1, float x2, float y1, float y2,
+ const unsigned char background_col[3])
{
rctf rect;
char str[32 + FILE_MAX];
@@ -648,7 +645,8 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
immUniformColor3ubvAlpha(col, col[3] + 50);
- imm_draw_box_wire_2d(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); /* outline */
+ /* outline */
+ imm_draw_box_wire_2d(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
}
if (seq->endofs) {
immUniformColor4ubv(col);
@@ -656,7 +654,8 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
immUniformColor3ubvAlpha(col, col[3] + 50);
- imm_draw_box_wire_2d(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); /* outline */
+ /* outline */
+ imm_draw_box_wire_2d(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
}
if (seq->startofs || seq->endofs) {
@@ -703,7 +702,9 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
* ARegion is currently only used to get the windows width in pixels
* so wave file sample drawing precision is zoom adjusted
*/
-static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
+static void draw_seq_strip(
+ const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq,
+ int outline_tint, float pixelx)
{
View2D *v2d = &ar->v2d;
float x1, x2, y1, y2;
@@ -991,30 +992,13 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop
return scope;
}
-static void sequencer_display_size(Scene *scene, SpaceSeq *sseq, float r_viewrect[2])
+static void sequencer_display_size(Scene *scene, float r_viewrect[2])
{
- float render_size, proxy_size;
-
- if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_SCENE) {
- render_size = (float)scene->r.size / 100.0f;
- proxy_size = 1.0f;
- }
- else {
- render_size = (float)sseq->render_size / 100.0f;
- proxy_size = render_size;
- }
-
- r_viewrect[0] = (render_size * (float)scene->r.xsch);
- r_viewrect[1] = (render_size * (float)scene->r.ysch);
+ r_viewrect[0] = (float)scene->r.xsch;
+ r_viewrect[1] = (float)scene->r.ysch;
- /* rectx = viewrectx + 0.5f; */ /* UNUSED */
- /* recty = viewrecty + 0.5f; */ /* UNUSED */
-
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- r_viewrect[0] *= scene->r.xasp / scene->r.yasp;
- r_viewrect[0] /= proxy_size;
- r_viewrect[1] /= proxy_size;
- }
+ /* Aspect ratio seems to have no effect on output image*/
+ /* r_viewrect[0] *= scene->r.xasp / scene->r.yasp; */
}
static void sequencer_draw_gpencil(const bContext *C)
@@ -1075,43 +1059,105 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
immUnbindProgram();
}
-/* draws checkerboard background for transparent content */
-static void sequencer_draw_background(
- const SpaceSeq *sseq, View2D *v2d, const float viewrect[2], const bool draw_overlay)
+#if 0
+void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq)
{
- /* setting up the view */
- UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
- UI_view2d_curRect_validate(v2d);
- UI_view2d_view_ortho(v2d);
+ /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
+ * for now just disable drawing since the strip frame will likely be offset */
- /* only draw alpha for main buffer */
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- if ((sseq->flag & SEQ_USE_ALPHA) && !draw_overlay) {
- imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
+ // if (sc->mode == SC_MODE_MASKEDIT)
+ if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+ Mask *mask = BKE_sequencer_mask_get(scene);
+
+ if (mask) {
+ int width, height;
+ float aspx = 1.0f, aspy = 1.0f;
+ // ED_mask_get_size(C, &width, &height);
+
+ //Scene *scene = CTX_data_scene(C);
+ width = (scene->r.size * scene->r.xsch) / 100;
+ height = (scene->r.size * scene->r.ysch) / 100;
+
+ ED_mask_draw_region(mask, ar,
+ 0, 0, 0, /* TODO */
+ width, height,
+ aspx, aspy,
+ false, true,
+ NULL, C);
}
}
}
+#endif
-void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, bool draw_overlay, bool draw_backdrop)
+static void *sequencer_OCIO_transform_ibuf(const bContext *C, ImBuf *ibuf, bool *glsl_used, int *format, int *type)
{
- struct Main *bmain = CTX_data_main(C);
- struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
- struct ImBuf *ibuf = NULL;
- struct ImBuf *scope = NULL;
- struct View2D *v2d = &ar->v2d;
- /* int rectx, recty; */ /* UNUSED */
- float viewrect[2];
- float col[3];
- GLuint texid;
void *display_buffer;
void *cache_handle = NULL;
- const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
- int format, type;
- bool glsl_used = false;
- const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
- const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
- bool draw_metadata = false;
+ bool force_fallback = false;
+ *glsl_used = false;
+ force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
+ force_fallback |= (ibuf->dither != 0.0f);
+
+ if (force_fallback) {
+ /* Fallback to CPU based color space conversion */
+ *glsl_used = false;
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ display_buffer = NULL;
+ }
+ else if (ibuf->rect_float) {
+ display_buffer = ibuf->rect_float;
+
+ if (ibuf->channels == 4) {
+ *format = GL_RGBA;
+ }
+ else if (ibuf->channels == 3) {
+ *format = GL_RGB;
+ }
+ else {
+ BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
+ *format = GL_RGBA;
+ display_buffer = NULL;
+ }
+
+ *type = GL_FLOAT;
+ if (ibuf->float_colorspace) {
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, ibuf->dither, true);
+ }
+ else {
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
+ }
+ }
+ else if (ibuf->rect) {
+ display_buffer = ibuf->rect;
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, ibuf->dither, false);
+ }
+ else {
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ display_buffer = NULL;
+ }
+
+ /* there's a data to be displayed, but GLSL is not initialized
+ * properly, in this case we fallback to CPU-based display transform
+ */
+ if ((ibuf->rect || ibuf->rect_float) && !*glsl_used) {
+ display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ }
+ if (cache_handle)
+ IMB_display_buffer_release(cache_handle);
+
+ return display_buffer;
+}
+
+static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
+{
if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
/* stop all running jobs, except screen one. currently previews frustrate Render
* needed to make so sequencer's rendering doesn't conflict with compositor
@@ -1123,104 +1169,56 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
*/
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_RENDER_PREVIEW);
}
+}
- if ((!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) && !draw_backdrop) {
- UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
- GPU_clear_color(col[0], col[1], col[2], 0.0);
- GPU_clear(GPU_COLOR_BIT);
- }
-
- /* only initialize the preview if a render is in progress */
- if (G.is_rendering)
- return;
-
- if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
- return;
- }
-
- /* for now we only support Left/Right */
- ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
+static void sequencer_preview_clear(void)
+{
+ float col[3];
- if ((ibuf == NULL) ||
- (ibuf->rect == NULL && ibuf->rect_float == NULL))
- {
- sequencer_display_size(scene, sseq, viewrect);
+ UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
+}
- sequencer_draw_background(sseq, v2d, viewrect, false);
- sequencer_draw_borders(sseq, v2d, scene);
+static void sequencer_preview_get_rect(
+ rctf *preview, Scene *scene, ARegion *ar, SpaceSeq *sseq,
+ bool draw_overlay, bool draw_backdrop)
+{
+ struct View2D *v2d = &ar->v2d;
+ float viewrect[2];
- /* gpencil can also be drawn without a valid imbuf */
- if ((draw_gpencil && is_imbuf) && !draw_overlay) {
- sequencer_draw_gpencil(C);
- }
+ sequencer_display_size(scene, viewrect);
+ BLI_rctf_init(preview, -1.0f, 1.0f, -1.0f, 1.0f);
- return;
+ if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
+ preview->xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
+ preview->xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
+ preview->ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
+ preview->ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
}
+ else if (draw_backdrop) {
+ float aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
+ float image_aspect = viewrect[0] / viewrect[1];
- sequencer_display_size(scene, sseq, viewrect);
-
- if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
- SequencerScopes *scopes = &sseq->scopes;
-
- sequencer_check_scopes(scopes, ibuf);
-
- switch (sseq->mainb) {
- case SEQ_DRAW_IMG_IMBUF:
- if (!scopes->zebra_ibuf) {
- ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
-
- if (display_ibuf->rect_float) {
- IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
- &scene->display_settings);
- }
- scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
- IMB_freeImBuf(display_ibuf);
- }
- scope = scopes->zebra_ibuf;
- break;
- case SEQ_DRAW_IMG_WAVEFORM:
- if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
- if (!scopes->sep_waveform_ibuf)
- scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
- scope = scopes->sep_waveform_ibuf;
- }
- else {
- if (!scopes->waveform_ibuf)
- scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
- scope = scopes->waveform_ibuf;
- }
- break;
- case SEQ_DRAW_IMG_VECTORSCOPE:
- if (!scopes->vector_ibuf)
- scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
- scope = scopes->vector_ibuf;
- break;
- case SEQ_DRAW_IMG_HISTOGRAM:
- if (!scopes->histogram_ibuf)
- scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
- scope = scopes->histogram_ibuf;
- break;
- }
-
- /* future files may have new scopes we don't catch above */
- if (scope) {
- scopes->reference_ibuf = ibuf;
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- /* scopes drawn in image preview use viewrect from orig ibuf - currently that's only zebra */
- }
- else {
- viewrect[0] = scope->x;
- viewrect[1] = scope->y;
- }
+ if (aspect >= image_aspect) {
+ preview->xmax = image_aspect / aspect;
+ preview->xmin = -preview->xmax;
}
else {
- scopes->reference_ibuf = NULL;
+ preview->ymax = aspect / image_aspect;
+ preview->ymin = -preview->ymax;
}
}
-
- if (!draw_backdrop) {
- sequencer_draw_background(sseq, v2d, viewrect, draw_overlay);
+ else {
+ *preview = v2d->tot;
}
+}
+
+static void sequencer_draw_display_buffer(
+ const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, ImBuf *ibuf, ImBuf *scope,
+ bool draw_overlay, bool draw_backdrop)
+{
+ void *display_buffer;
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
GPU_blend(true);
@@ -1230,12 +1228,14 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* Format needs to be created prior to any immBindProgram call.
* Do it here because OCIO binds it's own shader.
*/
+ int format, type;
+ bool glsl_used = false;
+ GLuint texid;
GPUVertFormat *imm_format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(imm_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
uint texCoord = GPU_vertformat_attr_add(imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
if (scope) {
- IMB_freeImBuf(ibuf);
ibuf = scope;
if (ibuf->rect_float && ibuf->rect == NULL) {
@@ -1247,83 +1247,28 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
type = GL_UNSIGNED_BYTE;
}
else {
- bool force_fallback = false;
-
- force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
- force_fallback |= (ibuf->dither != 0.0f);
-
- if (force_fallback) {
- /* Fallback to CPU based color space conversion */
- glsl_used = false;
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- display_buffer = NULL;
- }
- else if (ibuf->rect_float) {
- display_buffer = ibuf->rect_float;
-
- if (ibuf->channels == 4) {
- format = GL_RGBA;
- }
- else if (ibuf->channels == 3) {
- format = GL_RGB;
- }
- else {
- BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
- format = GL_RGBA;
- display_buffer = NULL;
- }
-
- type = GL_FLOAT;
-
- if (ibuf->float_colorspace) {
- glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, ibuf->dither, true);
- }
- else {
- glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
- }
- }
- else if (ibuf->rect) {
- display_buffer = ibuf->rect;
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
-
- glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, ibuf->dither, false);
- }
- else {
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- display_buffer = NULL;
- }
-
- /* there's a data to be displayed, but GLSL is not initialized
- * properly, in this case we fallback to CPU-based display transform
- */
- if ((ibuf->rect || ibuf->rect_float) && !glsl_used) {
- display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- }
+ display_buffer = sequencer_OCIO_transform_ibuf(C, ibuf, &glsl_used, &format, &type);
}
if (draw_backdrop) {
- /* XXX: need to load identity projection too? */
GPU_matrix_push();
GPU_matrix_identity_set();
+ GPU_matrix_push_projection();
+ GPU_matrix_identity_projection_set();
}
glGenTextures(1, (GLuint *)&texid);
-
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texid);
-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- if (type == GL_FLOAT)
+ if (type == GL_FLOAT) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, ibuf->x, ibuf->y, 0, format, type, display_buffer);
- else
+ }
+ else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer);
+ }
if (!glsl_used) {
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
@@ -1333,153 +1278,176 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
immBegin(GPU_PRIM_TRI_FAN, 4);
- if (draw_overlay) {
- if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
- rctf tot_clip;
- tot_clip.xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
- tot_clip.ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
- tot_clip.xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
- tot_clip.ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymin);
- immVertex2f(pos, tot_clip.xmin, tot_clip.ymin);
-
- immAttr2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymax);
- immVertex2f(pos, tot_clip.xmin, tot_clip.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymax);
- immVertex2f(pos, tot_clip.xmax, tot_clip.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymin);
- immVertex2f(pos, tot_clip.xmax, tot_clip.ymin);
- }
- else if (sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymin);
-
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymax);
-
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymax);
-
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymin);
- }
- }
- else if (draw_backdrop) {
- float aspect;
- float image_aspect = viewrect[0] / viewrect[1];
- float imagex, imagey;
-
- aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
-
- if (aspect >= image_aspect) {
- imagex = image_aspect / aspect;
- imagey = 1.0f;
- }
- else {
- imagex = 1.0f;
- imagey = aspect / image_aspect;
- }
-
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, -imagex, -imagey);
-
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, -imagex, imagey);
+ rctf preview;
+ rctf canvas;
+ sequencer_preview_get_rect(&preview, scene, ar, sseq, draw_overlay, draw_backdrop);
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, imagex, imagey);
-
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, imagex, -imagey);
+ if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
+ canvas = scene->ed->over_border;
}
else {
- draw_metadata = ((sseq->flag & SEQ_SHOW_METADATA) != 0);
+ BLI_rctf_init(&canvas, 0.0f, 1.0f, 0.0f, 1.0f);
+ }
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymin);
+ immAttr2f(texCoord, canvas.xmin, canvas.ymin);
+ immVertex2f(pos, preview.xmin, preview.ymin);
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymax);
+ immAttr2f(texCoord, canvas.xmin, canvas.ymax);
+ immVertex2f(pos, preview.xmin, preview.ymax);
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymax);
+ immAttr2f(texCoord, canvas.xmax, canvas.ymax);
+ immVertex2f(pos, preview.xmax, preview.ymax);
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymin);
- }
+ immAttr2f(texCoord, canvas.xmax, canvas.ymin);
+ immVertex2f(pos, preview.xmax, preview.ymin);
immEnd();
-
glBindTexture(GL_TEXTURE_2D, 0);
+ glDeleteTextures(1, &texid);
if (!glsl_used) {
immUnbindProgram();
}
+ else {
+ IMB_colormanagement_finish_glsl_draw();
+ }
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
GPU_blend(false);
}
- glDeleteTextures(1, &texid);
+ if (draw_backdrop) {
+ GPU_matrix_pop();
+ GPU_matrix_pop_projection();
+ }
+}
- if (glsl_used)
- IMB_colormanagement_finish_glsl_draw();
+static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, bool draw_backdrop)
+{
+ struct ImBuf *scope = NULL;
+ SequencerScopes *scopes = &sseq->scopes;
- if (cache_handle)
- IMB_display_buffer_release(cache_handle);
+ if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
+ sequencer_check_scopes(scopes, ibuf);
- if (!scope)
- IMB_freeImBuf(ibuf);
- if (draw_metadata) {
- ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
+ switch (sseq->mainb) {
+ case SEQ_DRAW_IMG_IMBUF:
+ if (!scopes->zebra_ibuf) {
+ ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
+
+ if (display_ibuf->rect_float) {
+ IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
+ &scene->display_settings);
+ }
+ scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
+ IMB_freeImBuf(display_ibuf);
+ }
+ scope = scopes->zebra_ibuf;
+ break;
+ case SEQ_DRAW_IMG_WAVEFORM:
+ if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
+ if (!scopes->sep_waveform_ibuf)
+ scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
+ scope = scopes->sep_waveform_ibuf;
+ }
+ else {
+ if (!scopes->waveform_ibuf)
+ scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
+ scope = scopes->waveform_ibuf;
+ }
+ break;
+ case SEQ_DRAW_IMG_VECTORSCOPE:
+ if (!scopes->vector_ibuf)
+ scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
+ scope = scopes->vector_ibuf;
+ break;
+ case SEQ_DRAW_IMG_HISTOGRAM:
+ if (!scopes->histogram_ibuf)
+ scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
+ scope = scopes->histogram_ibuf;
+ break;
+ }
+
+ /* future files may have new scopes we don't catch above */
+ if (scope) {
+ scopes->reference_ibuf = ibuf;
+ }
}
+ return scope;
+}
- if (draw_backdrop) {
- GPU_matrix_pop();
+void sequencer_draw_preview(
+ const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq,
+ int cfra, int frame_ofs,
+ bool draw_overlay, bool draw_backdrop)
+{
+ struct Main *bmain = CTX_data_main(C);
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct View2D *v2d = &ar->v2d;
+ struct ImBuf *ibuf = NULL;
+ struct ImBuf *scope = NULL;
+ float viewrect[2];
+ const bool show_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
+ const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
+ const char *names[2] = { STEREO_LEFT_NAME, STEREO_RIGHT_NAME };
+
+ sequencer_stop_running_jobs(C, scene);
+ if (G.is_rendering) {
return;
}
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- sequencer_draw_borders(sseq, v2d, scene);
+ if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
+ sequencer_preview_clear();
+ return;
}
- if (draw_gpencil && is_imbuf) {
- sequencer_draw_gpencil(C);
- }
- else {
- /* ortho at pixel level */
- UI_view2d_view_restore(C);
+ /* Setup view */
+ sequencer_display_size(scene, viewrect);
+ UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
+ UI_view2d_curRect_validate(v2d);
+ UI_view2d_view_ortho(v2d);
+
+ /* Draw background */
+ if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) {
+ sequencer_preview_clear();
+
+ if (sseq->flag & SEQ_USE_ALPHA) {
+ imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
+ }
}
+ /* Get image */
+ ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
+ if (ibuf) {
+ scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
- /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
- * for now just disable drawing since the strip frame will likely be offset */
+ /* Draw image */
+ sequencer_draw_display_buffer(C, scene, ar, sseq, ibuf, scope, draw_overlay, draw_backdrop);
- // if (sc->mode == SC_MODE_MASKEDIT)
- if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- Mask *mask = BKE_sequencer_mask_get(scene);
+ /* Draw over image */
+ if (sseq->flag & SEQ_SHOW_METADATA) {
+ ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
+ }
+ }
- if (mask) {
- int width, height;
- float aspx = 1.0f, aspy = 1.0f;
- // ED_mask_get_size(C, &width, &height);
+ if (draw_gpencil && show_imbuf) {
+ sequencer_draw_gpencil(C);
+ }
- //Scene *scene = CTX_data_scene(C);
- width = (scene->r.size * scene->r.xsch) / 100;
- height = (scene->r.size * scene->r.ysch) / 100;
+ if (show_imbuf) {
+ sequencer_draw_borders(sseq, v2d, scene);
+ }
- ED_mask_draw_region(mask, ar,
- 0, 0, 0, /* TODO */
- width, height,
- aspx, aspy,
- false, true,
- NULL, C);
- }
+ /* TODO */
+ /* sequencer_draw_maskedit(C, scene, ar, sseq); */
+
+ /* Scope is freed in sequencer_check_scopes when ibuf changes and scope image is to be replaced. */
+ if (ibuf) {
+ IMB_freeImBuf(ibuf);
}
+
+ UI_view2d_view_restore(C);
}
#if 0
@@ -1564,7 +1532,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* loop through twice, first unselected, then selected */
for (j = 0; j < 2; j++) {
Sequence *seq;
- int outline_tint = (j) ? 40 : -40; /* highlighting around strip edges indicating selection */
+ /* highlighting around strip edges indicating selection */
+ int outline_tint = (j) ? -60 : -150;
/* loop through strips, checking for those that are visible */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@@ -1584,7 +1553,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
sel = SELECT;
}
- /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
+ /* draw the last selected last (i.e. 'active' in other parts of Blender),
+ * removes some overlapping error */
if (last_seq)
draw_seq_strip(C, sseq, scene, ar, last_seq, 120, pixelx);
@@ -1701,7 +1671,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* Only draw backdrop in pure sequence view. */
if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) {
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
UI_view2d_view_ortho(v2d);
}
@@ -1725,7 +1695,11 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_LINES | DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (sseq->flag & SEQ_SHOW_MARKER_LINES) {
+ marker_draw_flag |= DRAW_MARKERS_LINES;
+ }
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index e55b8d17cd4..3c6e2abee12 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** begin GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_edit.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -51,7 +45,7 @@
#include "BKE_report.h"
#include "BKE_sequencer.h"
#include "BKE_sound.h"
-
+#include "BKE_library.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -95,7 +89,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
{SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* mute operator */
@@ -107,13 +101,13 @@ EnumPropertyItem prop_side_types[] = {
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", "" },
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
{SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_side_lr_types[] = {
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
typedef struct TransSeq {
@@ -402,9 +396,11 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
handsize = seq->handsize;
displen = (float)abs(seq->startdisp - seq->enddisp);
- if (displen / pixelx > 16) { /* don't even try to grab the handles of small strips */
- /* Set the max value to handle to 1/3 of the total len when its less than 28.
- * This is important because otherwise selecting handles happens even when you click in the middle */
+ /* don't even try to grab the handles of small strips */
+ if (displen / pixelx > 16) {
+ /* Set the max value to handle to 1/3 of the total len when its
+ * less than 28. This is important because otherwise selecting
+ * handles happens even when you click in the middle. */
if ((displen / 3) < 30 * pixelx) {
handsize = displen / 3;
@@ -667,7 +663,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
}
-static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
+static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
@@ -739,7 +735,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_ANIM);
+ seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -788,7 +784,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
return seqn;
}
-static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
+static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
@@ -848,7 +844,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_ANIM);
+ seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -900,7 +896,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
*/
static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
- Sequence * (*cut_seq)(Scene *, Sequence *, int))
+ Sequence * (*cut_seq)(Scene *, Sequence *, ListBase *, int))
{
Sequence *seq, *seq_next_iter;
Sequence *seq_first_new = NULL;
@@ -914,9 +910,8 @@ static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
if (cutframe > seq->startdisp &&
cutframe < seq->enddisp)
{
- Sequence *seqn = cut_seq(scene, seq, cutframe);
+ Sequence *seqn = cut_seq(scene, seq, slist, cutframe);
if (seqn) {
- BLI_addtail(slist, seqn);
if (seq_first_new == NULL) {
seq_first_new = seqn;
}
@@ -2045,7 +2040,7 @@ void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
static const EnumPropertyItem prop_cut_types[] = {
{SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""},
{SEQ_CUT_HARD, "HARD", 0, "Hard", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int sequencer_cut_exec(bContext *C, wmOperator *op)
@@ -2089,7 +2084,6 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
SEQP_BEGIN (ed, seq)
{
- BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
if (seq->seq1 || seq->seq2 || seq->seq3) {
BKE_sequence_calc(scene, seq);
}
@@ -2391,8 +2385,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new seq */
se = BKE_sequencer_give_stripelem(seq, cfra);
- seq_new = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
- BLI_addtail(ed->seqbasep, seq_new);
+ seq_new = BKE_sequence_dupli_recursive(scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME);
seq_new->start = start_ofs;
seq_new->type = SEQ_TYPE_IMAGE;
@@ -2404,7 +2397,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
strip_new->us = 1;
/* new stripdata (only one element now!) */
- /* Note this assume all elements (images) have the same dimension, since we only copy the name here. */
+ /* Note this assume all elements (images) have the same dimension,
+ * since we only copy the name here. */
se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new));
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
strip_new->stripdata = se_new;
@@ -2846,7 +2840,7 @@ static const EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -3207,6 +3201,7 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
static int sequencer_copy_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
@@ -3219,7 +3214,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME, 0);
+ BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME, LIB_ID_CREATE_NO_USER_REFCOUNT);
/* To make sure the copied strips have unique names between each other add
* them temporarily to the end of the original seqbase. (bug 25932)
@@ -3244,16 +3239,14 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
seqbase_clipboard_frame = scene->r.cfra;
/* Need to remove anything that references the current scene */
- {
- Sequence *seq;
- for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
- seq_copy_del_sound(scene, seq);
- }
-
- /* duplicate pointers */
- BKE_sequencer_base_clipboard_pointers_store(&seqbase_clipboard);
+ for (Sequence *seq = seqbase_clipboard.first; seq; seq = seq->next) {
+ seq_copy_del_sound(scene, seq);
}
+ /* Replace datablock pointers with copies, to keep things working in case
+ * datablocks get deleted or another .blend file is openeded. */
+ BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard);
+
return OPERATOR_FINISHED;
}
@@ -3285,7 +3278,12 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
ED_sequencer_deselect_all(scene);
ofs = scene->r.cfra - seqbase_clipboard_frame;
+ /* Copy strips, temporarily restoring pointers to actual datablocks. This
+ * must happen on the clipboard itself, so that copying does user counting
+ * on the actual datablocks. */
+ BKE_sequencer_base_clipboard_pointers_restore(&seqbase_clipboard, bmain);
BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME, 0);
+ BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard);
/* transform pasted strips before adding */
if (ofs) {
@@ -3294,8 +3292,6 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- BKE_sequencer_base_clipboard_pointers_restore(&nseqbase, bmain);
-
for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
BKE_sequence_sound_init(scene, iseq);
}
@@ -3583,7 +3579,7 @@ void SEQUENCER_OT_enable_proxies(wmOperatorType *ot)
/* identifiers */
ot->name = "Set Selected Strip Proxies";
ot->idname = "SEQUENCER_OT_enable_proxies";
- ot->description = "Enable selected proxies on all selected Movie strips";
+ ot->description = "Enable selected proxies on all selected Movie, Image and Meta strips";
/* api callbacks */
ot->invoke = sequencer_enable_proxies_invoke;
@@ -3605,7 +3601,7 @@ static const EnumPropertyItem prop_change_effect_input_types[] = {
{0, "A_B", 0, "A -> B", ""},
{1, "B_C", 0, "B -> C", ""},
{2, "A_C", 0, "A -> C", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
@@ -3689,7 +3685,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
}
else {
sh = BKE_sequence_get_effect(seq);
- sh.free(seq);
+ sh.free(seq, true);
seq->type = new_type;
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 0d647c883be..ad3ac79171c 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_intern.h
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#ifndef __SEQUENCER_INTERN_H__
@@ -36,18 +29,18 @@
/* internal exports only */
+struct ARegion;
+struct ARegionType;
struct Depsgraph;
+struct Main;
+struct Scene;
+struct ScrArea;
struct Sequence;
+struct SpaceSeq;
+struct StripElem;
struct bContext;
struct rctf;
-struct SpaceSeq;
-struct ScrArea;
-struct ARegion;
-struct ARegionType;
-struct Scene;
-struct Main;
struct wmOperator;
-struct StripElem;
/* space_sequencer.c */
struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
@@ -55,7 +48,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
+void sequencer_draw_preview(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
void color3ubv_from_seq(struct Scene *curscene, struct Sequence *seq, unsigned char col[3]);
void sequencer_special_update_set(Sequence *seq);
@@ -87,8 +80,8 @@ extern EnumPropertyItem sequencer_prop_effect_types[];
extern EnumPropertyItem prop_side_types[];
/* operators */
-struct wmOperatorType;
struct wmKeyConfig;
+struct wmOperatorType;
void SEQUENCER_OT_cut(struct wmOperatorType *ot);
void SEQUENCER_OT_slip(struct wmOperatorType *ot);
@@ -163,18 +156,18 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
enum {
SEQ_CUT_SOFT,
- SEQ_CUT_HARD
+ SEQ_CUT_HARD,
};
enum {
SEQ_SELECTED,
- SEQ_UNSELECTED
+ SEQ_UNSELECTED,
};
enum {
SEQ_SELECT_LR_NONE = 0,
SEQ_SELECT_LR_MOUSE,
SEQ_SELECT_LR_LEFT,
- SEQ_SELECT_LR_RIGHT
+ SEQ_SELECT_LR_RIGHT,
};
/* defines used internally */
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c
index 1b2357ef6a5..c3df5a0c5ee 100644
--- a/source/blender/editors/space_sequencer/sequencer_modifier.c
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_modifier.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -146,7 +139,7 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
enum {
SEQ_MODIFIER_MOVE_UP = 0,
- SEQ_MODIFIER_MOVE_DOWN
+ SEQ_MODIFIER_MOVE_DOWN,
};
static int strip_modifier_move_exec(bContext *C, wmOperator *op)
@@ -188,7 +181,7 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"},
{SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -262,7 +255,8 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot)
"Replace modifiers in destination"},
{SEQ_MODIFIER_COPY_APPEND, "APPEND", 0, "Append",
"Append active modifiers to selected strips"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Copy to Selected Strips";
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index cdba163f574..9a619dd0d9b 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_ops.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <stdlib.h>
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index ae011e48538..640d61a503b 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_preview.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include "DNA_sequence_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index 00811d68251..f93eaa5bce5 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,13 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Peter Schlaile < peter [at] schlaile [dot] de >
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/space_sequencer/sequencer_scopes.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -503,7 +498,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
memset(bins, 0, sizeof(bins));
- MakeHistogramViewData data = {.ibuf = ibuf, .bins = bins};
+ MakeHistogramViewData data = { .ibuf = ibuf, .bins = bins, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (ibuf->y >= 256);
@@ -588,7 +583,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
memset(bins, 0, sizeof(bins));
- MakeHistogramViewData data = {.ibuf = ibuf, .bins = bins};
+ MakeHistogramViewData data = { .ibuf = ibuf, .bins = bins, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (ibuf->y >= 256);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 433f1ca8ee5..2d035c70934 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_select.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -351,7 +345,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
marker->flag |= SELECT;
}
else {
- /* deselect_markers(0, 0); */ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */
+ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */
+ /* deselect_markers(0, 0); */
marker->flag |= SELECT;
}
@@ -554,7 +549,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
{SEQ_SELECT_LR_MOUSE, "MOUSE", 0, "Mouse", "Use mouse position for selection"},
{SEQ_SELECT_LR_LEFT, "LEFT", 0, "Left", "Select left"},
{SEQ_SELECT_LR_RIGHT, "RIGHT", 0, "Right", "Select right"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -964,7 +959,7 @@ static const EnumPropertyItem sequencer_prop_select_grouped_types[] = {
{SEQ_SELECT_GROUP_EFFECT_LINK, "EFFECT_LINK", 0, "Effect/Linked",
"Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
{SEQ_SELECT_GROUP_OVERLAP, "OVERLAP", 0, "Overlap", "Overlapping time"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define SEQ_IS_SOUND(_seq) ((_seq->type & SEQ_TYPE_SOUND_RAM) && !(_seq->type & SEQ_TYPE_EFFECT))
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index fb4ef3e51ab..d500a9a081d 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_view.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 4e10ed62366..dec70c4bf43 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/space_sequencer.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -123,7 +116,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene)
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
- sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA;
+ sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKER_LINES;
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
@@ -439,6 +432,7 @@ static void sequencer_dropboxes(void)
/* ************* end drop *********** */
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
+extern const char *sequencer_context_dir[]; /* quiet warning. */
const char *sequencer_context_dir[] = {"edit_mask", NULL};
static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -636,7 +630,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
if (!show_split || sseq->overlay_type != SEQ_DRAW_OVERLAY_REFERENCE)
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, false);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, false);
if (show_split && sseq->overlay_type != SEQ_DRAW_OVERLAY_CURRENT) {
int over_cfra;
@@ -647,14 +641,14 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
over_cfra = scene->r.cfra + scene->ed->over_ofs;
if (over_cfra != scene->r.cfra || sseq->overlay_type != SEQ_DRAW_OVERLAY_RECT)
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
}
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
rcti rect;
ED_region_visible_rect(ar, &rect);
int xoffset = rect.xmin + U.widget_unit;
- int yoffset = rect.xmax;
+ int yoffset = rect.ymax;
ED_scene_draw_fps(scene, xoffset, &yoffset);
}
}
diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt
index 31439942397..8440d410c31 100644
--- a/source/blender/editors/space_statusbar/CMakeLists.txt
+++ b/source/blender/editors/space_statusbar/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 35eb6c69585..e85d438e80d 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_statusbar/space_statusbar.c
- * \ingroup spstatusbar
+/** \file
+ * \ingroup spstatusbar
*/
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index 91420a5d63a..378f2e5d84f 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 8e04cd83fc5..cd5b3facfe9 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/space_text.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
@@ -45,7 +38,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 4f6a3bc82ba..65fb91893f3 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_autocomplete.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <ctype.h>
@@ -194,7 +190,8 @@ static GHash *text_autocomplete_build(Text *text)
str_sub[choice_len] = '\0';
if (!BLI_ghash_lookup(gh, str_sub)) {
char *str_dup = BLI_strdupn(str_sub, choice_len);
- BLI_ghash_insert(gh, str_dup, str_dup); /* A 'set' would make more sense here */
+ /* A 'set' would make more sense here */
+ BLI_ghash_insert(gh, str_dup, str_dup);
}
str_sub[choice_len] = str_sub_last;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index aa499d52589..87bbefdd365 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,16 +14,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_draw.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include "MEM_guardedalloc.h"
@@ -46,8 +38,6 @@
#include "ED_text.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -185,7 +175,6 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
* draw_end = pos+1
* pos += 1
* print line[draw_start:]
- *
*/
int wrap_width(const SpaceText *st, ARegion *ar)
@@ -562,13 +551,21 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
nlines = drawcache->nlines;
/* check if full cache update is needed */
- full_update |= drawcache->winx != ar->winx; /* area was resized */
- full_update |= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */
- full_update |= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */
- full_update |= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */
- full_update |= drawcache->lheight != st->lheight_dpi; /* word-wrapping option was toggled */
- full_update |= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */
- full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
+
+ /* area was resized */
+ full_update |= drawcache->winx != ar->winx;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->wordwrap != st->wordwrap;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->showlinenrs != st->showlinenrs;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->tabnumber != st->tabnumber;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->lheight != st->lheight_dpi;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->cwidth != st->cwidth;
+ /* text datablock was changed */
+ full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME);
if (st->wordwrap) {
/* update line heights */
@@ -798,24 +795,25 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
short barheight, barstart, hlstart, hlend, blank_lines;
short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff;
- pix_top_margin = 8;
- pix_bottom_margin = 4;
+ pix_top_margin = (0.4 * U.widget_unit);
+ pix_bottom_margin = (0.4 * U.widget_unit);
pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
ltexth = text_get_total_lines(st, ar);
blank_lines = st->viewlines / 2;
/* nicer code: use scroll rect for entire bar */
- back->xmin = ar->winx - (V2D_SCROLL_WIDTH + 1);
+ back->xmin = ar->winx - (0.6 * U.widget_unit);
back->xmax = ar->winx;
back->ymin = 0;
back->ymax = ar->winy;
- scroll->xmin = ar->winx - V2D_SCROLL_WIDTH;
- scroll->xmax = ar->winx - 5;
- scroll->ymin = 4;
- scroll->ymax = 4 + pix_available;
+ scroll->xmax = ar->winx - (0.2 * U.widget_unit);
+ scroll->xmin = scroll->xmax - (0.4 * U.widget_unit);
+ scroll->ymin = pix_top_margin;
+ scroll->ymax = pix_available;
- /* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
+ /* when re-sizing a view-port with the bar at the bottom to a greater height
+ * more blank lines will be added */
if (ltexth + blank_lines < st->top + st->viewlines) {
blank_lines = st->top + st->viewlines - ltexth;
}
diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c
index 7a36b4f3e9c..0f5dfed080c 100644
--- a/source/blender/editors/space_text/text_format.c
+++ b/source/blender/editors/space_text/text_format.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,16 +14,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h
index 5912dc2402c..9fac0a34d77 100644
--- a/source/blender/editors/space_text/text_format.h
+++ b/source/blender/editors/space_text/text_format.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format.h
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#ifndef __TEXT_FORMAT_H__
@@ -83,16 +76,26 @@ typedef struct TextFormatType {
} TextFormatType;
enum {
- FMT_TYPE_WHITESPACE = '_', /* Whitespace */
- FMT_TYPE_COMMENT = '#', /* Comment text */
- FMT_TYPE_SYMBOL = '!', /* Punctuation and other symbols */
- FMT_TYPE_NUMERAL = 'n', /* Numerals */
- FMT_TYPE_STRING = 'l', /* String letters */
- FMT_TYPE_DIRECTIVE = 'd', /* Decorator / Preprocessor directive */
- FMT_TYPE_SPECIAL = 'v', /* Special variables (class, def) */
- FMT_TYPE_RESERVED = 'r', /* Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */
- FMT_TYPE_KEYWORD = 'b', /* Built-in names (return, for, etc.) */
- FMT_TYPE_DEFAULT = 'q', /* Regular text (identifiers, etc.) */
+ /** Whitespace */
+ FMT_TYPE_WHITESPACE = '_',
+ /** Comment text */
+ FMT_TYPE_COMMENT = '#',
+ /** Punctuation and other symbols */
+ FMT_TYPE_SYMBOL = '!',
+ /** Numerals */
+ FMT_TYPE_NUMERAL = 'n',
+ /** String letters */
+ FMT_TYPE_STRING = 'l',
+ /** Decorator / Preprocessor directive */
+ FMT_TYPE_DIRECTIVE = 'd',
+ /** Special variables (class, def) */
+ FMT_TYPE_SPECIAL = 'v',
+ /** Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */
+ FMT_TYPE_RESERVED = 'r',
+ /** Built-in names (return, for, etc.) */
+ FMT_TYPE_KEYWORD = 'b',
+ /** Regular text (identifiers, etc.) */
+ FMT_TYPE_DEFAULT = 'q',
};
TextFormatType *ED_text_format_get(Text *text);
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index 2a92f9a4d7d..7118b8b748a 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_lua.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index 2b2dfef72d3..08cae0d978d 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_osl.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c
index f6b6d4f8d42..da10c8626b5 100644
--- a/source/blender/editors/space_text/text_format_pov.c
+++ b/source/blender/editors/space_text/text_format_pov.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_pov.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
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 ae7d784dffc..e41fd94ef49 100644
--- a/source/blender/editors/space_text/text_format_pov_ini.c
+++ b/source/blender/editors/space_text/text_format_pov_ini.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_pov_ini.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c
index 50bad9c07cf..d7dc9d625f5 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_py.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 896b5444a85..e76fab28327 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_header.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include "DNA_windowmanager_types.h"
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 02948d35623..bf31469c322 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_intern.h
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#ifndef __TEXT_INTERN_H__
@@ -34,11 +27,11 @@
/* internal exports only */
struct ARegion;
-struct bContext;
struct ScrArea;
struct SpaceText;
struct Text;
struct TextLine;
+struct bContext;
struct wmOperatorType;
/* text_draw.c */
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index d1dd2f4affd..0cc0037567a 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_ops.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
@@ -44,7 +36,6 @@
#include "PIL_time.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -387,7 +378,7 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- BKE_libblock_delete(bmain, text);
+ BKE_id_delete(bmain, text);
text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL);
@@ -623,7 +614,7 @@ static int text_run_script(bContext *C, ReportList *reports)
}
}
- BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now...");
+ BKE_report(reports, RPT_ERROR, "Python script failed, check the message in the system console");
return OPERATOR_FINISHED;
}
@@ -1092,7 +1083,8 @@ enum { TO_SPACES, TO_TABS };
static const EnumPropertyItem whitespace_type_items[] = {
{TO_SPACES, "SPACES", 0, "To Spaces", NULL},
{TO_TABS, "TABS", 0, "To Tabs", NULL},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
{
@@ -1188,7 +1180,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
if (tmp->format)
MEM_freeN(tmp->format);
- /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
+ /* Put new_line in the tmp->line spot
+ * still need to try and set the curc correctly. */
tmp->line = BLI_strdup(tmp_line);
tmp->len = strlen(tmp_line);
tmp->format = NULL;
@@ -1331,7 +1324,7 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{TXT_MOVE_LINE_UP, "UP", 0, "Up", ""},
{TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1365,7 +1358,8 @@ static const EnumPropertyItem move_type_items[] = {
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/* get cursor position in line by relative wrapped line and column positions */
static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int rell, int relc)
@@ -1979,7 +1973,8 @@ static const EnumPropertyItem delete_type_items[] = {
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int text_delete_exec(bContext *C, wmOperator *op)
{
@@ -2129,7 +2124,7 @@ static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
enum {
SCROLLHANDLE_BAR,
SCROLLHANDLE_MIN_OUTSIDE,
- SCROLLHANDLE_MAX_OUTSIDE
+ SCROLLHANDLE_MAX_OUTSIDE,
};
typedef struct TextScroll {
@@ -2144,7 +2139,8 @@ typedef struct TextScroll {
static bool text_scroll_poll(bContext *C)
{
- /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */
+ /* it should be possible to still scroll linked texts to read them,
+ * even if they can't be edited... */
return CTX_data_edit_text(C) != NULL;
}
@@ -2470,7 +2466,8 @@ static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y)
lines = text_get_visible_lines(st, ar, linep->line);
if (i + lines > *y) {
- /* We found the line matching given vertical 'coordinate', now set y relative to this line's start. */
+ /* We found the line matching given vertical 'coordinate',
+ * now set y relative to this line's start. */
*y -= i;
break;
}
@@ -2530,7 +2527,8 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
end = MIN2(end, i);
if (found) {
- /* exact cursor position was found, check if it's still on needed line (hasn't been wrapped) */
+ /* exact cursor position was found, check if it's still on needed line
+ * (hasn't been wrapped) */
if (charp > endj && !chop && ch != '\0')
charp = endj;
break;
@@ -3162,7 +3160,7 @@ static const EnumPropertyItem resolution_items[] = {
{RESOLVE_RELOAD, "RELOAD", 0, "Reload", ""},
{RESOLVE_SAVE, "SAVE", 0, "Save", ""},
{RESOLVE_MAKE_INTERNAL, "MAKE_INTERNAL", 0, "Make Internal", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int text_resolve_conflict_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c
index b8ae9972eec..76da0531225 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_undo.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
@@ -29,7 +25,6 @@
#include "DNA_text_types.h"
-#include "BLI_listbase.h"
#include "BLI_array_utils.h"
#include "BLT_translation.h"
@@ -70,16 +65,11 @@ typedef struct TextUndoStep {
TextUndoBuf data;
} TextUndoStep;
-static bool text_undosys_poll(bContext *C)
+static bool text_undosys_poll(bContext *UNUSED(C))
{
- Text *text = CTX_data_edit_text(C);
- if (text == NULL) {
- return false;
- }
- if (ID_IS_LINKED(text)) {
- return false;
- }
- return true;
+ /* Only use when operators initialized. */
+ UndoStack *ustack = ED_undo_stack_get();
+ return (ustack->step_init && (ustack->step_init->type == BKE_UNDOSYS_TYPE_TEXT));
}
static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
@@ -95,7 +85,7 @@ static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
us->data.pos = -1;
}
-static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool text_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
TextUndoStep *us = (TextUndoStep *)us_p;
@@ -106,6 +96,8 @@ static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return false;
}
+ us_p->is_applied = true;
+
us->text_ref.ptr = text;
us->step.data_size = us->data.len;
@@ -113,24 +105,83 @@ static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void text_undosys_step_decode(struct bContext *C, UndoStep *us_p, int dir)
+
+static void text_undosys_step_decode_undo_impl(Text *text, TextUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == true);
+ TextUndoBuf data = us->data;
+ while (data.pos > -1) {
+ txt_do_undo(text, &data);
+ }
+ BLI_assert(data.pos == -1);
+ us->step.is_applied = false;
+}
+
+static void text_undosys_step_decode_redo_impl(Text *text, TextUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
+ TextUndoBuf data = us->data;
+ data.pos = -1;
+ while (data.pos < us->data.pos) {
+ txt_do_redo(text, &data);
+ }
+ BLI_assert(data.pos == us->data.pos);
+ us->step.is_applied = true;
+}
+
+static void text_undosys_step_decode_undo(Text *text, TextUndoStep *us)
+{
+ TextUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ text_undosys_step_decode_undo_impl(text, us_iter);
+ us_iter = (TextUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void text_undosys_step_decode_redo(Text *text, TextUndoStep *us)
+{
+ TextUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ text_undosys_step_decode_redo_impl(text, us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.next;
+ }
+}
+
+static void text_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir)
{
TextUndoStep *us = (TextUndoStep *)us_p;
Text *text = us->text_ref.ptr;
if (dir < 0) {
- TextUndoBuf data = us->data;
- txt_do_undo(text, &data);
+ text_undosys_step_decode_undo(text, us);
}
else {
- TextUndoBuf data = us->data;
- data.pos = -1;
- txt_do_redo(text, &data);
+ text_undosys_step_decode_redo(text, us);
}
+ SpaceText *st = CTX_wm_space_text(C);
+ if (st) {
+ /* Not essential, always show text being undo where possible. */
+ st->text = text;
+ }
text_update_edited(text);
text_update_cursor_moved(C);
- text_drawcache_tag_update(CTX_wm_space_text(C), 1);
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
}
@@ -160,7 +211,6 @@ void ED_text_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = text_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = false;
ut->step_size = sizeof(TextUndoStep);
diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt
index 9559c28de0a..418a0eb3ad8 100644
--- a/source/blender/editors/space_topbar/CMakeLists.txt
+++ b/source/blender/editors/space_topbar/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c
index 567a733309c..e31f29cec8c 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_topbar/space_topbar.c
- * \ingroup sptopbar
+/** \file
+ * \ingroup sptopbar
*/
@@ -239,7 +233,7 @@ static void recent_files_menu_register(void)
mt = MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
strcpy(mt->idname, "TOPBAR_MT_file_open_recent");
- strcpy(mt->label, N_("Open Recent..."));
+ strcpy(mt->label, N_("Open Recent"));
strcpy(mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
mt->draw = recent_files_menu_draw;
WM_menutype_add(mt);
diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt
index bd82ef13cd7..ec0c76c3d5b 100644
--- a/source/blender/editors/space_userpref/CMakeLists.txt
+++ b/source/blender/editors/space_userpref/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 9a876f9d925..2857c5c8d81 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/space_userpref.c
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
@@ -53,7 +46,7 @@
/* ******************** default callbacks for userpref space ***************** */
-static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
+static SpaceLink *userpref_new(const ScrArea *area, const Scene *UNUSED(scene))
{
ARegion *ar;
SpaceUserPref *spref;
@@ -61,6 +54,14 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
spref->spacetype = SPACE_USERPREF;
+ /* header */
+ ar = MEM_callocN(sizeof(ARegion), "header for userpref");
+
+ BLI_addtail(&spref->regionbase, ar);
+ ar->regiontype = RGN_TYPE_HEADER;
+ /* Ignore user preference "USER_HEADER_BOTTOM" here (always show bottom for new types). */
+ ar->alignment = RGN_ALIGN_BOTTOM;
+
/* navigation region */
ar = MEM_callocN(sizeof(ARegion), "navigation region for userpref");
@@ -68,13 +69,18 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
ar->regiontype = RGN_TYPE_NAV_BAR;
ar->alignment = RGN_ALIGN_LEFT;
- /* header */
- ar = MEM_callocN(sizeof(ARegion), "header for userpref");
+ /* Use smaller size when opened in area like properties editor. */
+ if (area->winx && area->winx < 3.0f * UI_NAVIGATION_REGION_WIDTH * UI_DPI_FAC) {
+ ar->sizex = UI_NARROW_NAVIGATION_REGION_WIDTH;
+ }
+
+ /* execution region */
+ ar = MEM_callocN(sizeof(ARegion), "execution region for userpref");
BLI_addtail(&spref->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- /* Ignore user preference "USER_HEADER_BOTTOM" here (always show bottom for new types). */
- ar->alignment = RGN_ALIGN_BOTTOM;
+ ar->regiontype = RGN_TYPE_EXECUTE;
+ ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
+ ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
/* main region */
ar = MEM_callocN(sizeof(ARegion), "main region for userpref");
@@ -113,7 +119,8 @@ static SpaceLink *userpref_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
static void userpref_main_region_init(wmWindowManager *wm, ARegion *ar)
{
- /* do not use here, the properties changed in userprefs do a system-wide refresh, then scroller jumps back */
+ /* do not use here, the properties changed in userprefs do a system-wide refresh,
+ * then scroller jumps back */
/* ar->v2d.flag &= ~V2D_IS_INITIALISED; */
ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
@@ -123,7 +130,7 @@ static void userpref_main_region_init(wmWindowManager *wm, ARegion *ar)
static void userpref_main_region_draw(const bContext *C, ARegion *ar)
{
- ED_region_panels(C, ar);
+ ED_region_panels_ex(C, ar, NULL, U.userpref, true);
}
static void userpref_operatortypes(void)
@@ -159,6 +166,13 @@ static void userpref_navigation_region_draw(const bContext *C, ARegion *ar)
ED_region_panels(C, ar);
}
+/* add handlers, stuff you only do once or on area/region changes */
+static void userpref_execute_region_init(wmWindowManager *wm, ARegion *ar)
+{
+ ED_region_panels_init(wm, ar);
+ ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+}
+
static void userpref_main_region_listener(
wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar),
wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene))
@@ -186,6 +200,13 @@ static void userpref_navigation_region_listener(
/* context changes */
}
+static void userpref_execute_region_listener(
+ wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar),
+ wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene))
+{
+ /* context changes */
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_userpref(void)
{
@@ -234,6 +255,17 @@ void ED_spacetype_userpref(void)
BLI_addhead(&st->regiontypes, art);
+ /* regions: execution window */
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art->regionid = RGN_TYPE_EXECUTE;
+ art->init = userpref_execute_region_init;
+ art->layout = ED_region_panels_layout;
+ art->draw = ED_region_panels_draw;
+ art->listener = userpref_execute_region_listener;
+ art->keymapflag = ED_KEYMAP_UI;
+
+ BLI_addhead(&st->regiontypes, art);
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h
index 720b4da0f71..56930d3a231 100644
--- a/source/blender/editors/space_userpref/userpref_intern.h
+++ b/source/blender/editors/space_userpref/userpref_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/userpref_intern.h
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
#ifndef __USERPREF_INTERN_H__
diff --git a/source/blender/editors/space_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c
index 6666a6cfc16..f6aaf01747c 100644
--- a/source/blender/editors/space_userpref/userpref_ops.c
+++ b/source/blender/editors/space_userpref/userpref_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,19 +13,62 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/userpref_ops.c
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
-
#include <string.h>
-#include <stdio.h>
+
+#include "DNA_screen_types.h"
+
+#include "BKE_context.h"
+#include "BKE_report.h"
+
+#include "RNA_types.h"
+
+#include "UI_interface.h"
+
+#include "../interface/interface_intern.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_userpref.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Reset Default Theme
+ * \{ */
+
+static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ UI_theme_init_default();
+ UI_style_init_default();
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Reset to Default Theme";
+ ot->idname = "PREFERENCES_OT_reset_default_theme";
+ ot->description = "Reset to the default theme colors";
+
+ /* callbacks */
+ ot->exec = reset_default_theme_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER;
+}
+
+/** \} */
+
+void ED_operatortypes_userpref(void)
+{
+ WM_operatortype_append(PREFERENCES_OT_reset_default_theme);
+}
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 44089734e83..83e65246797 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -51,19 +48,18 @@ set(SRC
view3d_draw_legacy.c
view3d_edit.c
view3d_fly.c
- view3d_walk.c
- view3d_header.c
- view3d_iterators.c
view3d_gizmo_armature.c
view3d_gizmo_camera.c
view3d_gizmo_empty.c
view3d_gizmo_forcefield.c
- view3d_gizmo_lamp.c
+ view3d_gizmo_light.c
view3d_gizmo_navigate.c
view3d_gizmo_navigate_type.c
- view3d_gizmo_ruler.c
view3d_gizmo_preselect.c
view3d_gizmo_preselect_type.c
+ view3d_gizmo_ruler.c
+ view3d_header.c
+ view3d_iterators.c
view3d_ops.c
view3d_project.c
view3d_select.c
@@ -71,6 +67,7 @@ set(SRC
view3d_toolbar.c
view3d_utils.c
view3d_view.c
+ view3d_walk.c
view3d_intern.h
)
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 409f0300530..e6e0438164c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, full recode and added functions
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/drawobject.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_mesh_types.h"
@@ -70,7 +64,7 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
return false;
- if (G.f & G_BACKBUFSEL)
+ if (G.f & G_FLAG_BACKBUFSEL)
return false;
/* if its drawing textures with zbuf sel, then don't draw dots */
@@ -80,7 +74,7 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
return true;
}
-/* ----------------- OpenGL Circle Drawing - Tables for Optimized Drawing Speed ------------------ */
+/* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */
/* 32 values of sin function (still same result!) */
#define CIRCLE_RESOL 32
@@ -116,7 +110,7 @@ static const float sinval[CIRCLE_RESOL] = {
-0.57126821,
-0.39435585,
-0.20129852,
- 0.00000000
+ 0.00000000,
};
/* 32 values of cos function (still same result!) */
@@ -152,7 +146,7 @@ static const float cosval[CIRCLE_RESOL] = {
0.82076344,
0.91895781,
0.97952994,
- 1.00000000
+ 1.00000000,
};
static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, const float tmat[4][4])
@@ -163,7 +157,7 @@ static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3
mul_v3_v3fl(vx, tmat[0], rad);
mul_v3_v3fl(vy, tmat[1], rad);
- for (unsigned int a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
+ for (uint a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
@@ -184,121 +178,107 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
}
#ifdef VIEW3D_CAMERA_BORDER_HACK
-unsigned char view3d_camera_border_hack_col[3];
+uchar view3d_camera_border_hack_col[3];
bool view3d_camera_border_hack_test = false;
#endif
/* ***************** BACKBUF SEL (BBS) ********* */
-static void bbs_obmode_mesh_verts(Object *ob, int offset)
+/** See #DRW_shgroup_world_clip_planes_from_rv3d, same function for draw manager. */
+static void bbs_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_clip_planes[6][4])
{
- Mesh *me = ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
+ GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]);
}
-static void bbs_mesh_verts(BMEditMesh *em, int offset)
+static void bbs_mesh_verts(GPUBatch *batch, int offset, const float world_clip_planes[6][4])
{
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", offset);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
-static void bbs_mesh_wire(BMEditMesh *em, int offset)
+static void bbs_mesh_wire(GPUBatch *batch, int offset, const float world_clip_planes[6][4])
{
GPU_line_width(1.0f);
+ glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", offset);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
+
+ glProvokingVertex(GL_LAST_VERTEX_CONVENTION);
}
-static void bbs_mesh_face(BMEditMesh *em, const bool use_select)
+/* two options, facecolors or black */
+static void bbs_mesh_face(GPUBatch *batch, const bool use_select, const float world_clip_planes[6][4])
{
- Mesh *me = em->ob->data;
- GPUBatch *batch;
-
if (use_select) {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", 1);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
else {
- int selcol;
- GPU_select_index_get(0, &selcol);
- batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
- GPU_batch_uniform_1ui(batch, "color", selcol);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_UNIFORM_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "id", 0);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
}
-static void bbs_mesh_face_dot(BMEditMesh *em)
-{
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
-}
-
-/* two options, facecolors or black */
-static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
- Object *ob, bool use_faceselect)
+static void bbs_mesh_face_dot(GPUBatch *batch, const float world_clip_planes[6][4])
{
- if (use_faceselect) {
- bbs_mesh_face(em, true);
-
- if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
- bbs_mesh_face_dot(em);
- }
- }
- else {
- bbs_mesh_face(em, false);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", 1);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
}
+ GPU_batch_draw(batch);
}
-static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob)
+static void bbs_mesh_solid_verts(
+ Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob, const float world_clip_planes[6][4])
{
Mesh *me = ob->data;
- /* Only draw faces to mask out verts, we don't want their selection ID's. */
- const int G_f_orig = G.f;
- G.f &= ~G_BACKBUFSEL;
-
- {
- int selcol;
- GPUBatch *batch;
- GPU_select_index_get(0, &selcol);
- batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
- GPU_batch_uniform_1ui(batch, "color", selcol);
- GPU_batch_draw(batch);
- }
+ GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true);
- G.f |= (G_f_orig & G_BACKBUFSEL);
+ /* Only draw faces to mask out verts, we don't want their selection ID's. */
+ bbs_mesh_face(geom_faces, false, world_clip_planes);
+ bbs_mesh_verts(geom_verts, 1, world_clip_planes);
- bbs_obmode_mesh_verts(ob, 1);
bm_vertoffs = me->totvert + 1;
}
-static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob)
+static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob, const float world_clip_planes[6][4])
{
Mesh *me = ob->data;
Mesh *me_orig = DEG_get_original_object(ob)->data;
- GPUBatch *batch;
- if ((me_orig->editflag & ME_EDIT_PAINT_FACE_SEL)) {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
- }
- else {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false, 1);
- }
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
+
+ const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL);
+ GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, use_hide);
+
+ bbs_mesh_face(geom_faces, true, world_clip_planes);
}
void draw_object_backbufsel(
@@ -311,19 +291,43 @@ void draw_object_backbufsel(
}
GPU_matrix_mul(ob->obmat);
-
- glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT);
GPU_depth_test(true);
+ const float (*world_clip_planes)[4] = NULL;
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ ED_view3d_clipping_local(rv3d, ob->obmat);
+ world_clip_planes = rv3d->clip_local;
+ }
+
switch (ob->type) {
case OB_MESH:
if (ob->mode & OB_MODE_EDIT) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
+ const bool draw_facedot = check_ob_drawface_dot(scene, v3d, ob->dt);
+ const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0;
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
- bbs_mesh_solid_EM(em, scene, v3d, ob, (select_mode & SCE_SELECT_FACE) != 0);
+ GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots;
+ geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ if (select_mode & SCE_SELECT_EDGE) {
+ geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
+ }
+ if (select_mode & SCE_SELECT_VERTEX) {
+ geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
+ }
+ if (draw_facedot) {
+ geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me);
+ }
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true);
+
+ bbs_mesh_face(geom_faces, use_faceselect, world_clip_planes);
+
+ if (use_faceselect && draw_facedot) {
+ bbs_mesh_face_dot(geom_facedots, world_clip_planes);
+ }
+
if (select_mode & SCE_SELECT_FACE)
bm_solidoffs = 1 + em->bm->totface;
else {
@@ -334,7 +338,7 @@ void draw_object_backbufsel(
/* we draw edges if edge select mode */
if (select_mode & SCE_SELECT_EDGE) {
- bbs_mesh_wire(em, bm_solidoffs);
+ bbs_mesh_wire(geom_edges, bm_solidoffs, world_clip_planes);
bm_wireoffs = bm_solidoffs + em->bm->totedge;
}
else {
@@ -342,9 +346,11 @@ void draw_object_backbufsel(
bm_wireoffs = bm_solidoffs;
}
+ ED_view3d_polygon_offset(rv3d, 1.1);
+
/* we draw verts if vert select mode. */
if (select_mode & SCE_SELECT_VERTEX) {
- bbs_mesh_verts(em, bm_wireoffs);
+ bbs_mesh_verts(geom_verts, bm_wireoffs, world_clip_planes);
bm_vertoffs = bm_wireoffs + em->bm->totvert;
}
else {
@@ -354,15 +360,15 @@ void draw_object_backbufsel(
ED_view3d_polygon_offset(rv3d, 0.0);
}
else {
- Mesh *me = ob->data;
+ Mesh *me = DEG_get_original_object(ob)->data;
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) &&
/* currently vertex select supports weight paint and vertex paint*/
((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT)))
{
- bbs_mesh_solid_verts(depsgraph, scene, ob);
+ bbs_mesh_solid_verts(depsgraph, scene, ob, world_clip_planes);
}
else {
- bbs_mesh_solid_faces(scene, ob);
+ bbs_mesh_solid_faces(scene, ob, world_clip_planes);
}
}
break;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 354d27bd293..6475de521d9 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/space_view3d.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -324,11 +317,11 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->gridsubdiv = 10;
BKE_screen_view3d_shading_init(&v3d->shading);
- v3d->overlay.wireframe_threshold = 0.5f;
+ v3d->overlay.wireframe_threshold = 1.0f;
v3d->overlay.xray_alpha_bone = 0.5f;
- v3d->overlay.texture_paint_mode_opacity = 0.8;
+ v3d->overlay.texture_paint_mode_opacity = 1.0f;
v3d->overlay.weight_paint_mode_opacity = 1.0f;
- v3d->overlay.vertex_paint_mode_opacity = 0.8;
+ v3d->overlay.vertex_paint_mode_opacity = 1.0f;
v3d->overlay.edit_flag = V3D_OVERLAY_EDIT_FACES |
V3D_OVERLAY_EDIT_SEAMS |
V3D_OVERLAY_EDIT_SHARP |
@@ -346,8 +339,8 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION;
v3d->lens = 50.0f;
- v3d->near = 0.01f;
- v3d->far = 1000.0f;
+ v3d->clip_start = 0.01f;
+ v3d->clip_end = 1000.0f;
v3d->overlay.gpencil_paper_opacity = 0.5f;
v3d->overlay.gpencil_grid_opacity = 0.9f;
@@ -568,7 +561,8 @@ static bool view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEven
static bool view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
if (drag->type == WM_DRAG_PATH) {
- return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); /* rule might not work? */
+ /* rule might not work? */
+ return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
}
else {
return WM_drag_ID(drag, ID_IM) != NULL;
@@ -692,9 +686,9 @@ 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_lamp_spot);
- WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_lamp_area);
- WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_lamp_target);
+ 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);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_force_field);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera_view);
@@ -794,7 +788,7 @@ static void view3d_main_region_listener(
ED_region_tag_redraw(ar);
break;
case ND_ANIMCHAN:
- if (wmn->action == NA_SELECTED)
+ if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED))
ED_region_tag_redraw(ar);
break;
}
@@ -1093,6 +1087,9 @@ static void view3d_main_region_message_subscribe(
WM_msg_subscribe_rna_anon_prop(
mbus, Object, mode,
&msg_sub_value_region_tag_refresh);
+ WM_msg_subscribe_rna_anon_prop(
+ mbus, LayerObjects, active,
+ &msg_sub_value_region_tag_refresh);
}
}
@@ -1363,12 +1360,13 @@ static void space_view3d_refresh(const bContext *C, ScrArea *UNUSED(sa))
}
const char *view3d_context_dir[] = {
- "active_base", "active_object", NULL
+ "active_base", "active_object", NULL,
};
static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
{
- /* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */
+ /* fallback to the scene layer,
+ * allows duplicate and other object operators to run outside the 3d view */
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, view3d_context_dir);
@@ -1436,7 +1434,8 @@ static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_i
if (is_local == false) {
if ((ID *)v3d->ob_centre == old_id) {
v3d->ob_centre = (Object *)new_id;
- /* Otherwise, bonename may remain valid... We could be smart and check this, too? */
+ /* Otherwise, bonename may remain valid...
+ * We could be smart and check this, too? */
if (new_id == NULL) {
v3d->ob_centre_bone[0] = '\0';
}
@@ -1474,7 +1473,7 @@ void ED_spacetype_view3d(void)
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_GPENCIL;
art->draw = view3d_main_region_draw;
art->init = view3d_main_region_init;
art->exit = view3d_main_region_exit;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 277d0f6a2a0..175e0eb6c4f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_buttons.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -81,20 +74,49 @@
/* ******************* view3d space & buttons ************** */
-#define B_REDR 2
-#define B_OBJECTPANELMEDIAN 1008
+enum {
+ B_REDR = 2,
+ B_TRANSFORM_PANEL_MEDIAN = 1008,
+ B_TRANSFORM_PANEL_DIMS = 1009,
+};
+
+/* All must start w/ location */
+
+typedef struct {
+ float location[3];
+} TransformMedian_Generic;
+
+typedef struct {
+ float location[3], bv_weight, be_weight, skin[2], crease;
+} TransformMedian_Mesh;
-#define NBR_TRANSFORM_PROPERTIES 8
+typedef struct {
+ float location[3], weight, b_weight, radius, tilt;
+} TransformMedian_Curve;
+
+typedef struct {
+ float location[3], weight;
+} TransformMedian_Lattice;
+
+
+typedef union {
+ TransformMedian_Generic generic;
+ TransformMedian_Mesh mesh;
+ TransformMedian_Curve curve;
+ TransformMedian_Lattice lattice;
+} TransformMedian;
/* temporary struct for storing transform properties */
+
typedef struct {
- float ob_eul[4]; /* used for quat too... */
- float ob_scale[3]; /* need temp space due to linked values */
+ float ob_dims_orig[3];
float ob_dims[3];
- short link_scale;
- float ve_median[NBR_TRANSFORM_PROPERTIES];
+ /* Floats only (treated as an array). */
+ TransformMedian ve_median, median;
} TransformProperties;
+#define TRANSFORM_MEDIAN_ARRAY_LEN (sizeof(TransformMedian) / sizeof(float))
+
/* Helper function to compute a median changed value,
* when the value should be clamped in [0.0, 1.0].
* Returns either 0.0, 1.0 (both can be applied directly), a positive scale factor
@@ -170,49 +192,32 @@ 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");
+ }
+ return v3d->properties_storage;
+}
+
/* is used for both read and write... */
static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
{
-/* Get rid of those ugly magic numbers, even in a single func they become confusing! */
-/* Location, common to all. */
-/* Next three *must* remain contiguous (used as array)! */
-#define LOC_X 0
-#define LOC_Y 1
-#define LOC_Z 2
-/* Meshes... */
-#define M_BV_WEIGHT 3
-/* Next two *must* remain contiguous (used as array)! */
-#define M_SKIN_X 4
-#define M_SKIN_Y 5
-#define M_BE_WEIGHT 6
-#define M_CREASE 7
-/* Curves... */
-#define C_BWEIGHT 3
-#define C_WEIGHT 4
-#define C_RADIUS 5
-#define C_TILT 6
-/*Lattice... */
-#define L_WEIGHT 4
-
uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
- TransformProperties *tfp;
- float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES];
+ TransformProperties *tfp = v3d_transform_props_ensure(v3d);
+ TransformMedian median_basis, ve_median_basis;
int tot, totedgedata, totcurvedata, totlattdata, totcurvebweight;
bool has_meshdata = false;
bool has_skinradius = false;
PointerRNA data_ptr;
- copy_vn_fl(median, NBR_TRANSFORM_PROPERTIES, 0.0f);
+ copy_vn_fl((float *)&median_basis, TRANSFORM_MEDIAN_ARRAY_LEN, 0.0f);
tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
- /* make sure we got storage */
- if (v3d->properties_storage == NULL)
- v3d->properties_storage = MEM_callocN(sizeof(TransformProperties), "TransformProperties");
- tfp = v3d->properties_storage;
-
if (ob->type == OB_MESH) {
+ TransformMedian_Mesh *median = &median_basis.mesh;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
BMVert *eve;
BMEdge *eed;
@@ -229,15 +234,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
tot++;
- add_v3_v3(&median[LOC_X], eve->co);
+ add_v3_v3(median->location, eve->co);
if (cd_vert_bweight_offset != -1) {
- median[M_BV_WEIGHT] += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_bweight_offset);
+ median->bv_weight += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_bweight_offset);
}
if (has_skinradius) {
MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
- add_v2_v2(&median[M_SKIN_X], vs->radius); /* Third val not used currently. */
+ add_v2_v2(median->skin, vs->radius); /* Third val not used currently. */
}
}
}
@@ -248,11 +253,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
if (cd_edge_bweight_offset != -1) {
- median[M_BE_WEIGHT] += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_bweight_offset);
+ median->be_weight += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_bweight_offset);
}
if (cd_edge_crease_offset != -1) {
- median[M_CREASE] += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_crease_offset);
+ median->crease += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_crease_offset);
}
totedgedata++;
@@ -267,6 +272,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
has_meshdata = (tot || totedgedata);
}
else if (ob->type == OB_CURVE || ob->type == OB_SURF) {
+ TransformMedian_Curve *median = &median_basis.curve;
Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
@@ -283,11 +289,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
a = nu->pntsu;
while (a--) {
if (bezt->f2 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[1]);
+ add_v3_v3(median->location, bezt->vec[1]);
tot++;
- median[C_WEIGHT] += bezt->weight;
- median[C_RADIUS] += bezt->radius;
- median[C_TILT] += bezt->alfa;
+ median->weight += bezt->weight;
+ median->radius += bezt->radius;
+ median->tilt += bezt->alfa;
if (!totcurvedata) { /* I.e. first time... */
selp = bezt;
seltype = &RNA_BezierSplinePoint;
@@ -296,11 +302,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else {
if (bezt->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[0]);
+ add_v3_v3(median->location, bezt->vec[0]);
tot++;
}
if (bezt->f3 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[2]);
+ add_v3_v3(median->location, bezt->vec[2]);
tot++;
}
}
@@ -312,13 +318,13 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bp->vec);
- median[C_BWEIGHT] += bp->vec[3];
+ add_v3_v3(median->location, bp->vec);
+ median->b_weight += bp->vec[3];
totcurvebweight++;
tot++;
- median[C_WEIGHT] += bp->weight;
- median[C_RADIUS] += bp->radius;
- median[C_TILT] += bp->alfa;
+ median->weight += bp->weight;
+ median->radius += bp->radius;
+ median->tilt += bp->alfa;
if (!totcurvedata) { /* I.e. first time... */
selp = bp;
seltype = &RNA_SplinePoint;
@@ -336,6 +342,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;
+ TransformMedian_Lattice *median = &median_basis.lattice;
BPoint *bp;
int a;
StructRNA *seltype = NULL;
@@ -345,9 +352,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bp->vec);
+ add_v3_v3(median->location, bp->vec);
tot++;
- median[L_WEIGHT] += bp->weight;
+ median->weight += bp->weight;
if (!totlattdata) { /* I.e. first time... */
selp = bp;
seltype = &RNA_LatticePoint;
@@ -367,44 +374,48 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
/* Location, X/Y/Z */
- mul_v3_fl(&median[LOC_X], 1.0f / (float)tot);
+ mul_v3_fl(median_basis.generic.location, 1.0f / (float)tot);
if (v3d->flag & V3D_GLOBAL_STATS)
- mul_m4_v3(ob->obmat, &median[LOC_X]);
+ mul_m4_v3(ob->obmat, median_basis.generic.location);
if (has_meshdata) {
+ TransformMedian_Mesh *median = &median_basis.mesh;
if (totedgedata) {
- median[M_CREASE] /= (float)totedgedata;
- median[M_BE_WEIGHT] /= (float)totedgedata;
+ median->crease /= (float)totedgedata;
+ median->be_weight /= (float)totedgedata;
}
if (tot) {
- median[M_BV_WEIGHT] /= (float)tot;
+ median->bv_weight /= (float)tot;
if (has_skinradius) {
- median[M_SKIN_X] /= (float)tot;
- median[M_SKIN_Y] /= (float)tot;
+ median->skin[0] /= (float)tot;
+ median->skin[1] /= (float)tot;
}
}
}
else if (totcurvedata) {
+ TransformMedian_Curve *median = &median_basis.curve;
if (totcurvebweight) {
- median[C_BWEIGHT] /= (float)totcurvebweight;
+ median->b_weight /= (float)totcurvebweight;
}
- median[C_WEIGHT] /= (float)totcurvedata;
- median[C_RADIUS] /= (float)totcurvedata;
- median[C_TILT] /= (float)totcurvedata;
+ median->weight /= (float)totcurvedata;
+ median->radius /= (float)totcurvedata;
+ median->tilt /= (float)totcurvedata;
}
else if (totlattdata) {
- median[L_WEIGHT] /= (float)totlattdata;
+ TransformMedian_Lattice *median = &median_basis.lattice;
+ median->weight /= (float)totlattdata;
}
if (block) { /* buttons */
uiBut *but;
int yi = 200;
const float tilt_limit = DEG2RADF(21600.0f);
+ const int butw = 200;
const int buth = 20 * UI_DPI_FAC;
const int but_margin = 2;
const char *c;
- memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
+ memcpy(&tfp->ve_median, &median_basis, sizeof(tfp->ve_median));
UI_block_align_begin(block);
if (tot == 1) {
@@ -415,24 +426,24 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else
c = IFACE_("Median:");
- uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, "");
+ uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, butw, buth, NULL, 0, 0, 0, 0, "");
UI_block_align_begin(block);
/* Should be no need to translate these. */
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_X]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("X:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[0], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_Y]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Y:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[1], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_Z]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Z:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[2], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
if (totcurvebweight == tot) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[C_BWEIGHT]), 0.01, 100.0, 1, 3, "");
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("W:"), 0, yi -= buth, butw, buth,
+ &(tfp->ve_median.curve.b_weight), 0.01, 100.0, 1, 3, "");
}
UI_block_align_begin(block);
@@ -446,101 +457,108 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* Meshes... */
if (has_meshdata) {
+ TransformMedian_Mesh *ve_median = &tfp->ve_median.mesh;
if (tot) {
uiDefBut(block, UI_BTYPE_LABEL, 0, tot == 1 ? IFACE_("Vertex Data:") : IFACE_("Vertices Data:"),
- 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, "");
+ 0, yi -= buth + but_margin, butw, buth, NULL, 0.0, 0.0, 0, 0, "");
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_BV_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Vertex weight used by Bevel modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->bv_weight, 0.0, 1.0, 1, 2, TIP_("Vertex weight used by Bevel modifier"));
}
if (has_skinradius) {
UI_block_align_begin(block);
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Radius X:") : IFACE_("Mean Radius X:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_SKIN_X]), 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier"));
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->skin[0], 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier"));
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Radius Y:") : IFACE_("Mean Radius Y:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_SKIN_Y]), 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->skin[1], 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier"));
UI_block_align_end(block);
}
if (totedgedata) {
uiDefBut(block, UI_BTYPE_LABEL, 0, totedgedata == 1 ? IFACE_("Edge Data:") : IFACE_("Edges Data:"),
- 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, "");
+ 0, yi -= buth + but_margin, butw, buth, NULL, 0.0, 0.0, 0, 0, "");
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_BE_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Edge weight used by Bevel modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->be_weight, 0.0, 1.0, 1, 2, TIP_("Edge weight used by Bevel modifier"));
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 2, TIP_("Weight used by the Subdivision Surface modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->crease, 0.0, 1.0, 1, 2, TIP_("Weight used by the Subdivision Surface modifier"));
}
}
/* Curve... */
- else if (totcurvedata == 1) {
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL);
- }
- else if (totcurvedata > 1) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_RADIUS]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_TILT]), -tilt_limit, tilt_limit, 1, 3,
- TIP_("Tilt of curve control points"));
- UI_but_unit_type_set(but, PROP_UNIT_ROTATION);
+ else if (totcurvedata) {
+ TransformMedian_Curve *ve_median = &tfp->ve_median.curve;
+ if (totcurvedata == 1) {
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL);
+ }
+ else if (totcurvedata > 1) {
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Weight:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->weight, 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Radius:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->radius, 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Tilt:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->tilt, -tilt_limit, tilt_limit, 1, 3,
+ TIP_("Tilt of curve control points"));
+ UI_but_unit_type_set(but, PROP_UNIT_ROTATION);
+ }
}
/* Lattice... */
- else if (totlattdata == 1) {
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
- }
- else if (totlattdata > 1) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[L_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ else if (totlattdata) {
+ TransformMedian_Lattice *ve_median = &tfp->ve_median.lattice;
+ if (totlattdata == 1) {
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
+ }
+ else if (totlattdata > 1) {
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Weight:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->weight, 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ }
}
UI_block_align_end(block);
}
else { /* apply */
- int i;
- bool apply_vcos;
-
- memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
+ memcpy(&ve_median_basis, &tfp->ve_median, sizeof(tfp->ve_median));
if (v3d->flag & V3D_GLOBAL_STATS) {
invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, &median[LOC_X]);
- mul_m4_v3(ob->imat, &ve_median[LOC_X]);
+ mul_m4_v3(ob->imat, median_basis.generic.location);
+ mul_m4_v3(ob->imat, ve_median_basis.generic.location);
}
- i = NBR_TRANSFORM_PROPERTIES;
- while (i--)
- median[i] = ve_median[i] - median[i];
+ sub_vn_vnvn(
+ (float *)&median_basis,
+ (float *)&ve_median_basis,
+ (float *)&median_basis,
+ TRANSFORM_MEDIAN_ARRAY_LEN);
/* Note with a single element selected, we always do. */
- apply_vcos = (tot == 1) || (len_squared_v3(&median[LOC_X]) != 0.0f);
+ const bool apply_vcos = (tot == 1) || (len_squared_v3(median_basis.generic.location) != 0.0f);
if ((ob->type == OB_MESH) &&
- (apply_vcos || median[M_BV_WEIGHT] || median[M_SKIN_X] || median[M_SKIN_Y] ||
- median[M_BE_WEIGHT] || median[M_CREASE]))
+ (apply_vcos || median_basis.mesh.bv_weight || median_basis.mesh.skin[0] || median_basis.mesh.skin[1] ||
+ median_basis.mesh.be_weight || median_basis.mesh.crease))
{
+ const TransformMedian_Mesh *median = &median_basis.mesh, *ve_median = &ve_median_basis.mesh;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
BMIter iter;
BMVert *eve;
@@ -552,63 +570,53 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
int cd_edge_crease_offset = -1;
float scale_bv_weight = 1.0f;
- float scale_skin_x = 1.0f;
- float scale_skin_y = 1.0f;
+ float scale_skin[2] = {1.0f, 1.0f};
float scale_be_weight = 1.0f;
float scale_crease = 1.0f;
/* Vertices */
- if (apply_vcos || median[M_BV_WEIGHT] || median[M_SKIN_X] || median[M_SKIN_Y]) {
- if (median[M_BV_WEIGHT]) {
+ if (apply_vcos || median->bv_weight || median->skin[0] || median->skin[1]) {
+ if (median->bv_weight) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_VERT_BWEIGHT);
cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
BLI_assert(cd_vert_bweight_offset != -1);
- scale_bv_weight = compute_scale_factor(ve_median[M_BV_WEIGHT], median[M_BV_WEIGHT]);
+ scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight);
}
- if (median[M_SKIN_X]) {
- cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
- BLI_assert(cd_vert_skin_offset != -1);
-
- if (ve_median[M_SKIN_X] != median[M_SKIN_X]) {
- scale_skin_x = ve_median[M_SKIN_X] / (ve_median[M_SKIN_X] - median[M_SKIN_X]);
- }
- }
- if (median[M_SKIN_Y]) {
- if (cd_vert_skin_offset == -1) {
+ for (int i = 0; i < 2; i++) {
+ if (median->skin[i]) {
cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
BLI_assert(cd_vert_skin_offset != -1);
- }
- if (ve_median[M_SKIN_Y] != median[M_SKIN_Y]) {
- scale_skin_y = ve_median[M_SKIN_Y] / (ve_median[M_SKIN_Y] - median[M_SKIN_Y]);
+ if (ve_median->skin[i] != median->skin[i]) {
+ scale_skin[i] = ve_median->skin[i] / (ve_median->skin[i] - median->skin[i]);
+ }
}
}
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
if (apply_vcos) {
- apply_raw_diff_v3(eve->co, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(eve->co, tot, ve_median->location, median->location);
}
if (cd_vert_bweight_offset != -1) {
- float *bweight = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset);
- apply_scale_factor_clamp(bweight, tot, ve_median[M_BV_WEIGHT], scale_bv_weight);
+ float *b_weight = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset);
+ apply_scale_factor_clamp(b_weight, tot, ve_median->bv_weight, scale_bv_weight);
}
if (cd_vert_skin_offset != -1) {
MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
/* That one is not clamped to [0.0, 1.0]. */
- if (median[M_SKIN_X] != 0.0f) {
- apply_scale_factor(&vs->radius[0], tot, ve_median[M_SKIN_X], median[M_SKIN_X],
- scale_skin_x);
- }
- if (median[M_SKIN_Y] != 0.0f) {
- apply_scale_factor(&vs->radius[1], tot, ve_median[M_SKIN_Y], median[M_SKIN_Y],
- scale_skin_y);
+ for (int i = 0; i < 2; i++) {
+ if (median->skin[i] != 0.0f) {
+ apply_scale_factor(
+ &vs->radius[i], tot, ve_median->skin[i], median->skin[i],
+ scale_skin[i]);
+ }
}
}
}
@@ -621,48 +629,53 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* Edges */
- if (median[M_BE_WEIGHT] || median[M_CREASE]) {
- if (median[M_BE_WEIGHT]) {
+ if (median->be_weight || median->crease) {
+ if (median->be_weight) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_BWEIGHT);
cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
BLI_assert(cd_edge_bweight_offset != -1);
- scale_be_weight = compute_scale_factor(ve_median[M_BE_WEIGHT], median[M_BE_WEIGHT]);
+ scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight);
}
- if (median[M_CREASE]) {
+ if (median->crease) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE);
cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
BLI_assert(cd_edge_crease_offset != -1);
- scale_crease = compute_scale_factor(ve_median[M_CREASE], median[M_CREASE]);
+ scale_crease = compute_scale_factor(ve_median->crease, median->crease);
}
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
- if (median[M_BE_WEIGHT] != 0.0f) {
- float *bweight = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_bweight_offset);
- apply_scale_factor_clamp(bweight, tot, ve_median[M_BE_WEIGHT], scale_be_weight);
+ if (median->be_weight != 0.0f) {
+ float *b_weight = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_bweight_offset);
+ apply_scale_factor_clamp(b_weight, tot, ve_median->be_weight, scale_be_weight);
}
- if (median[M_CREASE] != 0.0f) {
+ if (median->crease != 0.0f) {
float *crease = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_crease_offset);
- apply_scale_factor_clamp(crease, tot, ve_median[M_CREASE], scale_crease);
+ apply_scale_factor_clamp(crease, tot, ve_median->crease, scale_crease);
}
}
}
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF) &&
- (apply_vcos || median[C_BWEIGHT] || median[C_WEIGHT] || median[C_RADIUS] || median[C_TILT]))
+ (apply_vcos ||
+ median_basis.curve.b_weight ||
+ median_basis.curve.weight ||
+ median_basis.curve.radius ||
+ median_basis.curve.tilt))
{
+ const TransformMedian_Curve *median = &median_basis.curve, *ve_median = &ve_median_basis.curve;
Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
int a;
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
- const float scale_w = compute_scale_factor(ve_median[C_WEIGHT], median[C_WEIGHT]);
+ const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
nu = nurbs->first;
while (nu) {
@@ -674,26 +687,27 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
* Cannot avoid some glitches when going e.g. from 3 to 0.0001 (see T37327),
* unless we use doubles.
*/
- add_v3_v3(bezt->vec[0], &median[LOC_X]);
- add_v3_v3(bezt->vec[1], &median[LOC_X]);
- add_v3_v3(bezt->vec[2], &median[LOC_X]);
+ add_v3_v3(bezt->vec[0], median->location);
+ add_v3_v3(bezt->vec[1], median->location);
+ add_v3_v3(bezt->vec[2], median->location);
}
- if (median[C_WEIGHT]) {
- apply_scale_factor_clamp(&bezt->weight, tot, ve_median[C_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bezt->weight, tot, ve_median->weight, scale_w);
}
- if (median[C_RADIUS]) {
- apply_raw_diff(&bezt->radius, tot, ve_median[C_RADIUS], median[C_RADIUS]);
+ if (median->radius) {
+ apply_raw_diff(&bezt->radius, tot, ve_median->radius, median->radius);
}
- if (median[C_TILT]) {
- apply_raw_diff(&bezt->alfa, tot, ve_median[C_TILT], median[C_TILT]);
+ if (median->tilt) {
+ apply_raw_diff(&bezt->alfa, tot, ve_median->tilt, median->tilt);
}
}
- else if (apply_vcos) { /* Handles can only have their coordinates changed here. */
+ else if (apply_vcos) {
+ /* Handles can only have their coordinates changed here. */
if (bezt->f1 & SELECT) {
- apply_raw_diff_v3(bezt->vec[0], tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bezt->vec[0], tot, ve_median->location, median->location);
}
if (bezt->f3 & SELECT) {
- apply_raw_diff_v3(bezt->vec[2], tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bezt->vec[2], tot, ve_median->location, median->location);
}
}
}
@@ -702,19 +716,19 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) {
if (bp->f1 & SELECT) {
if (apply_vcos) {
- apply_raw_diff_v3(bp->vec, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
}
- if (median[C_BWEIGHT]) {
- apply_raw_diff(&bp->vec[3], tot, ve_median[C_BWEIGHT], median[C_BWEIGHT]);
+ if (median->b_weight) {
+ apply_raw_diff(&bp->vec[3], tot, ve_median->b_weight, median->b_weight);
}
- if (median[C_WEIGHT]) {
- apply_scale_factor_clamp(&bp->weight, tot, ve_median[C_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
}
- if (median[C_RADIUS]) {
- apply_raw_diff(&bp->radius, tot, ve_median[C_RADIUS], median[C_RADIUS]);
+ if (median->radius) {
+ apply_raw_diff(&bp->radius, tot, ve_median->radius, median->radius);
}
- if (median[C_TILT]) {
- apply_raw_diff(&bp->alfa, tot, ve_median[C_TILT], median[C_TILT]);
+ if (median->tilt) {
+ apply_raw_diff(&bp->alfa, tot, ve_median->tilt, median->tilt);
}
}
}
@@ -725,21 +739,24 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
nu = nu->next;
}
}
- else if ((ob->type == OB_LATTICE) && (apply_vcos || median[L_WEIGHT])) {
+ else if ((ob->type == OB_LATTICE) &&
+ (apply_vcos || median_basis.lattice.weight))
+ {
+ const TransformMedian_Lattice *median = &median_basis.lattice, *ve_median = &ve_median_basis.lattice;
Lattice *lt = ob->data;
BPoint *bp;
int a;
- const float scale_w = compute_scale_factor(ve_median[L_WEIGHT], median[L_WEIGHT]);
+ const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
if (apply_vcos) {
- apply_raw_diff_v3(bp->vec, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
}
- if (median[L_WEIGHT]) {
- apply_scale_factor_clamp(&bp->weight, tot, ve_median[L_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
}
}
bp++;
@@ -748,27 +765,52 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* ED_undo_push(C, "Transform properties"); */
}
+}
+
+#undef TRANSFORM_MEDIAN_ARRAY_LEN
+
+static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
+{
+ uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
+ TransformProperties *tfp = v3d_transform_props_ensure(v3d);
+
+ if (block) {
+ BLI_assert(C == NULL);
+ int yi = 200;
+ const int butw = 200;
+ const int buth = 20 * UI_DPI_FAC;
+
+ BKE_object_dimensions_get(ob, tfp->ob_dims);
+ copy_v3_v3(tfp->ob_dims_orig, tfp->ob_dims);
+
+ uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Dimensions:"), 0, yi -= buth, butw, buth, NULL, 0, 0, 0, 0, "");
+ UI_block_align_begin(block);
+ const float lim = 10000;
+ for (int i = 0; i < 3; i++) {
+ uiBut *but;
+ char text[3] = {'X' + i, ':', '\0'};
+ but = uiDefButF(
+ block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_DIMS, text, 0, yi -= buth, butw, buth,
+ &(tfp->ob_dims[i]), 0.0f, lim, 10, 3, "");
+ UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
+ }
+ UI_block_align_end(block);
+ }
+ else { /* apply */
+ int axis_mask = 0;
+ for (int i = 0; i < 3; i++) {
+ if (tfp->ob_dims[i] == tfp->ob_dims_orig[i]) {
+ axis_mask |= (1 << i);
+ }
+ }
+ BKE_object_dimensions_set(ob, tfp->ob_dims, axis_mask);
-/* Clean up! */
-/* Location, common to all. */
-#undef LOC_X
-#undef LOC_Y
-#undef LOC_Z
-/* Meshes (and lattice)... */
-#undef M_BV_WEIGHT
-#undef M_SKIN_X
-#undef M_SKIN_Y
-#undef M_BE_WEIGHT
-#undef M_CREASE
-/* Curves... */
-#undef C_BWEIGHT
-#undef C_WEIGHT
-#undef C_RADIUS
-#undef C_TILT
-/* Lattice... */
-#undef L_WEIGHT
+ PointerRNA obptr;
+ RNA_id_pointer_create(&ob->id, &obptr);
+ PropertyRNA *prop = RNA_struct_find_property(&obptr, "scale");
+ RNA_property_update(C, &obptr, prop);
+ }
}
-#undef NBR_TRANSFORM_PROPERTIES
#define B_VGRP_PNL_EDIT_SINGLE 8 /* or greater */
@@ -826,7 +868,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiLayout *row;
uiBut *but;
bDeformGroup *dg;
- unsigned int i;
+ uint i;
int subset_count, vgroup_tot;
const bool *vgroup_validmap;
eVGroupSelect subset_type = ts->vgroupsubset;
@@ -987,14 +1029,6 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiLayoutSetEmboss(colsub, UI_EMBOSS_NONE);
uiItemL(colsub, "", ICON_NONE);
uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_DECORATE_UNLOCKED);
-
- if (ptr->type == &RNA_Object) {
- Object *ob = ptr->data;
- /* dimensions and editmode just happen to be the same checks */
- if (OB_TYPE_SUPPORT_EDITMODE(ob->type)) {
- uiItemR(layout, ptr, "dimensions", 0, NULL, ICON_NONE);
- }
- }
}
static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
@@ -1114,12 +1148,17 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
ED_area_tag_redraw(CTX_wm_area(C));
return; /* no notifier! */
- case B_OBJECTPANELMEDIAN:
+ case B_TRANSFORM_PANEL_MEDIAN:
if (ob) {
v3d_editvertex_buts(NULL, v3d, ob, 1.0);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
break;
+ case B_TRANSFORM_PANEL_DIMS:
+ if (ob) {
+ v3d_object_dimension_buts(C, NULL, v3d, ob);
+ }
+ break;
}
/* default for now */
@@ -1135,10 +1174,9 @@ static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)
static void view3d_panel_transform(const bContext *C, Panel *pa)
{
uiBlock *block;
- Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obedit = CTX_data_edit_object(C);
Object *ob = view_layer->basact->object;
+ Object *obedit = OBEDIT_FROM_OBACT(ob);
uiLayout *col;
block = uiLayoutGetBlock(pa->layout);
@@ -1155,6 +1193,7 @@ static void view3d_panel_transform(const bContext *C, Panel *pa)
}
else {
View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
const float lim = 10000.0f * max_ff(1.0f, ED_view3d_grid_scale(scene, v3d, NULL));
v3d_editvertex_buts(col, v3d, ob, lim);
}
@@ -1167,6 +1206,12 @@ static void view3d_panel_transform(const bContext *C, Panel *pa)
RNA_id_pointer_create(&ob->id, &obptr);
v3d_transform_butsR(col, &obptr);
+
+ /* dimensions and editmode just happen to be the same checks */
+ if (OB_TYPE_SUPPORT_EDITMODE(ob->type)) {
+ View3D *v3d = CTX_wm_view3d(C);
+ v3d_object_dimension_buts(NULL, col, v3d, ob);
+ }
}
}
@@ -1181,7 +1226,7 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
strcpy(pt->idname, "VIEW3D_PT_transform");
- strcpy(pt->label, N_("Transform")); /* XXX C panels not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Transform")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->category, "View");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = view3d_panel_transform;
@@ -1190,7 +1235,7 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
strcpy(pt->idname, "VIEW3D_PT_vgroup");
- strcpy(pt->label, N_("Vertex Weights")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Vertex Weights")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->category, "View");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = view3d_panel_vgroup;
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index d8b7d449c36..d1ff73d1f87 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,21 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_camera_control.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* The purpose of View3DCameraControl is to allow editing \a rv3d manipulation
* (mainly \a ofs and \a viewquat) for the purpose of view navigation
* without having to worry about positioning the camera, its parent...
* or other details.
- *
- *
* Typical view-control usage:
*
* - acquire a view-control (#ED_view3d_cameracontrol_acquire).
@@ -54,7 +46,6 @@
#include "BLI_utildefines.h"
#include "BKE_object.h"
-#include "BKE_context.h"
#include "DEG_depsgraph.h"
@@ -94,20 +85,24 @@ typedef struct View3DCameraControl {
Object *root_parent;
/* backup values */
- float dist_backup; /* backup the views distance since we use a zero dist for fly mode */
- float ofs_backup[3]; /* backup the views offset in case the user cancels flying in non camera mode */
+ float dist_backup;
+ /* backup the views distance since we use a zero dist for fly mode */
+ float ofs_backup[3];
+ /* backup the views offset in case the user cancels flying in non camera mode */
/* backup the views quat in case the user cancels flying in non camera mode.
* (quat for view, eul for camera) */
float rot_backup[4];
- char persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+ /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+ char persp_backup;
/* are we flying an ortho camera in perspective view,
* which was originally in ortho view?
* could probably figure it out but better be explicit */
bool is_ortho_cam;
- void *obtfm; /* backup the objects transform */
+ /* backup the objects transform */
+ void *obtfm;
} View3DCameraControl;
@@ -185,8 +180,10 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(
}
else {
/* perspective or ortho */
- if (rv3d->persp == RV3D_ORTHO)
- rv3d->persp = RV3D_PERSP; /* if ortho projection, make perspective */
+ if (rv3d->persp == RV3D_ORTHO) {
+ /* if ortho projection, make perspective */
+ rv3d->persp = RV3D_PERSP;
+ }
copy_qt_qt(vctrl->rot_backup, rv3d->viewquat);
copy_v3_v3(vctrl->ofs_backup, rv3d->ofs);
@@ -217,7 +214,8 @@ void ED_view3d_cameracontrol_update(
const bool use_autokey,
struct bContext *C, const bool do_rotate, const bool do_translate)
{
- /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
+ /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera
+ * to the view */
Scene *scene = vctrl->ctx_scene;
View3D *v3d = vctrl->ctx_v3d;
@@ -253,21 +251,21 @@ void ED_view3d_cameracontrol_update(
}
else {
float view_mat[4][4];
- float size_mat[4][4];
- float size_back[3];
+ float scale_mat[4][4];
+ float scale_back[3];
- /* even though we handle the size matrix, this still changes over time */
- copy_v3_v3(size_back, v3d->camera->size);
+ /* even though we handle the scale matrix, this still changes over time */
+ copy_v3_v3(scale_back, v3d->camera->scale);
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- size_to_mat4(size_mat, v3d->camera->size);
- mul_m4_m4m4(view_mat, view_mat, size_mat);
+ size_to_mat4(scale_mat, v3d->camera->scale);
+ mul_m4_m4m4(view_mat, view_mat, scale_mat);
BKE_object_apply_mat4(v3d->camera, view_mat, true, true);
DEG_id_tag_update(&v3d->camera->id, ID_RECALC_TRANSFORM);
- copy_v3_v3(v3d->camera->size, size_back);
+ copy_v3_v3(v3d->camera->scale, scale_back);
id_key = &v3d->camera->id;
}
@@ -303,7 +301,8 @@ void ED_view3d_cameracontrol_release(
DEG_id_tag_update(&ob_back->id, ID_RECALC_TRANSFORM);
}
else {
- /* Non Camera we need to reset the view back to the original location because the user canceled*/
+ /* Non Camera we need to reset the view back
+ * to the original location because the user canceled. */
copy_qt_qt(rv3d->viewquat, vctrl->rot_backup);
rv3d->persp = vctrl->persp_backup;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 9fee8f38533..aca2cf53aa6 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_draw.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <math.h>
@@ -37,8 +30,6 @@
#include "BLI_threads.h"
#include "BLI_jitter_2d.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "BKE_camera.h"
#include "BKE_collection.h"
@@ -154,7 +145,7 @@ void ED_view3d_update_viewmat(
rv3d->viewcamtexcofac[2] = rv3d->viewcamtexcofac[3] = 0.0f;
}
- /* calculate pixelsize factor once, is used for lamps and obcenters */
+ /* calculate pixelsize factor once, is used for lights and obcenters */
{
/* note: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])'
* because of float point precision problems at large values [#23908] */
@@ -248,20 +239,22 @@ static void view3d_stereo3d_setup(
/* update the viewport matrices with the new camera */
if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
- Camera *data;
+ Camera *data, *data_eval;
float viewmat[4][4];
float shiftx;
data = (Camera *)v3d->camera->data;
- shiftx = data->shiftx;
+ data_eval = (Camera *)DEG_get_evaluated_id(depsgraph, &data->id);
+
+ shiftx = data_eval->shiftx;
BLI_thread_lock(LOCK_VIEW3D);
- data->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
+ data_eval->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect);
- data->shiftx = shiftx;
+ data_eval->shiftx = shiftx;
BLI_thread_unlock(LOCK_VIEW3D);
}
else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
@@ -320,8 +313,8 @@ static void view3d_camera_border(
/* get camera viewplane */
BKE_camera_params_init(&params);
/* fallback for non camera objects */
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
BKE_camera_params_from_object(&params, camera_eval);
if (no_shift) {
params.shiftx = 0.0f;
@@ -716,7 +709,10 @@ void ED_view3d_draw_depth(
/* temp set drawtype to solid */
/* Setting these temporarily is not nice */
v3d->flag &= ~V3D_SELECT_OUTLINE;
- U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */
+
+ /* not that nice but means we wont zoom into billboards */
+ U.glalphaclip = alphaoverride ? 0.5f : glalphaclip;
+
U.obcenter_dia = 0;
/* Tools may request depth outside of regular drawing code. */
@@ -780,9 +776,9 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
}
-/* Simulates the grid scale that is visualized by the shaders drawing functions.
- * The actual code is seen in `object_grid_frag.glsl` when you get the `grid_res` value.
- * Currently the simulation is done only when RV3D_VIEW_IS_AXIS. */
+/* Simulates the grid scale that is actually viewed.
+ * The actual code is seen in `object_grid_frag.glsl` (see `grid_res`).
+ * Currently the simulation is only done when RV3D_VIEW_IS_AXIS. */
float ED_view3d_grid_view_scale(
Scene *scene, View3D *v3d, RegionView3D *rv3d, const char **grid_unit)
{
@@ -791,19 +787,17 @@ float ED_view3d_grid_view_scale(
/* Decrease the distance between grid snap points depending on zoom. */
float grid_subdiv = v3d->gridsubdiv;
if (grid_subdiv > 1) {
- float grid_distance = rv3d->dist;
- float lvl = (logf(grid_distance / grid_scale) / logf(grid_subdiv));
- if (lvl < 0.0f) {
- /* Negative values need an offset for correct casting.
- * By convention, the minimum lvl is limited to -2 (see `objec_mode.c`) */
- if (lvl > -2.0f) {
- lvl -= 1.0f;
- }
- else {
- lvl = -2.0f;
- }
- }
- grid_scale *= pow(grid_subdiv, (int)lvl - 1);
+ /* Allow 3 more subdivisions (see OBJECT_engine_init). */
+ grid_scale /= powf(grid_subdiv, 3);
+
+ /* `3.0` was a value obtained by trial and error in order to get
+ * a nice snap distance.*/
+ float grid_res = 3.0 * (rv3d->dist / v3d->lens);
+ float lvl = (logf(grid_res / grid_scale) / logf(grid_subdiv));
+
+ CLAMP_MIN(lvl, 0.0f);
+
+ grid_scale *= pow(grid_subdiv, (int)lvl);
}
}
@@ -813,7 +807,8 @@ float ED_view3d_grid_view_scale(
static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
{
const float k = U.rvisize * U.pixelsize; /* axis size */
- const int bright = - 20 * (10 - U.rvibright); /* axis alpha offset (rvibright has range 0-10) */
+ /* axis alpha offset (rvibright has range 0-10) */
+ const int bright = - 20 * (10 - U.rvibright);
/* Axis center in screen coordinates.
*
@@ -824,7 +819,7 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
const float starty = rect->ymax - (k + UI_UNIT_Y);
float axis_pos[3][2];
- unsigned char axis_col[3][4];
+ uchar axis_col[3][4];
int axis_order[3] = {0, 1, 2};
axis_sort_v3(rv3d->viewinv[2], axis_order);
@@ -1210,12 +1205,15 @@ static void draw_selected_name(Scene *scene, ViewLayer *view_layer, Object *ob,
}
/* color depends on whether there is a keyframe */
- if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL))
+ if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL)) {
UI_FontThemeColor(font_id, TH_TIME_KEYFRAME);
- else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra))
+ }
+ else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra)) {
UI_FontThemeColor(font_id, TH_TIME_GP_KEYFRAME);
- else
+ }
+ else {
UI_FontThemeColor(font_id, TH_TEXT_HI);
+ }
}
else {
/* no object */
@@ -1368,7 +1366,6 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
}
/* -------------------------------------------------------------------- */
-
/** \name Offscreen Drawing
* \{ */
@@ -1422,7 +1419,7 @@ void ED_view3d_draw_offscreen(
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
/* set flags */
- G.f |= G_RENDER_OGL;
+ G.f |= G_FLAG_RENDER_VIEWPORT;
{
/* free images which can have changed on frame-change
@@ -1455,7 +1452,7 @@ void ED_view3d_draw_offscreen(
UI_Theme_Restore(&theme_state);
- G.f &= ~G_RENDER_OGL;
+ G.f &= ~G_FLAG_RENDER_VIEWPORT;
}
/**
@@ -1468,7 +1465,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
Depsgraph *depsgraph, Scene *scene,
int drawtype,
View3D *v3d, ARegion *ar, int sizex, int sizey,
- unsigned int flag, unsigned int draw_flags,
+ uint flag, uint draw_flags,
int alpha_mode, int samples, const char *viewname,
/* output vars */
GPUOffScreen *ofs, char err_out[256])
@@ -1520,8 +1517,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
BKE_camera_params_init(&params);
/* fallback for non camera objects */
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
BKE_camera_params_from_object(&params, camera_eval);
BKE_camera_multiview_params(&scene->r, &params, camera_eval, viewname);
BKE_camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
@@ -1534,14 +1531,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
}
else {
rctf viewplane;
- float clipsta, clipend;
+ float clip_start, clipend;
- is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
+ is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &clipend, NULL);
if (is_ortho) {
orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
}
else {
- perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+ perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clipend);
}
}
@@ -1594,7 +1591,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
&fx_settings, ofs, viewport);
GPU_offscreen_read_pixels(ofs, GL_FLOAT, rect_temp);
- unsigned int i = sizex * sizey * 4;
+ uint i = sizex * sizey * 4;
while (i--) {
accum_buffer[i] += rect_temp[i];
}
@@ -1612,16 +1609,16 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
if (ibuf->rect_float) {
float *rect_float = ibuf->rect_float;
- unsigned int i = sizex * sizey * 4;
+ uint i = sizex * sizey * 4;
while (i--) {
rect_float[i] = accum_buffer[i] / samples;
}
}
else {
- unsigned char *rect_ub = (unsigned char *)ibuf->rect;
- unsigned int i = sizex * sizey * 4;
+ uchar *rect_ub = (uchar *)ibuf->rect;
+ uint i = sizex * sizey * 4;
while (i--) {
- rect_ub[i] = (unsigned char)(255.0f * accum_buffer[i] / samples);
+ rect_ub[i] = (uchar)(255.0f * accum_buffer[i] / samples);
}
}
@@ -1659,7 +1656,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
Depsgraph *depsgraph, Scene *scene,
int drawtype,
Object *camera, int width, int height,
- unsigned int flag, unsigned int draw_flags,
+ uint flag, uint draw_flags,
int alpha_mode, int samples, const char *viewname,
GPUOffScreen *ofs, char err_out[256])
{
@@ -1708,8 +1705,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
BKE_camera_params_compute_matrix(&params);
copy_m4_m4(rv3d.winmat, params.winmat);
- v3d.near = params.clipsta;
- v3d.far = params.clipend;
+ v3d.clip_start = params.clip_start;
+ v3d.clip_end = params.clip_end;
v3d.lens = params.lens;
}
@@ -1723,3 +1720,28 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Viewport Clipping
+ * \{ */
+
+static bool view3d_clipping_test(const float co[3], const float clip[6][4])
+{
+ if (plane_point_side_v3(clip[0], co) > 0.0f)
+ if (plane_point_side_v3(clip[1], co) > 0.0f)
+ if (plane_point_side_v3(clip[2], co) > 0.0f)
+ if (plane_point_side_v3(clip[3], co) > 0.0f)
+ return false;
+
+ return true;
+}
+
+/* for 'local' ED_view3d_clipping_local must run first
+ * then all comparisons can be done in localspace */
+bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
+{
+ return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
+}
+
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index c9a6a9d608b..d7d0e4660f7 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_draw_legacy.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -39,7 +32,7 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
#include "DNA_brush_types.h"
@@ -48,7 +41,6 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_jitter_2d.h"
#include "BLI_utildefines.h"
#include "BLI_endian_switch.h"
#include "BLI_threads.h"
@@ -60,12 +52,10 @@
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_global.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_unit.h"
#include "BKE_movieclip.h"
@@ -114,50 +104,49 @@
/* ********* custom clipping *********** */
+/* Legacy 2.7x, now use shaders that use clip distance instead.
+ * Remove once clipping is working properly. */
+#define USE_CLIP_PLANES
+
void ED_view3d_clipping_set(RegionView3D *rv3d)
{
+#ifdef USE_CLIP_PLANES
double plane[4];
- const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
+ const uint tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
for (unsigned a = 0; a < tot; a++) {
copy_v4db_v4fl(plane, rv3d->clip[a]);
glClipPlane(GL_CLIP_PLANE0 + a, plane);
glEnable(GL_CLIP_PLANE0 + a);
+ glEnable(GL_CLIP_DISTANCE0 + a);
+ }
+#else
+ for (unsigned a = 0; a < 6; a++) {
+ glEnable(GL_CLIP_DISTANCE0 + a);
}
+#endif
}
/* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */
void ED_view3d_clipping_disable(void)
{
for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
glDisable(GL_CLIP_PLANE0 + a);
+#endif
+ glDisable(GL_CLIP_DISTANCE0 + a);
}
}
void ED_view3d_clipping_enable(void)
{
for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
glEnable(GL_CLIP_PLANE0 + a);
+#endif
+ glEnable(GL_CLIP_DISTANCE0 + a);
}
}
-static bool view3d_clipping_test(const float co[3], const float clip[6][4])
-{
- if (plane_point_side_v3(clip[0], co) > 0.0f)
- if (plane_point_side_v3(clip[1], co) > 0.0f)
- if (plane_point_side_v3(clip[2], co) > 0.0f)
- if (plane_point_side_v3(clip[3], co) > 0.0f)
- return false;
-
- return true;
-}
-
-/* for 'local' ED_view3d_clipping_local must run first
- * then all comparisons can be done in localspace */
-bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
-{
- return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
-}
-
/* *********************** backdraw for selection *************** */
static void backdrawview3d(
@@ -257,7 +246,7 @@ static void backdrawview3d(
if (rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(rv3d);
- G.f |= G_BACKBUFSEL;
+ G.f |= G_FLAG_BACKBUFSEL;
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
draw_object_backbufsel(depsgraph, scene_eval, v3d, rv3d, obact_eval, select_mode);
@@ -268,7 +257,7 @@ static void backdrawview3d(
v3d->flag &= ~V3D_INVALID_BACKBUF;
- G.f &= ~G_BACKBUFSEL;
+ G.f &= ~G_FLAG_BACKBUFSEL;
GPU_depth_test(false);
glEnable(GL_DITHER);
@@ -319,7 +308,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
}
/* samples a single pixel (copied from vpaint) */
-unsigned int ED_view3d_backbuf_sample(
+uint ED_view3d_backbuf_sample(
ViewContext *vc, int x, int y)
{
if (x >= vc->ar->winx || y >= vc->ar->winy) {
@@ -328,7 +317,7 @@ unsigned int ED_view3d_backbuf_sample(
ED_view3d_backbuf_validate(vc);
- unsigned int col;
+ uint col;
view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
@@ -397,9 +386,9 @@ ImBuf *ED_view3d_backbuf_read(
}
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
-unsigned int ED_view3d_backbuf_sample_rect(
+uint ED_view3d_backbuf_sample_rect(
ViewContext *vc, const int mval[2], int size,
- unsigned int min, unsigned int max, float *r_dist)
+ uint min, uint max, float *r_dist)
{
int dirvec[4][2];
@@ -491,8 +480,6 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
Camera *cam = v3d->camera->data;
for (CameraBGImage *bgpic = cam->bg_images.first; bgpic; bgpic = bgpic->next) {
- bgpic->iuser.scene = scene; /* Needed for render results. */
-
if ((bgpic->flag & CAM_BGIMG_FLAG_FOREGROUND) != fg_flag)
continue;
@@ -515,13 +502,16 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
ima = bgpic->ima;
if (ima == NULL)
continue;
- BKE_image_user_frame_calc(&bgpic->iuser, (int)DEG_get_ctime(depsgraph));
- if (ima->source == IMA_SRC_SEQUENCE && !(bgpic->iuser.flag & IMA_USER_FRAME_IN_RANGE)) {
+
+ ImageUser iuser = bgpic->iuser;
+ iuser.scene = scene; /* Needed for render results. */
+ BKE_image_user_frame_calc(&iuser, (int)DEG_get_ctime(depsgraph));
+ if (ima->source == IMA_SRC_SEQUENCE && !(iuser.flag & IMA_USER_FRAME_IN_RANGE)) {
ibuf = NULL; /* frame is out of range, dont show */
}
else {
- view3d_stereo_bgpic_setup(scene, v3d, ima, &bgpic->iuser);
- ibuf = BKE_image_acquire_ibuf(ima, &bgpic->iuser, &lock);
+ view3d_stereo_bgpic_setup(scene, v3d, ima, &iuser);
+ ibuf = BKE_image_acquire_ibuf(ima, &iuser, &lock);
releaseibuf = ibuf;
}
@@ -563,7 +553,8 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
if (ibuf == NULL)
continue;
- if ((ibuf->rect == NULL && ibuf->rect_float == NULL) || ibuf->channels != 4) { /* invalid image format */
+ if ((ibuf->rect == NULL && ibuf->rect_float == NULL) || ibuf->channels != 4) {
+ /* invalid image format */
if (freeibuf)
IMB_freeImBuf(freeibuf);
if (releaseibuf)
@@ -767,7 +758,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
.xmin = 0,
.xmax = ar->winx - 1,
.ymin = 0,
- .ymax = ar->winy - 1
+ .ymax = ar->winy - 1,
};
/* Constrain rect to depth bounds */
@@ -888,7 +879,7 @@ void ED_view3d_draw_depth_gpencil(
/* *********************** customdata **************** */
-CustomDataMask ED_view3d_datamask(const Scene *UNUSED(scene), const View3D *v3d)
+CustomDataMask ED_view3d_datamask(const bContext *C, const Scene *UNUSED(scene), const View3D *v3d)
{
CustomDataMask mask = 0;
const int drawtype = view3d_effective_drawtype(v3d);
@@ -900,18 +891,24 @@ CustomDataMask ED_view3d_datamask(const Scene *UNUSED(scene), const View3D *v3d)
mask |= CD_MASK_ORCO;
}
+ if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) &&
+ (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT))
+ {
+ mask |= CD_MASK_MDEFORMVERT;
+ }
+
return mask;
}
/* goes over all modes and view3d settings */
-CustomDataMask ED_view3d_screen_datamask(const Scene *scene, const bScreen *screen)
+CustomDataMask ED_view3d_screen_datamask(const bContext *C, const Scene *scene, const bScreen *screen)
{
CustomDataMask mask = CD_MASK_BAREMESH;
/* check if we need tfaces & mcols due to view mode */
for (const ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
- mask |= ED_view3d_datamask(scene, sa->spacedata.first);
+ mask |= ED_view3d_datamask(C, scene, sa->spacedata.first);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 4ac2121c7a4..fe0dfc6bc31 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_edit.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* 3D view manipulation/operators.
*/
@@ -294,19 +287,19 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) {
/* object mode use boundbox centers */
Base *base_eval;
- unsigned int tot = 0;
+ uint tot = 0;
float select_center[3];
zero_v3(select_center);
for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
- if (TESTBASE(v3d, base_eval)) {
+ if (BASE_SELECTED(v3d, base_eval)) {
/* use the boundbox if we can */
Object *ob_eval = base_eval->object;
- if (ob_eval->bb && !(ob_eval->bb->flag & BOUNDBOX_DIRTY)) {
+ if (ob_eval->runtime.bb && !(ob_eval->runtime.bb->flag & BOUNDBOX_DIRTY)) {
float cent[3];
- BKE_boundbox_calc_center_aabb(ob_eval->bb, cent);
+ BKE_boundbox_calc_center_aabb(ob_eval->runtime.bb, cent);
mul_m4_v3(ob_eval->obmat, cent);
add_v3_v3(select_center, cent);
@@ -457,8 +450,8 @@ static void viewops_data_create(
negate_v3_v3(my_origin, rv3d->ofs); /* ofs is flipped */
- /* Set the dist value to be the distance from this 3d point
- * this means youll always be able to zoom into it and panning wont go bad when dist was zero */
+ /* Set the dist value to be the distance from this 3d point this means youll
+ * always be able to zoom into it and panning wont go bad when dist was zero */
/* remove dist value */
upvec[0] = upvec[1] = 0;
@@ -469,7 +462,8 @@ static void viewops_data_create(
sub_v3_v3v3(my_pivot, rv3d->ofs, upvec);
negate_v3(my_pivot); /* ofs is flipped */
- /* find a new ofs value that is along the view axis (rather than the mouse location) */
+ /* find a new ofs value that is along the view axis
+ * (rather than the mouse location) */
closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin);
vod->init.dist = rv3d->dist = len_v3v3(my_pivot, dvec);
@@ -549,7 +543,7 @@ static void viewops_data_free(bContext *C, wmOperator *op)
enum {
VIEW_PASS = 0,
VIEW_APPLY,
- VIEW_CONFIRM
+ VIEW_CONFIRM,
};
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
@@ -574,7 +568,7 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
@@ -1224,7 +1218,8 @@ void view3d_ndof_fly(
}
if (!is_zero_v3(trans)) {
- /* move center of view opposite of hand motion (this is camera mode, not object mode) */
+ /* move center of view opposite of hand motion
+ * (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, trans);
has_translate = true;
}
@@ -1579,7 +1574,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Move Modal");
@@ -1706,7 +1701,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
@@ -1771,7 +1766,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
@@ -2203,7 +2198,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
@@ -2302,7 +2297,7 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
@@ -2520,7 +2515,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
@@ -2645,7 +2640,7 @@ static void view3d_from_minmax(
new_dist = ED_view3d_radius_to_dist(v3d, ar, CTX_data_depsgraph(C), persp, true, (size / 2) * VIEW3D_MARGIN);
if (rv3d->is_persp) {
/* don't zoom closer than the near clipping plane */
- new_dist = max_ff(new_dist, v3d->near * 1.5f);
+ new_dist = max_ff(new_dist, v3d->clip_start * 1.5f);
}
}
}
@@ -2659,12 +2654,13 @@ static void view3d_from_minmax(
C, v3d, ar, smooth_viewtx,
&(const V3D_SmoothParams) {
.camera_old = v3d->camera, .ofs = new_ofs,
- .dist = ok_dist ? &new_dist : NULL});
+ .dist = ok_dist ? &new_dist : NULL,
+ });
}
else {
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = new_ofs, .dist = ok_dist ? &new_dist : NULL});
+ &(const V3D_SmoothParams) { .ofs = new_ofs, .dist = ok_dist ? &new_dist : NULL, });
}
/* smooth view does viewlock RV3D_BOXVIEW copy */
@@ -2716,7 +2712,10 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
zero_v3(min);
zero_v3(max);
zero_v3(cursor->location);
- unit_qt(cursor->rotation);
+ unit_qt(cursor->rotation_quaternion);
+ zero_v3(cursor->rotation_euler);
+ ARRAY_SET_ITEMS(cursor->rotation_axis, 0.0f, 1.0f, 0.0f);
+ cursor->rotation_angle = 0.0f;
}
else {
INIT_MINMAX(min, max);
@@ -2818,10 +2817,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
if (ob_eval && (ob_eval->mode & OB_MODE_WEIGHT_PAINT)) {
/* hard-coded exception, we look for the one selected armature */
- /* this is weak code this way, we should make a generic active/selection callback interface once... */
+ /* this is weak code this way, we should make a generic
+ * active/selection callback interface once... */
Base *base_eval;
for (base_eval = view_layer_eval->object_bases.first; base_eval; base_eval = base_eval->next) {
- if (TESTBASELIB(v3d, base_eval)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base_eval)) {
if (base_eval->object->type == OB_ARMATURE)
if (base_eval->object->mode & OB_MODE_POSE)
break;
@@ -2888,15 +2888,17 @@ static int viewselected_exec(bContext *C, wmOperator *op)
else {
Base *base_eval;
for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
- if (TESTBASE(v3d, base_eval)) {
+ if (BASE_SELECTED(v3d, base_eval)) {
if (skip_camera && base_eval->object == v3d->camera) {
continue;
}
/* account for duplis */
- if (BKE_object_minmax_dupli(depsgraph, scene, base_eval->object, min, max, false) == 0)
- BKE_object_minmax(base_eval->object, min, max, false); /* use if duplis not found */
+ if (BKE_object_minmax_dupli(depsgraph, scene, base_eval->object, min, max, false) == 0) {
+ /* use if duplis not found */
+ BKE_object_minmax(base_eval->object, min, max, false);
+ }
ok = 1;
}
@@ -3135,7 +3137,7 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
/** \name View Camera Center Operator
* \{ */
-static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
+static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op))
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
@@ -3187,7 +3189,7 @@ void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
/** \name View Lock Center Operator
* \{ */
-static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
+static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op))
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -3440,7 +3442,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
new_dist = len_v3(dvec);
/* ignore dist_range min */
- dist_range[0] = v3d->near * 1.5f;
+ dist_range[0] = v3d->clip_start * 1.5f;
}
else { /* othographic */
/* find the current window width and height */
@@ -3497,7 +3499,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = new_ofs, .dist = &new_dist});
+ &(const V3D_SmoothParams) { .ofs = new_ofs, .dist = &new_dist, });
if (rv3d->viewlock & RV3D_BOXVIEW) {
view3d_boxview_sync(CTX_wm_area(C), ar);
@@ -3594,7 +3596,7 @@ static const EnumPropertyItem prop_view_items[] = {
{RV3D_VIEW_TOP, "TOP", ICON_TRIA_UP, "Top", "View From the Top"},
{RV3D_VIEW_FRONT, "FRONT", 0, "Front", "View From the Front"},
{RV3D_VIEW_BACK, "BACK", 0, "Back", "View From the Back"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -3642,7 +3644,7 @@ static void axis_set_view(
/* to camera */
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.camera_old = v3d->camera, .ofs = rv3d->ofs, .quat = quat});
+ &(const V3D_SmoothParams) { .camera_old = v3d->camera, .ofs = rv3d->ofs, .quat = quat, });
}
else if (orig_persp == RV3D_CAMOB && v3d->camera) {
/* from camera */
@@ -3657,7 +3659,7 @@ static void axis_set_view(
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = ofs, .quat = quat, .dist = &dist});
+ &(const V3D_SmoothParams) { .ofs = ofs, .quat = quat, .dist = &dist, });
}
else {
/* rotate around selection */
@@ -3674,7 +3676,7 @@ static void axis_set_view(
/* no camera involved */
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat, .dyn_ofs = dyn_ofs_pt, });
}
}
@@ -3872,7 +3874,8 @@ static int view_camera_exec(bContext *C, wmOperator *op)
C, v3d, ar, smooth_viewtx,
&(const V3D_SmoothParams) {
.camera = v3d->camera, .ofs = rv3d->ofs, .quat = rv3d->viewquat,
- .dist = &rv3d->dist, .lens = &v3d->lens});
+ .dist = &rv3d->dist, .lens = &v3d->lens,
+ });
}
else {
/* return to settings of last view */
@@ -3912,7 +3915,7 @@ static const EnumPropertyItem prop_view_orbit_items[] = {
{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"},
{V3D_VIEW_STEPUP, "ORBITUP", 0, "Orbit Up", "Orbit the view Up"},
{V3D_VIEW_STEPDOWN, "ORBITDOWN", 0, "Orbit Down", "Orbit the view Down"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int vieworbit_exec(bContext *C, wmOperator *op)
@@ -3998,7 +4001,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat_new, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat_new, .dyn_ofs = dyn_ofs_pt, });
return OPERATOR_FINISHED;
}
@@ -4138,7 +4141,7 @@ static const EnumPropertyItem prop_view_roll_items[] = {
{0, "ANGLE", 0, "Roll Angle", "Roll the view using an angle value"},
{V3D_VIEW_STEPLEFT, "LEFT", 0, "Roll Left", "Roll the view around to the Left"},
{V3D_VIEW_STEPRIGHT, "RIGHT", 0, "Roll Right", "Roll the view around to the Right"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -4188,7 +4191,7 @@ static int viewroll_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat_new, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat_new, .dyn_ofs = dyn_ofs_pt, });
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -4274,7 +4277,7 @@ static const EnumPropertyItem prop_view_pan_items[] = {
{V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"},
{V3D_VIEW_PANUP, "PANUP", 0, "Pan Up", "Pan the view Up"},
{V3D_VIEW_PANDOWN, "PANDOWN", 0, "Pan Down", "Pan the view Down"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
@@ -4296,7 +4299,7 @@ static int viewpan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
else if (pandir == V3D_VIEW_PANDOWN) { y = 25; }
viewops_data_alloc(C, op);
- viewops_data_create(C, op, event, viewops_flag_from_prefs());
+ viewops_data_create(C, op, event, (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT));
ViewOpsData *vod = op->customdata;
viewmove_apply(vod, vod->prev.event_xy[0] + x, vod->prev.event_xy[1] + y);
@@ -4558,8 +4561,6 @@ void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
}
-#if 0 /* TODO Missing from 2.8 drawing code. Find a solution to support clip border then uncomment it. */
-
static int view3d_clipping_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
@@ -4616,7 +4617,6 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
/* properties */
WM_operator_properties_border(ot);
}
-#endif
/** \} */
@@ -4765,10 +4765,30 @@ void ED_view3d_cursor3d_update(
View3DCursor *cursor_curr = &scene->cursor;
View3DCursor cursor_prev = *cursor_curr;
- ED_view3d_cursor3d_position_rotation(
- C, mval,
- use_depth, orientation,
- cursor_curr->location, cursor_curr->rotation);
+ {
+ float quat[4], quat_prev[4];
+ BKE_scene_cursor_rot_to_quat(cursor_curr, quat);
+ copy_qt_qt(quat_prev, quat);
+ ED_view3d_cursor3d_position_rotation(
+ C, mval,
+ use_depth, orientation,
+ cursor_curr->location, quat);
+
+ if (!equals_v4v4(quat_prev, quat)) {
+ if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) &&
+ RV3D_VIEW_IS_AXIS(rv3d->view))
+ {
+ float tmat[3][3], cmat[3][3];
+ quat_to_mat3(tmat, quat);
+ negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
+ axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
+ cursor_curr->rotation_angle = angle_signed_on_axis_v3v3_v3(cmat[0], tmat[0], cursor_curr->rotation_axis);
+ }
+ else {
+ BKE_scene_cursor_quat_to_rot(cursor_curr, quat, true);
+ }
+ }
+ }
/* offset the cursor lock to avoid jumping to new offset */
if (v3d->ob_centre_cursor) {
@@ -4786,7 +4806,8 @@ void ED_view3d_cursor3d_update(
}
}
else {
- /* Cursor may be outside of the view, prevent it getting 'lost', see: T40353 & T45301 */
+ /* Cursor may be outside of the view,
+ * prevent it getting 'lost', see: T40353 & T45301 */
zero_v2(rv3d->ofs_lock);
}
}
@@ -4798,8 +4819,9 @@ void ED_view3d_cursor3d_update(
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
- WM_msg_publish_rna_prop(
- mbus, &scene->id, scene, Scene, cursor_location);
+ wmMsgParams_RNA msg_key_params = {{{0}}};
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &msg_key_params.ptr);
+ WM_msg_publish_rna_params(mbus, &msg_key_params);
}
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
@@ -4845,7 +4867,7 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
{V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
{V3D_CURSOR_ORIENT_XFORM, "XFORM", 0, "Transform", "Orient to the current transform setting"},
{V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_boolean(
@@ -4870,7 +4892,7 @@ static const EnumPropertyItem prop_shading_type_items[] = {
{OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
{OB_MATERIAL, "MATERIAL", 0, "LookDev", "Toggle lookdev shading"},
{OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int toggle_shading_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index de5d5d29e52..47961371530 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,21 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_fly.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
/* defines VIEW3D_OT_fly modal operator */
#ifdef WITH_INPUT_NDOF
//# define NDOF_FLY_DEBUG
-//# define NDOF_FLY_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+/* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+//# define NDOF_FLY_DRAW_TOOMUCH
#endif /* WITH_INPUT_NDOF */
#include "DNA_object_types.h"
@@ -43,7 +38,6 @@
#include "BLT_translation.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -62,7 +56,8 @@
#include "view3d_intern.h" /* own include */
-/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
+/* NOTE: these defines are saved in keymap files,
+ * do not change values but just add new ones */
enum {
FLY_MODAL_CANCEL = 1,
FLY_MODAL_CONFIRM,
@@ -90,12 +85,13 @@ typedef enum eFlyPanState {
/* disabled */
FLY_AXISLOCK_STATE_OFF = 0,
- /* enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
- * when the mouse moves, locking is set to 2 so checks are done. */
+ /* enabled but not checking because mouse hasn't moved outside the margin since locking was
+ * checked an not needed when the mouse moves, locking is set to 2 so checks are done. */
FLY_AXISLOCK_STATE_IDLE = 1,
- /* mouse moved and checking needed, if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
- FLY_AXISLOCK_STATE_ACTIVE = 2
+ /* mouse moved and checking needed,
+ * if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
+ FLY_AXISLOCK_STATE_ACTIVE = 2,
} eFlyPanState;
/* called in transform_ops.c, on each regeneration of keymaps */
@@ -127,7 +123,8 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
{FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation", ""},
{FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation (Off)", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Fly Modal");
@@ -531,7 +528,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
/* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast) */
- time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f)));
if (fly->speed < 0.0f) {
fly->speed = 0.0f;
@@ -555,7 +553,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
time_currwheel = PIL_check_seconds_timer();
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
- time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f)));
if (fly->speed > 0.0f) {
fly->speed = 0;
@@ -575,7 +574,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
/* implement WASD keys,
* comments only for 'forward '*/
case FLY_MODAL_DIR_FORWARD:
- if (fly->axis == 2 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */
+ if (fly->axis == 2 && fly->speed < 0.0f) {
+ /* reverse direction stops, tap again to continue */
fly->axis = -1;
}
else {
@@ -694,18 +694,21 @@ static int flyApply(bContext *C, FlyInfo *fly)
*/
RegionView3D *rv3d = fly->rv3d;
- float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */
- float dvec[3] = {0, 0, 0}; /* this is the direction that's added to the view offset per redraw */
+ /* 3x3 copy of the view matrix so we can move along the view axis */
+ float mat[3][3];
+ /* this is the direction that's added to the view offset per redraw */
+ float dvec[3] = {0, 0, 0};
/* Camera Uprighting variables */
float moffset[2]; /* mouse offset from the views center */
float tmp_quat[4]; /* used for rotating the view */
- int xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
+ /* x and y margin are define the safe area where the mouses movement wont rotate the view */
+ int xmargin, ymargin;
#ifdef NDOF_FLY_DEBUG
{
- static unsigned int iteration = 1;
+ static uint iteration = 1;
printf("fly timer %d\n", iteration++);
}
#endif
@@ -763,7 +766,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
#endif
time_current = PIL_check_seconds_timer();
time_redraw = (float)(time_current - fly->time_lastdraw);
- time_redraw_clamped = min_ff(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
+
+ /* clamp redraw time to avoid jitter in roll correction */
+ time_redraw_clamped = min_ff(0.05f, time_redraw);
+
fly->time_lastdraw = time_current;
/* Scale the time to use shift to scale the speed down- just like
@@ -853,7 +859,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
}
else {
- fly->zlock = FLY_AXISLOCK_STATE_IDLE; /* don't check until the view rotates again */
+ /* don't check until the view rotates again */
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE;
fly->zlock_momentum = 0.0f;
}
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
index 9766e8f7ff9..8f268a40817 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_armature.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "BLI_blenlib.h"
@@ -51,7 +47,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Armature Spline Gizmo
*
* \{ */
@@ -138,7 +133,7 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = BKE_object_pose_armature_get(base->object);
if (ob) {
const bArmature *arm = ob->data;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index ace22094e53..2d871e8d646 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_camera.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -47,11 +43,12 @@
#include "WM_types.h"
#include "WM_message.h"
+#include "DEG_depsgraph.h"
+
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Camera Gizmos
* \{ */
@@ -72,7 +69,7 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_CAMERA) {
Camera *camera = ob->data;
@@ -177,7 +174,7 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
/* account for lens shifting */
- offset[0] = ((ob->size[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
+ offset[0] = ((ob->scale[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
offset[1] = 2.0f * ca->shifty;
offset[2] = 0.0f;
@@ -307,11 +304,13 @@ void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name CameraView Gizmos
* \{ */
struct CameraViewWidgetGroup {
+ Scene *scene;
+ bool is_camera;
+
wmGizmo *border;
struct {
@@ -348,7 +347,11 @@ static void gizmo_render_border_prop_matrix_set(
BLI_rctf_resize(border, len_v3(matrix[0]), len_v3(matrix[1]));
BLI_rctf_recenter(border, matrix[3][0], matrix[3][1]);
- BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, border, border);
+ BLI_rctf_isect(&(rctf){ .xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1, }, border, border);
+
+ if (viewgroup->is_camera) {
+ DEG_id_tag_update(&viewgroup->scene->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
@@ -416,7 +419,7 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewgroup->state.view_border, false);
}
else {
- viewgroup->state.view_border = (rctf){.xmin = 0, .ymin = 0, .xmax = ar->winx, .ymax = ar->winy};
+ viewgroup->state.view_border = (rctf){ .xmin = 0, .ymin = 0, .xmax = ar->winx, .ymax = ar->winy, };
}
wmGizmo *gz = viewgroup->border;
@@ -436,6 +439,8 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzg
RegionView3D *rv3d = ar->regiondata;
Scene *scene = CTX_data_scene(C);
+ viewgroup->scene = scene;
+
{
wmGizmo *gz = viewgroup->border;
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
@@ -445,9 +450,11 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzg
if (rv3d->persp == RV3D_CAMOB) {
viewgroup->state.edit_border = &scene->r.border;
+ viewgroup->is_camera = true;
}
else {
viewgroup->state.edit_border = &v3d->render_border;
+ viewgroup->is_camera = false;
}
WM_gizmo_target_property_def_func(
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index e5dafad0757..708d91fc823 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,16 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_empty.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -34,7 +29,7 @@
#include "DEG_depsgraph.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "ED_screen.h"
#include "ED_gizmo_library.h"
@@ -51,7 +46,6 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Empty Image Gizmos
* \{ */
@@ -120,7 +114,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_EMPTY) {
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
index 0e3d214ae3c..b39cc5086bb 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,17 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_forcefield.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -48,7 +42,6 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Force Field Gizmos
* \{ */
@@ -64,7 +57,7 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->pd && ob->pd->forcefield) {
return true;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c
index c4e93234aa5..4680fadcb7f 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,16 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_lamp.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -33,7 +28,7 @@
#include "DEG_depsgraph.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "ED_screen.h"
#include "ED_gizmo_library.h"
@@ -50,11 +45,10 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
-/** \name Spot Lamp Gizmos
+/** \name Spot Light Gizmos
* \{ */
-static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
@@ -65,17 +59,17 @@ static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmGizmoGroupType *UNUS
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (la->type == LA_SPOT);
}
}
return false;
}
-static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_spot_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
@@ -90,13 +84,13 @@ static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmGizmoGroup
UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, gz->color);
}
-static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_spot_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
wmGizmo *gz = wwrapper->gizmo;
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- Lamp *la = ob->data;
+ Light *la = ob->data;
float dir[3];
negate_v3_v3(dir, ob->obmat[2]);
@@ -111,47 +105,46 @@ static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmGizmoGroup *gzgro
WM_gizmo_target_property_def_rna(gz, "offset", &lamp_ptr, propname, -1);
}
-void VIEW3D_GGT_lamp_spot(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_spot(wmGizmoGroupType *gzgt)
{
gzgt->name = "Spot Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_spot";
+ gzgt->idname = "VIEW3D_GGT_light_spot";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D |
WM_GIZMOGROUPTYPE_DEPTH_3D);
- gzgt->poll = WIDGETGROUP_lamp_spot_poll;
- gzgt->setup = WIDGETGROUP_lamp_spot_setup;
- gzgt->refresh = WIDGETGROUP_lamp_spot_refresh;
+ gzgt->poll = WIDGETGROUP_light_spot_poll;
+ gzgt->setup = WIDGETGROUP_light_spot_setup;
+ gzgt->refresh = WIDGETGROUP_light_spot_refresh;
}
/** \} */
/* -------------------------------------------------------------------- */
-
-/** \name Area Lamp Gizmos
+/** \name Area Light Gizmos
* \{ */
/* scale callbacks */
-static void gizmo_area_lamp_prop_matrix_get(
+static void gizmo_area_light_prop_matrix_get(
const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop,
void *value_p)
{
BLI_assert(gz_prop->type->array_length == 16);
float (*matrix)[4] = value_p;
- const Lamp *la = gz_prop->custom_func.user_data;
+ const Light *la = gz_prop->custom_func.user_data;
matrix[0][0] = la->area_size;
matrix[1][1] = ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE) ? la->area_sizey : la->area_size;
}
-static void gizmo_area_lamp_prop_matrix_set(
+static void gizmo_area_light_prop_matrix_set(
const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop,
const void *value_p)
{
const float (*matrix)[4] = value_p;
BLI_assert(gz_prop->type->array_length == 16);
- Lamp *la = gz_prop->custom_func.user_data;
+ Light *la = gz_prop->custom_func.user_data;
if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE)) {
la->area_size = len_v3(matrix[0]);
@@ -165,7 +158,7 @@ static void gizmo_area_lamp_prop_matrix_set(
WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, la);
}
-static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
@@ -174,17 +167,17 @@ static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmGizmoGroupType *UNUS
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (la->type == LA_AREA);
}
}
return false;
}
-static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_area_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, NULL);
@@ -200,12 +193,12 @@ static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmGizmoGroup
UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi);
}
-static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_area_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- Lamp *la = ob->data;
+ Light *la = ob->data;
wmGizmo *gz = wwrapper->gizmo;
copy_m4_m4(gz->matrix_basis, ob->obmat);
@@ -220,36 +213,35 @@ static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmGizmoGroup *gzgro
WM_gizmo_target_property_def_func(
gz, "matrix",
&(const struct wmGizmoPropertyFnParams) {
- .value_get_fn = gizmo_area_lamp_prop_matrix_get,
- .value_set_fn = gizmo_area_lamp_prop_matrix_set,
+ .value_get_fn = gizmo_area_light_prop_matrix_get,
+ .value_set_fn = gizmo_area_light_prop_matrix_set,
.range_get_fn = NULL,
.user_data = la,
});
}
-void VIEW3D_GGT_lamp_area(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
{
gzgt->name = "Area Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_area";
+ gzgt->idname = "VIEW3D_GGT_light_area";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D |
WM_GIZMOGROUPTYPE_DEPTH_3D);
- gzgt->poll = WIDGETGROUP_lamp_area_poll;
- gzgt->setup = WIDGETGROUP_lamp_area_setup;
- gzgt->refresh = WIDGETGROUP_lamp_area_refresh;
+ gzgt->poll = WIDGETGROUP_light_area_poll;
+ gzgt->setup = WIDGETGROUP_light_area_setup;
+ gzgt->refresh = WIDGETGROUP_light_area_refresh;
}
/** \} */
/* -------------------------------------------------------------------- */
-
-/** \name Lamp Target Gizmo
+/** \name Light Target Gizmo
* \{ */
-static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
@@ -258,10 +250,10 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
- if (base && BASE_VISIBLE(v3d, base)) {
+ if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA));
}
#if 0
@@ -273,7 +265,7 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
return false;
}
-static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_target_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_move_3d", gzgroup, NULL);
@@ -294,7 +286,7 @@ static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGrou
WM_gizmo_operator_set(gz, 0, ot, NULL);
}
-static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_target_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -305,9 +297,9 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup
unit_m4(gz->matrix_offset);
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type == LA_SPOT) {
- /* Draw just past the lamp size angle gizmo. */
+ /* Draw just past the light size angle gizmo. */
madd_v3_v3fl(gz->matrix_basis[3], gz->matrix_basis[2], -la->spotsize);
}
}
@@ -315,17 +307,17 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup
WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_OFFSET_SCALE, true);
}
-void VIEW3D_GGT_lamp_target(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_target(wmGizmoGroupType *gzgt)
{
gzgt->name = "Target Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_target";
+ gzgt->idname = "VIEW3D_GGT_light_target";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D);
- gzgt->poll = WIDGETGROUP_lamp_target_poll;
- gzgt->setup = WIDGETGROUP_lamp_target_setup;
- gzgt->draw_prepare = WIDGETGROUP_lamp_target_draw_prepare;
+ gzgt->poll = WIDGETGROUP_light_target_poll;
+ gzgt->setup = WIDGETGROUP_light_target_setup;
+ gzgt->draw_prepare = WIDGETGROUP_light_target_draw_prepare;
}
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index d45da76a477..a86e4ac7f98 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,15 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_navigate.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -61,17 +56,17 @@
enum {
- MPR_MOVE = 0,
- MPR_ROTATE = 1,
- MPR_ZOOM = 2,
+ GZ_INDEX_MOVE = 0,
+ GZ_INDEX_ROTATE = 1,
+ GZ_INDEX_ZOOM = 2,
/* just buttons */
- /* overlaps MPR_ORTHO (switch between) */
- MPR_PERSP = 3,
- MPR_ORTHO = 4,
- MPR_CAMERA = 5,
+ /* overlaps GZ_INDEX_ORTHO (switch between) */
+ GZ_INDEX_PERSP = 3,
+ GZ_INDEX_ORTHO = 4,
+ GZ_INDEX_CAMERA = 5,
- MPR_TOTAL = 6,
+ GZ_INDEX_TOTAL = 6,
};
struct NavigateGizmoInfo {
@@ -80,7 +75,7 @@ struct NavigateGizmoInfo {
uint icon;
};
-static struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = {
+static struct NavigateGizmoInfo g_navigate_params[GZ_INDEX_TOTAL] = {
{
.opname = "VIEW3D_OT_move",
.gizmo = "GIZMO_GT_button_2d",
@@ -109,7 +104,7 @@ static struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = {
};
struct NavigateWidgetGroup {
- wmGizmo *gz_array[MPR_TOTAL];
+ wmGizmo *gz_array[GZ_INDEX_TOTAL];
/* Store the view state to check for changes. */
struct {
rcti rect_visible;
@@ -145,13 +140,13 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
wmOperatorType *ot_view_axis = WM_operatortype_find("VIEW3D_OT_view_axis", true);
wmOperatorType *ot_view_camera = WM_operatortype_find("VIEW3D_OT_view_camera", true);
- for (int i = 0; i < MPR_TOTAL; i++) {
+ for (int i = 0; i < GZ_INDEX_TOTAL; i++) {
const struct NavigateGizmoInfo *info = &g_navigate_params[i];
navgroup->gz_array[i] = WM_gizmo_new(info->gizmo, gzgroup, NULL);
wmGizmo *gz = navgroup->gz_array[i];
gz->flag |= WM_GIZMO_MOVE_CURSOR | WM_GIZMO_DRAW_MODAL;
- if (i == MPR_ROTATE) {
+ if (i == GZ_INDEX_ROTATE) {
gz->color[3] = 0.0f;
gz->color_hi[3] = 0.1f;
}
@@ -176,13 +171,13 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
}
{
- wmGizmo *gz = navgroup->gz_array[MPR_CAMERA];
+ wmGizmo *gz = navgroup->gz_array[GZ_INDEX_CAMERA];
WM_gizmo_operator_set(gz, 0, ot_view_camera, NULL);
}
/* Click only buttons (not modal). */
{
- int gz_ids[] = {MPR_PERSP, MPR_ORTHO, MPR_CAMERA};
+ int gz_ids[] = {GZ_INDEX_PERSP, GZ_INDEX_ORTHO, GZ_INDEX_CAMERA};
for (int i = 0; i < ARRAY_SIZE(gz_ids); i++) {
wmGizmo *gz = navgroup->gz_array[gz_ids[i]];
RNA_boolean_set(gz->ptr, "show_drag", false);
@@ -191,7 +186,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
/* Modal operators, don't use initial mouse location since we're clicking on a button. */
{
- int gz_ids[] = {MPR_MOVE, MPR_ROTATE, MPR_ZOOM};
+ int gz_ids[] = {GZ_INDEX_MOVE, GZ_INDEX_ROTATE, GZ_INDEX_ZOOM};
for (int i = 0; i < ARRAY_SIZE(gz_ids); i++) {
wmGizmo *gz = navgroup->gz_array[gz_ids[i]];
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
@@ -200,7 +195,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
}
{
- wmGizmo *gz = navgroup->gz_array[MPR_ROTATE];
+ wmGizmo *gz = navgroup->gz_array[GZ_INDEX_ROTATE];
gz->scale_basis = GIZMO_SIZE / 2;
char mapping[6] = {
RV3D_VIEW_LEFT,
@@ -230,7 +225,7 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
const RegionView3D *rv3d = ar->regiondata;
for (int i = 0; i < 3; i++) {
- copy_v3_v3(navgroup->gz_array[MPR_ROTATE]->matrix_offset[i], rv3d->viewmat[i]);
+ copy_v3_v3(navgroup->gz_array[GZ_INDEX_ROTATE]->matrix_offset[i], rv3d->viewmat[i]);
}
rcti rect_visible;
@@ -275,7 +270,7 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
/* RV3D_LOCKED or Camera: only show supported buttons. */
if (show_rotate) {
- gz = navgroup->gz_array[MPR_ROTATE];
+ gz = navgroup->gz_array[GZ_INDEX_ROTATE];
gz->matrix_basis[3][0] = co_rotate[0];
gz->matrix_basis[3][1] = co_rotate[1];
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
@@ -283,24 +278,24 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
int icon_mini_slot = 0;
- gz = navgroup->gz_array[MPR_ZOOM];
+ gz = navgroup->gz_array[GZ_INDEX_ZOOM];
gz->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
gz->matrix_basis[3][1] = co[1];
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
- gz = navgroup->gz_array[MPR_MOVE];
+ gz = navgroup->gz_array[GZ_INDEX_MOVE];
gz->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
gz->matrix_basis[3][1] = co[1];
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
- gz = navgroup->gz_array[MPR_CAMERA];
+ gz = navgroup->gz_array[GZ_INDEX_CAMERA];
gz->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
gz->matrix_basis[3][1] = co[1];
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
if (navgroup->state.rv3d.is_camera == false) {
- gz = navgroup->gz_array[rv3d->is_persp ? MPR_PERSP : MPR_ORTHO];
+ gz = navgroup->gz_array[rv3d->is_persp ? GZ_INDEX_PERSP : GZ_INDEX_ORTHO];
gz->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
gz->matrix_basis[3][1] = co[1];
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
index f57ff4464e0..906ff5d8058 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file view3d_gizmo_navigate_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Custom Orientation/Navigation Gizmo for the 3D View
*
@@ -37,8 +33,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -485,7 +479,8 @@ static int gizmo_axis_test_select(
bool ok = true;
- /* Check if we're viewing on an axis, there is no point to clicking on the current axis so show the reverse. */
+ /* Check if we're viewing on an axis,
+ * there is no point to clicking on the current axis so show the reverse. */
if (len_squared_v2(co) < 1e-6f && (gz->matrix_offset[i][2] > 0.0f) == is_pos) {
ok = false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
index 7b8e3a76c85..b71c03684d6 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_preselect.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
index be07928d5fc..029df078a09 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file view3d_gizmo_preselect_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Preselection Gizmo
*
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index ed5a1ab7720..6e26f9a2c13 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_ruler.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "BLI_listbase.h"
@@ -44,8 +40,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_view3d_types.h"
-#include "BIF_gl.h"
-
#include "ED_gizmo_utils.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
@@ -72,7 +66,6 @@
#include "BLF_api.h"
-
static const char *view3d_gzgt_ruler_id = "VIEW3D_GGT_ruler";
@@ -80,16 +73,15 @@ static const char *view3d_gzgt_ruler_id = "VIEW3D_GGT_ruler";
/* -------------------------------------------------------------------- */
/* Ruler Item (we can have many) */
-enum {
- RULERITEM_USE_ANGLE = (1 << 0), /* use protractor */
- RULERITEM_USE_RAYCAST = (1 << 1)
-};
enum {
- RULERITEM_DIRECTION_IN = 0,
- RULERITEM_DIRECTION_OUT
+ /** Use protractor. */
+ RULERITEM_USE_ANGLE = (1 << 0),
+ /** Protractor vertex is selected (deleting removes it). */
+ RULERITEM_USE_ANGLE_ACTIVE = (1 << 1),
};
+
/* keep smaller then selection, since we may want click elsewhere without selecting a ruler */
#define RULER_PICK_DIST 12.0f
#define RULER_PICK_DIST_SQ (RULER_PICK_DIST * RULER_PICK_DIST)
@@ -102,16 +94,17 @@ enum {
enum {
RULER_STATE_NORMAL = 0,
- RULER_STATE_DRAG
+ RULER_STATE_DRAG,
};
enum {
RULER_SNAP_OK = (1 << 0),
};
+struct RulerItem;
+
typedef struct RulerInfo {
- // ListBase items;
- int item_active;
+ struct RulerItem *item_active;
int flag;
int snap_flag;
int state;
@@ -141,7 +134,6 @@ typedef struct RulerInteraction {
/* selected coord */
char co_index; /* 0 -> 2 */
float drag_start_co[3];
- uint inside_region : 1;
} RulerInteraction;
/* -------------------------------------------------------------------- */
@@ -159,6 +151,10 @@ static RulerItem *ruler_item_add(wmGizmoGroup *gzgroup)
static void ruler_item_remove(bContext *C, wmGizmoGroup *gzgroup, RulerItem *ruler_item)
{
+ RulerInfo *ruler_info = gzgroup->customdata;
+ if (ruler_info->item_active == ruler_item) {
+ ruler_info->item_active = NULL;
+ }
WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, &ruler_item->gz, C);
}
@@ -513,8 +509,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
const int arc_steps = ARC_STEPS;
const float color_act[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const float color_base[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- unsigned char color_text[3];
- unsigned char color_wire[3];
+ uchar color_text[3];
+ uchar color_wire[3];
float color_back[4] = {1.0f, 1.0f, 1.0f, 0.5f};
/* anti-aliased lines for more consistent appearance */
@@ -533,7 +529,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
copy_v3_fl(color_back, 0.0f);
}
- const bool is_act = (gz->flag & WM_GIZMO_DRAW_HOVER);
+ const bool is_act = (ruler_info->item_active == ruler_item);
float dir_ruler[2];
float co_ss[3][2];
int j;
@@ -632,6 +628,20 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
GPU_blend(true);
+ if (is_act && (ruler_item->flag & RULERITEM_USE_ANGLE_ACTIVE)) {
+ GPU_line_width(3.0f);
+ immUniformColor3fv(color_act);
+ immBegin(GPU_PRIM_LINES, 4);
+ /* angle vertex */
+ immVertex2f(shdr_pos, co_ss[1][0] - cap_size, co_ss[1][1] - cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] + cap_size, co_ss[1][1] + cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] - cap_size, co_ss[1][1] + cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] + cap_size, co_ss[1][1] - cap_size);
+
+ immEnd();
+ GPU_line_width(1.0f);
+ }
+
immUniformColor3ubv(color_wire);
immBegin(GPU_PRIM_LINES, 8);
@@ -836,7 +846,6 @@ static int gizmo_ruler_modal(
int exit_code = OPERATOR_RUNNING_MODAL;
RulerInfo *ruler_info = gz->parent_gzgroup->customdata;
RulerItem *ruler_item = (RulerItem *)gz;
- RulerInteraction *inter = ruler_item->gz.interaction_data;
ARegion *ar = CTX_wm_region(C);
ruler_info->ar = ar;
@@ -851,7 +860,6 @@ static int gizmo_ruler_modal(
{
do_draw = true;
}
- inter->inside_region = BLI_rcti_isect_pt_v(&ar->winrct, &event->x);
}
break;
}
@@ -913,8 +921,14 @@ static int gizmo_ruler_invoke(
copy_v3_v3(inter->drag_start_co, ruler_item_pick->co[inter->co_index]);
}
- /* Should always be true. */
- inter->inside_region = BLI_rcti_isect_pt_v(&ar->winrct, &event->x);
+ if (inter->co_index == 1) {
+ ruler_item_pick->flag |= RULERITEM_USE_ANGLE_ACTIVE;
+ }
+ else {
+ ruler_item_pick->flag &= ~RULERITEM_USE_ANGLE_ACTIVE;
+ }
+
+ ruler_info->item_active = ruler_item_pick;
return OPERATOR_RUNNING_MODAL;
}
@@ -926,22 +940,6 @@ static void gizmo_ruler_exit(bContext *C, wmGizmo *gz, const bool cancel)
if (!cancel) {
if (ruler_info->state == RULER_STATE_DRAG) {
- RulerItem *ruler_item = (RulerItem *)gz;
- RulerInteraction *inter = gz->interaction_data;
- /* rubber-band angle removal */
- if (!inter->inside_region) {
- if ((inter->co_index == 1) && (ruler_item->flag & RULERITEM_USE_ANGLE)) {
- ruler_item->flag &= ~RULERITEM_USE_ANGLE;
- }
- else {
- /* Not ideal, since the ruler isn't a mode and we don't want to override delete key
- * use dragging out of the view for removal. */
- ruler_item_remove(C, gzgroup, ruler_item);
- ruler_item = NULL;
- gz = NULL;
- inter = NULL;
- }
- }
if (ruler_info->snap_flag & RULER_SNAP_OK) {
ruler_info->snap_flag &= ~RULER_SNAP_OK;
}
@@ -1099,3 +1097,55 @@ void VIEW3D_OT_ruler_add(wmOperatorType *ot)
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Remove Ruler Operator
+ * \{ */
+
+static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+ ARegion *ar = CTX_wm_region(C);
+ View3D *v3d = CTX_wm_view3d(C);
+
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
+ {
+ BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
+ return OPERATOR_CANCELLED;
+ }
+
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
+ if (gzgroup) {
+ RulerInfo *ruler_info = gzgroup->customdata;
+ if (ruler_info->item_active) {
+ RulerItem *ruler_item = ruler_info->item_active;
+ if ((ruler_item->flag & RULERITEM_USE_ANGLE) &&
+ (ruler_item->flag & RULERITEM_USE_ANGLE_ACTIVE))
+ {
+ ruler_item->flag &= ~(RULERITEM_USE_ANGLE | RULERITEM_USE_ANGLE_ACTIVE);
+ }
+ else {
+ ruler_item_remove(C, gzgroup, ruler_item);
+ }
+ ED_region_tag_redraw(ar);
+ return OPERATOR_FINISHED;
+ }
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void VIEW3D_OT_ruler_remove(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Ruler Remove";
+ ot->idname = "VIEW3D_OT_ruler_remove";
+
+ ot->invoke = view3d_ruler_remove_invoke;
+ ot->poll = view3d_ruler_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
+}
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 7ed7d399df4..78bda66b8ff 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2004-2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_header.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -42,8 +35,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_screen.h"
#include "BKE_editmesh.h"
#include "DEG_depsgraph.h"
@@ -143,10 +134,10 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL,
- 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+ 0, 0, ceilf(UI_UNIT_X - U.pixelsize), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Edge select - Shift-Click for multiple modes, Ctrl-Click expands/contracts selection"));
uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
- 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+ 0, 0, ceilf(UI_UNIT_X - U.pixelsize), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
}
}
@@ -168,16 +159,13 @@ static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C)
else {
uiLayout *row = uiLayoutRow(layout, true);
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (ob->mode & OB_MODE_WEIGHT_PAINT) {
- uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
+ uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
}
}
void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C)
{
- /* Extracted from: uiTemplateHeader3D */
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Object *obedit = CTX_data_edit_object(C);
@@ -193,68 +181,3 @@ void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C)
uiTemplatePaintModeSelection(layout, C);
}
}
-
-void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
-{
- bScreen *screen = CTX_wm_screen(C);
- ScrArea *sa = CTX_wm_area(C);
- View3D *v3d = sa->spacedata.first;
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
- PointerRNA v3dptr, toolsptr, sceneptr;
- Object *ob = OBACT(view_layer);
- Object *obedit = CTX_data_edit_object(C);
- bGPdata *gpd = CTX_data_gpencil_data(C);
- uiBlock *block;
- bool is_paint = (
- ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
- ELEM(ob->mode,
- OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT));
-
- RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
- RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
- RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
-
- block = uiLayoutGetBlock(layout);
- UI_block_func_handle_set(block, do_view3d_header_buttons, NULL);
-
- /* other buttons: */
- UI_block_emboss_set(block, UI_EMBOSS);
-
- /* moved to topbar */
-#if 0
- uiLayout *row = uiLayoutRow(layout, true);
- uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
- uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
-#endif
-
- if (obedit == NULL && is_paint) {
- /* Currently Python calls this directly. */
-#if 0
- uiTemplatePaintModeSelection(layout, C);
-#endif
-
- }
- else {
- /* Moved to popover and topbar. */
-#if 0
- /* Transform widget / gizmos */
- row = uiLayoutRow(layout, true);
- uiItemR(row, &v3dptr, "show_gizmo", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- uiItemR(row, &sceneptr, "transform_orientation", 0, "", ICON_NONE);
-#endif
- }
-
- if (obedit == NULL && v3d->localvd == NULL) {
- /* Scene lock */
- uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
-
- /* Currently Python calls this directly. */
-#if 0
- uiTemplateEditModeSelection(layout, C);
-#endif
-}
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 164c444d9a5..bb6b96b96d5 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_intern.h
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#ifndef __VIEW3D_INTERN_H__
@@ -39,31 +32,30 @@ struct ARegion;
struct ARegionType;
struct Base;
struct BoundBox;
-struct GPUBatch;
struct Depsgraph;
+struct GPUBatch;
+struct Mesh;
struct Object;
struct SmokeDomainSettings;
+struct ViewLayer;
struct bAnimVizSettings;
struct bContext;
struct bMotionPath;
struct bPoseChannel;
-struct Mesh;
-struct ViewLayer;
-struct wmOperatorType;
-struct wmKeyConfig;
struct wmGizmoGroupType;
struct wmGizmoType;
+struct wmKeyConfig;
+struct wmOperatorType;
struct wmWindowManager;
/* drawing flags: */
enum {
DRAW_PICKING = (1 << 0),
DRAW_CONSTCOLOR = (1 << 1),
- DRAW_SCENESET = (1 << 2)
+ DRAW_SCENESET = (1 << 2),
};
/* view3d_header.c */
-void VIEW3D_OT_layers(struct wmOperatorType *ot);
void VIEW3D_OT_toggle_matcap_flip(struct wmOperatorType *ot);
/* view3d_ops.c */
@@ -98,7 +90,7 @@ void VIEW3D_OT_background_image_add(struct wmOperatorType *ot);
void VIEW3D_OT_background_image_remove(struct wmOperatorType *ot);
void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
void VIEW3D_OT_view_roll(struct wmOperatorType *ot);
-// void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
+void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
@@ -130,9 +122,6 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot);
/* view3d_walk.c */
void VIEW3D_OT_walk(struct wmOperatorType *ot);
-/* view3d_ruler.c */
-void VIEW3D_OT_ruler(struct wmOperatorType *ot);
-
/* drawobject.c */
void draw_object_backbufsel(
struct Depsgraph *depsgraph, Scene *scene,
@@ -159,8 +148,6 @@ void ED_view3d_draw_select_loop(
void ED_view3d_draw_depth_loop(
struct Depsgraph *depsgraph, Scene *scene, struct ARegion *ar, View3D *v3d);
-void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag);
-
void view3d_update_depths_rect(struct ARegion *ar, struct ViewDepths *d, struct rcti *rect);
float view3d_depth_near(struct ViewDepths *d);
@@ -258,9 +245,9 @@ struct ARegion *view3d_has_tools_region(struct ScrArea *sa);
extern const char *view3d_context_dir[]; /* doc access */
/* view3d_widgets.c */
-void VIEW3D_GGT_lamp_spot(struct wmGizmoGroupType *gzgt);
-void VIEW3D_GGT_lamp_area(struct wmGizmoGroupType *gzgt);
-void VIEW3D_GGT_lamp_target(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_spot(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_area(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_target(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_camera(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_camera_view(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_force_field(struct wmGizmoGroupType *gzgt);
@@ -273,16 +260,10 @@ void VIEW3D_GGT_mesh_preselect_edgering(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_ruler(struct wmGizmoGroupType *gzgt);
void VIEW3D_GT_ruler_item(struct wmGizmoType *gzt);
void VIEW3D_OT_ruler_add(struct wmOperatorType *ot);
+void VIEW3D_OT_ruler_remove(struct wmOperatorType *ot);
void VIEW3D_GT_navigate_rotate(struct wmGizmoType *gzt);
-/* draw_volume.c */
-void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob,
- const float min[3], const float max[3],
- const float viewnormal[3]);
-
-void draw_smoke_velocity(struct SmokeDomainSettings *domain, float viewnormal[3]);
-
/* workaround for trivial but noticeable camera bug caused by imprecision
* between view border calculation in 2D/3D space, workaround for bug [#28037].
* without this define we get the old behavior which is to try and align them
@@ -290,7 +271,7 @@ void draw_smoke_velocity(struct SmokeDomainSettings *domain, float viewnormal[3]
* any direction it starts to fail */
#define VIEW3D_CAMERA_BORDER_HACK
#ifdef VIEW3D_CAMERA_BORDER_HACK
-extern unsigned char view3d_camera_border_hack_col[3];
+extern uchar view3d_camera_border_hack_col[3];
extern bool view3d_camera_border_hack_test;
#endif
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 9ee7cbabd2a..93cdecec557 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Foundation, full recode and added functions
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_iterators.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_curve_types.h"
@@ -42,7 +36,6 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
-#include "BKE_context.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_iterators.h"
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 46a00ffeacf..d712a9582d5 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_ops.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -192,7 +185,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_view_center_lock);
WM_operatortype_append(VIEW3D_OT_select);
WM_operatortype_append(VIEW3D_OT_select_box);
- // WM_operatortype_append(VIEW3D_OT_clip_border);
+ WM_operatortype_append(VIEW3D_OT_clip_border);
WM_operatortype_append(VIEW3D_OT_select_circle);
WM_operatortype_append(VIEW3D_OT_smoothview);
WM_operatortype_append(VIEW3D_OT_render_border);
@@ -229,6 +222,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_toggle_matcap_flip);
WM_operatortype_append(VIEW3D_OT_ruler_add);
+ WM_operatortype_append(VIEW3D_OT_ruler_remove);
transform_operatortypes();
}
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 718f3cd40f1..bb5fdeabc2b 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_project.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_camera_types.h"
@@ -116,9 +109,10 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
* - 'rv3d->perspmat', is_local == false
* - 'rv3d->persmatob', is_local == true
*/
-static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
- float perspmat[4][4], const bool is_local, /* normally hidden */
- const float co[3], float r_co[2], const eV3DProjTest flag)
+static eV3DProjStatus ed_view3d_project__internal(
+ const ARegion *ar,
+ float perspmat[4][4], const bool is_local, /* normally hidden */
+ const float co[3], float r_co[2], const eV3DProjTest flag)
{
float vec4[4];
@@ -328,7 +322,7 @@ static void view3d_win_to_ray_segment(
ED_view3d_win_to_vector(ar, mval, r_ray_dir);
if ((rv3d->is_persp == false) && (rv3d->persp != RV3D_CAMOB)) {
- end_offset = v3d->far / 2.0f;
+ end_offset = v3d->clip_end / 2.0f;
start_offset = -end_offset;
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c976803065e..e14d0a5ff3f 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_select.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -158,26 +151,33 @@ void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
/** \name Internal Object Utilities
* \{ */
-static void object_deselect_all_visible(ViewLayer *view_layer, View3D *v3d)
+static bool object_deselect_all_visible(ViewLayer *view_layer, View3D *v3d)
{
- Base *base;
-
- for (base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_SELECTABLE(v3d, base)) {
- ED_object_base_select(base, BA_DESELECT);
+ bool changed = false;
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (base->flag & BASE_SELECTED) {
+ if (BASE_SELECTABLE(v3d, base)) {
+ ED_object_base_select(base, BA_DESELECT);
+ changed = true;
+ }
}
}
+ return changed;
}
-static void object_deselect_all_except(ViewLayer *view_layer, Base *b) /* deselect all except b */
+/* deselect all except b */
+static bool object_deselect_all_except(ViewLayer *view_layer, Base *b)
{
+ bool changed = false;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (base->flag & BASE_SELECTED) {
if (b != base) {
ED_object_base_select(base, BA_DESELECT);
+ changed = true;
}
}
}
+ return changed;
}
/** \} */
@@ -186,11 +186,12 @@ static void object_deselect_all_except(ViewLayer *view_layer, Base *b) /* dese
/** \name Internal Edit-Mesh Utilities
* \{ */
-static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp sel_op)
{
BMVert *eve;
BMIter iter;
- unsigned int index = bm_wireoffs;
+ uint index = bm_wireoffs;
+ bool changed = false;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
@@ -199,17 +200,20 @@ static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_vert_select_set(em->bm, eve, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
-static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp sel_op)
{
BMEdge *eed;
BMIter iter;
- unsigned int index = bm_solidoffs;
+ uint index = bm_solidoffs;
+ bool changed = false;
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
@@ -218,17 +222,20 @@ static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_edge_select_set(em->bm, eed, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
-static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp sel_op)
{
BMFace *efa;
BMIter iter;
- unsigned int index = 1;
+ uint index = 1;
+ bool changed = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
@@ -237,17 +244,20 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_face_select_set(em->bm, efa, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
/* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp sel_op)
{
MVert *mv = me->mvert;
- unsigned int index;
+ uint index;
+ bool changed = false;
if (mv) {
for (index = 1; index <= me->totvert; index++, mv++) {
@@ -257,17 +267,20 @@ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(mv->flag, sel_op_result, SELECT);
+ changed = true;
}
}
}
}
+ return changed;
}
/* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_op)
{
MPoly *mpoly = me->mpoly;
- unsigned int index;
+ uint index;
+ bool changed = false;
if (mpoly) {
for (index = 1; index <= me->totpoly; index++, mpoly++) {
@@ -277,10 +290,12 @@ static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_o
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(mpoly->flag, sel_op_result, ME_FACE_SEL);
+ changed = true;
}
}
}
}
+ return changed;
}
/** \} */
@@ -451,11 +466,11 @@ static void do_lasso_select_objects(
View3D *v3d = vc->v3d;
Base *base;
+ bool changed = false;
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
- object_deselect_all_visible(vc->view_layer, vc->v3d);
+ changed = object_deselect_all_visible(vc->view_layer, vc->v3d);
}
- bool changed = false;
for (base = vc->view_layer->object_bases.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) { /* use this to avoid un-needed lasso lookups */
const bool is_select = base->flag & BASE_SELECTED;
@@ -941,7 +956,8 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
return;
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
- paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false); /* flush selection at the end */
+ /* flush selection at the end */
+ paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false);
}
bm_vertoffs = me->totpoly + 1; /* max index array */
@@ -1155,7 +1171,8 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- /* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
+ /* this is a bit dodjy, there should only be ONE object with this name,
+ * but library objects can mess this up */
if (STREQ(name, base->object->id.name + 2)) {
ED_object_base_activate(C, base);
ED_object_base_select(base, BA_SELECT);
@@ -1205,14 +1222,14 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
}
static Base *object_mouse_select_menu(
- bContext *C, ViewContext *vc, unsigned int *buffer, int hits,
+ bContext *C, ViewContext *vc, uint *buffer, int hits,
const int mval[2], bool toggle)
{
short baseCount = 0;
bool ok;
LinkNode *linklist = NULL;
- /* handle base->object->select_color */
+ /* handle base->object->select_id */
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1221,7 +1238,7 @@ static Base *object_mouse_select_menu(
if (buffer) {
for (int a = 0; a < hits; a++) {
/* index was converted */
- if (base->object->select_color == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
+ if (base->object->select_id == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
ok = true;
break;
}
@@ -1288,7 +1305,7 @@ static Base *object_mouse_select_menu(
static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
{
- unsigned int i;
+ uint i;
for (i = 0; i < hits; i++) {
if (buffer[(4 * i) + 3] & 0xFFFF0000) {
return true;
@@ -1298,22 +1315,22 @@ static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
}
/* utility function for mixed_bones_object_selectbuffer */
-static int selectbuffer_ret_hits_15(unsigned int *UNUSED(buffer), const int hits15)
+static int selectbuffer_ret_hits_15(uint *UNUSED(buffer), const int hits15)
{
return hits15;
}
-static int selectbuffer_ret_hits_9(unsigned int *buffer, const int hits15, const int hits9)
+static int selectbuffer_ret_hits_9(uint *buffer, const int hits15, const int hits9)
{
const int offs = 4 * hits15;
- memcpy(buffer, buffer + offs, 4 * hits9 * sizeof(unsigned int));
+ memcpy(buffer, buffer + offs, 4 * hits9 * sizeof(uint));
return hits9;
}
-static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const int hits9, const int hits5)
+static int selectbuffer_ret_hits_5(uint *buffer, const int hits15, const int hits9, const int hits5)
{
const int offs = 4 * hits15 + 4 * hits9;
- memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(unsigned int));
+ memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(uint));
return hits5;
}
@@ -1322,7 +1339,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const
* Checks three selection levels and compare.
*/
static int mixed_bones_object_selectbuffer(
- ViewContext *vc, unsigned int *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
+ ViewContext *vc, uint *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
bool do_nearest)
{
rcti rect;
@@ -1382,7 +1399,7 @@ finally:
}
static int mixed_bones_object_selectbuffer_extended(
- ViewContext *vc, unsigned int *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
+ ViewContext *vc, uint *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
bool use_cycle, bool enumerate, bool *r_do_nearest)
{
static int last_mval[2] = {-100, -100};
@@ -1446,7 +1463,7 @@ static Base *mouse_select_eval_buffer(
int a;
if (do_nearest) {
- unsigned int min = 0xFFFFFFFF;
+ uint min = 0xFFFFFFFF;
int selcol = 0, notcol = 0;
@@ -1462,7 +1479,7 @@ static Base *mouse_select_eval_buffer(
else {
/* only exclude active object when it is selected... */
if (BASACT(view_layer) && (BASACT(view_layer)->flag & BASE_SELECTED) && hits > 1) {
- notcol = BASACT(view_layer)->object->select_color;
+ notcol = BASACT(view_layer)->object->select_id;
}
for (a = 0; a < hits; a++) {
@@ -1476,7 +1493,9 @@ static Base *mouse_select_eval_buffer(
base = FIRSTBASE(view_layer);
while (base) {
if (BASE_SELECTABLE(v3d, base)) {
- if (base->object->select_color == selcol) break;
+ if (base->object->select_id == selcol) {
+ break;
+ }
}
base = base->next;
}
@@ -1499,13 +1518,15 @@ static Base *mouse_select_eval_buffer(
if (has_bones) {
/* skip non-bone objects */
if ((buffer[4 * a + 3] & 0xFFFF0000)) {
- if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_id == (buffer[(4 * a) + 3] & 0xFFFF)) {
basact = base;
+ }
}
}
else {
- if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_id == (buffer[(4 * a) + 3] & 0xFFFF)) {
basact = base;
+ }
}
}
}
@@ -1526,7 +1547,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
{
ViewContext vc;
Base *basact = NULL;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
/* setup view context for argument to callbacks */
view3d_operator_needs_opengl(C);
@@ -1582,11 +1603,16 @@ static bool ed_object_select_pick(
bool extend, bool deselect, bool toggle, bool obcenter, bool enumerate, bool object)
{
ViewContext vc;
+ /* setup view context for argument to callbacks */
+ ED_view3d_viewcontext_init(C, &vc);
+
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
- Base *base, *startbase = NULL, *basact = NULL, *oldbasact = BASACT(view_layer);
+ /* Don't set when the context has no active object (hidden), see: T60807. */
+ const Base *oldbasact = vc.obact ? BASACT(view_layer) : NULL;
+ Base *base, *startbase = NULL, *basact = NULL;
const eObjectMode object_mode = oldbasact ? oldbasact->object->mode : OB_MODE_OBJECT;
bool is_obedit;
float dist = ED_view3d_select_dist_px() * 1.3333f;
@@ -1594,8 +1620,6 @@ static bool ed_object_select_pick(
int hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
- /* setup view context for argument to callbacks */
- ED_view3d_viewcontext_init(C, &vc);
is_obedit = (vc.obedit != NULL);
if (object) {
@@ -1608,9 +1632,13 @@ static bool ed_object_select_pick(
/* always start list from basact in wire mode */
startbase = FIRSTBASE(view_layer);
- if (BASACT(view_layer) && BASACT(view_layer)->next) startbase = BASACT(view_layer)->next;
+ if (oldbasact && oldbasact->next) {
+ startbase = oldbasact->next;
+ }
+
+ /* This block uses the control key to make the object selected
+ * by its center point rather than its contents */
- /* This block uses the control key to make the object selected by its center point rather than its contents */
/* in editmode do not activate */
if (obcenter) {
@@ -1628,7 +1656,9 @@ static bool ed_object_select_pick(
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
- if (base == BASACT(view_layer)) dist_temp += 10.0f;
+ if (base == oldbasact) {
+ dist_temp += 10.0f;
+ }
if (dist_temp < dist) {
dist = dist_temp;
basact = base;
@@ -1637,8 +1667,12 @@ static bool ed_object_select_pick(
}
base = base->next;
- if (base == NULL) base = FIRSTBASE(view_layer);
- if (base == startbase) break;
+ if (base == NULL) {
+ base = FIRSTBASE(view_layer);
+ }
+ if (base == startbase) {
+ break;
+ }
}
}
if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
@@ -1656,7 +1690,7 @@ static bool ed_object_select_pick(
}
}
else {
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
bool do_nearest;
// TIMEIT_START(select_time);
@@ -1685,7 +1719,7 @@ static bool ed_object_select_pick(
if (has_bones && basact) {
if (basact->object->type == OB_CAMERA) {
- if (BASACT(view_layer) == basact) {
+ if (oldbasact == basact) {
int i, hitresult;
bool changed = false;
@@ -1694,12 +1728,13 @@ static bool ed_object_select_pick(
/* if there's bundles in buffer select bundles first,
* so non-camera elements should be ignored in buffer */
- if (basact->object->select_color != (hitresult & 0xFFFF)) {
+ if (basact->object->select_id != (hitresult & 0xFFFF)) {
continue;
}
/* index of bundle is 1<<16-based. if there's no "bone" index
- * in height word, this buffer value belongs to camera. not to bundle */
+ * in height word, this buffer value belongs to camera. not to bundle
+ */
if (buffer[4 * i + 3] & 0xFFFF0000) {
MovieClip *clip = BKE_object_movieclip_get(scene, basact->object, false);
MovieTracking *tracking = &clip->tracking;
@@ -1714,13 +1749,15 @@ static bool ed_object_select_pick(
}
else {
int oldsel = TRACK_SELECTED(track) ? 1 : 0;
- if (!extend)
+ if (!extend) {
deselect_all_tracks(tracking);
+ }
BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, extend);
- if (oldsel != (TRACK_SELECTED(track) ? 1 : 0))
+ if (oldsel != (TRACK_SELECTED(track) ? 1 : 0)) {
changed = true;
+ }
}
basact->flag |= BASE_SELECTED;
@@ -1758,16 +1795,18 @@ static bool ed_object_select_pick(
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
- /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
- if (BASACT(view_layer) && (BASACT(view_layer)->object->mode & OB_MODE_WEIGHT_PAINT)) {
+ /* in weightpaint, we use selected bone to select vertexgroup,
+ * so no switch to new active object */
+ if (oldbasact && (oldbasact->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
basact = NULL;
}
}
/* prevent bone selecting to pass on to object selecting */
- if (basact == BASACT(view_layer))
+ if (basact == oldbasact) {
basact = NULL;
+ }
}
if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
@@ -1800,6 +1839,9 @@ static bool ed_object_select_pick(
}
}
+ /* Ensure code above doesn't change the active base. */
+ BLI_assert(oldbasact == (vc.obact ? BASACT(view_layer) : NULL));
+
/* so, do we have something selected? */
if (basact) {
retval = true;
@@ -1879,7 +1921,7 @@ static bool ed_wpaint_vertex_select_pick(
const bool use_zbuf = V3D_IS_ZBUF(v3d);
Mesh *me = obact->data; /* already checked for NULL */
- unsigned int index = 0;
+ uint index = 0;
MVert *mv;
if (ED_mesh_pick_vert(C, obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, use_zbuf)) {
@@ -2076,7 +2118,7 @@ static int do_paintvert_box_select(
Mesh *me;
MVert *mvert;
struct ImBuf *ibuf;
- unsigned int *rt;
+ uint *rt;
int a, index;
char *selar;
const int size[2] = {
@@ -2341,7 +2383,7 @@ static int do_meta_box_select(
MetaElem *ml;
int a;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
int hits;
hits = view3d_opengl_select(
@@ -2368,7 +2410,7 @@ static int do_meta_box_select(
}
const uint hit_object = hitresult & 0xFFFF;
- if (vc->obedit->select_color != hit_object) {
+ if (vc->obedit->select_id != hit_object) {
continue;
}
@@ -2412,7 +2454,7 @@ static int do_armature_box_select(
bool changed = false;
int a;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
int hits;
hits = view3d_opengl_select(
@@ -2520,7 +2562,7 @@ static int do_object_box_select(bContext *C, ViewContext *vc, rcti *rect, const
for (Base *base = vc->view_layer->object_bases.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) {
- if ((base->object->select_color & 0x0000FFFF) != 0) {
+ if ((base->object->select_id & 0x0000FFFF) != 0) {
BLI_array_append(bases, base);
}
}
@@ -2532,7 +2574,9 @@ static int do_object_box_select(bContext *C, ViewContext *vc, rcti *rect, const
for (const uint *col = vbuffer + 3, *col_end = col + (hits * 4); col < col_end; col += 4) {
Bone *bone;
Base *base = ED_armature_base_and_bone_from_select_buffer(bases, BLI_array_len(bases), *col, &bone);
- base->object->id.tag |= LIB_TAG_DOIT;
+ if (base != NULL) {
+ base->object->id.tag |= LIB_TAG_DOIT;
+ }
}
for (Base *base = vc->view_layer->object_bases.first; base && hits; base = base->next) {
@@ -2610,7 +2654,7 @@ static int do_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, const eS
/* Select the next bone if we're not switching bases. */
if (col + 4 != col_end) {
- if ((base->object->select_color & 0x0000FFFF) != (col[4] & 0x0000FFFF)) {
+ if ((base->object->select_id & 0x0000FFFF) != (col[4] & 0x0000FFFF)) {
break;
}
if (base->object->pose != NULL) {
@@ -2799,6 +2843,7 @@ static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float sc
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
+ data->is_changed = true;
}
}
static void mesh_circle_doSelectEdge(
@@ -2808,6 +2853,7 @@ static void mesh_circle_doSelectEdge(
if (edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
+ data->is_changed = true;
}
}
static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
@@ -2816,25 +2862,32 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
BM_face_select_set(data->vc->em->bm, efa, data->select);
+ data->is_changed = true;
}
}
-static void mesh_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool mesh_circle_select(ViewContext *vc, eSelectOp sel_op, const int mval[2], float rad)
{
ToolSettings *ts = vc->scene->toolsettings;
int bbsel;
CircleSelectUserData data;
+ vc->em = BKE_editmesh_from_object(vc->obedit);
+
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
- vc->em = BKE_editmesh_from_object(vc->obedit);
-
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
if (ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
- edbm_backbuf_check_and_select_verts(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_verts(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -2843,7 +2896,7 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
if (ts->selectmode & SCE_SELECT_EDGE) {
if (bbsel) {
- edbm_backbuf_check_and_select_edges(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_edges(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
@@ -2852,31 +2905,48 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
- edbm_backbuf_check_and_select_faces(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_faces(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
}
+ changed |= data.is_changed;
+
EDBM_backbuf_free();
- EDBM_selectmode_flush(vc->em);
+
+ if (changed) {
+ EDBM_selectmode_flush(vc->em);
+ }
+
+ return changed;
}
-static void paint_facesel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool paint_facesel_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));
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
+ bool changed = false;
+
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false);
+ changed = true;
+ }
bm_vertoffs = me->totpoly + 1; /* max index array */
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
if (bbsel) {
- edbm_backbuf_check_and_select_tfaces(me, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_tfaces(me, sel_op);
EDBM_backbuf_free();
+ }
+ if (changed) {
paintface_flush_flags(vc->C, ob, SELECT);
}
+ return changed;
}
static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
@@ -2887,20 +2957,29 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
-static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+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);
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
/* CircleSelectUserData data = {NULL}; */ /* UNUSED */
+ bool changed = false;
+
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
+ changed = true;
+ }
+
+ const bool select = (sel_op != SEL_OP_SUB);
if (use_zbuf) {
bm_vertoffs = me->totvert + 1; /* max index array */
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
if (bbsel) {
- edbm_backbuf_check_and_select_verts_obmode(me, select ? SEL_OP_ADD : SEL_OP_SET);
+ changed |= edbm_backbuf_check_and_select_verts_obmode(me, sel_op);
EDBM_backbuf_free();
}
}
@@ -2911,13 +2990,17 @@ static void paint_vertsel_circle_select(ViewContext *vc, const bool select, cons
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
meshobject_foreachScreenVert(vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ changed |= data.is_changed;
}
- if (select == false) {
- BKE_mesh_mselect_validate(me);
+ if (changed) {
+ if (sel_op == SEL_OP_SUB) {
+ BKE_mesh_mselect_validate(me);
+ }
+ paintvert_flush_flags(ob);
+ paintvert_tag_select_update(vc->C, ob);
}
- paintvert_flush_flags(ob);
- paintvert_tag_select_update(vc->C, ob);
+ return changed;
}
@@ -2947,17 +3030,27 @@ static void nurbscurve_circle_doSelect(
}
}
}
+ data->is_changed = true;
}
}
-static void nurbscurve_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool nurbscurve_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ Curve *curve = vc->obedit->data;
+ ED_curve_deselect_all(curve->editnurb);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
BKE_curve_nurb_vert_active_validate(vc->obedit->data);
+
+ return changed || data.is_changed;
}
@@ -2967,16 +3060,26 @@ static void latticecurve_circle_doSelect(void *userData, BPoint *bp, const float
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
+ data->is_changed = true;
}
}
-static void lattice_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool lattice_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ Curve *curve = vc->obedit->data;
+ ED_curve_deselect_all(curve->editnurb);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
lattice_foreachScreenVert(vc, latticecurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+
+ return changed || data.is_changed;
}
@@ -3038,9 +3141,15 @@ static void do_circle_select_pose__doSelectBone(
data->is_changed |= is_point_done;
}
}
-static void pose_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool pose_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));
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ changed |= ED_pose_deselect_all(vc->obact, SEL_DESELECT, false);
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
@@ -3048,9 +3157,11 @@ static void pose_circle_select(ViewContext *vc, const bool select, const int mva
pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
- if (data.is_changed) {
+ changed |= data.is_changed;
+ if (changed) {
ED_pose_bone_select_tag_update(vc->obact);
}
+ return changed;
}
static bool armature_circle_doSelectJoint(void *userData, EditBone *ebone, const float screen_co[2], bool head)
@@ -3118,11 +3229,18 @@ static void do_circle_select_armature__doSelectBone(
data->is_changed |= is_point_done;
}
}
-static void armature_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool armature_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
bArmature *arm = vc->obedit->data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_armature_edit_deselect_all_visible(vc->obedit);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
+
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
@@ -3134,6 +3252,8 @@ static void armature_circle_select(ViewContext *vc, const bool select, const int
ED_armature_edit_validate_active(arm);
WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
}
+ changed |= data.is_changed;
+ return changed;
}
static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem *ml, const float screen_co[2])
@@ -3146,55 +3266,68 @@ static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem
data->is_changed = true;
}
}
-static void mball_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool mball_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ BKE_mball_deselect_all(vc->obedit->data);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
+
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mball_foreachScreenElem(vc, do_circle_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ changed |= data.is_changed;
+ return changed;
}
/** Callbacks for circle selection in Editmode */
-static void obedit_circle_select(
- ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool obedit_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));
switch (vc->obedit->type) {
case OB_MESH:
- mesh_circle_select(vc, select, mval, rad);
- break;
+ return mesh_circle_select(vc, sel_op, mval, rad);
case OB_CURVE:
case OB_SURF:
- nurbscurve_circle_select(vc, select, mval, rad);
- break;
+ return nurbscurve_circle_select(vc, sel_op, mval, rad);
case OB_LATTICE:
- lattice_circle_select(vc, select, mval, rad);
- break;
+ return lattice_circle_select(vc, sel_op, mval, rad);
case OB_ARMATURE:
- armature_circle_select(vc, select, mval, rad);
- break;
+ return armature_circle_select(vc, sel_op, mval, rad);
case OB_MBALL:
- mball_circle_select(vc, select, mval, rad);
- break;
+ return mball_circle_select(vc, sel_op, mval, rad);
default:
- return;
+ BLI_assert(0);
+ return false;
}
}
-static bool object_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool object_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));
ViewLayer *view_layer = vc->view_layer;
View3D *v3d = vc->v3d;
const float radius_squared = rad * rad;
const float mval_fl[2] = {mval[0], mval[1]};
+
bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ if (object_deselect_all_visible(vc->view_layer, vc->v3d)) {
+ changed = true;
+ }
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
const int select_flag = select ? BASE_SELECTED : 0;
-
Base *base;
for (base = FIRSTBASE(view_layer); base; base = base->next) {
if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) {
@@ -3218,11 +3351,17 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
static int view3d_circle_select_exec(bContext *C, wmOperator *op)
{
ViewContext vc;
+ const bool is_first = (op->customdata && (((wmGesture *)op->customdata)->is_active_prev == false));
const int radius = RNA_int_get(op->ptr, "radius");
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
+ eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const int mval[2] = {RNA_int_get(op->ptr, "x"),
RNA_int_get(op->ptr, "y")};
+ if (is_first == false) {
+ if (sel_op == SEL_OP_SET) {
+ sel_op = SEL_OP_ADD;
+ }
+ }
ED_view3d_viewcontext_init(C, &vc);
@@ -3240,31 +3379,38 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
obact = vc.obact;
obedit = vc.obedit;
- if (CTX_data_edit_object(C)) {
- obedit_circle_select(&vc, select, mval, (float)radius);
- DEG_id_tag_update(obact->data, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
+ if (obedit) {
+ if (obedit_circle_select(&vc, sel_op, mval, (float)radius)) {
+ DEG_id_tag_update(obact->data, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
+ }
}
else if (BKE_paint_select_face_test(obact)) {
- paint_facesel_circle_select(&vc, select, mval, (float)radius);
+ paint_facesel_circle_select(&vc, sel_op, mval, (float)radius);
}
else if (BKE_paint_select_vert_test(obact)) {
- paint_vertsel_circle_select(&vc, select, mval, (float)radius);
+ paint_vertsel_circle_select(&vc, sel_op, mval, (float)radius);
}
else if (obact->mode & OB_MODE_POSE) {
- pose_circle_select(&vc, select, mval, (float)radius);
+ pose_circle_select(&vc, sel_op, mval, (float)radius);
}
else {
- return PE_circle_select(C, select, mval, (float)radius);
+ BLI_assert(0);
}
}
FOREACH_OBJECT_IN_MODE_END;
}
+ else if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) {
+ if (PE_circle_select(C, sel_op, mval, (float)radius)) {
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_CANCELLED;
+ }
else if (obact && obact->mode & OB_MODE_SCULPT) {
return OPERATOR_CANCELLED;
}
else {
- if (object_circle_select(&vc, select, mval, (float)radius)) {
+ if (object_circle_select(&vc, sel_op, mval, (float)radius)) {
DEG_id_tag_update(&vc.scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene);
}
@@ -3289,7 +3435,8 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index dbf2271e114..d4b94963795 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_snap.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -79,13 +71,14 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
+ RegionView3D *rv3d = CTX_wm_region_data(C);
View3D *v3d = CTX_wm_view3d(C);
TransVertStore tvs = {NULL};
TransVert *tv;
float gridf, imat[3][3], bmat[3][3], vec[3];
int a;
- gridf = ED_view3d_grid_scale(scene, v3d, NULL);
+ gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL);
if (obedit) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -316,8 +309,12 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
}
else if (obact && (obact->mode & OB_MODE_POSE)) {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, CTX_wm_view3d(C),
+ &objects_len, OB_MODE_POSE);
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *ob = objects[ob_index];
bPoseChannel *pchan;
bArmature *arm = ob->data;
float snap_target_local[3];
@@ -381,7 +378,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
- CTX_DATA_END;
+ MEM_freeN(objects);
}
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
@@ -516,10 +513,11 @@ void VIEW3D_OT_snap_selected_to_active(wmOperatorType *ot)
static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
+ RegionView3D *rv3d = CTX_wm_region_data(C);
View3D *v3d = CTX_wm_view3d(C);
float gridf, *curs;
- gridf = ED_view3d_grid_scale(scene, v3d, NULL);
+ gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL);
curs = scene->cursor.location;
curs[0] = gridf * floorf(0.5f + curs[0] / gridf);
@@ -549,7 +547,10 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
/* **************************************************** */
-/** Returns the center position of a tracking marker visible on the viewport (useful to snap to). **/
+/**
+ * Returns the center position of a tracking marker visible on the viewport
+ * (useful to snap to).
+ */
static void bundle_midpoint(Scene *scene, Object *ob, float r_vec[3])
{
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
@@ -828,7 +829,10 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
/* **************************************************** */
-/** Calculates the bounding box corners (min and max) for \a obedit. The returned values are in global space. **/
+/**
+ * Calculates the bounding box corners (min and max) for \a obedit.
+ * The returned values are in global space.
+ */
bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
{
TransVertStore tvs = {NULL};
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 707e0e7a394..438cab21134 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_toolbar.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 540806d4b67..ab2d09e0862 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_utils.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* 3D View checks and manipulation (no operators).
*/
@@ -47,14 +43,13 @@
#include "BKE_camera.h"
#include "BKE_context.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_screen.h"
+#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "GPU_matrix.h"
@@ -88,25 +83,28 @@ void ED_view3d_background_color_get(const Scene *scene, const View3D *v3d, float
return;
}
- UI_GetThemeColor3fv(TH_HIGH_GRAD, r_color);
+ UI_GetThemeColor3fv(TH_BACK, r_color);
}
void ED_view3d_cursor3d_calc_mat3(const Scene *scene, float mat[3][3])
{
const View3DCursor *cursor = &scene->cursor;
- quat_to_mat3(mat, cursor->rotation);
+ BKE_scene_cursor_rot_to_mat3(cursor, mat);
}
void ED_view3d_cursor3d_calc_mat4(const Scene *scene, float mat[4][4])
{
const View3DCursor *cursor = &scene->cursor;
- quat_to_mat4(mat, cursor->rotation);
+ float mat3[3][3];
+ BKE_scene_cursor_rot_to_mat3(cursor, mat3);
+ copy_m4_m3(mat, mat3);
copy_v3_v3(mat[3], cursor->location);
}
Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d)
{
- /* establish the camera object, so we can default to view mapping if anything is wrong with it */
+ /* establish the camera object,
+ * so we can default to view mapping if anything is wrong with it */
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera && (v3d->camera->type == OB_CAMERA)) {
return v3d->camera->data;
}
@@ -120,7 +118,7 @@ void ED_view3d_dist_range_get(
float r_dist_range[2])
{
r_dist_range[0] = v3d->grid * 0.001f;
- r_dist_range[1] = v3d->far * 10.0f;
+ r_dist_range[1] = v3d->clip_end * 10.0f;
}
/**
@@ -138,13 +136,13 @@ bool ED_view3d_clip_range_get(
BKE_camera_params_from_view3d(&params, depsgraph, v3d, rv3d);
if (use_ortho_factor && params.is_ortho) {
- const float fac = 2.0f / (params.clipend - params.clipsta);
- params.clipsta *= fac;
- params.clipend *= fac;
+ const float fac = 2.0f / (params.clip_end - params.clip_start);
+ params.clip_start *= fac;
+ params.clip_end *= fac;
}
- if (r_clipsta) *r_clipsta = params.clipsta;
- if (r_clipend) *r_clipend = params.clipend;
+ if (r_clipsta) *r_clipsta = params.clip_start;
+ if (r_clipend) *r_clipend = params.clip_end;
return params.is_ortho;
}
@@ -152,7 +150,7 @@ bool ED_view3d_clip_range_get(
bool ED_view3d_viewplane_get(
Depsgraph *depsgraph,
const View3D *v3d, const RegionView3D *rv3d, int winx, int winy,
- rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize)
+ rctf *r_viewplane, float *r_clip_start, float *r_clip_end, float *r_pixsize)
{
CameraParams params;
@@ -161,8 +159,8 @@ bool ED_view3d_viewplane_get(
BKE_camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
if (r_viewplane) *r_viewplane = params.viewplane;
- if (r_clipsta) *r_clipsta = params.clipsta;
- if (r_clipend) *r_clipend = params.clipend;
+ if (r_clip_start) *r_clip_start = params.clip_start;
+ if (r_clip_end) *r_clip_end = params.clip_end;
if (r_pixsize) *r_pixsize = params.viewdx;
return params.is_ortho;
@@ -438,7 +436,8 @@ bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *ar
if (rv3d->persp != RV3D_PERSP) {
if (rv3d->persp == RV3D_CAMOB) {
- /* If autopersp and previous view was an axis one, switch back to PERSP mode, else reuse previous mode. */
+ /* If autopersp and previous view was an axis one,
+ * switch back to PERSP mode, else reuse previous mode. */
char persp = (autopersp && RV3D_VIEW_IS_AXIS(rv3d->lview)) ? RV3D_PERSP : rv3d->lpersp;
ED_view3d_persp_switch_from_camera(depsgraph, v3d, rv3d, persp);
}
@@ -1095,8 +1094,8 @@ float ED_view3d_radius_to_dist(
if (persp == RV3D_CAMOB) {
CameraParams params;
BKE_camera_params_init(&params);
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_camera_params_from_object(&params, camera_eval);
@@ -1114,7 +1113,8 @@ float ED_view3d_radius_to_dist(
angle = focallength_to_fov(lens, sensor_size);
- /* zoom influences lens, correct this by scaling the angle as a distance (by the zoom-level) */
+ /* zoom influences lens, correct this by scaling the angle as a distance
+ * (by the zoom-level) */
angle = atanf(tanf(angle / 2.0f) * zoom) * 2.0f;
dist = ED_view3d_radius_to_dist_persp(angle, radius);
@@ -1337,7 +1337,7 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c
* \param ofs: The view offset to be set, normally from RegionView3D.ofs.
* \param quat: The view rotation to be set, quaternion normally from RegionView3D.viewquat.
* \param dist: The view distance from ofs to be set, normally from RegionView3D.dist.
- * \param lens: The view lens angle set for cameras and lamps, normally from View3D.lens.
+ * \param lens: The view lens angle set for cameras and lights, normally from View3D.lens.
*/
void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
{
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index e3b31a65aec..292dd6bee1a 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_view.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_camera_types.h"
@@ -66,6 +59,9 @@
#include "DRW_engine.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
@@ -212,7 +208,8 @@ void ED_view3d_smooth_view_ex(
}
/* grid draw as floor */
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
- /* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */
+ /* use existing if exists, means multiple calls to smooth view
+ * wont loose the original 'view' setting */
rv3d->view = RV3D_VIEW_USER;
}
@@ -224,7 +221,8 @@ void ED_view3d_smooth_view_ex(
* this means small rotations wont lag */
if (sview->quat && !sview->ofs && !sview->dist) {
/* scale the time allowed by the rotation */
- sms.time_allowed *= (double)fabsf(angle_signed_normalized_qtqt(sms.dst.quat, sms.src.quat)) / M_PI; /* 180deg == 1.0 */
+ /* 180deg == 1.0 */
+ sms.time_allowed *= (double)fabsf(angle_signed_normalized_qtqt(sms.dst.quat, sms.src.quat)) / M_PI;
}
/* ensure it shows correct */
@@ -239,8 +237,8 @@ void ED_view3d_smooth_view_ex(
rv3d->rflag |= RV3D_NAVIGATING;
- /* not essential but in some cases the caller will tag the area for redraw,
- * and in that case we can get a flicker of the 'org' user view but we want to see 'src' */
+ /* not essential but in some cases the caller will tag the area for redraw, and in that
+ * case we can get a flicker of the 'org' user view but we want to see 'src' */
view3d_smooth_view_state_restore(&sms.src, v3d, rv3d);
/* keep track of running timer! */
@@ -252,7 +250,8 @@ void ED_view3d_smooth_view_ex(
WM_event_remove_timer(wm, win, rv3d->smooth_timer);
}
/* TIMER1 is hardcoded in keymap */
- rv3d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ rv3d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
@@ -605,7 +604,8 @@ static void sync_viewport_camera_smoothview(bContext *C, View3D *v3d, Object *ob
.ofs = other_rv3d->ofs,
.quat = other_rv3d->viewquat,
.dist = &other_rv3d->dist,
- .lens = &other_v3d->lens});
+ .lens = &other_v3d->lens,
+ });
}
else {
other_v3d->camera = ob;
@@ -651,7 +651,8 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
&(const V3D_SmoothParams) {
.camera_old = camera_old, .camera = v3d->camera,
.ofs = rv3d->ofs, .quat = rv3d->viewquat,
- .dist = &rv3d->dist, .lens = &v3d->lens});
+ .dist = &rv3d->dist, .lens = &v3d->lens,
+ });
}
if (v3d->scenelock) {
@@ -930,7 +931,7 @@ static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void
* \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection.
*/
int view3d_opengl_select(
- ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input,
+ ViewContext *vc, uint *buffer, uint bufsize, const rcti *input,
eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter)
{
struct bThemeState theme_state;
@@ -944,8 +945,7 @@ int view3d_opengl_select(
const bool is_pick_select = (U.gpu_select_pick_deph != 0);
const bool do_passes = (
(is_pick_select == false) &&
- (select_mode == VIEW3D_SELECT_PICK_NEAREST) &&
- GPU_select_query_check_active());
+ (select_mode == VIEW3D_SELECT_PICK_NEAREST));
const bool use_nearest = (is_pick_select && select_mode == VIEW3D_SELECT_PICK_NEAREST);
bool draw_surface = true;
@@ -980,6 +980,8 @@ int view3d_opengl_select(
}
}
+ /* Important to use 'vc->obact', not 'OBACT(vc->view_layer)' below,
+ * so it will be NULL when hidden. */
struct {
DRW_ObjectFilterFn fn;
void *user_data;
@@ -987,7 +989,7 @@ int view3d_opengl_select(
switch (select_filter) {
case VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK:
{
- Object *obact = OBACT(vc->view_layer);
+ Object *obact = vc->obact;
if (obact && obact->mode != OB_MODE_OBJECT) {
object_filter.fn = drw_select_filter_object_mode_lock;
object_filter.user_data = obact;
@@ -996,7 +998,7 @@ int view3d_opengl_select(
}
case VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK:
{
- Object *obact = OBACT(vc->view_layer);
+ Object *obact = vc->obact;
BLI_assert(obact && (obact->mode & OB_MODE_WEIGHT_PAINT));
Object *ob_pose = BKE_object_pose_armature_get(obact);
@@ -1025,7 +1027,7 @@ int view3d_opengl_select(
/* All of the queries need to be perform on the drawing context. */
DRW_opengl_context_enable();
- G.f |= G_PICKSEL;
+ G.f |= G_FLAG_PICKSEL;
/* Important we use the 'viewmat' and don't re-calculate since
* the object & bone view locking takes 'rect' into account, see: T51629. */
@@ -1074,7 +1076,7 @@ int view3d_opengl_select(
.rect = &rect,
.gpu_select_mode = gpu_select_mode,
};
- draw_surface = true;
+ draw_surface = (v3d->shading.type > OB_WIRE) || ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) == 0);
DRW_draw_select_loop(
depsgraph, ar, v3d,
use_obedit_skip, draw_surface, use_nearest, &rect,
@@ -1083,7 +1085,7 @@ int view3d_opengl_select(
hits = drw_select_loop_user_data.hits;
}
- G.f &= ~G_PICKSEL;
+ 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) {
@@ -1110,12 +1112,12 @@ finally:
/** \name Local View Operators
* \{ */
-static unsigned int free_localbit(Main *bmain)
+static uint free_localbit(Main *bmain)
{
ScrArea *sa;
bScreen *sc;
- unsigned short local_view_bits = 0;
+ ushort local_view_bits = 0;
/* sometimes we loose a localview: when an area is closed */
/* check all areas: which localviews are in use? */
@@ -1149,14 +1151,15 @@ static bool view3d_localview_init(
Main *bmain,
ViewLayer *view_layer,
ScrArea *sa,
+ const bool frame_selected,
const int smooth_viewtx,
ReportList *reports)
{
View3D *v3d = sa->spacedata.first;
Base *base;
- float min[3], max[3], box[3], mid[3];
+ float min[3], max[3], box[3];
float size = 0.0f;
- unsigned int local_view_bit;
+ uint local_view_bit;
bool ok = false;
if (v3d->localvd) {
@@ -1184,7 +1187,7 @@ static bool view3d_localview_init(
}
else {
for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
BKE_object_minmax(base->object, min, max, false);
base->local_view_bits |= local_view_bit;
ok = true;
@@ -1196,27 +1199,32 @@ static bool view3d_localview_init(
size = max_fff(box[0], box[1], box[2]);
}
- if (ok == true) {
- ARegion *ar;
+ if (ok == false) {
+ return false;
+ }
- v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
+ ARegion *ar;
- memcpy(v3d->localvd, v3d, sizeof(View3D));
+ v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
- mid_v3_v3v3(mid, min, max);
+ memcpy(v3d->localvd, v3d, sizeof(View3D));
+ v3d->local_view_uuid = local_view_bit;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
- bool ok_dist = true;
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = ar->regiondata;
+ bool ok_dist = true;
- /* New view values. */
- Object *camera_old = NULL;
- float dist_new, ofs_new[3];
+ /* New view values. */
+ Object *camera_old = NULL;
+ float dist_new, ofs_new[3];
- rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
- memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
+ rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
+ memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
+ if (frame_selected) {
+ float mid[3];
+ mid_v3_v3v3(mid, min, max);
negate_v3_v3(ofs_new, mid);
if (rv3d->persp == RV3D_CAMOB) {
@@ -1235,7 +1243,7 @@ static bool view3d_localview_init(
if (rv3d->persp == RV3D_PERSP) {
/* Don't zoom closer than the near clipping plane. */
- dist_new = max_ff(dist_new, v3d->near * 1.5f);
+ dist_new = max_ff(dist_new, v3d->clip_start * 1.5f);
}
}
@@ -1245,48 +1253,52 @@ static bool view3d_localview_init(
&(const V3D_SmoothParams) {
.camera_old = camera_old,
.ofs = ofs_new, .quat = rv3d->viewquat,
- .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens});
+ .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens,
+ });
}
}
-
- v3d->local_view_uuid = local_view_bit;
}
- DEG_on_visible_update(bmain, false);
return ok;
}
-static void restore_localviewdata(
+static void view3d_localview_exit(
const Depsgraph *depsgraph,
wmWindowManager *wm,
wmWindow *win,
- Main *bmain,
+ ViewLayer *view_layer,
ScrArea *sa,
+ const bool frame_selected,
const int smooth_viewtx)
{
- const bool free = true;
- ARegion *ar;
View3D *v3d = sa->spacedata.first;
- Object *camera_old, *camera_new;
if (v3d->localvd == NULL) return;
- camera_old = v3d->camera;
- camera_new = v3d->localvd->camera;
+ for (Base *base = FIRSTBASE(view_layer); base; base = base->next) {
+ if (base->local_view_bits & v3d->local_view_uuid) {
+ base->local_view_bits &= ~v3d->local_view_uuid;
+ }
+ }
+
+ Object *camera_old = v3d->camera;
+ Object *camera_new = v3d->localvd->camera;
v3d->local_view_uuid = 0;
v3d->camera = v3d->localvd->camera;
- if (free) {
- MEM_freeN(v3d->localvd);
- v3d->localvd = NULL;
- }
+ MEM_freeN(v3d->localvd);
+ v3d->localvd = NULL;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = ar->regiondata;
- if (rv3d->localvd) {
+ if (rv3d->localvd == NULL) {
+ continue;
+ }
+
+ if (frame_selected) {
Object *camera_old_rv3d, *camera_new_rv3d;
camera_old_rv3d = (rv3d->persp == RV3D_CAMOB) ? camera_old : NULL;
@@ -1303,57 +1315,16 @@ static void restore_localviewdata(
&(const V3D_SmoothParams) {
.camera_old = camera_old_rv3d, .camera = camera_new_rv3d,
.ofs = rv3d->localvd->ofs, .quat = rv3d->localvd->viewquat,
- .dist = &rv3d->localvd->dist});
-
- if (free) {
- MEM_freeN(rv3d->localvd);
- rv3d->localvd = NULL;
- }
+ .dist = &rv3d->localvd->dist,
+ });
}
- ED_view3d_shade_update(bmain, v3d, sa);
+ MEM_freeN(rv3d->localvd);
+ rv3d->localvd = NULL;
}
}
}
-static bool view3d_localview_exit(
- const Depsgraph *depsgraph,
- wmWindowManager *wm,
- wmWindow *win,
- Main *bmain,
- ViewLayer *view_layer,
- ScrArea *sa,
- const int smooth_viewtx)
-{
- View3D *v3d = sa->spacedata.first;
- struct Base *base;
- unsigned int local_view_bit;
-
- if (v3d->localvd) {
-
- local_view_bit = v3d->local_view_uuid;
-
- restore_localviewdata(depsgraph, wm, win, bmain, sa, smooth_viewtx);
-
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (base->local_view_bits & local_view_bit) {
- base->local_view_bits &= ~local_view_bit;
- if (base->object != obedit) {
- ED_object_base_select(base, BA_SELECT);
- }
- }
- }
-
- DEG_on_visible_update(bmain, false);
-
- return true;
- }
- else {
- return false;
- }
-}
-
static int localview_exec(bContext *C, wmOperator *op)
{
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -1365,13 +1336,15 @@ static int localview_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
+ bool frame_selected = RNA_boolean_get(op->ptr, "frame_selected");
bool changed;
if (v3d->localvd) {
- changed = view3d_localview_exit(depsgraph, wm, win, bmain, view_layer, sa, smooth_viewtx);
+ view3d_localview_exit(depsgraph, wm, win, view_layer, sa, frame_selected, smooth_viewtx);
+ changed = true;
}
else {
- changed = view3d_localview_init(depsgraph, wm, win, bmain, view_layer, sa, smooth_viewtx, op->reports);
+ changed = view3d_localview_init(depsgraph, wm, win, bmain, view_layer, sa, frame_selected, smooth_viewtx, op->reports);
}
if (changed) {
@@ -1406,6 +1379,8 @@ void VIEW3D_OT_localview(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
ot->poll = ED_operator_view3d_active;
+
+ RNA_def_boolean(ot->srna, "frame_selected", true, "Frame Selected", "Move the view to frame the selected objects");
}
static int localview_remove_from_exec(bContext *C, wmOperator *op)
@@ -1417,7 +1392,7 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op)
bool changed = false;
for (Base *base = FIRSTBASE(view_layer); base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
base->local_view_bits &= ~v3d->local_view_uuid;
ED_object_base_select(base, BA_DESELECT);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index a716264febb..0caaf6eb113 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Dalai Felinto, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_walk.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
/* defines VIEW3D_OT_navigate - walk modal operator */
@@ -42,9 +36,6 @@
#include "BLT_translation.h"
-
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -65,7 +56,8 @@
#ifdef WITH_INPUT_NDOF
//# define NDOF_WALK_DEBUG
-//# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+/* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+//# define NDOF_WALK_DRAW_TOOMUCH
#endif
#define USE_TABLET_SUPPORT
@@ -76,7 +68,8 @@
/* prototypes */
static float getVelocityZeroTime(const float gravity, const float velocity);
-/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
+/* NOTE: these defines are saved in keymap files,
+ * do not change values but just add new ones */
enum {
WALK_MODAL_CANCEL = 1,
WALK_MODAL_CONFIRM,
@@ -167,7 +160,8 @@ void walk_modal_keymap(wmKeyConfig *keyconf)
{WALK_MODAL_TOGGLE, "GRAVITY_TOGGLE", 0, "Toggle Gravity", "Toggle gravity effect"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Walk Modal");
@@ -945,15 +939,17 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
RegionView3D *rv3d = walk->rv3d;
ARegion *ar = walk->ar;
- float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */
- float dvec[3] = {0.0f, 0.0f, 0.0f}; /* this is the direction that's added to the view offset per redraw */
+ /* 3x3 copy of the view matrix so we can move along the view axis */
+ float mat[3][3];
+ /* this is the direction that's added to the view offset per redraw */
+ float dvec[3] = {0.0f, 0.0f, 0.0f};
int moffset[2]; /* mouse offset from the views center */
float tmp_quat[4]; /* used for rotating the view */
#ifdef NDOF_WALK_DEBUG
{
- static unsigned int iteration = 1;
+ static uint iteration = 1;
printf("walk timer %d\n", iteration++);
}
#endif
@@ -1378,7 +1374,8 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, walk_object);
}
- // puts("redraw!"); // too frequent, commented with NDOF_WALK_DRAW_TOOMUCH for now
+ // too frequent, commented with NDOF_WALK_DRAW_TOOMUCH for now
+ // puts("redraw!");
ED_region_tag_redraw(CTX_wm_region(C));
}
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index ccc143af18f..088128ba152 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 7509b88ccff..6f979460f8b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -72,8 +64,6 @@
#include "DEG_depsgraph.h"
-#include "BIF_glutil.h"
-
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
@@ -223,8 +213,8 @@ static bool transdata_check_local_center(TransInfo *t, short around)
return ((around == V3D_AROUND_LOCAL_ORIGINS) && (
(t->flag & (T_OBJECT | T_POSE)) ||
/* implicit: (t->flag & T_EDIT) */
- (ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE)) ||
- (t->spacetype == SPACE_IPO) ||
+ (ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) ||
+ (t->spacetype == SPACE_GRAPH) ||
(t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE)))
);
}
@@ -287,7 +277,7 @@ void setTransformViewAspect(TransInfo *t, float r_aspect[3])
ED_space_clip_get_aspect(sclip, &r_aspect[0], &r_aspect[1]);
}
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
/* depemds on context of usage */
}
}
@@ -354,7 +344,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
r_vec[0] *= t->aspect[0];
r_vec[1] *= t->aspect[1];
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
convertViewVec2D(t->view, r_vec, dx, dy);
}
else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
@@ -382,7 +372,8 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
if (t->spacetype == SPACE_VIEW3D) {
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
if (ED_view3d_project_int_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
- adr[0] = (int)2140000000.0f; /* this is what was done in 2.64, perhaps we can be smarter? */
+ /* this is what was done in 2.64, perhaps we can be smarter? */
+ adr[0] = (int)2140000000.0f;
adr[1] = (int)2140000000.0f;
}
}
@@ -435,7 +426,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
adr[0] = out[0];
adr[1] = out[1];
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
int out[2] = {0, 0};
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
@@ -598,7 +589,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
else
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- /* for realtime animation record - send notifiers recognised by animation editors */
+ /* For real-time animation record - send notifiers recognized by animation editors */
// XXX: is this notifier a lame duck?
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
@@ -609,8 +600,8 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
//SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
- else if (t->spacetype == SPACE_IPO) {
- //SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ //SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
else if (t->spacetype == SPACE_NLA) {
@@ -693,7 +684,7 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
- else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
+ else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)) {
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
@@ -942,7 +933,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -995,7 +986,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
stopConstraint(t);
}
else {
- setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg1);
+ setUserConstraint(t, V3D_ORIENT_GLOBAL, constraint_axis, msg1);
}
}
else if (!edit_2d) {
@@ -1003,7 +994,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
/* First press, constraint to an axis. */
t->orientation.index = 0;
const short *orientation_ptr = t->orientation.types[t->orientation.index];
- const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
+ const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
if (is_plane == false) {
setUserConstraint(t, orientation, constraint_axis, msg2);
}
@@ -1020,7 +1011,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
}
else {
const short *orientation_ptr = t->orientation.types[t->orientation.index];
- const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
+ const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
if (is_plane == false) {
setUserConstraint(t, orientation, constraint_axis, msg2);
}
@@ -1055,7 +1046,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
copy_v2_v2_int(t->mval, event->mval);
- // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
+ /* Use this for soft redraw. Might cause flicker in object mode */
+ // t->redraw |= TREDRAW_SOFT;
t->redraw |= TREDRAW_HARD;
if (t->state == TRANS_STARTING) {
@@ -1162,7 +1154,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (ELEM(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
/* Scale isn't normally very useful after extrude along normals, see T39756 */
- if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_MANIP_NORMAL)) {
+ if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_ORIENT_NORMAL)) {
stopConstraint(t);
}
@@ -1270,7 +1262,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
float fac = 1.0f + 0.005f *(event->y - event->prevy);
t->prop_size *= fac;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
- t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->far), T_PROP_SIZE_MIN);
+ t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->clip_end), T_PROP_SIZE_MIN);
}
else {
t->prop_size = max_ff(min_ff(t->prop_size, T_PROP_SIZE_MAX), T_PROP_SIZE_MIN);
@@ -1284,7 +1276,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (t->flag & T_PROP_EDIT) {
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
- t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
}
else {
t->prop_size = min_ff(t->prop_size, T_PROP_SIZE_MAX);
@@ -1381,7 +1373,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
else {
if (event->shift) {
- /* bit hackish... but it prevents mmb select to print the orientation from menu */
+ /* bit hackish... but it prevents mmb select to print the
+ * orientation from menu */
float mati[3][3];
strcpy(t->spacename, "global");
unit_m3(mati);
@@ -1473,7 +1466,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (event->alt && t->flag & T_PROP_EDIT) {
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO)
- t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
calculatePropRatio(t);
t->redraw = TREDRAW_HARD;
handled = true;
@@ -1985,7 +1978,8 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
}
}
-/* just draw a little warning message in the top-right corner of the viewport to warn that autokeying is enabled */
+/* just draw a little warning message in the top-right corner of the viewport
+ * to warn that autokeying is enabled */
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
{
rcti rect;
@@ -2061,7 +2055,6 @@ static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- bool constraint_axis[3] = {false, false, false};
int proportional = 0;
PropertyRNA *prop;
@@ -2108,7 +2101,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
!RNA_property_is_set(op->ptr, prop))
{
- if (t->spacetype == SPACE_IPO)
+ if (t->spacetype == SPACE_GRAPH)
ts->proportional_fcurve = proportional;
else if (t->spacetype == SPACE_ACTION)
ts->proportional_action = proportional;
@@ -2143,9 +2136,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if (t->spacetype == SPACE_VIEW3D) {
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
!RNA_property_is_set(op->ptr, prop) &&
- (t->orientation.user != V3D_MANIP_CUSTOM_MATRIX))
+ (t->orientation.user != V3D_ORIENT_CUSTOM_MATRIX))
{
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
orient_slot->type = t->orientation.user;
@@ -2162,55 +2155,103 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
- if ((prop = RNA_struct_find_property(op->ptr, "axis"))) {
- RNA_property_float_set_array(op->ptr, prop, t->axis);
- }
-
- if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho"))) {
- RNA_property_float_set_array(op->ptr, prop, t->axis_ortho);
- }
-
if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
- RNA_property_boolean_set(op->ptr, prop, (t->flag & T_MIRROR) != 0);
+ RNA_property_boolean_set(op->ptr, prop, (t->flag & T_NO_MIRROR) == 0);
}
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
- /* constraint orientation can be global, even if user selects something else
- * so use the orientation in the constraint if set */
- short orientation = (t->con.mode & CON_APPLY) ? t->con.orientation : t->orientation.user;
-
- if (orientation == V3D_MANIP_CUSTOM) {
+ /* Orientation used for redo. */
+ short orientation;
+ if (t->con.mode & CON_APPLY) {
+ orientation = t->con.orientation;
+ if (orientation == V3D_ORIENT_CUSTOM) {
const int orientation_index_custom = BKE_scene_transform_orientation_get_index(
t->scene, t->orientation.custom);
-
- /* Maybe we need a t->con.custom_orientation? Seems like it would always match t->orientation.custom. */
- orientation = V3D_MANIP_CUSTOM + orientation_index_custom;
- BLI_assert(orientation >= V3D_MANIP_CUSTOM);
+ /* Maybe we need a t->con.custom_orientation?
+ * Seems like it would always match t->orientation.custom. */
+ orientation = V3D_ORIENT_CUSTOM + orientation_index_custom;
+ BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
}
+ }
+ else if ((t->orientation.user == V3D_ORIENT_CUSTOM_MATRIX) &&
+ (prop = RNA_struct_find_property(op->ptr, "orient_matrix_type")))
+ {
+ orientation = RNA_property_enum_get(op->ptr, prop);
+ }
+ else {
+ /* We're not using an orientation, use the fallback. */
+ orientation = t->orientation.unset;
+ }
- RNA_float_set_array(op->ptr, "constraint_matrix", &t->spacemtx[0][0]);
- /* Use 'constraint_matrix' instead. */
- if (orientation != V3D_MANIP_CUSTOM_MATRIX) {
- RNA_enum_set(op->ptr, "constraint_orientation", orientation);
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
+ if (t->flag & T_MODAL) {
+ if (t->con.mode & CON_APPLY) {
+ int orient_axis = constraintModeToIndex(t);
+ if (orient_axis != -1) {
+ RNA_property_enum_set(op->ptr, prop, orient_axis);
+ }
+ }
+ else {
+ RNA_property_enum_set(op->ptr, prop, t->orient_axis);
+ }
}
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
+ if (t->flag & T_MODAL) {
+ RNA_property_enum_set(op->ptr, prop, t->orient_axis_ortho);
+ }
+ }
- if (t->con.mode & CON_APPLY) {
- if (t->con.mode & CON_AXIS0) {
- constraint_axis[0] = true;
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_matrix"))) {
+ if (t->flag & T_MODAL) {
+ if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
+ if (t->flag & T_MODAL) {
+ RNA_enum_set(op->ptr, "orient_matrix_type", orientation);
+ }
}
- if (t->con.mode & CON_AXIS1) {
- constraint_axis[1] = true;
+ if (t->con.mode & CON_APPLY) {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->con.mtx[0][0]);
}
- if (t->con.mode & CON_AXIS2) {
- constraint_axis[2] = true;
+ else if (t->orient_matrix_is_set) {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->orient_matrix[0][0]);
+ }
+ else {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->spacemtx[0][0]);
}
}
+ }
- /* Only set if needed, so we can hide in the UI when nothing is set.
- * See 'transform_poll_property'. */
- if (ELEM(true, UNPACK3(constraint_axis))) {
- RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_type"))) {
+ /* constraint orientation can be global, even if user selects something else
+ * so use the orientation in the constraint if set */
+
+ /* Use 'orient_matrix' instead. */
+ if (t->flag & T_MODAL) {
+ if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
+ RNA_property_enum_set(op->ptr, prop, orientation);
+ }
+ }
+ }
+
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
+ bool constraint_axis[3] = {false, false, false};
+ if (t->flag & T_MODAL) {
+ /* Only set if needed, so we can hide in the UI when nothing is set.
+ * See 'transform_poll_property'. */
+ if (t->con.mode & CON_APPLY) {
+ if (t->con.mode & CON_AXIS0) {
+ constraint_axis[0] = true;
+ }
+ if (t->con.mode & CON_AXIS1) {
+ constraint_axis[1] = true;
+ }
+ if (t->con.mode & CON_AXIS2) {
+ constraint_axis[2] = true;
+ }
+ }
+ if (ELEM(true, UNPACK3(constraint_axis))) {
+ RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ }
}
}
@@ -2223,7 +2264,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) {
- RNA_property_boolean_set(op->ptr, prop, ((t->flag & T_ALT_TRANSFORM) != 0) == prop_state);
+ RNA_property_boolean_set(op->ptr, prop, ((t->flag & T_ALT_TRANSFORM) == 0) == prop_state);
}
}
@@ -2322,7 +2363,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
SPACE_TYPE_ANY, RGN_TYPE_ANY,
helpline_poll, drawHelpline, t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
t->draw_handle_cursor = WM_paint_cursor_activate(
@@ -2378,9 +2419,13 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
initSnapSpatial(t, t->snap_spatial);
- /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
+ /* EVIL! posemode code can switch translation to rotate when 1 bone is selected.
+ * will be removed (ton) */
+
/* EVIL2: we gave as argument also texture space context bit... was cleared */
- /* EVIL3: extend mode for animation editors also switches modes... but is best way to avoid duplicate code */
+
+ /* EVIL3: extend mode for animation editors also switches modes...
+ * but is best way to avoid duplicate code */
mode = t->mode;
calculatePropRatio(t);
@@ -2413,41 +2458,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
- /* Transformation axis from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_get_array(op->ptr, prop, t->axis);
- normalize_v3(t->axis);
- copy_v3_v3(t->axis_orig, t->axis);
- }
-
- if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho")) && RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_get_array(op->ptr, prop, t->axis_ortho);
- normalize_v3(t->axis_ortho);
- }
-
- /* Constraint init from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
- bool constraint_axis[3];
-
- RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
-
- if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
- t->con.mode |= CON_APPLY;
-
- if (constraint_axis[0]) {
- t->con.mode |= CON_AXIS0;
- }
- if (constraint_axis[1]) {
- t->con.mode |= CON_AXIS1;
- }
- if (constraint_axis[2]) {
- t->con.mode |= CON_AXIS2;
- }
-
- setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
- }
- }
-
if (event) {
/* Initialize accurate transform to settings requested by keymap. */
bool use_accurate = false;
@@ -2559,7 +2569,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* same as TFM_TIME_EXTEND, but we need the mode info for later
* so that duplicate-culling will work properly
*/
- if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
+ if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
initTranslation(t);
else
initTimeTranslate(t);
@@ -2571,7 +2581,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
* (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement)
* depending on which editor this was called from
*/
- if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
+ if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
initTranslation(t);
else
initTimeTranslate(t);
@@ -2601,6 +2611,65 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
return 0;
}
+ /* Transformation axis from operator */
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ t->orient_axis = RNA_property_enum_get(op->ptr, prop);
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
+ }
+
+ /* Constraint init from operator */
+ if (t->flag & T_MODAL) {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ bool constraint_axis[3];
+
+ RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
+
+ if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
+ t->con.mode |= CON_APPLY;
+
+ /* Only for interactive operation, when redoing, ignore these values since the numbers
+ * will be constrainted already. */
+ if (t->flag & T_MODAL) {
+ if (constraint_axis[0]) {
+ t->con.mode |= CON_AXIS0;
+ }
+ if (constraint_axis[1]) {
+ t->con.mode |= CON_AXIS1;
+ }
+ if (constraint_axis[2]) {
+ t->con.mode |= CON_AXIS2;
+ }
+ }
+ else {
+ t->con.mode |= CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
+ }
+
+ setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
+ }
+ }
+ }
+ else {
+ /* So we can adjust in non global orientation. */
+ if (t->orientation.user != V3D_ORIENT_GLOBAL) {
+ t->con.mode |= CON_APPLY | CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
+ setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
+ }
+ }
+
+ /* Don't write into the values when non-modal because they are already set from operator redo values. */
+ if (t->flag & T_MODAL) {
+ /* Setup the mouse input with initial values. */
+ applyMouseInput(t, &t->mouse, t->mouse.imval, t->values);
+ }
+
if ((prop = RNA_struct_find_property(op->ptr, "preserve_clnor"))) {
if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
@@ -2609,8 +2678,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
BMEditMesh *em = NULL;// BKE_editmesh_from_object(t->obedit);
bool do_skip = false;
- /* Currently only used for two of three most frequent transform ops, can include more ops.
- * Note that scaling cannot be included here, non-uniform scaling will affect normals. */
+ /* Currently only used for two of three most frequent transform ops,
+ * can include more ops.
+ * Note that scaling cannot be included here,
+ * non-uniform scaling will affect normals. */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_ROTATION)) {
if (em->bm->totvertsel == em->bm->totvert) {
/* No need to invalidate if whole mesh is selected. */
@@ -3305,7 +3376,20 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(fac, 0.0f, 1.0f);
}
- fac_scaled = fac * td->factor;
+ if (t->options & CTX_GPENCIL_STROKES) {
+ /* grease pencil multiframe falloff */
+ bGPDstroke *gps = (bGPDstroke *)td->extra;
+ if (gps != NULL) {
+ fac_scaled = fac * td->factor * gps->runtime.multi_frame_falloff;
+ }
+ else {
+ fac_scaled = fac * td->factor;
+ }
+ }
+ else {
+ fac_scaled = fac * td->factor;
+ }
+
axis_angle_normalized_to_mat3(mat, data->warp_nor, values.angle * fac_scaled);
interp_v3_v3v3(delta, warp_sta_local, warp_end_radius_local, fac_scaled);
sub_v3_v3(delta, warp_sta_local);
@@ -3347,10 +3431,15 @@ static void initShear_mouseInputMode(TransInfo *t)
float dir[3];
if (t->custom.mode.data == NULL) {
- copy_v3_v3(dir, t->axis_ortho);
+ copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]);
}
else {
- cross_v3_v3v3(dir, t->axis_ortho, t->axis);
+ cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis_ortho], t->orient_matrix[t->orient_axis]);
+ }
+
+ /* Without this, half the gizmo handles move in the opposite direction. */
+ if ((t->orient_axis_ortho + 1) % 3 != t->orient_axis) {
+ negate_v3(dir);
}
mul_mat3_m4_v3(t->viewmat, dir);
@@ -3368,13 +3457,9 @@ static void initShear(TransInfo *t)
t->transform = applyShear;
t->handleEvent = handleEventShear;
- if (is_zero_v3(t->axis)) {
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
- }
- if (is_zero_v3(t->axis_ortho)) {
- copy_v3_v3(t->axis_ortho, t->viewinv[0]);
- normalize_v3(t->axis_ortho);
+ if (t->orient_axis == t->orient_axis_ortho) {
+ t->orient_axis = 2;
+ t->orient_axis_ortho = 1;
}
initShear_mouseInputMode(t);
@@ -3463,8 +3548,8 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
else
smat[0][1] = value;
- copy_v3_v3(axismat_inv[0], t->axis_ortho);
- copy_v3_v3(axismat_inv[2], t->axis);
+ copy_v3_v3(axismat_inv[0], t->orient_matrix[t->orient_axis_ortho]);
+ copy_v3_v3(axismat_inv[2], t->orient_matrix[t->orient_axis]);
cross_v3_v3v3(axismat_inv[1], axismat_inv[0], axismat_inv[2]);
invert_m3_m3(axismat, axismat_inv);
@@ -3504,7 +3589,19 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
add_v3_v3(vec, center);
sub_v3_v3(vec, co);
- mul_v3_fl(vec, td->factor);
+ if (t->options & CTX_GPENCIL_STROKES) {
+ /* grease pencil multiframe falloff */
+ bGPDstroke *gps = (bGPDstroke *)td->extra;
+ if (gps != NULL) {
+ mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
+ }
+ else {
+ mul_v3_fl(vec, td->factor);
+ }
+ }
+ else {
+ mul_v3_fl(vec, td->factor);
+ }
add_v3_v3v3(td->loc, td->iloc, vec);
}
@@ -3763,14 +3860,28 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
}
size_to_mat3(mat, t->values);
-
- if (t->con.applySize) {
+ if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
+
+ /* Only so we have re-usable value with redo. */
+ float pvec[3] = {0.0f, 0.0f, 0.0f};
+ int j = 0;
+ for (i = 0; i < 3; i++) {
+ if (!(t->con.mode & (CON_AXIS0 << i))) {
+ t->values[i] = 1.0f;
+ }
+ else {
+ pvec[j++] = t->values[i];
+ }
+ }
+ headerResize(t, pvec, str);
+ }
+ else {
+ headerResize(t, t->values, str);
}
copy_m3_m3(t->mat, mat); // used in gizmo
- headerResize(t, t->values, str);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@@ -3789,8 +3900,9 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) {
size_to_mat3(mat, t->values);
- if (t->con.applySize)
+ if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
+ }
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -4024,8 +4136,10 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
static void postInputRotation(TransInfo *t, float values[3])
{
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, values);
+ t->con.applyRot(t, NULL, NULL, axis_final, values);
}
}
@@ -4050,18 +4164,6 @@ static void initRotation(TransInfo *t)
if (t->flag & T_2D_EDIT)
t->flag |= T_NO_CONSTRAINT;
-
- if (t->options & CTX_PAINT_CURVE) {
- t->axis[0] = 0.0;
- t->axis[1] = 0.0;
- t->axis[2] = -1.0;
- }
- else {
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
- }
-
- copy_v3_v3(t->axis_orig, t->axis);
}
/* Used by Transform Rotation and Transform Normal Rotation */
@@ -4295,7 +4397,7 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
mul_m3_m3m3(smat, td->smtx, totmat);
/* calculate the total rotatation in eulers */
- add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
+ add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta rot */
eulO_to_mat3(obmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = object rotation */
mul_m3_m3m3(fmat, smat, obmat);
@@ -4370,12 +4472,11 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
snapGridIncrement(t, &final);
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
+
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, NULL);
- }
- else {
- /* reset axis if constraint is not set */
- copy_v3_v3(t->axis, t->axis_orig);
+ t->con.applyRot(t, NULL, NULL, axis_final, NULL);
}
applySnapping(t, &final);
@@ -4387,7 +4488,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
headerRotation(t, str, final);
- applyRotationValue(t, final, t->axis);
+ applyRotationValue(t, final, axis_final);
recalcData(t);
@@ -4517,7 +4618,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
/* Transform (Normal Rotation) */
/** \name Transform Normal Rotation
-* \{ */
+ * \{ */
static void storeCustomLNorValue(TransDataContainer *tc, BMesh *bm)
{
@@ -4537,7 +4638,8 @@ void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
BMesh *bm = em->bm;
- for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) { /* Restore custom loop normal on cancel */
+ /* Restore custom loop normal on cancel */
+ for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) {
BKE_lnor_space_custom_normal_to_data(
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->niloc, lnor_ed->clnors_data);
}
@@ -4576,11 +4678,6 @@ static void initNormalRotation(TransInfo *t)
storeCustomLNorValue(tc, bm);
}
-
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
-
- copy_v3_v3(t->axis_orig, t->axis);
}
/* Works by getting custom normal from clnor_data, transform, then store */
@@ -4588,12 +4685,11 @@ static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
{
char str[UI_MAX_DRAW_STR];
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
+
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, NULL);
- }
- else {
- /* reset axis if constraint is not set */
- copy_v3_v3(t->axis, t->axis_orig);
+ t->con.applyRot(t, NULL, NULL, axis_final, NULL);
}
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
@@ -4606,7 +4702,7 @@ static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
float axis[3];
float mat[3][3];
float angle = t->values[0];
- copy_v3_v3(axis, t->axis);
+ copy_v3_v3(axis, axis_final);
snapGridIncrement(t, &angle);
@@ -4664,7 +4760,7 @@ static void initSnapSpatial(TransInfo *t, float r_snap[3])
r_snap[1] = ED_node_grid_size();
r_snap[2] = ED_node_grid_size();
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
r_snap[0] = 0.0f;
r_snap[1] = 1.0;
r_snap[2] = 0.1f;
@@ -4708,7 +4804,7 @@ static void initTranslation(TransInfo *t)
t->num.unit_type[2] = B_UNIT_LENGTH;
}
else {
- /* SPACE_IPO, SPACE_ACTION, etc. could use some time units, when we have them... */
+ /* SPACE_GRAPH, SPACE_ACTION, etc. could use some time units, when we have them... */
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
t->num.unit_type[2] = B_UNIT_NONE;
@@ -5050,7 +5146,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
}
}
BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_(" or Alt) Even Thickness %s"),
- WM_bool_as_string((t->flag & T_ALT_TRANSFORM) == 0));
+ WM_bool_as_string((t->flag & T_ALT_TRANSFORM) != 0));
/* done with header string */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -5065,7 +5161,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* get the final offset */
tdistance = distance * td->factor;
- if (td->ext && (t->flag & T_ALT_TRANSFORM) == 0) {
+ if (td->ext && (t->flag & T_ALT_TRANSFORM) != 0) {
tdistance *= td->ext->isize[0]; /* shell factor */
}
@@ -5980,7 +6076,7 @@ static void slide_origdata_create_data_vert(
}
static void slide_origdata_create_data(
- TransInfo *t, TransDataContainer *tc, SlideOrigData *sod,
+ TransDataContainer *tc, SlideOrigData *sod,
TransDataGenericSlideVert *sv_array, unsigned int v_stride, unsigned int v_num)
{
if (sod->use_origfaces) {
@@ -6015,7 +6111,7 @@ static void slide_origdata_create_data(
slide_origdata_create_data_vert(bm, sod, sv);
}
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
TransData *td = tc->data;
TransDataGenericSlideVert *sv_mirror;
@@ -6101,9 +6197,12 @@ static void slide_origdata_interp_data_vert(
bool co_next_ok;
- /* In the unlikely case that we're next to a zero length edge - walk around the to the next.
+ /* In the unlikely case that we're next to a zero length edge -
+ * walk around the to the next.
+ *
* Since we only need to check if the vertex is in this corner,
- * its not important _which_ loop - as long as its not overlapping 'sv->co_orig_3d', see: T45096. */
+ * its not important _which_ loop - as long as its not overlapping
+ * 'sv->co_orig_3d', see: T45096. */
project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis);
while (UNLIKELY(((co_prev_ok = (len_squared_v3v3(v_proj[1], v_proj[0]) > eps)) == false) &&
((l_prev = l_prev->prev) != l->next)))
@@ -6941,7 +7040,9 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
else if (l_b == NULL && l_a && (l_a->radial_next != l_a)) l_b = l_a->radial_next;
}
else if (e->l != NULL) {
- /* if there are non-contiguous faces, we can still recover the loops of the new edges faces */
+ /* if there are non-contiguous faces, we can still recover
+ * the loops of the new edges faces */
+
/* note!, the behavior in this case means edges may move in opposite directions,
* this could be made to work more usefully. */
@@ -6995,7 +7096,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
/* create copies of faces for customdata projection */
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
if (rv3d) {
calcEdgeSlide_even(t, tc, sld, mval);
@@ -7190,7 +7291,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t
/* create copies of faces for customdata projection */
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
if (rv3d) {
calcEdgeSlide_even(t, tc, sld, mval);
@@ -7806,7 +7907,7 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc)
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
sld->em = em;
@@ -8541,7 +8642,8 @@ static void initSeqSlide(TransInfo *t)
copy_v3_fl(t->num.val_inc, t->snap[1]);
t->num.unit_sys = t->scene->unit.system;
- /* Would be nice to have a time handling in units as well (supporting frames in addition to "natural" time...). */
+ /* Would be nice to have a time handling in units as well
+ * (supporting frames in addition to "natural" time...). */
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
}
@@ -8641,8 +8743,8 @@ static short getAnimEdit_SnapMode(TransInfo *t)
if (saction)
autosnap = saction->autosnap;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
if (sipo)
autosnap = sipo->autosnap;
@@ -9181,6 +9283,9 @@ static void applyTimeScaleValue(TransInfo *t)
fac = floorf(fac + 0.5f);
}
+ /* take proportional editing into account */
+ fac = ((fac - 1.0f) * td->factor) + 1;
+
/* check if any need to apply nla-mapping */
if (adt)
startx = BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fc52f5e723c..c8af018f7b9 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform.h
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
@@ -45,30 +37,30 @@
/* ************************** Types ***************************** */
+struct ARegion;
struct Depsgraph;
-struct TransInfo;
-struct TransDataContainer;
-struct TransData;
-struct TransformOrientation;
-struct TransSnap;
+struct EditBone;
struct NumInput;
struct Object;
-struct View3D;
-struct ScrArea;
+struct RNG;
+struct RenderEngineType;
+struct ReportList;
struct Scene;
+struct ScrArea;
+struct SnapObjectContext;
+struct TransData;
+struct TransDataContainer;
+struct TransInfo;
+struct TransSnap;
+struct TransformOrientation;
+struct View3D;
struct ViewLayer;
struct bConstraint;
-struct wmKeyMap;
-struct wmKeyConfig;
struct bContext;
struct wmEvent;
+struct wmKeyConfig;
+struct wmKeyMap;
struct wmTimer;
-struct ARegion;
-struct ReportList;
-struct RNG;
-struct EditBone;
-struct RenderEngineType;
-struct SnapObjectContext;
#include "DNA_object_enums.h"
@@ -95,8 +87,10 @@ typedef struct TransSnap {
bool peel;
bool snap_spatial_grid;
short status;
- float snapPoint[3]; /* snapping from this point (in global-space)*/
- float snapTarget[3]; /* to this point (in global-space)*/
+ /** snapping from this point (in global-space). */
+ float snapPoint[3];
+ /** to this point (in global-space). */
+ float snapTarget[3];
float snapNormal[3];
char snapNodeBorder;
ListBase points;
@@ -120,77 +114,116 @@ typedef struct TransSnap {
} TransSnap;
typedef struct TransCon {
- short orientation; /**/
- char text[50]; /* Description of the Constraint for header_print */
- float mtx[3][3]; /* Matrix of the Constraint space */
- float imtx[3][3]; /* Inverse Matrix of the Constraint space */
- float pmtx[3][3]; /* Projection Constraint Matrix (same as imtx with some axis == 0) */
- int imval[2]; /* initial mouse value for visual calculation */
- /* the one in TransInfo is not guarantee to stay the same (Rotates change it) */
- int mode; /* Mode flags of the Constraint */
+ short orientation;
+ /** Description of the constraint for header_print. */
+ char text[50];
+ /** Matrix of the constraint space. */
+ float mtx[3][3];
+ /** Inverse matrix of the constraint space. */
+ float imtx[3][3];
+ /** Projection constraint matrix (same as #imtx with some axis == 0). */
+ float pmtx[3][3];
+ /** Initial mouse value for visual calculation
+ * the one in #TransInfo is not guarantee to stay the same (Rotates change it). */
+ int imval[2];
+ /** Mode flags of the constraint. */
+ int mode;
void (*drawExtra)(struct TransInfo *t);
- /* Note: if 'tc' is NULL, 'td' must also be NULL. */
- /* For constraints that needs to draw differently from the other
- * uses this instead of the generic draw function */
+ /* Note: if 'tc' is NULL, 'td' must also be NULL.
+ * For constraints that needs to draw differently from the other
+ * uses this instead of the generic draw function. */
+
+ /** Apply function pointer for linear vectorial transformation
+ * The last three parameters are pointers to the in/out/printable vectors. */
void (*applyVec)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, const float in[3], float out[3], float pvec[3]);
- /* Apply function pointer for linear vectorial transformation */
- /* The last three parameters are pointers to the in/out/printable vectors */
+ /** Apply function pointer for size transformation. */
void (*applySize)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, float smat[3][3]);
- /* Apply function pointer for size transformation */
+ /** Apply function pointer for rotation transformation */
void (*applyRot)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, float vec[3], float *angle);
- /* Apply function pointer for rotation transformation */
} TransCon;
typedef struct TransDataExtension {
- float drot[3]; /* Initial object drot */
- // float drotAngle; /* Initial object drotAngle, TODO: not yet implemented */
- // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implemented */
- float dquat[4]; /* Initial object dquat */
- float dscale[3]; /* Initial object dscale */
- float *rot; /* Rotation of the data to transform */
- float irot[3]; /* Initial rotation */
- float *quat; /* Rotation quaternion of the data to transform */
- float iquat[4]; /* Initial rotation quaternion */
- float *rotAngle; /* Rotation angle of the data to transform */
- float irotAngle; /* Initial rotation angle */
- float *rotAxis; /* Rotation axis of the data to transform */
- float irotAxis[4]; /* Initial rotation axis */
- float *size; /* Size of the data to transform */
- float isize[3]; /* Initial size */
- float obmat[4][4]; /* Object matrix */
- float l_smtx[3][3]; /* use instead of td->smtx, It is the same but without the 'bone->bone_mat', see TD_PBONE_LOCAL_MTX_C */
- float r_mtx[3][3]; /* The rotscale matrix of pose bone, to allow using snap-align in translation mode,
- * when td->mtx is the loc pose bone matrix (and hence can't be used to apply rotation in some cases,
- * namely when a bone is in "NoLocal" or "Hinge" mode)... */
- float r_smtx[3][3]; /* Inverse of previous one. */
- int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
- float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle; /* Original object transformation used for rigid bodies */
+ /** Initial object drot. */
+ float drot[3];
+ // /* Initial object drotAngle, TODO: not yet implemented */
+ // float drotAngle;
+ // /* Initial object drotAxis, TODO: not yet implemented */
+ // float drotAxis[3];
+ /** Initial object delta quat. */
+ float dquat[4];
+ /** Initial object delta scale. */
+ float dscale[3];
+ /** Rotation of the data to transform. */
+ float *rot;
+ /** Initial rotation. */
+ float irot[3];
+ /** Rotation quaternion of the data to transform. */
+ float *quat;
+ /** Initial rotation quaternion. */
+ float iquat[4];
+ /** Rotation angle of the data to transform. */
+ float *rotAngle;
+ /** Initial rotation angle. */
+ float irotAngle;
+ /** Rotation axis of the data to transform. */
+ float *rotAxis;
+ /** Initial rotation axis. */
+ float irotAxis[4];
+ /** Size of the data to transform. */
+ float *size;
+ /** Initial size. */
+ float isize[3];
+ /** Object matrix. */
+ float obmat[4][4];
+ /** Use instead of #TransData.smtx,
+ * It is the same but without the #Bone.bone_mat, see #TD_PBONE_LOCAL_MTX_C. */
+ float l_smtx[3][3];
+ /** The rotscale matrix of pose bone, to allow using snap-align in translation mode,
+ * when td->mtx is the loc pose bone matrix (and hence can't be used to apply
+ * rotation in some cases, namely when a bone is in "NoLocal" or "Hinge" mode)... */
+ float r_mtx[3][3];
+ /** Inverse of previous one. */
+ float r_smtx[3][3];
+ /** Rotation mode, as defined in #eRotationModes (DNA_action_types.h). */
+ int rotOrder;
+ /** Original object transformation used for rigid bodies. */
+ float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle;
} TransDataExtension;
typedef struct TransData2D {
- float loc[3]; /* Location of data used to transform (x,y,0) */
- float *loc2d; /* Pointer to real 2d location of data */
+ /** Location of data used to transform (x,y,0). */
+ float loc[3];
+ /** Pointer to real 2d location of data. */
+ float *loc2d;
- float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independently */
+ /** Pointer to handle locations, if handles aren't being moved independently. */
+ float *h1, *h2;
float ih1[2], ih2[2];
} TransData2D;
-/* we need to store 2 handles for each transdata in case the other handle wasn't selected */
+/** Used to store 2 handles for each #TransData in case the other handle wasn't selected. */
typedef struct TransDataCurveHandleFlags {
char ih1, ih2;
char *h1, *h2;
} TransDataCurveHandleFlags;
-/* for sequencer transform */
+/** Used for sequencer transform. */
typedef struct TransDataSeq {
struct Sequence *seq;
- int flag; /* a copy of seq->flag that may be modified for nested strips */
- int start_offset; /* use this so we can have transform data at the strips start, but apply correctly to the start frame */
- short sel_flag; /* one of SELECT, SEQ_LEFTSEL and SEQ_RIGHTSEL */
+ /** A copy of #Sequence.flag that may be modified for nested strips. */
+ int flag;
+ /** Use this so we can have transform data at the strips start,
+ * but apply correctly to the start frame. */
+ int start_offset;
+ /** one of #SELECT, #SEQ_LEFTSEL and #SEQ_RIGHTSEL. */
+ short sel_flag;
} TransDataSeq;
+/**
+ * Sequencer transform customdata (stored in #TransCustomDataContainer).
+ */
typedef struct TransSeq {
TransDataSeq *tdseq;
int min;
@@ -198,25 +231,33 @@ typedef struct TransSeq {
bool snap_left;
} TransSeq;
-/* for NLA transform (stored in td->extra pointer) */
+/** Used for NLA transform (stored in #TransData.extra pointer). */
typedef struct TransDataNla {
- ID *id; /* ID-block NLA-data is attached to */
+ /** ID-block NLA-data is attached to. */
+ ID *id;
- struct NlaTrack *oldTrack; /* Original NLA-Track that the strip belongs to */
- struct NlaTrack *nlt; /* Current NLA-Track that the strip belongs to */
+ /** Original NLA-Track that the strip belongs to. */
+ struct NlaTrack *oldTrack;
+ /** Current NLA-Track that the strip belongs to. */
+ struct NlaTrack *nlt;
- struct NlaStrip *strip; /* NLA-strip this data represents */
+ /** NLA-strip this data represents. */
+ struct NlaStrip *strip;
/* dummy values for transform to write in - must have 3 elements... */
- float h1[3]; /* start handle */
- float h2[3]; /* end handle */
-
- int trackIndex; /* index of track that strip is currently in */
- int handle; /* handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends */
+ /** start handle. */
+ float h1[3];
+ /** end handle. */
+ float h2[3];
+
+ /** index of track that strip is currently in. */
+ int trackIndex;
+ /** handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends. */
+ int handle;
} TransDataNla;
-struct LinkNode;
struct GHash;
+struct LinkNode;
/* header of TransDataEdgeSlideVert, TransDataEdgeSlideEdge */
typedef struct TransDataGenericSlideVert {
@@ -226,7 +267,7 @@ typedef struct TransDataGenericSlideVert {
} TransDataGenericSlideVert;
typedef struct TransDataEdgeSlideVert {
- /* TransDataGenericSlideVert */
+ /** #TransDataGenericSlideVert (header) */
struct BMVert *v;
struct LinkNode **cd_loop_groups;
float v_co_orig[3];
@@ -245,22 +286,23 @@ typedef struct TransDataEdgeSlideVert {
/* store original data so we can correct UV's and similar when sliding */
typedef struct SlideOrigData {
- /* flag that is set when origfaces is initialized */
+ /** Set when #origfaces is initialized. */
bool use_origfaces;
int cd_loop_mdisp_offset;
- struct GHash *origverts; /* map {BMVert: TransDataGenericSlideVert} */
+ /** map {BMVert: TransDataGenericSlideVert} */
+ struct GHash *origverts;
struct GHash *origfaces;
struct BMesh *bm_origfaces;
struct MemArena *arena;
- /* number of math BMLoop layers */
+ /** Number of math BMLoop layers. */
int layer_math_map_num;
- /* array size of 'layer_math_map_num'
+ /** Array size of 'layer_math_map_num'
* maps TransDataVertSlideVert.cd_group index to absolute CustomData layer index */
int *layer_math_map;
- /* array of slide vert data especially for mirror verts */
+ /** Array of slide vert data especially for mirror verts. */
TransDataGenericSlideVert *sv_mirror;
int totsv_mirror;
} SlideOrigData;
@@ -289,7 +331,7 @@ typedef struct EdgeSlideParams {
} EdgeSlideParams;
typedef struct TransDataVertSlideVert {
- /* TransDataGenericSlideVert */
+ /** #TransDataGenericSlideVert (header) */
struct BMVert *v;
struct LinkNode **cd_loop_groups;
float co_orig_3d[3];
@@ -333,36 +375,58 @@ typedef struct BoneInitData {
} BoneInitData;
typedef struct TransData {
- float dist; /* Distance needed to affect element (for Proportionnal Editing) */
- float rdist; /* Distance to the nearest element (for Proportionnal Editing) */
- float factor; /* Factor of the transformation (for Proportionnal Editing) */
- float *loc; /* Location of the data to transform */
- float iloc[3]; /* Initial location */
- float *val; /* Value pointer for special transforms */
- float ival; /* Old value*/
- float center[3]; /* Individual data center */
- float mtx[3][3]; /* Transformation matrix from data space to global space */
- float smtx[3][3]; /* Transformation matrix from global space to data space */
- float axismtx[3][3];/* Axis orientation matrix of the data */
+ /** Distance needed to affect element (for Proportionnal Editing). */
+ float dist;
+ /** Distance to the nearest element (for Proportionnal Editing). */
+ float rdist;
+ /** Factor of the transformation (for Proportionnal Editing). */
+ float factor;
+ /** Location of the data to transform. */
+ float *loc;
+ /** Initial location. */
+ float iloc[3];
+ /** Value pointer for special transforms. */
+ float *val;
+ /** Old value. */
+ float ival;
+ /** Individual data center. */
+ float center[3];
+ /** Transformation matrix from data space to global space. */
+ float mtx[3][3];
+ /** Transformation matrix from global space to data space. */
+ float smtx[3][3];
+ /** Axis orientation matrix of the data. */
+ float axismtx[3][3];
struct Object *ob;
- struct bConstraint *con; /* for objects/bones, the first constraint in its constraint stack */
- TransDataExtension *ext; /* for objects, poses. 1 single malloc per TransInfo! */
- TransDataCurveHandleFlags *hdata; /* for curves, stores handle flags for modification/cancel */
- void *extra; /* extra data (mirrored element pointer, in editmode mesh to BMVert) (editbone for roll fixing) (...) */
- int flag; /* Various flags */
- short protectflag; /* If set, copy of Object or PoseChannel protection */
+ /** For objects/bones, the first constraint in its constraint stack. */
+ struct bConstraint *con;
+ /** For objects, poses. 1 single malloc per TransInfo! */
+ TransDataExtension *ext;
+ /** for curves, stores handle flags for modification/cancel. */
+ TransDataCurveHandleFlags *hdata;
+ /**
+ * Extra data (mirrored element pointer, in editmode mesh to BMVert)
+ * (editbone for roll fixing) (...).
+ */
+ void *extra;
+ /** Various flags. */
+ int flag;
+ /** If set, copy of Object or PoseChannel protection. */
+ short protectflag;
} TransData;
typedef struct MouseInput {
void (*apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3]);
void (*post)(struct TransInfo *t, float values[3]);
- int imval[2]; /* initial mouse position */
+ /** Initial mouse position. */
+ int imval[2];
bool precision;
float precision_factor;
float center[2];
float factor;
- void *data; /* additional data, if needed by the particular function */
+ /** Additional data, if needed by the particular function. */
+ void *data;
/**
* Use virtual cursor, which takes precision into account
@@ -445,6 +509,16 @@ typedef struct TransDataContainer {
/** Center of transformation (in local-space), Calculated from #TransInfo.center_global. */
float center_local[3];
+ /**
+ * Mirror option
+ */
+ struct {
+ /* Currently for mesh X mirror only. */
+ int axis_flag;
+ /** Set to -1.0f or 1.0 when use_mirror is set. */
+ float sign;
+ } mirror;
+
TransCustomDataContainer custom;
} TransDataContainer;
@@ -455,80 +529,131 @@ typedef struct TransInfo {
* Use to check if nothing is selected or if we have a single selection. */
int data_len_all;
- int mode; /* current mode */
- int flag; /* generic flags for special behaviors */
- int modifiers; /* special modifiers, by function, not key */
- short state; /* current state (running, canceled,...)*/
- int options; /* current context/options for transform */
- float val; /* init value for some transformations (and rotation angle) */
+ /** Current mode. */
+ int mode;
+ /** Generic flags for special behaviors. */
+ int flag;
+ /** Special modifiers, by function, not key. */
+ int modifiers;
+ /** Current state (running, canceled. */
+ short state;
+ /** Current context/options for transform. */
+ int options;
+ /** Init value for some transformations (and rotation angle). */
+ float val;
void (*transform)(struct TransInfo *, const int[2]);
- /* transform function pointer */
+ /** Transform function pointer. */
eRedrawFlag (*handleEvent)(struct TransInfo *, const struct wmEvent *);
/* event handler function pointer RETURN 1 if redraw is needed */
- TransCon con; /* transformed constraint */
+ /** transformed constraint. */
+ TransCon con;
TransSnap tsnap;
- NumInput num; /* numerical input */
- MouseInput mouse; /* mouse input */
- eRedrawFlag redraw; /* redraw flag */
- float prop_size; /* proportional circle radius */
- char proptext[20]; /* proportional falloff text */
- float aspect[3]; /* spaces using non 1:1 aspect, (uv's, f-curve, movie-clip... etc)
- * use for conversion and snapping. */
- float center_global[3]; /* center of transformation (in global-space) */
- float center2d[2]; /* center in screen coordinates */
+ /** numerical input. */
+ NumInput num;
+ /** mouse input. */
+ MouseInput mouse;
+ /** redraw flag. */
+ eRedrawFlag redraw;
+ /** proportional circle radius. */
+ float prop_size;
+ /** proportional falloff text. */
+ char proptext[20];
+ /**
+ * Spaces using non 1:1 aspect, (uv's, f-curve, movie-clip... etc)
+ * use for conversion and snapping.
+ */
+ float aspect[3];
+ /** center of transformation (in global-space) */
+ float center_global[3];
+ /** center in screen coordinates. */
+ float center2d[2];
/* Lazy initialize center data for when we need other center values.
* V3D_AROUND_ACTIVE + 1 (static assert checks this) */
TransCenterData center_cache[5];
- short idx_max; /* maximum index on the input vector */
- float snap[3]; /* Snapping Gears */
- float snap_spatial[3]; /* Spatial snapping gears(even when rotating, scaling... etc) */
- char frame_side; /* Mouse side of the cfra, 'L', 'R' or 'B' */
-
- float viewmat[4][4]; /* copy from G.vd, prevents feedback, */
- float viewinv[4][4]; /* and to make sure we don't have to */
- float persmat[4][4]; /* access G.vd from other space types */
+ /** maximum index on the input vector. */
+ short idx_max;
+ /** Snapping Gears. */
+ float snap[3];
+ /** Spatial snapping gears(even when rotating, scaling... etc). */
+ float snap_spatial[3];
+ /** Mouse side of the cfra, 'L', 'R' or 'B' */
+ char frame_side;
+
+ /** copy from G.vd, prevents feedback. */
+ float viewmat[4][4];
+ /** and to make sure we don't have to. */
+ float viewinv[4][4];
+ /** access G.vd from other space types. */
+ float persmat[4][4];
float persinv[4][4];
short persp;
short around;
- char spacetype; /* spacetype where transforming is */
- char helpline; /* Choice of custom cursor with or without a help line from the gizmo to the mouse position. */
- short obedit_type; /* Avoid looking inside TransDataContainer obedit. */
-
- float vec[3]; /* translation, to show for widget */
- float mat[3][3]; /* rot/rescale, to show for widget */
-
- float spacemtx[3][3]; /* orientation matrix of the current space */
- char spacename[64]; /* name of the current space, MAX_NAME */
+ /** spacetype where transforming is. */
+ char spacetype;
+ /** Choice of custom cursor with or without a help line from the gizmo to the mouse position. */
+ char helpline;
+ /** Avoid looking inside TransDataContainer obedit. */
+ short obedit_type;
+
+ /** translation, to show for widget. */
+ float vec[3];
+ /** rot/rescale, to show for widget. */
+ float mat[3][3];
+
+ /** orientation matrix of the current space. */
+ float spacemtx[3][3];
+ /** name of the current space, MAX_NAME. */
+ char spacename[64];
/*************** NEW STUFF *********************/
- short launch_event; /* event type used to launch transform */
+ /** event type used to launch transform. */
+ short launch_event;
struct {
+ /** Orientation type when when we're not constrained.
+ * nearly always global except for rotate which defaults to screen-space orientation. */
+ short unset;
+ /** Orientation to use when a key is pressed. */
short user;
/* Used when user is global. */
short user_alt;
short index;
short *types[2];
- /* this gets used when custom_orientation is V3D_MANIP_CUSTOM */
+ /* this gets used when custom_orientation is V3D_ORIENT_CUSTOM */
TransformOrientation *custom;
} orientation;
- short gizmo_flag; /* backup from view3d, to restore on end */
+ /** backup from view3d, to restore on end. */
+ short gizmo_flag;
short prop_mode;
- short mirror;
-
float values[4];
- float values_modal_offset[4]; /* Offset applied ontop of modal input. */
+ /** Offset applied ontop of modal input. */
+ float values_modal_offset[4];
float auto_values[4];
- float axis[3];
- float axis_orig[3]; /* TransCon can change 'axis', store the original value here */
- float axis_ortho[3];
- bool remove_on_cancel; /* remove elements if operator is canceled */
+ /* Axis members for modes that use an axis separate from the orientation (rotate & shear). */
+
+ /** Primary axis, rotate only uses this. */
+ int orient_axis;
+ /** Secondary axis, shear uses this. */
+ int orient_axis_ortho;
+
+ /** Often this matrix has similar usage to #TransInfo.spacemtx however this
+ * is used to define extra axes to operate on, not necessarily a space.
+ *
+ * For example, by default rotation operates on the view (`orient_matrix[2]`),
+ * even when the current space isn't set to the view. */
+ float orient_matrix[3][3];
+ /** Don't overwrite when set by operator redo defines the orientation axis. */
+ bool orient_matrix_is_set;
+
+ /** remove elements if operator is canceled. */
+ bool remove_on_cancel;
void *view;
- struct bContext *context; /* Only valid (non null) during an operator called function. */
+ /** Only valid (non null) during an operator called function. */
+ struct bContext *context;
struct ScrArea *sa;
struct ARegion *ar;
struct Depsgraph *depsgraph;
@@ -536,10 +661,14 @@ typedef struct TransInfo {
struct ViewLayer *view_layer;
struct ToolSettings *settings;
struct wmTimer *animtimer;
- struct wmKeyMap *keymap; /* so we can do lookups for header text */
- struct ReportList *reports; /* assign from the operator, or can be NULL */
- int mval[2]; /* current mouse position */
- float zfac; /* use for 3d view */
+ /** so we can do lookups for header text. */
+ struct wmKeyMap *keymap;
+ /** assign from the operator, or can be NULL. */
+ struct ReportList *reports;
+ /** current mouse position. */
+ int mval[2];
+ /** use for 3d view. */
+ float zfac;
void *draw_handle_apply;
void *draw_handle_view;
void *draw_handle_pixel;
@@ -556,75 +685,82 @@ typedef struct TransInfo {
/* ******************** Macros & Prototypes *********************** */
/* transinfo->state */
-#define TRANS_STARTING 0
-#define TRANS_RUNNING 1
-#define TRANS_CONFIRM 2
-#define TRANS_CANCEL 3
+enum {
+ TRANS_STARTING = 0,
+ TRANS_RUNNING = 1,
+ TRANS_CONFIRM = 2,
+ TRANS_CANCEL = 3,
+};
/* transinfo->flag */
-#define T_OBJECT (1 << 0)
-/** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
-#define T_EDIT (1 << 1)
-#define T_POSE (1 << 2)
-#define T_TEXTURE (1 << 3)
- /* transforming the camera while in camera view */
-#define T_CAMERA (1 << 4)
- /* transforming the 3D cursor. */
-#define T_CURSOR (1 << 5)
- // trans on points, having no rotation/scale
-#define T_POINTS (1 << 6)
-/**
- * Apply matrix #TransDataContainer.matrix, this avoids having to have duplicate check all over
- * that happen to apply to spesiifc modes (edit & pose for eg). */
-#define T_LOCAL_MATRIX (1 << 7)
+enum {
+ T_OBJECT = 1 << 0,
+ /** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
+ T_EDIT = 1 << 1,
+ T_POSE = 1 << 2,
+ T_TEXTURE = 1 << 3,
+ /** Transforming the camera while in camera view. */
+ T_CAMERA = 1 << 4,
+ /** Transforming the 3D cursor. */
+ T_CURSOR = 1 << 5,
+ /** Transform points, having no rotation/scale. */
+ T_POINTS = 1 << 6,
+ /**
+ * Apply matrix #TransDataContainer.matrix, this avoids having to have duplicate check all over
+ * that happen to apply to spesiifc modes (edit & pose for eg). */
+ T_LOCAL_MATRIX = 1 << 7,
- /* restrictions flags */
-#define T_ALL_RESTRICTIONS ((1 << 8)|(1 << 9)|(1 << 10))
-#define T_NO_CONSTRAINT (1 << 8)
-#define T_NULL_ONE (1 << 9)
-#define T_NO_ZERO (1 << 10)
+ /** restrictions flags */
+ T_NO_CONSTRAINT = 1 << 8,
+ T_NULL_ONE = 1 << 9,
+ T_NO_ZERO = 1 << 10,
+ T_ALL_RESTRICTIONS = T_NO_CONSTRAINT | T_NULL_ONE | T_NO_ZERO,
-#define T_PROP_EDIT (1 << 11)
-#define T_PROP_CONNECTED (1 << 12)
-#define T_PROP_PROJECTED (1 << 13)
-#define T_PROP_EDIT_ALL (T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED)
+ T_PROP_EDIT = 1 << 11,
+ T_PROP_CONNECTED = 1 << 12,
+ T_PROP_PROJECTED = 1 << 13,
+ T_PROP_EDIT_ALL = T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED,
-#define T_V3D_ALIGN (1 << 14)
- /* for 2d views like uv or ipo */
-#define T_2D_EDIT (1 << 15)
-#define T_CLIP_UV (1 << 16)
+ T_V3D_ALIGN = 1 << 14,
+ /** For 2d views like uv or fcurve. */
+ T_2D_EDIT = 1 << 15,
+ T_CLIP_UV = 1 << 16,
- /* auto-ik is on */
-#define T_AUTOIK (1 << 18)
+ /** Auto-ik is on. */
+ T_AUTOIK = 1 << 18,
-#define T_MIRROR (1 << 19)
+ /** Don't use mirror even if the data-block option is set. */
+ T_NO_MIRROR = 1 << 19,
-#define T_AUTOVALUES (1 << 20)
+ T_AUTOVALUES = 1 << 20,
- /* to specify if we save back settings at the end */
-#define T_MODAL (1 << 21)
+ /** To specify if we save back settings at the end. */
+ T_MODAL = 1 << 21,
- /* no retopo */
-#define T_NO_PROJECT (1 << 22)
+ /** No retopo. */
+ T_NO_PROJECT = 1 << 22,
-#define T_RELEASE_CONFIRM (1 << 23)
+ T_RELEASE_CONFIRM = 1 << 23,
- /* alternative transformation. used to add offset to tracking markers */
-#define T_ALT_TRANSFORM (1 << 24)
+ /** Alternative transformation. used to add offset to tracking markers. */
+ T_ALT_TRANSFORM = 1 << 24,
- /** #TransInfo.center has been set, don't change it. */
-#define T_OVERRIDE_CENTER (1 << 25)
+ /** #TransInfo.center has been set, don't change it. */
+ T_OVERRIDE_CENTER = 1 << 25,
-#define T_MODAL_CURSOR_SET (1 << 26)
+ T_MODAL_CURSOR_SET = 1 << 26,
-#define T_CLNOR_REBUILD (1 << 27)
+ T_CLNOR_REBUILD = 1 << 27,
+};
-/* TransInfo->modifiers */
-#define MOD_CONSTRAINT_SELECT 0x01
-#define MOD_PRECISION 0x02
-#define MOD_SNAP 0x04
-#define MOD_SNAP_INVERT 0x08
-#define MOD_CONSTRAINT_PLANE 0x10
+/** #TransInfo.modifiers */
+enum {
+ MOD_CONSTRAINT_SELECT = 1 << 0,
+ MOD_PRECISION = 1 << 1,
+ MOD_SNAP = 1 << 2,
+ MOD_SNAP_INVERT = 1 << 3,
+ MOD_CONSTRAINT_PLANE = 1 << 4,
+};
/* use node center for transform instead of upper-left corner.
* disabled since it makes absolute snapping not work so nicely
@@ -634,49 +770,74 @@ typedef struct TransInfo {
/* ******************************************************************************** */
-/* transinfo->helpline */
-#define HLP_NONE 0
-#define HLP_SPRING 1
-#define HLP_ANGLE 2
-#define HLP_HARROW 3
-#define HLP_VARROW 4
-#define HLP_CARROW 5
-#define HLP_TRACKBALL 6
-
-/* transinfo->con->mode */
-#define CON_APPLY 1
-#define CON_AXIS0 2
-#define CON_AXIS1 4
-#define CON_AXIS2 8
-#define CON_SELECT 16
-#define CON_NOFLIP 32 /* does not reorient vector to face viewport when on */
-#define CON_USER 64
-
-/* transdata->flag */
-#define TD_SELECTED 1
-#define TD_NOACTION (1 << 2)
-#define TD_USEQUAT (1 << 3)
-#define TD_NOTCONNECTED (1 << 4)
-#define TD_SINGLESIZE (1 << 5) /* used for scaling of MetaElem->rad */
-#define TD_INDIVIDUAL_SCALE (1 << 8) /* Scale relative to individual element center */
-#define TD_NOCENTER (1 << 9)
-#define TD_NO_EXT (1 << 10) /* ext abused for particle key timing */
-#define TD_SKIP (1 << 11) /* don't transform this data */
-#define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */
-#define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */
-#define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */
-#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
-#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */
-#define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */
-#define TD_MOVEHANDLE2 (1 << 18)
-#define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */
-#define TD_PBONE_LOCAL_MTX_C (1 << 20) /* same as above but for a child bone */
-
-/* transsnap->status */
-#define SNAP_FORCED 1
-#define TARGET_INIT 2
-#define POINT_INIT 4
-#define MULTI_POINTS 8
+/** #TransInfo.helpline */
+enum {
+ HLP_NONE = 0,
+ HLP_SPRING = 1,
+ HLP_ANGLE = 2,
+ HLP_HARROW = 3,
+ HLP_VARROW = 4,
+ HLP_CARROW = 5,
+ HLP_TRACKBALL = 6,
+};
+
+/** #TransCon.mode, #TransInfo.con.mode */
+enum {
+ /** When set constraints are in use. */
+ CON_APPLY = 1 << 0,
+ /** These are only used for modal execution. */
+ CON_AXIS0 = 1 << 1,
+ CON_AXIS1 = 1 << 2,
+ CON_AXIS2 = 1 << 3,
+ CON_SELECT = 1 << 4,
+ /** Does not reorient vector to face viewport when on. */
+ CON_NOFLIP = 1 << 5,
+ CON_USER = 1 << 6,
+};
+
+/** #TransData.flag */
+enum {
+ TD_SELECTED = 1 << 0,
+ TD_NOACTION = 1 << 2,
+ TD_USEQUAT = 1 << 3,
+ TD_NOTCONNECTED = 1 << 4,
+ /** Used for scaling of #MetaElem.rad */
+ TD_SINGLESIZE = 1 << 5,
+ /** Scale relative to individual element center */
+ TD_INDIVIDUAL_SCALE = 1 << 8,
+ TD_NOCENTER = 1 << 9,
+ /** #TransData.ext abused for particle key timing. */
+ TD_NO_EXT = 1 << 10,
+ /** don't transform this data */
+ TD_SKIP = 1 << 11,
+ /** if this is a bez triple, we need to restore the handles,
+ * if this is set #TransData.hdata needs freeing */
+ TD_BEZTRIPLE = 1 << 12,
+ /** when this is set, don't apply translation changes to this element */
+ TD_NO_LOC = 1 << 13,
+ /** for Graph Editor autosnap, indicates that point should not undergo autosnapping */
+ TD_NOTIMESNAP = 1 << 14,
+ /** for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
+ TD_INTVALUES = 1 << 15,
+ /** For editmode mirror, clamp to x = 0 */
+ TD_MIRROR_EDGE = 1 << 16,
+ /** For fcurve handles, move them along with their keyframes */
+ TD_MOVEHANDLE1 = 1 << 17,
+ TD_MOVEHANDLE2 = 1 << 18,
+ /** Exceptional case with pose bone rotating when a parent bone has 'Local Location'
+ * option enabled and rotating also transforms it. */
+ TD_PBONE_LOCAL_MTX_P = 1 << 19,
+ /** Same as above but for a child bone. */
+ TD_PBONE_LOCAL_MTX_C = 1 << 20,
+};
+
+/** #TransSnap.status */
+enum {
+ SNAP_FORCED = 1 << 0,
+ TARGET_INIT = 1 << 1,
+ POINT_INIT = 1 << 2,
+ MULTI_POINTS = 1 << 3,
+};
/* Hard min/max for proportional size. */
#define T_PROP_SIZE_MIN 1e-6f
@@ -705,7 +866,6 @@ struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf);
/*********************** transform_conversions.c ********** */
-struct ListBase;
void flushTransIntFrameActionData(TransInfo *t);
void flushTransGraphData(TransInfo *t);
@@ -764,7 +924,8 @@ void constraintNumInput(TransInfo *t, float vec[3]);
bool isLockConstraint(TransInfo *t);
int getConstraintSpaceDimension(TransInfo *t);
-char constraintModeToChar(TransInfo *t);
+int constraintModeToIndex(const TransInfo *t);
+char constraintModeToChar(const TransInfo *t);
void startConstraint(TransInfo *t);
void stopConstraint(TransInfo *t);
@@ -780,7 +941,7 @@ void setNearestAxis(TransInfo *t);
typedef enum {
NO_GEARS = 0,
BIG_GEARS = 1,
- SMALL_GEARS = 2
+ SMALL_GEARS = 2,
} GearsType;
bool transformModeUseSnap(const TransInfo *t);
@@ -887,11 +1048,13 @@ struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3],
const char *name, const bool overwrite);
bool applyTransformOrientation(const struct TransformOrientation *ts, float r_mat[3][3], char r_name[64]);
-#define ORIENTATION_NONE 0
-#define ORIENTATION_NORMAL 1
-#define ORIENTATION_VERT 2
-#define ORIENTATION_EDGE 3
-#define ORIENTATION_FACE 4
+enum {
+ ORIENTATION_NONE = 0,
+ ORIENTATION_NORMAL = 1,
+ ORIENTATION_VERT = 2,
+ ORIENTATION_EDGE = 3,
+ ORIENTATION_FACE = 4,
+};
#define ORIENTATION_USE_PLANE(ty) \
ELEM(ty, ORIENTATION_NORMAL, ORIENTATION_EDGE, ORIENTATION_FACE)
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index fe997b77a31..4bed5a3f05c 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_constraints.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -176,7 +168,7 @@ static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3])
{
if (t->spacetype == SPACE_VIEW3D) {
// View3D *v3d = t->sa->spacedata.first;
- const float min_dist = 1.0f; /* v3d->near; */
+ const float min_dist = 1.0f; /* v3d->clip_start; */
float dir[3];
float l;
@@ -333,7 +325,6 @@ static void planeProjection(const TransInfo *t, const float in[3], float out[3])
* The IN vector in projected into the constrained space and then further
* projected along the view vector.
* (in perspective mode, the view vector is relative to the position on screen)
- *
*/
static void applyAxisConstraintVec(
@@ -668,7 +659,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
char text[256];
switch (orientation) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
{
float mtx[3][3];
BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
@@ -676,11 +667,11 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
setConstraint(t, mtx, mode, text);
break;
}
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
setLocalConstraint(t, mode, text);
break;
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
if (checkUseAxisMatrix(t)) {
setAxisMatrixConstraint(t, mode, text);
@@ -689,23 +680,23 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
setConstraint(t, t->spacemtx, mode, text);
}
break;
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("cursor"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CUSTOM_MATRIX:
+ case V3D_ORIENT_CUSTOM_MATRIX:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
{
char orientation_str[128];
BLI_snprintf(orientation_str, sizeof(orientation_str), "%s \"%s\"",
@@ -814,7 +805,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_IMAGE) {
GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]);
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {
/* only scale y */
rcti *mask = &t->ar->v2d.mask;
rctf *datamask = &t->ar->v2d.cur;
@@ -1101,26 +1092,35 @@ void setNearestAxis(TransInfo *t)
/*-------------- HELPER FUNCTIONS ----------------*/
-char constraintModeToChar(TransInfo *t)
+int constraintModeToIndex(const TransInfo *t)
{
if ((t->con.mode & CON_APPLY) == 0) {
- return '\0';
+ return -1;
}
switch (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) {
case (CON_AXIS0):
case (CON_AXIS1 | CON_AXIS2):
- return 'X';
+ return 0;
case (CON_AXIS1):
case (CON_AXIS0 | CON_AXIS2):
- return 'Y';
+ return 1;
case (CON_AXIS2):
case (CON_AXIS0 | CON_AXIS1):
- return 'Z';
+ return 2;
default:
- return '\0';
+ return -1;
}
}
+char constraintModeToChar(const TransInfo *t)
+{
+ int index = constraintModeToIndex(t);
+ if (index == -1) {
+ return '\0';
+ }
+ BLI_assert((uint)index < 3);
+ return 'X' + index;
+}
bool isLockConstraint(TransInfo *t)
{
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 79e223ca700..f4419dbe758 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_conversions.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -414,15 +406,39 @@ static void createTransCursor_view3d(TransInfo *t)
td->ob = NULL;
unit_m3(td->mtx);
- quat_to_mat3(td->axismtx, cursor->rotation);
+ BKE_scene_cursor_rot_to_mat3(cursor, td->axismtx);
normalize_m3(td->axismtx);
pseudoinverse_m3_m3(td->smtx, td->mtx, PSEUDOINVERSE_EPSILON);
td->loc = cursor->location;
copy_v3_v3(td->iloc, cursor->location);
- td->ext->quat = cursor->rotation;
- copy_qt_qt(td->ext->iquat, cursor->rotation);
+ if (cursor->rotation_mode > 0) {
+ td->ext->rot = cursor->rotation_euler;
+ td->ext->rotAxis = NULL;
+ td->ext->rotAngle = NULL;
+ td->ext->quat = NULL;
+
+ copy_v3_v3(td->ext->irot, cursor->rotation_euler);
+ }
+ else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
+ td->ext->rot = NULL;
+ td->ext->rotAxis = cursor->rotation_axis;
+ td->ext->rotAngle = &cursor->rotation_angle;
+ td->ext->quat = NULL;
+
+ td->ext->irotAngle = cursor->rotation_angle;
+ copy_v3_v3(td->ext->irotAxis, cursor->rotation_axis);
+ }
+ else {
+ td->ext->rot = NULL;
+ td->ext->rotAxis = NULL;
+ td->ext->rotAngle = NULL;
+ td->ext->quat = cursor->rotation_quaternion;
+
+ copy_qt_qt(td->ext->iquat, cursor->rotation_quaternion);
+ }
+ td->ext->rotOrder = cursor->rotation_mode;
}
/** \} */
@@ -998,14 +1014,16 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data = con->data;
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) {
- /* make reference to constraint to base things off later (if it's the last targetless constraint encountered) */
+ /* make reference to constraint to base things off later
+ * (if it's the last targetless constraint encountered) */
targetless = (bKinematicConstraint *)con->data;
/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
if (con->enforce != 0.0f) {
data->flag |= CONSTRAINT_IK_AUTO;
- /* if no chain length has been specified, just make things obey standard rotation locks too */
+ /* if no chain length has been specified,
+ * just make things obey standard rotation locks too */
if (data->rootbone == 0) {
for (; pchan; pchan = pchan->parent) {
/* here, we set ik-settings for bone from pchan->protectflag */
@@ -1026,7 +1044,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
}
con = BKE_constraint_add_for_pose(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
- pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
+
+ /* for draw, but also for detecting while pose solving */
+ pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET);
+
data = con->data;
if (targetless) {
/* if exists, use values from last targetless (but disabled) IK-constraint as base */
@@ -1036,7 +1057,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data->flag = CONSTRAINT_IK_TIP;
data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
- data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
+
+ /* watch-it! has to be 0 here, since we're still on the
+ * same bone for the first time through the loop T25885. */
+ data->rootbone = 0;
/* we only include bones that are part of a continual connected chain */
do {
@@ -1097,7 +1121,8 @@ static short pose_grab_with_ik(Main *bmain, Object *ob)
arm = ob->data;
- /* Rule: allow multiple Bones (but they must be selected, and only one ik-solver per chain should get added) */
+ /* Rule: allow multiple Bones
+ * (but they must be selected, and only one ik-solver per chain should get added) */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & arm->layer) {
if (pchan->bone->flag & BONE_SELECTED) {
@@ -1163,22 +1188,28 @@ static void createTransPose(TransInfo *t)
continue;
}
+ /* set flags and count total */
+ tc->data_len = count_set_pose_transflags(ob, t->mode, t->around, has_translate_rotate);
+ if (tc->data_len == 0) {
+ continue;
+ }
+
if (arm->flag & ARM_RESTPOS) {
if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE) == 0) {
BKE_report(t->reports, RPT_ERROR, "Cannot change Pose when 'Rest Position' is enabled");
- return;
+ tc->data_len = 0;
+ continue;
}
}
/* do we need to add temporal IK chains? */
if ((arm->flag & ARM_AUTO_IK) && t->mode == TFM_TRANSLATION) {
ik_on = pose_grab_with_ik(bmain, ob);
- if (ik_on) t->flag |= T_AUTOIK;
+ if (ik_on) {
+ t->flag |= T_AUTOIK;
+ has_translate_rotate[0] = true;
+ }
}
-
- /* set flags and count total (warning, can change transform to rotate) */
- tc->data_len = count_set_pose_transflags(ob, t->mode, t->around, has_translate_rotate);
- /* len may be zero, skip next iteration. */
}
/* if there are no translatable bones, do rotation */
@@ -1851,7 +1882,8 @@ static void createTransCurveVerts(TransInfo *t)
else td->flag = 0;
td->ext = NULL;
- if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
+ /* TODO - make points scale */
+ if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/
td->val = &(bezt->radius);
td->ival = bezt->radius;
}
@@ -1871,7 +1903,8 @@ static void createTransCurveVerts(TransInfo *t)
if ((bezt_tx & SEL_F1) == 0 && (bezt_tx & SEL_F3) == 0)
/* If the middle is selected but the sides arnt, this is needed */
- if (hdata == NULL) { /* if the handle was not saved by the previous handle */
+ if (hdata == NULL) {
+ /* if the handle was not saved by the previous handle */
hdata = initTransDataCurveHandles(td, bezt);
}
@@ -1895,7 +1928,8 @@ static void createTransCurveVerts(TransInfo *t)
td->ext = NULL;
td->val = NULL;
- if (hdata == NULL) { /* if the handle was not saved by the previous handle */
+ if (hdata == NULL) {
+ /* if the handle was not saved by the previous handle */
hdata = initTransDataCurveHandles(td, bezt);
}
@@ -1922,7 +1956,8 @@ static void createTransCurveVerts(TransInfo *t)
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
* but for now just don't change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT, TFM_DUMMY) == 0) {
- /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ /* sets the handles based on their selection,
+ * do this after the data is copied to the TransData */
BKE_nurb_handles_test(nu, !hide_handles);
}
}
@@ -2069,7 +2104,6 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
ParticleEditSettings *pset = PE_settings(t->scene);
PTCacheEdit *edit = PE_get_current(t->scene, ob);
ParticleSystem *psys = NULL;
- ParticleSystemModifierData *psmd = NULL;
PTCacheEditPoint *point;
PTCacheEditKey *key;
float mat[4][4];
@@ -2081,9 +2115,6 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
psys = edit->psys;
- if (psys)
- psmd = psys_get_modifier(ob, psys);
-
for (i = 0, point = edit->points; i < edit->totpoint; i++, point++) {
point->flag &= ~PEP_TRANSFORM;
transformparticle = 0;
@@ -2128,8 +2159,10 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
if (!(point->flag & PEP_TRANSFORM)) continue;
- if (psys && !(psys->flag & PSYS_GLOBAL_HAIR))
- psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles + i, mat);
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
+ psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
+ }
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
if (key->flag & PEK_USE_WCO) {
@@ -2188,7 +2221,6 @@ void flushTransParticles(TransInfo *t)
Object *ob = OBACT(view_layer);
PTCacheEdit *edit = PE_get_current(scene, ob);
ParticleSystem *psys = edit->psys;
- ParticleSystemModifierData *psmd = NULL;
PTCacheEditPoint *point;
PTCacheEditKey *key;
TransData *td;
@@ -2196,9 +2228,6 @@ void flushTransParticles(TransInfo *t)
int i, k;
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
- if (psys)
- psmd = psys_get_modifier(ob, psys);
-
/* we do transform in world space, so flush world space position
* back to particle local space (only for hair particles) */
td = tc->data;
@@ -2206,7 +2235,8 @@ void flushTransParticles(TransInfo *t)
if (!(point->flag & PEP_TRANSFORM)) continue;
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
- psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles + i, mat);
+ ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
+ psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
invert_m4_m4(imat, mat);
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
@@ -2226,6 +2256,7 @@ void flushTransParticles(TransInfo *t)
}
PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1);
+ DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
}
}
@@ -2450,7 +2481,8 @@ static struct TransIslandData *editmesh_islands_info_calc(
vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__);
/* we shouldn't need this, but with incorrect selection flushing
- * its possible we have a selected vertex that's not in a face, for now best not crash in that case. */
+ * its possible we have a selected vertex that's not in a face,
+ * for now best not crash in that case. */
copy_vn_i(vert_map, bm->totvert, -1);
BM_mesh_elem_table_ensure(bm, htype);
@@ -2662,10 +2694,12 @@ static void createTransEditVerts(TransInfo *t)
int island_info_tot;
int *island_vert_map = NULL;
- /* Snap rotation along normal needs a common axis for whole islands, otherwise one get random crazy results,
- * see T59104. However, we do not want to use the island center for the pivot/translation reference... */
+ /* Snap rotation along normal needs a common axis for whole islands,
+ * otherwise one get random crazy results, see T59104.
+ * However, we do not want to use the island center for the pivot/translation reference. */
const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) &&
- /* There is not guarantee that snapping is initialized yet at this point... */
+ /* There is not guarantee that snapping
+ * is initialized yet at this point... */
(usingSnappingNormal(t) || (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) &&
(t->around != V3D_AROUND_LOCAL_ORIGINS));
/* Even for translation this is needed because of island-orientation, see: T51651. */
@@ -2674,12 +2708,9 @@ static void createTransEditVerts(TransInfo *t)
* Optional, allocate if needed. */
int *dists_index = NULL;
- if (t->flag & T_MIRROR) {
- /* TODO(campbell): xform: We need support for many mirror objects at once! */
- if (tc->is_active) {
- EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology);
- mirror = 1;
- }
+ if (tc->mirror.axis_flag) {
+ EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology);
+ mirror = 1;
}
/**
@@ -2789,7 +2820,7 @@ static void createTransEditVerts(TransInfo *t)
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->co[0] != 0.0f) {
if (eve->co[0] < 0.0f) {
- t->mirror = -1;
+ tc->mirror.sign = -1.0f;
mirror = -1;
}
break;
@@ -2893,7 +2924,7 @@ cleanup:
if (dists_index)
MEM_freeN(dists_index);
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
EDBM_verts_mirror_cache_end(em);
}
}
@@ -2967,7 +2998,8 @@ BLI_INLINE void trans_update_seq(Scene *sce, Sequence *seq, int old_start, int s
void flushTransSeq(TransInfo *t)
{
- ListBase *seqbasep = BKE_sequencer_editing_get(t->scene, false)->seqbasep; /* Editing null check already done */
+ /* Editing null check already done */
+ ListBase *seqbasep = BKE_sequencer_editing_get(t->scene, false)->seqbasep;
int a, new_frame;
TransData *td = NULL;
@@ -2994,11 +3026,15 @@ void flushTransSeq(TransInfo *t)
switch (tdsq->sel_flag) {
case SELECT:
#ifdef SEQ_TX_NESTED_METAS
- if ((seq->depth != 0 || BKE_sequence_tx_test(seq))) /* for meta's, their children move */
+ if ((seq->depth != 0 || BKE_sequence_tx_test(seq))) {
+ /* for meta's, their children move */
seq->start = new_frame - tdsq->start_offset;
+ }
#else
- if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
+ if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) {
+ /* for meta's, their children move */
seq->start = new_frame - tdsq->start_offset;
+ }
#endif
if (seq->depth == 0) {
seq->machine = round_fl_to_int(td2d->loc[1]);
@@ -3008,12 +3044,16 @@ void flushTransSeq(TransInfo *t)
case SEQ_LEFTSEL: /* no vertical transform */
BKE_sequence_tx_set_final_left(seq, new_frame);
BKE_sequence_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
- BKE_sequence_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+
+ /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+ BKE_sequence_single_fix(seq);
break;
case SEQ_RIGHTSEL: /* no vertical transform */
BKE_sequence_tx_set_final_right(seq, new_frame);
BKE_sequence_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
- BKE_sequence_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+
+ /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+ BKE_sequence_single_fix(seq);
break;
}
@@ -3040,8 +3080,8 @@ void flushTransSeq(TransInfo *t)
trans_update_seq(t->scene, seq_prev, old_start_prev, sel_flag_prev);
}
-
- if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) { /* originally TFM_TIME_EXTEND, transform changes */
+ /* originally TFM_TIME_EXTEND, transform changes */
+ if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) {
/* Special annoying case here, need to calc metas with TFM_TIME_EXTEND only */
/* calc all meta's then effects [#27953] */
@@ -3299,7 +3339,8 @@ finally:
void flushTransUVs(TransInfo *t)
{
SpaceImage *sima = t->sa->spacedata.first;
- const bool use_pixel_snap = ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL));
+ const bool use_pixel_snap = ((sima->pixel_snap_mode != SI_PIXEL_SNAP_DISABLED) &&
+ (t->state != TRANS_CANCEL));
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData2D *td;
@@ -3322,8 +3363,22 @@ void flushTransUVs(TransInfo *t)
td->loc2d[1] = td->loc[1] * aspect_inv[1];
if (use_pixel_snap) {
- td->loc2d[0] = roundf(td->loc2d[0] * size[0]) / size[0];
- td->loc2d[1] = roundf(td->loc2d[1] * size[1]) / size[1];
+ td->loc2d[0] *= size[0];
+ td->loc2d[1] *= size[1];
+
+ switch (sima->pixel_snap_mode) {
+ case SI_PIXEL_SNAP_CENTER:
+ td->loc2d[0] = roundf(td->loc2d[0] - 0.5f) + 0.5f;
+ td->loc2d[1] = roundf(td->loc2d[1] - 0.5f) + 0.5f;
+ break;
+ case SI_PIXEL_SNAP_CORNER:
+ td->loc2d[0] = roundf(td->loc2d[0]);
+ td->loc2d[1] = roundf(td->loc2d[1]);
+ break;
+ }
+
+ td->loc2d[0] /= size[0];
+ td->loc2d[1] /= size[1];
}
}
}
@@ -3573,7 +3628,8 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td++;
}
if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) {
- /* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
+ /* if tdn is already holding the start handle,
+ * then we're doing both, otherwise, only end */
tdn->handle = (tdn->handle) ? 2 : 1;
/* now, link the transform data up to this data */
@@ -3992,7 +4048,8 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* only add selected keyframes (for now, proportional edit is not enabled) */
- if (is_prop_edit || (bezt->f2 & SELECT)) { /* note this MUST match count_fcurve_keys(), so can't use BEZT_ISSEL_ANY() macro */
+ if (is_prop_edit || (bezt->f2 & SELECT)) { /* note this MUST match count_fcurve_keys(),
+ * so can't use BEZT_ISSEL_ANY() macro */
/* only add if on the right 'side' of the current frame */
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
TimeToTransData(td, bezt->vec[1], adt, ypos);
@@ -4476,7 +4533,7 @@ static void graph_key_shortest_dist(TransInfo *t, FCurve *fcu, TransData *td_sta
static void createTransGraphEditData(bContext *C, TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
Scene *scene = t->scene;
ARegion *ar = t->ar;
View2D *v2d = &ar->v2d;
@@ -4645,7 +4702,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, anim_map_flag, &offset);
- /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
+ /* only include BezTriples whose 'keyframe' occurs on the same side
+ * of the current frame as mouse (if applicable) */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
const bool sel2 = (bezt->f2 & SELECT) != 0;
@@ -4749,7 +4807,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
else
cfra = (float)CFRA;
- /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
+ /* only include BezTriples whose 'keyframe' occurs on the
+ * same side of the current frame as mouse (if applicable) */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
const bool sel2 = (bezt->f2 & SELECT) != 0;
@@ -4963,7 +5022,7 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
*/
void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
bAnimListElem *ale;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
@@ -4997,7 +5056,7 @@ void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
*/
void flushTransGraphData(TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
TransData *td;
TransData2D *td2d;
TransDataGraph *tdg;
@@ -5012,7 +5071,9 @@ void flushTransGraphData(TransInfo *t)
a < tc->data_len;
a++, td++, td2d++, tdg++)
{
- AnimData *adt = (AnimData *)td->extra; /* pointers to relevant AnimData blocks are stored in the td->extra pointers */
+ /* pointers to relevant AnimData blocks are stored in the td->extra pointers */
+ AnimData *adt = (AnimData *)td->extra;
+
float inv_unit_scale = 1.0f / tdg->unit_scale;
/* handle snapping for time values
@@ -5060,7 +5121,7 @@ void flushTransGraphData(TransInfo *t)
break;
case SACTSNAP_TSTEP: /* second step */
- /* XXX: the handle behaviour in this case is still not quite right... */
+ /* XXX: the handle behavior in this case is still not quite right... */
td2d->loc[0] = floor(((double)td2d->loc[0] / secf) + 0.5) * secf;
td->loc[0] = floor(((double)td->loc[0] / secf) + 0.5) * secf;
break;
@@ -5432,8 +5493,8 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c
}
}
else {
- /* Tag seq with a non zero value,
- * used by BKE_sequence_base_shuffle_time to identify the ones to shuffle */
+ /* Tag seq with a non zero value, used by
+ * BKE_sequence_base_shuffle_time to identify the ones to shuffle */
if (seq->depth == 0) {
seq->tmp = (void *)1;
}
@@ -5705,7 +5766,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
float rot[3][3], scale[3];
float ctime = BKE_scene_frame_get(scene);
- /* only use rigid body transform if simulation is running, avoids problems with initial setup of rigid bodies */
+ /* only use rigid body transform if simulation is running,
+ * avoids problems with initial setup of rigid bodies */
if (BKE_rigidbody_check_sim_running(scene->rigidbody_world, ctime)) {
/* save original object transform */
@@ -5745,13 +5807,34 @@ 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
+ * 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
+ * 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) {
- ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */
- BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
- ob->transflag &= ~OB_NO_CONSTRAINTS;
+ object_eval->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc checks this */
+ /* It is possiblre 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);
+ BKE_object_where_is_calc(t->depsgraph, t->scene, object_eval);
+ object_eval->transflag &= ~OB_NO_CONSTRAINTS;
}
- else
- BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
+ else {
+ BKE_object_where_is_calc(t->depsgraph, t->scene, object_eval);
+ }
+ /* 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
+ * 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;
+ ob->transflag |= (object_eval->transflag & OB_NEG_SCALE);
td->ob = ob;
@@ -5789,8 +5872,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
td->ext->rotOrder = ob->rotmode;
- td->ext->size = ob->size;
- copy_v3_v3(td->ext->isize, ob->size);
+ td->ext->size = ob->scale;
+ copy_v3_v3(td->ext->isize, ob->scale);
copy_v3_v3(td->ext->dscale, ob->dscale);
copy_v3_v3(td->center, ob->obmat[3]);
@@ -5875,7 +5958,7 @@ static void set_trans_object_base_flags(TransInfo *t)
/* Traverse all bases and set all possible flags. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
base->flag_legacy &= ~BA_WAS_SEL;
- if (TESTBASELIB_BGMODE(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
Object *ob = base->object;
Object *parsel = ob->parent;
/* If parent selected, deselect. */
@@ -5883,7 +5966,7 @@ static void set_trans_object_base_flags(TransInfo *t)
if (parsel->base_flag & BASE_SELECTED) {
Base *parbase = BKE_view_layer_base_find(view_layer, parsel);
if (parbase != NULL) { /* in rare cases this can fail */
- if (TESTBASELIB_BGMODE(v3d, parbase)) {
+ if (BASE_SELECTED_EDITABLE(v3d, parbase)) {
break;
}
}
@@ -5941,7 +6024,7 @@ static int count_proportional_objects(TransInfo *t)
{
/* Mark all parents. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (TESTBASELIB_BGMODE(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
Object *parent = base->object->parent;
/* flag all parents */
while (parent != NULL) {
@@ -5955,7 +6038,7 @@ static int count_proportional_objects(TransInfo *t)
/* all base not already selected or marked that is editable */
if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, base)))
+ (BASE_EDITABLE(v3d, base)))
{
mark_children(base->object);
}
@@ -5969,7 +6052,7 @@ static int count_proportional_objects(TransInfo *t)
*/
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, base)))
+ (BASE_EDITABLE(v3d, base)))
{
flush_trans_object_base_deps_flag(depsgraph, ob);
total += 1;
@@ -6379,7 +6462,7 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t)
char hflag;
bool has_face_sel = (bm->totfacesel != 0);
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
TransData *td;
int i;
@@ -6553,9 +6636,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
FCurve *fcu = (FCurve *)ale->key_data;
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)) )
@@ -6584,9 +6669,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed.
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these.
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6597,9 +6684,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
else if (ac.datatype == ANIMCONT_GPENCIL) {
/* remove duplicate frames and also make sure points are in order! */
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6663,8 +6752,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
bAnimContext ac;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
@@ -6685,9 +6774,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
FCurve *fcu = (FCurve *)ale->key_data;
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((sipo->flag & SIPO_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6759,7 +6850,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
else if (t->flag & T_POSE && (t->mode == TFM_BONESIZE)) {
/* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be
- * in pose mode (to use bone orientation matrix), in that case we don't do operations like autokeyframing. */
+ * in pose mode (to use bone orientation matrix),
+ * in that case we don't do operations like autokeyframing. */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
ob = tc->poseobj;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -6804,7 +6896,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (t->mode == TFM_TRANSLATION)
pose_grab_with_ik_clear(bmain, ob);
- /* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */
+ /* automatic inserting of keys and unkeyed tagging -
+ * only if transform wasn't canceled (or TFM_DUMMY) */
if (!canceled && (t->mode != TFM_DUMMY)) {
autokeyframe_pose(C, t->scene, ob, t->mode, targetless_ik);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -6869,8 +6962,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR);
for (pid = pidlist.first; pid; pid = pid->next) {
- if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ if (pid->type != PTCACHE_TYPE_PARTICLES) {
+ /* particles don't need reset on geometry change */
pid->cache->flag |= PTCACHE_OUTDATED;
+ }
}
BLI_freelistN(&pidlist);
@@ -6916,7 +7011,7 @@ int special_transform_moving(TransInfo *t)
if (t->spacetype == SPACE_SEQ) {
return G_TRANSFORM_SEQ;
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
return G_TRANSFORM_FCURVES;
}
else if ((t->flag & T_EDIT) || (t->flag & T_POSE)) {
@@ -6940,7 +7035,7 @@ static void createTransObject(bContext *C, TransInfo *t)
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
/* count */
- tc->data_len = CTX_DATA_COUNT(C, selected_objects);
+ tc->data_len = CTX_DATA_COUNT(C, selected_bases);
if (!tc->data_len) {
/* clear here, main transform function escapes too */
@@ -6989,10 +7084,11 @@ static void createTransObject(bContext *C, TransInfo *t)
for (base = view_layer->object_bases.first; base; base = base->next) {
Object *ob = base->object;
- /* if base is not selected, not a parent of selection or not a child of selection and it is editable */
+ /* if base is not selected, not a parent of selection
+ * or not a child of selection and it is editable */
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- BASE_EDITABLE_BGMODE(v3d, base))
+ BASE_EDITABLE(v3d, base))
{
td->protectflag = ob->protectflag;
td->ext = tx;
@@ -8450,9 +8546,10 @@ static void createTransGPencil(bContext *C, TransInfo *t)
if (point_ok) {
copy_v3_v3(td->iloc, &pt->x);
/* only copy center in local origins.
- * This allows get interesting effects also when move using proportional editing */
+ * This allows get interesting effects also when move
+ * using proportional editing */
if ((gps->flag & GP_STROKE_SELECT) &&
- (ts->transform_pivot_point == V3D_AROUND_LOCAL_ORIGINS))
+ (ts->transform_pivot_point == V3D_AROUND_LOCAL_ORIGINS))
{
copy_v3_v3(td->center, center);
}
@@ -8492,7 +8589,8 @@ static void createTransGPencil(bContext *C, TransInfo *t)
copy_m3_m4(td->mtx, diff_mat); /* display position */
copy_m3_m4(td->axismtx, diff_mat); /* axis orientation */
- /* Triangulation must be calculated again, so save the stroke for recalc function */
+ /* Triangulation must be calculated again,
+ * so save the stroke for recalc function */
td->extra = gps;
/* save pointer to object */
@@ -8550,6 +8648,7 @@ void createTransData(bContext *C, TransInfo *t)
ViewLayer *view_layer = t->view_layer;
Object *ob = OBACT(view_layer);
+ bool has_transform_context = true;
t->data_len_all = -1;
/* if tests must match recalcData for correct updates */
@@ -8591,7 +8690,7 @@ void createTransData(bContext *C, TransInfo *t)
}
else if (t->options & CTX_GPENCIL_STROKES) {
t->options |= CTX_GPENCIL_STROKES;
- t->flag |= T_POINTS;
+ t->flag |= T_POINTS | T_EDIT;
initTransDataContainers_FromObjectData(t, ob, NULL, 0);
createTransGPencil(C, t);
@@ -8622,6 +8721,9 @@ void createTransData(bContext *C, TransInfo *t)
createTransPaintCurveVerts(C, t);
countAndCleanTransDataContainer(t);
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->obedit_type == OB_MESH) {
@@ -8637,6 +8739,9 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->spacetype == SPACE_ACTION) {
t->flag |= T_POINTS | T_2D_EDIT;
@@ -8647,7 +8752,8 @@ void createTransData(bContext *C, TransInfo *t)
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
- //set_prop_dist(t, false); /* don't do that, distance has been set in createTransActionData already */
+ /* don't do that, distance has been set in createTransActionData already */
+ //set_prop_dist(t, false);
sort_trans_data_dist(t);
}
}
@@ -8662,11 +8768,11 @@ void createTransData(bContext *C, TransInfo *t)
t->flag |= T_POINTS | T_2D_EDIT;
t->obedit_type = -1;
- t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point transformations */
+ t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point trasnform */
createTransSeqData(C, t);
countAndCleanTransDataContainer(t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
t->flag |= T_POINTS | T_2D_EDIT;
t->obedit_type = -1;
@@ -8674,8 +8780,12 @@ void createTransData(bContext *C, TransInfo *t)
countAndCleanTransDataContainer(t);
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, false); /* don't do that, distance has been set in createTransGraphEditData already */
+ /* makes selected become first in array */
+ sort_trans_data(t);
+
+ /* don't do that, distance has been set in createTransGraphEditData already */
+ set_prop_dist(t, false);
+
sort_trans_data_dist(t);
}
}
@@ -8711,6 +8821,9 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->obedit_type != -1) {
/* Multi object editing. */
@@ -8785,6 +8898,7 @@ void createTransData(bContext *C, TransInfo *t)
else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && !(t->options & CTX_PAINT_CURVE)) {
/* important that ob_armature can be set even when its not selected [#23412]
* lines below just check is also visible */
+ has_transform_context = false;
Object *ob_armature = modifiers_isDeformedByArmature(ob);
if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature);
@@ -8797,13 +8911,10 @@ void createTransData(bContext *C, TransInfo *t)
initTransDataContainers_FromObjectData(t, ob_armature, objects, objects_len);
createTransPose(t);
countAndCleanTransDataContainer(t);
+ has_transform_context = true;
}
}
}
- /* Mark as initialized if above checks fail. */
- if (t->data_len_all == -1) {
- t->data_len_all = 0;
- }
}
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
createTransParticleVerts(C, t);
@@ -8822,9 +8933,8 @@ void createTransData(bContext *C, TransInfo *t)
createTransPaintCurveVerts(C, t);
countAndCleanTransDataContainer(t);
}
- /* Mark as initialized if above checks fail. */
- if (t->data_len_all == -1) {
- t->data_len_all = 0;
+ else {
+ has_transform_context = false;
}
}
else {
@@ -8852,7 +8962,13 @@ void createTransData(bContext *C, TransInfo *t)
}
/* Check that 'countAndCleanTransDataContainer' ran. */
- BLI_assert(t->data_len_all != -1);
+ if (has_transform_context) {
+ BLI_assert(t->data_len_all != -1);
+ }
+ else {
+ BLI_assert(t->data_len_all == -1);
+ t->data_len_all = 0;
+ }
BLI_assert((!(t->flag & T_EDIT)) == (!(t->obedit_type != -1)));
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index f1dc5525dbc..93bfb7261a8 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_generics.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -237,27 +229,29 @@ static void clipMirrorModifier(TransInfo *t)
static void editbmesh_apply_to_mirror(TransInfo *t)
{
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
- TransData *td = tc->data;
- BMVert *eve;
- int i;
+ if (tc->mirror.axis_flag) {
+ TransData *td = tc->data;
+ BMVert *eve;
+ int i;
- for (i = 0; i < tc->data_len; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
- if (td->loc == NULL)
- break;
- if (td->flag & TD_SKIP)
- continue;
-
- eve = td->extra;
- if (eve) {
- eve->co[0] = -td->loc[0];
- eve->co[1] = td->loc[1];
- eve->co[2] = td->loc[2];
- }
+ for (i = 0; i < tc->data_len; i++, td++) {
+ if (td->flag & TD_NOACTION)
+ break;
+ if (td->loc == NULL)
+ break;
+ if (td->flag & TD_SKIP)
+ continue;
- if (td->flag & TD_MIRROR_EDGE) {
- td->loc[0] = 0;
+ eve = td->extra;
+ if (eve) {
+ eve->co[0] = -td->loc[0];
+ eve->co[1] = td->loc[1];
+ eve->co[2] = td->loc[2];
+ }
+
+ if (td->flag & TD_MIRROR_EDGE) {
+ td->loc[0] = 0;
+ }
}
}
}
@@ -278,7 +272,8 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
* - the option to add new actions for each round is not enabled
*/
if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL) == 0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
- /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
+ /* if playback has just looped around,
+ * we need to add a new NLA track+strip to allow a clean pass to occur */
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
AnimData *adt = BKE_animdata_from_id(id);
const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
@@ -403,7 +398,7 @@ static void recalcData_actedit(TransInfo *t)
/* helper for recalcData() - for Graph Editor transforms */
static void recalcData_graphedit(TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
ViewLayer *view_layer = t->view_layer;
ListBase anim_data = {NULL, NULL};
@@ -571,7 +566,8 @@ static void recalcData_nla(TransInfo *t)
if (t->state != TRANS_CANCEL) {
switch (snla->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
- case SACTSNAP_STEP: /* frame step - this is basically the same, since we don't have any remapping going on */
+ case SACTSNAP_STEP: /* frame step - this is basically the same,
+ * since we don't have any remapping going on */
{
tdn->h1[0] = floorf(tdn->h1[0] + 0.5f);
tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
@@ -579,7 +575,8 @@ static void recalcData_nla(TransInfo *t)
}
case SACTSNAP_SECOND: /* snap to nearest second */
- case SACTSNAP_TSTEP: /* second step - this is basically the same, since we don't have any remapping going on */
+ case SACTSNAP_TSTEP: /* second step - this is basically the same,
+ * since we don't have any remapping going on */
{
/* This case behaves differently from the rest, since lengths of strips
* may not be multiples of a second. If we just naively resize adjust
@@ -777,7 +774,8 @@ static void recalcData_objects(TransInfo *t)
if (t->state == TRANS_CANCEL) {
while (nu) {
- BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ BKE_nurb_handles_calc(nu);
nu = nu->next;
}
}
@@ -812,8 +810,11 @@ static void recalcData_objects(TransInfo *t)
applyProject(t);
clipMirrorModifier(t);
}
- if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+ if ((t->flag & T_NO_MIRROR) == 0 &&
+ (t->options & CTX_NO_MIRROR) == 0)
+ {
editbmesh_apply_to_mirror(t);
+ }
if (t->mode == TFM_EDGE_SLIDE) {
projectEdgeSlideData(t, false);
@@ -1080,7 +1081,7 @@ static void recalcData_gpencil_strokes(TransInfo *t)
for (int i = 0; i < tc->data_len; i++, td++) {
bGPDstroke *gps = td->extra;
if (gps != NULL) {
- gps->flag |= GP_STROKE_RECALC_CACHES;
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
}
}
@@ -1117,7 +1118,7 @@ void recalcData(TransInfo *t)
else if (t->spacetype == SPACE_SEQ) {
recalcData_sequencer(t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
recalcData_graphedit(t);
}
else if (t->spacetype == SPACE_NODE) {
@@ -1142,7 +1143,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
GPU_matrix_push();
copy_v3_v3(v3, dir);
- mul_v3_fl(v3, v3d->far);
+ mul_v3_fl(v3, v3d->clip_end);
sub_v3_v3v3(v2, center, v3);
add_v3_v3v3(v1, center, v3);
@@ -1227,6 +1228,13 @@ void initTransDataContainers_FromObjectData(TransInfo *t, Object *obact, Object
for (int i = 0; i < objects_len; i++) {
TransDataContainer *tc = &t->data_container[i];
+ /* TODO, multiple axes. */
+ tc->mirror.axis_flag = (
+ ((t->flag & T_NO_MIRROR) == 0) &&
+ ((t->options & CTX_NO_MIRROR) == 0) &&
+ (objects[i]->type == OB_MESH) &&
+ (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_X) != 0);
+
if (object_mode & OB_MODE_EDIT) {
tc->obedit = objects[i];
/* Check needed for UV's */
@@ -1292,7 +1300,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->flag = 0;
- t->obedit_type = (object_mode == OB_MODE_EDIT) ? object_type : -1;
+ t->obedit_type = ((object_mode == OB_MODE_EDIT) || (object_mode == OB_MODE_EDIT_GPENCIL)) ? object_type : -1;
/* Many kinds of transform only use a single handle. */
if (t->data_container == NULL) {
@@ -1329,6 +1337,15 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
unit_m3(t->mat);
+ unit_m3(t->orient_matrix);
+ negate_m3(t->orient_matrix);
+ /* Leave 't->orient_matrix_is_set' to false,
+ * so we overwrite it when we have a useful value. */
+
+ /* Default to rotate on the Z axis. */
+ t->orient_axis = 2;
+ t->orient_axis_ortho = 1;
+
/* if there's an event, we're modal */
if (event) {
t->flag |= T_MODAL;
@@ -1374,7 +1391,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) {
- SET_FLAG_FROM_TEST(t->flag, !RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
+ SET_FLAG_FROM_TEST(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
}
}
@@ -1402,6 +1419,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
+ t->orientation.unset = V3D_ORIENT_GLOBAL;
t->orientation.user = orient_slot->type;
t->orientation.custom = BKE_scene_transform_orientation_find(t->scene, orient_slot->index_custom);
@@ -1412,8 +1430,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
NULL);
/* Make second orientation local if both are global. */
- if (t->orientation.user == V3D_MANIP_GLOBAL) {
- t->orientation.user_alt = V3D_MANIP_LOCAL;
+ if (t->orientation.user == V3D_ORIENT_GLOBAL) {
+ t->orientation.user_alt = V3D_ORIENT_LOCAL;
t->orientation.types[0] = &t->orientation.user_alt;
SWAP(short *, t->orientation.types[0], t->orientation.types[1]);
}
@@ -1477,8 +1495,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->view = &ar->v2d;
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = sa->spacedata.first;
t->view = &ar->v2d;
t->around = sipo->around;
}
@@ -1504,27 +1522,46 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_matrix")) &&
- RNA_property_is_set(op->ptr, prop)))
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
+ t->orient_axis = RNA_property_enum_get(op->ptr, prop);
+ }
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
+ t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
+ }
+
+ if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
+ RNA_property_is_set(op->ptr, prop)) &&
+ ((t->flag & T_MODAL) ||
+ /* When using redo, don't use the the custom constraint matrix
+ * if the user selects a different orientation. */
+ (RNA_enum_get(op->ptr, "orient_type") ==
+ RNA_enum_get(op->ptr, "orient_matrix_type"))))
{
RNA_property_float_get_array(op->ptr, prop, &t->spacemtx[0][0]);
- t->orientation.user = V3D_MANIP_CUSTOM_MATRIX;
+ /* Some transform modes use this to operate on an axis. */
+ t->orient_matrix_is_set = true;
+ copy_m3_m3(t->orient_matrix, t->spacemtx);
+ t->orient_matrix_is_set = true;
+ t->orientation.user = V3D_ORIENT_CUSTOM_MATRIX;
t->orientation.custom = 0;
+ if (t->flag & T_MODAL) {
+ RNA_enum_set(op->ptr, "orient_matrix_type", RNA_enum_get(op->ptr, "orient_type"));
+ }
}
- else if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ else if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
RNA_property_is_set(op->ptr, prop)))
{
short orientation = RNA_property_enum_get(op->ptr, prop);
TransformOrientation *custom_orientation = NULL;
- if (orientation >= V3D_MANIP_CUSTOM) {
- if (orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
- orientation = V3D_MANIP_GLOBAL;
+ if (orientation >= V3D_ORIENT_CUSTOM) {
+ if (orientation >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) {
+ orientation = V3D_ORIENT_GLOBAL;
}
else {
custom_orientation = BKE_scene_transform_orientation_find(
- t->scene, orientation - V3D_MANIP_CUSTOM);
- orientation = V3D_MANIP_CUSTOM;
+ t->scene, orientation - V3D_ORIENT_CUSTOM);
+ orientation = V3D_ORIENT_CUSTOM;
}
}
@@ -1548,18 +1585,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (op && ((prop = RNA_struct_find_property(op->ptr, "mirror")) &&
RNA_property_is_set(op->ptr, prop)))
{
- if (RNA_property_boolean_get(op->ptr, prop)) {
- t->flag |= T_MIRROR;
- t->mirror = 1;
+ if (!RNA_property_boolean_get(op->ptr, prop)) {
+ t->flag |= T_NO_MIRROR;
}
}
- // Need stuff to take it from edit mesh or whatnot here
- else if (t->spacetype == SPACE_VIEW3D) {
- /* TODO(campbell): xform, get mirror from each object. */
- if (t->obedit_type == OB_MESH && (((Mesh *)OBACT(t->view_layer)->data)->editflag & ME_EDIT_MIRROR_X)) {
- t->flag |= T_MIRROR;
- t->mirror = 1;
- }
+ else if ((t->spacetype == SPACE_VIEW3D) && (t->obedit_type == OB_MESH)) {
+ /* pass */
+ }
+ else {
+ /* Avoid mirroring for unsupported contexts. */
+ t->options |= CTX_NO_MIRROR;
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
@@ -1571,7 +1606,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* use settings from scene only if modal */
if (t->flag & T_MODAL) {
if ((t->options & CTX_NO_PET) == 0) {
- if (t->spacetype == SPACE_IPO) {
+ if (t->spacetype == SPACE_GRAPH) {
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_fcurve);
}
else if (t->spacetype == SPACE_ACTION) {
@@ -1712,7 +1747,7 @@ void postTrans(bContext *C, TransInfo *t)
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
/* free data malloced per trans-data */
if (ELEM(t->obedit_type, OB_CURVE, OB_SURF) ||
- (t->spacetype == SPACE_IPO))
+ (t->spacetype == SPACE_GRAPH))
{
TransData *td = tc->data;
for (int a = 0; a < tc->data_len; a++, td++) {
@@ -1927,7 +1962,7 @@ void calculateCenterCursor2D(TransInfo *t, float r_center[2])
void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
Scene *scene = t->scene;
/* cursor is combination of current frame, and graph-editor cursor value */
@@ -2003,12 +2038,13 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
{
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t);
- bool ok = false;
-
- if (tc->obedit) {
+ if (t->spacetype != SPACE_VIEW3D) {
+ return false;
+ }
+ else if (tc->obedit) {
if (ED_object_calc_active_center_for_editmode(tc->obedit, select_only, r_center)) {
mul_m4_v3(tc->obedit->obmat, r_center);
- ok = true;
+ return true;
}
}
else if (t->flag & T_POSE) {
@@ -2016,7 +2052,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
Object *ob = OBACT(view_layer) ;
if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
mul_m4_v3(ob->obmat, r_center);
- ok = true;
+ return true;
}
}
else if (t->options & CTX_PAINT_CURVE) {
@@ -2025,7 +2061,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
PaintCurve *pc = br->paint_curve;
copy_v3_v3(r_center, pc->points[pc->add_index - 1].bez.vec[1]);
r_center[2] = 0.0f;
- ok = true;
+ return true;
}
else {
/* object mode */
@@ -2034,11 +2070,11 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
Base *base = BASACT(view_layer);
if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) {
copy_v3_v3(r_center, ob->obmat[3]);
- ok = true;
+ return true;
}
}
- return ok;
+ return false;
}
static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[3])
@@ -2053,7 +2089,7 @@ static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[
case V3D_AROUND_CURSOR:
if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP))
calculateCenterCursor2D(t, r_center);
- else if (t->spacetype == SPACE_IPO)
+ else if (t->spacetype == SPACE_GRAPH)
calculateCenterCursorGraph2D(t, r_center);
else
calculateCenterCursor(t, r_center);
@@ -2167,7 +2203,7 @@ void calculatePropRatio(TransInfo *t)
if (td->flag & TD_SELECTED) {
td->factor = 1.0f;
}
- else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) {
+ else if (tc->mirror.axis_flag && (td->loc[0] * tc->mirror.sign) < -0.00001f) {
td->flag |= TD_SKIP;
td->factor = 0.0f;
restoreElement(td);
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 7d0584e3571..cbc72f99168 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_2d.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*
* \name 2D Transform Gizmo
*
@@ -28,7 +24,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
#include "BLI_math.h"
#include "DNA_meshdata_types.h"
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 4d76ec4a2e2..2e6a399d0ea 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_3d.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*
* \name 3D Transform Gizmo
*
@@ -59,8 +55,6 @@
#include "BKE_workspace.h"
#include "BKE_object.h"
-#include "BIF_gl.h"
-
#include "DEG_depsgraph.h"
#include "WM_api.h"
@@ -657,11 +651,11 @@ void ED_transform_calc_orientation_from_type_ex(
bool ok = false;
switch (orientation_type) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
{
break; /* nothing to do */
}
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
{
if (gimbal_axis(ob, r_mat)) {
ok = true;
@@ -670,7 +664,7 @@ void ED_transform_calc_orientation_from_type_ex(
/* if not gimbal, fall through to normal */
ATTR_FALLTHROUGH;
}
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
{
if (obedit || ob->mode & OB_MODE_POSE) {
ED_getTransformOrientationMatrix(C, r_mat, pivot_point);
@@ -680,7 +674,7 @@ void ED_transform_calc_orientation_from_type_ex(
/* no break we define 'normal' as 'local' in Object mode */
ATTR_FALLTHROUGH;
}
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
{
if (ob->mode & OB_MODE_POSE) {
/* each bone moves on its own local axis, but to avoid confusion,
@@ -696,7 +690,7 @@ void ED_transform_calc_orientation_from_type_ex(
ok = true;
break;
}
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
if (rv3d != NULL) {
copy_m3_m4(r_mat, rv3d->viewinv);
@@ -705,13 +699,13 @@ void ED_transform_calc_orientation_from_type_ex(
}
break;
}
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
{
ED_view3d_cursor3d_calc_mat3(scene, r_mat);
ok = true;
break;
}
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
{
TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find(
scene, orientation_index_custom);
@@ -1088,7 +1082,7 @@ int ED_transform_calc_gizmo_stats(
if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL;
for (base = view_layer->object_bases.first; base; base = base->next) {
- if (!TESTBASELIB(v3d, base)) {
+ if (!BASE_SELECTED_EDITABLE(v3d, base)) {
continue;
}
if (ob == NULL) {
@@ -1211,8 +1205,6 @@ 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)
{
- GizmoGroup *ggd = gzgroup->customdata;
-
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
.owner = ar,
@@ -1220,26 +1212,44 @@ static void gizmo_xform_message_subscribe(
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
+ int orient_flag = 0;
+ if (type_fn == TRANSFORM_GGT_gizmo) {
+ GizmoGroup *ggd = gzgroup->customdata;
+ orient_flag = ggd->twtype_init;
+ }
+ else if (type_fn == VIEW3D_GGT_xform_cage) {
+ orient_flag = SCE_GIZMO_SHOW_SCALE;
+ /* pass */
+ }
+ else if (type_fn == VIEW3D_GGT_xform_shear) {
+ orient_flag = SCE_GIZMO_SHOW_ROTATE;
+ }
+ TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, orient_flag);
+ PointerRNA orient_ref_ptr;
+ RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
+ const ToolSettings *ts = scene->toolsettings;
+
PointerRNA scene_ptr;
RNA_id_pointer_create(&scene->id, &scene_ptr);
-
{
extern PropertyRNA rna_Scene_transform_orientation_slots;
- extern PropertyRNA rna_Scene_cursor_location;
const PropertyRNA *props[] = {
&rna_Scene_transform_orientation_slots,
- (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) ? &rna_Scene_cursor_location : NULL,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
- if (props[i]) {
- WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
- }
+ WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
}
}
- TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
- PointerRNA orient_ref_ptr;
- RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
+ if ((ts->transform_pivot_point == V3D_AROUND_CURSOR) ||
+ (orient_slot->type == V3D_ORIENT_CURSOR))
+ {
+ /* We could be more specific here, for now subscribe to any cursor change. */
+ PointerRNA cursor_ptr;
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &cursor_ptr);
+ WM_msg_subscribe_rna(mbus, &cursor_ptr, NULL, &msg_sub_value_gz_tag_refresh, __func__);
+ }
+
{
extern PropertyRNA rna_TransformOrientationSlot_type;
extern PropertyRNA rna_TransformOrientationSlot_use;
@@ -1258,9 +1268,12 @@ static void gizmo_xform_message_subscribe(
RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
if (type_fn == TRANSFORM_GGT_gizmo) {
+ GizmoGroup *ggd = gzgroup->customdata;
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__);
@@ -1283,7 +1296,7 @@ static void gizmo_xform_message_subscribe(
void drawDial3d(const TransInfo *t)
{
if (t->mode == TFM_ROTATION && t->spacetype == SPACE_VIEW3D) {
- wmGizmo *gz = wm_gizmomap_highlight_get(t->ar->gizmo_map);
+ wmGizmo *gz = wm_gizmomap_modal_get(t->ar->gizmo_map);
if (gz == NULL) {
/* We only draw Dial3d if the operator has been called by a gizmo. */
return;
@@ -1316,7 +1329,7 @@ void drawDial3d(const TransInfo *t)
}
else {
axis_idx = MAN_AXIS_ROT_C;
- negate_v3_v3(mat_basis[2], t->axis);
+ negate_v3_v3(mat_basis[2], t->orient_matrix[t->orient_axis]);
scale *= 1.2f;
line_with -= 1.0f;
}
@@ -1785,7 +1798,7 @@ static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgr
Scene *scene = CTX_data_scene(C);
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
WIDGETGROUP_gizmo_refresh(C, gzgroup);
break;
@@ -1808,15 +1821,15 @@ static void WIDGETGROUP_gizmo_invoke_prepare(
Scene *scene = CTX_data_scene(C);
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA *ptr = &gzop->ptr;
- PropertyRNA *prop_constraint_orientation = RNA_struct_find_property(ptr, "constraint_orientation");
+ PropertyRNA *prop_orient_type = RNA_struct_find_property(ptr, "orient_type");
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
if (orient_slot == &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
- RNA_property_unset(ptr, prop_constraint_orientation);
+ RNA_property_unset(ptr, prop_orient_type);
}
else {
/* TODO: APIfunction */
int index = BKE_scene_orientation_slot_get_index(orient_slot);
- RNA_property_enum_set(ptr, prop_constraint_orientation, index);
+ RNA_property_enum_set(ptr, prop_orient_type, index);
}
}
@@ -1895,7 +1908,7 @@ void TRANSFORM_GGT_gizmo(wmGizmoGroupType *gzgt)
{SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
{SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
{0, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzgt->srna, "drag_action", rna_enum_gizmo_items, SCE_GIZMO_SHOW_TRANSLATE, "Drag Action", "");
}
@@ -2068,7 +2081,7 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup
Scene *scene = CTX_data_scene(C);
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_SCALE);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
float viewinv_m3[3][3];
copy_m3_m4(viewinv_m3, rv3d->viewinv);
@@ -2157,15 +2170,20 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
+ Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
struct TransformBounds tbounds;
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+
if (ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams) {
.use_local_axis = false,
+ .orientation_type = orient_slot->type + 1,
+ .orientation_index_custom = orient_slot->index_custom,
}, &tbounds) == 0)
{
for (int i = 0; i < 3; i++) {
@@ -2189,15 +2207,12 @@ static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzg
WM_gizmo_set_matrix_rotation_from_yz_axis(gz, rv3d->twmat[i_ortho_a], rv3d->twmat[i]);
WM_gizmo_set_matrix_location(gz, rv3d->twmat[3]);
- float axis[3];
- if (j == 0) {
- copy_v3_v3(axis, tbounds.axis[i_ortho_b]);
- }
- else {
- negate_v3_v3(axis, tbounds.axis[i_ortho_b]);
- }
- RNA_float_set_array(&gzop->ptr, "axis", axis);
- RNA_float_set_array(&gzop->ptr, "axis_ortho", tbounds.axis[i_ortho_a]);
+ RNA_float_set_array(&gzop->ptr, "orient_matrix", &tbounds.axis[0][0]);
+ RNA_enum_set(&gzop->ptr, "orient_type", orient_slot->type);
+
+ RNA_enum_set(&gzop->ptr, "orient_axis", i_ortho_b);
+ RNA_enum_set(&gzop->ptr, "orient_axis_ortho", i_ortho_a);
+
mul_v3_fl(gz->matrix_basis[0], 0.5f);
mul_v3_fl(gz->matrix_basis[1], 6.0f);
}
@@ -2227,7 +2242,7 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
/* Shear is like rotate, use the rotate setting. */
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
float viewinv_m3[3][3];
copy_m3_m4(viewinv_m3, rv3d->viewinv);
@@ -2246,7 +2261,8 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
LISTBASE_FOREACH (wmGizmo *, gz, &gzgroup->gizmos) {
/* Since we have two pairs of each axis,
* bias the values so gizmos that are orthogonal to the view get priority.
- * This means we never default to shearing along the view axis in the case of an overlap. */
+ * This means we never default to shearing along
+ * the view axis in the case of an overlap. */
float axis_order[3], axis_bias[3];
copy_v3_v3(axis_order, gz->matrix_basis[2]);
copy_v3_v3(axis_bias, gz->matrix_basis[1]);
diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
index 441141e9718..b1ea7b87efb 100644
--- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_extrude_3d.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "BLI_utildefines.h"
@@ -84,7 +80,7 @@ typedef struct GizmoExtrudeGroup {
/* Copied from the transform operator,
* use to redo with the same settings. */
struct {
- float constraint_matrix[3][3];
+ float orient_matrix[3][3];
bool constraint_axis[3];
float value[4];
} redo_xform;
@@ -235,7 +231,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
ggd->data.orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type;
const bool use_normal = (
- (ggd->data.orientation_type != V3D_MANIP_NORMAL) ||
+ (ggd->data.orientation_type != V3D_ORIENT_NORMAL) ||
(axis_type == EXTRUDE_AXIS_NORMAL));
const int axis_len_used = use_normal ? 4 : 3;
@@ -245,7 +241,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
struct TransformBounds tbounds_normal;
if (!ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams){
- .orientation_type = V3D_MANIP_NORMAL + 1,
+ .orientation_type = V3D_ORIENT_NORMAL + 1,
}, &tbounds_normal))
{
unit_m3(tbounds_normal.axis);
@@ -286,7 +282,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
gz_adjust = ggd->adjust[1];
/* We can't access this from 'ot->last_properties'
* because some properties use skip-save. */
- RNA_float_get_array(op_xform->ptr, "constraint_matrix", &ggd->redo_xform.constraint_matrix[0][0]);
+ RNA_float_get_array(op_xform->ptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
RNA_boolean_get_array(op_xform->ptr, "constraint_axis", ggd->redo_xform.constraint_axis);
RNA_float_get_array(op_xform->ptr, "value", ggd->redo_xform.value);
@@ -315,7 +311,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
if (has_redo) {
if (gz_adjust == ggd->adjust[0]) {
- gizmo_mesh_extrude_orientation_matrix_set_for_adjust(ggd, ggd->redo_xform.constraint_matrix);
+ gizmo_mesh_extrude_orientation_matrix_set_for_adjust(ggd, ggd->redo_xform.orient_matrix);
if (adjust_is_flip) {
negate_v3(ggd->adjust[0]->matrix_basis[2]);
}
@@ -358,7 +354,7 @@ static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzg
{
GizmoExtrudeGroup *ggd = gzgroup->customdata;
switch (ggd->data.orientation_type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float mat[3][3];
@@ -393,8 +389,9 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmo
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA macroptr = RNA_pointer_get(&gzop->ptr, "TRANSFORM_OT_translate");
if (gz == ggd->adjust[0]) {
- RNA_float_set_array(&macroptr, "constraint_matrix", &ggd->redo_xform.constraint_matrix[0][0]);
RNA_boolean_set_array(&macroptr, "constraint_axis", ggd->redo_xform.constraint_axis);
+ RNA_float_set_array(&macroptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
+ RNA_enum_set(&macroptr, "orient_type", V3D_ORIENT_NORMAL);
}
RNA_float_set_array(&macroptr, "value", ggd->redo_xform.value);
}
@@ -406,13 +403,14 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmo
if (i == 3) {
use_normal_matrix = true;
}
- else if (ggd->data.orientation_type == V3D_MANIP_NORMAL) {
+ else if (ggd->data.orientation_type == V3D_ORIENT_NORMAL) {
use_normal_matrix = true;
}
if (use_normal_matrix) {
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA macroptr = RNA_pointer_get(&gzop->ptr, "TRANSFORM_OT_translate");
- RNA_float_set_array(&macroptr, "constraint_matrix", &ggd->data.normal_mat3[0][0]);
+ RNA_float_set_array(&macroptr, "orient_matrix", &ggd->data.normal_mat3[0][0]);
+ RNA_enum_set(&macroptr, "orient_type", V3D_ORIENT_NORMAL);
}
}
}
@@ -438,7 +436,7 @@ static void gizmo_mesh_extrude_message_subscribe(
WM_msg_subscribe_rna_params(
mbus,
&(const wmMsgParams_RNA){
- .ptr = (PointerRNA){.type = gzgroup->type->srna},
+ .ptr = (PointerRNA){ .type = gzgroup->type->srna, },
.prop = ggd->gzgt_axis_type_prop,
},
&msg_sub_value_gz_tag_refresh, __func__);
@@ -462,9 +460,9 @@ void VIEW3D_GGT_xform_extrude(struct wmGizmoGroupType *gzgt)
gzgt->message_subscribe = gizmo_mesh_extrude_message_subscribe;
static const EnumPropertyItem axis_type_items[] = {
- {EXTRUDE_AXIS_NORMAL, "NORMAL", 0, "Normal", "Only show normal axis"},
+ {EXTRUDE_AXIS_NORMAL, "NORMAL", 0, "Regular", "Only show normal axis"},
{EXTRUDE_AXIS_XYZ, "XYZ", 0, "XYZ", "Follow scene orientation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzgt->srna, "axis_type", axis_type_items, 0, "Axis Type", "");
}
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 2721bccb7de..b03d50e11e7 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_input.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
@@ -197,7 +191,8 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2
double dx3 = mval[0] - data->mval_prev[0];
double dy3 = mval[1] - data->mval_prev[1];
- /* use doubles here, to make sure a "1.0" (no rotation) doesn't become 9.999999e-01, which gives 0.02 for acos */
+ /* use doubles here, to make sure a "1.0" (no rotation)
+ * doesn't become 9.999999e-01, which gives 0.02 for acos */
double deler = (((dx1 * dx1 + dy1 * dy1) +
(dx2 * dx2 + dy2 * dy2) -
(dx3 * dx3 + dy3 * dy3)) / (2.0 * (((A * B) != 0.0) ? (A * B) : 1.0)));
@@ -387,12 +382,6 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
if (mi_data_prev && (mi_data_prev != mi->data)) {
MEM_freeN(mi_data_prev);
}
-
- /* Don't write into the values when non-modal because they are already set from operator redo values. */
- if (t->flag & T_MODAL) {
- /* bootstrap mouse input with initial values */
- applyMouseInput(t, mi, mi->imval, t->values);
- }
}
void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3]))
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 5a3575c04d9..a1bb970e844 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_ops.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include "MEM_guardedalloc.h"
@@ -125,7 +119,7 @@ static TransformModeItem transform_modes[] =
{OP_EDGE_BWEIGHT, TFM_BWEIGHT, TRANSFORM_OT_edge_bevelweight},
{OP_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide},
{OP_NORMAL_ROTATION, TFM_NORMAL_ROTATION, TRANSFORM_OT_rotate_normal},
- {NULL, 0}
+ {NULL, 0},
};
const EnumPropertyItem rna_enum_transform_mode_types[] =
@@ -161,7 +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", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int select_orientation_exec(bContext *C, wmOperator *op)
@@ -235,7 +229,7 @@ static bool delete_orientation_poll(bContext *C)
if (ED_operator_areaactive(C) == 0)
return 0;
- return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_MANIP_CUSTOM) &&
+ return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_ORIENT_CUSTOM) &&
(scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom != -1));
}
@@ -409,7 +403,8 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* XXX, workaround: active needs to be calculated before transforming,
* since we're not reading from 'td->center' in this case. see: T40241 */
if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) {
- /* In camera view, tsnap callback is not set (see initSnappingMode() in transfrom_snap.c, and T40348). */
+ /* In camera view, tsnap callback is not set
+ * (see initSnappingMode() in transfrom_snap.c, and T40348). */
if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) {
t->tsnap.targetSnap(t);
}
@@ -520,8 +515,8 @@ static bool transform_poll_property(const bContext *UNUSED(C), wmOperator *op, c
/* Orientation/Constraints. */
{
/* Hide orientation axis if no constraints are set, since it wont be used. */
- PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "constraint_axis");
- if (prop_con && !RNA_property_is_set(op->ptr, prop_con)) {
+ PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
+ if (prop_con != NULL && (prop_con != prop)) {
if (STRPREFIX(prop_id, "constraint")) {
return false;
}
@@ -547,33 +542,41 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
{
PropertyRNA *prop;
- if (flags & P_AXIS) {
- prop = RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- /* Make this not hidden when there's a nice axis selection widget */
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
+ if (flags & P_ORIENT_AXIS) {
+ prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_enum_default(prop, 2);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-
- if (flags & P_AXIS_ORTHO) {
- prop = RNA_def_property(ot->srna, "axis_ortho", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- /* Make this not hidden when there's a nice axis selection widget */
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "Axis", "The orthogonal axis around which the transformation occurs");
+ if (flags & P_ORIENT_AXIS_ORTHO) {
+ prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Axis Ortho", "");
+ RNA_def_property_enum_default(prop, 1);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
- if (flags & P_CONSTRAINT) {
- RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
+ if (flags & P_ORIENT_MATRIX) {
+ prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
+ RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
- /* Set by 'constraint_orientation' or gizmo which acts on non-standard orientation. */
- prop = RNA_def_float_matrix(ot->srna, "constraint_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
+ /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */
+ prop = RNA_def_float_matrix(ot->srna, "orient_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- prop = RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
- RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
+ /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
+ * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability
+ * to switch over to other orientations. */
+ prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Matrix Orientation", "");
RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ }
+ if (flags & P_CONSTRAINT) {
+ RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
}
if (flags & P_MIRROR) {
@@ -589,7 +592,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_enum(ot->srna, "proportional", rna_enum_proportional_editing_items, 0, "Proportional Editing", "");
prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", rna_enum_proportional_falloff_items, 0,
"Proportional Falloff", "Falloff type for proportional editing mode");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ /* Abusing id_curve :/ */
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE);
RNA_def_float(ot->srna, "proportional_size", 1, T_PROP_SIZE_MIN, T_PROP_SIZE_MAX,
"Proportional Size", "", 0.001f, 100.0f);
}
@@ -673,7 +677,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
Transform_Properties(
ot,
- P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS |
+ P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS |
P_GPENCIL_EDIT | P_CURSOR_EDIT);
}
@@ -698,7 +702,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
static bool skin_resize_poll(bContext *C)
@@ -731,7 +735,8 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
- Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE);
+ Transform_Properties(
+ ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE);
}
static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
@@ -779,7 +784,7 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
@@ -852,7 +857,9 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
- Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_AXIS | P_AXIS_ORTHO);
+ Transform_Properties(
+ ot, P_ORIENT_AXIS | P_ORIENT_AXIS_ORTHO | P_ORIENT_MATRIX | P_PROPORTIONAL | P_MIRROR |
+ P_SNAP | P_GPENCIL_EDIT);
}
static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
@@ -894,9 +901,9 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
ot->poll = ED_operator_editmesh;
ot->poll_property = transform_poll_property;
- RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
+ RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
- RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_even_offset", false, "Offset Even", "Scale the offset to give more even thickness");
WM_operatortype_props_advanced_begin(ot);
@@ -943,7 +950,7 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
ot->poll = ED_operator_screenactive;
ot->poll_property = transform_poll_property;
- Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT | P_CENTER);
+ Transform_Properties(ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
@@ -1095,7 +1102,7 @@ static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot)
RNA_def_float_rotation(ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
- Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_MIRROR);
+ Transform_Properties(ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_MIRROR);
}
@@ -1125,7 +1132,8 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP |
+ P_GPENCIL_EDIT | P_CENTER);
}
static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 04999213c63..b486976bfad 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_orientations.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -51,8 +45,6 @@
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_report.h"
-#include "BKE_main.h"
-#include "BKE_screen.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
@@ -73,8 +65,8 @@ void BIF_clearTransformOrientation(bContext *C)
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
- if (orient_slot->type == V3D_MANIP_CUSTOM) {
- orient_slot->type = V3D_MANIP_GLOBAL; /* fallback to global */
+ if (orient_slot->type == V3D_ORIENT_CUSTOM) {
+ orient_slot->type = V3D_ORIENT_GLOBAL; /* fallback to global */
orient_slot->index_custom = -1;
}
}
@@ -369,7 +361,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
BLI_assert(index != -1);
- scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_MANIP_CUSTOM;
+ scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_ORIENT_CUSTOM;
scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom = index;
}
@@ -422,26 +414,26 @@ void initTransformOrientation(bContext *C, TransInfo *t)
Object *obedit = CTX_data_active_object(C);
switch (t->orientation.user) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
unit_m3(t->spacemtx);
BLI_strncpy(t->spacename, IFACE_("global"), sizeof(t->spacename));
break;
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
unit_m3(t->spacemtx);
if (ob && gimbal_axis(ob, t->spacemtx)) {
BLI_strncpy(t->spacename, IFACE_("gimbal"), sizeof(t->spacename));
break;
}
ATTR_FALLTHROUGH; /* no gimbal fallthrough to normal */
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename));
ED_getTransformOrientationMatrix(C, t->spacemtx, t->around);
break;
}
ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
if (ob) {
@@ -454,7 +446,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
break;
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
if ((t->spacetype == SPACE_VIEW3D) &&
(t->ar->regiontype == RGN_TYPE_WINDOW))
{
@@ -470,17 +462,17 @@ void initTransformOrientation(bContext *C, TransInfo *t)
unit_m3(t->spacemtx);
}
break;
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
{
BLI_strncpy(t->spacename, IFACE_("cursor"), sizeof(t->spacename));
ED_view3d_cursor3d_calc_mat3(t->scene, t->spacemtx);
break;
}
- case V3D_MANIP_CUSTOM_MATRIX:
+ case V3D_ORIENT_CUSTOM_MATRIX:
/* Already set. */
BLI_strncpy(t->spacename, IFACE_("custom"), sizeof(t->spacename));
break;
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename));
if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) {
@@ -491,6 +483,20 @@ void initTransformOrientation(bContext *C, TransInfo *t)
}
break;
}
+
+ if (t->orient_matrix_is_set == false) {
+ t->orient_matrix_is_set = true;
+ if (t->flag & T_MODAL) {
+ /* Rotate for example defaults to operating on the view plane. */
+ t->orientation.unset = V3D_ORIENT_VIEW;
+ copy_m3_m4(t->orient_matrix, t->viewinv);
+ normalize_m3(t->orient_matrix);
+ }
+ else {
+ copy_m3_m3(t->orient_matrix, t->spacemtx);
+ }
+ negate_m3(t->orient_matrix);
+ }
}
/**
@@ -1079,7 +1085,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
/* first selected */
ob = NULL;
for (base = view_layer->object_bases.first; base; base = base->next) {
- if (TESTBASELIB(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
ob = base->object;
break;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9cf71dc4cf4..2dacf5b4c5a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_snap.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -52,7 +44,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_object.h"
#include "BKE_anim.h" /* for duplis */
@@ -879,7 +870,9 @@ static void ApplySnapResize(TransInfo *t, float vec[3])
getSnapPoint(t, point);
float dist = ResizeBetween(t, t->tsnap.snapTarget, point);
- copy_v3_fl(vec, dist);
+ if (dist != TRANSFORM_DIST_INVALID) {
+ copy_v3_fl(vec, dist);
+ }
}
/********************** DISTANCE **************************/
@@ -1527,10 +1520,10 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, const fl
if (use_aspect) {
/* custom aspect for fcurve */
- if (t->spacetype == SPACE_IPO) {
+ if (t->spacetype == SPACE_GRAPH) {
View2D *v2d = &t->ar->v2d;
View2DGrid *grid;
- SpaceIpo *sipo = t->sa->spacedata.first;
+ SpaceGraph *sipo = t->sa->spacedata.first;
int unity = V2D_UNIT_VALUES;
int unitx = (sipo->flag & SIPO_DRAWTIME) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE;
@@ -1590,7 +1583,8 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, const fl
float grid_p = iter_fac * roundf(pos_on_axis[j] / iter_fac);
float dist_p = fabs((grid_p - pos_on_axis[j]) / local_axis[j]);
- /* The amount of distance needed to travel along the local axis to snap to the closest grid point */
+ /* The amount of distance needed to travel along the
+ * local axis to snap to the closest grid point */
/* in the global j axis direction */
float move_dist = (grid_p - center_global[j]) / local_axis[j];
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index c31019144b5..e7c4c2e441c 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_snap_object.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -33,7 +29,6 @@
#include "BLI_kdopbvh.h"
#include "BLI_memarena.h"
#include "BLI_ghash.h"
-#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
@@ -210,7 +205,7 @@ typedef void(*IterSnapObjsCallback)(SnapObjectContext *sctx, bool is_obedit, Obj
* Walks through all objects in the scene to create the list of objects to snap.
*
* \param sctx: Snap context to store data.
- * \param snap_select : from enum eSnapSelect.
+ * \param snap_select: from enum #eSnapSelect.
*/
static void iter_snap_objects(
SnapObjectContext *sctx,
@@ -225,7 +220,7 @@ static void iter_snap_objects(
Base *base_act = view_layer->basact;
for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
- if ((BASE_VISIBLE_BGMODE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
+ if ((BASE_VISIBLE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
!((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
(snap_select == SNAP_NOT_ACTIVE && base == base_act)))
{
@@ -454,7 +449,7 @@ static bool raycastMesh(
retval = data.retval;
}
else {
- BVHTreeRayHit hit = {.index = -1, .dist = local_depth};
+ BVHTreeRayHit hit = { .index = -1, .dist = local_depth, };
if (BLI_bvhtree_ray_cast(
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
@@ -564,13 +559,21 @@ static bool raycastEditMesh(
if (treedata->tree == NULL) {
BVHCache **bvh_cache = NULL;
BLI_bitmap *elem_mask = NULL;
+ BMEditMesh *em_orig;
int looptri_num_active = -1;
+ /* Get original version of the edit_mesh. */
+ em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
+
if (sctx->callbacks.edit_mesh.test_face_fn) {
- elem_mask = BLI_BITMAP_NEW(em->tottri, __func__);
+ BMesh *bm = em_orig->bm;
+ BLI_assert(poly_to_tri_count(bm->totface, bm->totloop) == em_orig->tottri);
+
+ elem_mask = BLI_BITMAP_NEW(em_orig->tottri, __func__);
looptri_num_active = BM_iter_mesh_bitmap_from_filter_tessface(
- em->bm, elem_mask,
- sctx->callbacks.edit_mesh.test_face_fn, sctx->callbacks.edit_mesh.user_data);
+ bm, elem_mask,
+ sctx->callbacks.edit_mesh.test_face_fn,
+ sctx->callbacks.edit_mesh.user_data);
}
else {
/* Only cache if bvhtree is created without a mask.
@@ -578,9 +581,6 @@ static bool raycastEditMesh(
bvh_cache = &em_bvh_cache;
}
- /* Get original version of the edit_btmesh. */
- BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
-
bvhtree_from_editmesh_looptri_ex(
treedata, em_orig, elem_mask, looptri_num_active,
0.0f, 4, 6, bvh_cache);
@@ -617,7 +617,7 @@ static bool raycastEditMesh(
retval = data.retval;
}
else {
- BVHTreeRayHit hit = {.index = -1, .dist = local_depth};
+ BVHTreeRayHit hit = { .index = -1, .dist = local_depth, };
if (BLI_bvhtree_ray_cast(
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
@@ -641,7 +641,7 @@ static bool raycastEditMesh(
retval = true;
if (r_index) {
- /* Get original version of the edit_btmesh. */
+ /* Get original version of the edit_mesh. */
BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
*r_index = BM_elem_index_get(em_orig->looptris[hit.index][0]->f);
@@ -762,8 +762,8 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool use_obedit, Object *ob,
* Walks through all objects in the scene to find the `hit` on object surface.
*
* \param sctx: Snap context to store data.
- * \param snap_select : from enum eSnapSelect.
- * \param use_object_edit_cage : Uses the coordinates of BMesh(if any) to do the snapping.
+ * \param snap_select: from enum eSnapSelect.
+ * \param use_object_edit_cage: Uses the coordinates of BMesh(if any) to do the snapping.
* \param obj_list: List with objects to snap (created in `create_object_list`).
*
* Read/Write Args
@@ -781,7 +781,6 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool use_obedit, Object *ob,
* \param r_ob: Hit object.
* \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
* \param r_hit_list: List of #SnapObjectHitDepth (caller must free).
- *
*/
static bool raycastObjects(
SnapObjectContext *sctx,
@@ -990,7 +989,8 @@ static bool test_projected_edge_dist(
typedef void (*Nearest2DGetVertCoCallback)(const int index, const float **co, void *data);
typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, int v_index[2], void *data);
typedef void (*Nearest2DGetTriVertsCallback)(const int index, int v_index[3], void *data);
-typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data); /* Equal the previous one */
+/* Equal the previous one */
+typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data);
typedef void (*Nearest2DCopyVertNoCallback)(const int index, float r_no[3], void *data);
typedef struct Nearest2dUserData {
@@ -1538,7 +1538,7 @@ static short snapCurve(
if (nu->bezt) {
/* don't snap to selected (moving) or hidden */
if (nu->bezt[u].f2 & SELECT || nu->bezt[u].hide != 0) {
- break;
+ continue;
}
has_snap |= test_projected_vert_dist(
&neasrest_precalc,
@@ -1568,7 +1568,7 @@ static short snapCurve(
else {
/* don't snap to selected (moving) or hidden */
if (nu->bp[u].f1 & SELECT || nu->bp[u].hide != 0) {
- break;
+ continue;
}
has_snap |= test_projected_vert_dist(
&neasrest_precalc,
@@ -2295,7 +2295,6 @@ static void sanp_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, flo
* (currently only set to the polygon index when when using ``snap_to == SCE_SNAP_MODE_FACE``).
* \param r_ob: Hit object.
* \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
- *
*/
static short snapObjectsRay(
SnapObjectContext *sctx, SnapData *snapdata,
diff --git a/source/blender/editors/undo/CMakeLists.txt b/source/blender/editors/undo/CMakeLists.txt
index 2e3e73f34f4..6ccba01c465 100644
--- a/source/blender/editors/undo/CMakeLists.txt
+++ b/source/blender/editors/undo/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index dd459749029..7c8fc4ef8ba 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/ed_undo.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#include <string.h>
@@ -56,7 +48,7 @@
#include "BKE_workspace.h"
#include "BKE_paint.h"
-#include "BLO_writefile.h"
+#include "BLO_blend_validate.h"
#include "ED_gpencil.h"
#include "ED_render.h"
@@ -110,9 +102,13 @@ void ED_undo_push(bContext *C, const char *str)
WM_file_tag_modified();
}
-/* note: also check undo_history_exec() in bottom if you change notifiers */
+/**
+ * \note Also check #undo_history_exec in bottom if you change notifiers.
+ */
static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList *reports)
{
+ /* Mutually exclusives, ensure correct input. */
+ BLI_assert((undoname && !step) || (!undoname && step));
CLOG_INFO(&LOG, 1, "name='%s', step=%d", undoname, step);
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
@@ -125,7 +121,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList
if (G.debug & G_DEBUG_IO) {
Main *bmain = CTX_data_main(C);
if (bmain->lock != NULL) {
- BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *BEFORE* undo step.");
+ BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *BEFORE* undo step");
BLO_main_validate_libraries(bmain, reports);
}
}
@@ -173,7 +169,12 @@ static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList
BKE_undosys_step_undo_with_data(wm->undo_stack, C, step_data_from_name);
}
else {
- BKE_undosys_step_undo_compat_only(wm->undo_stack, C, step);
+ if (step == 1) {
+ BKE_undosys_step_undo(wm->undo_stack, C);
+ }
+ else {
+ BKE_undosys_step_redo(wm->undo_stack, C);
+ }
}
/* Set special modes for grease pencil */
@@ -199,14 +200,14 @@ static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList
Main *bmain = CTX_data_main(C);
scene = CTX_data_scene(C);
wm->op_undo_depth++;
- BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE);
+ BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_POST : BLI_CB_EVT_REDO_POST);
wm->op_undo_depth--;
}
if (G.debug & G_DEBUG_IO) {
Main *bmain = CTX_data_main(C);
if (bmain->lock != NULL) {
- BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *AFTER* undo step.");
+ BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *AFTER* undo step");
BLO_main_validate_libraries(bmain, reports);
}
}
@@ -273,6 +274,23 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname)
return BKE_undosys_stack_has_undo(wm->undo_stack, undoname);
}
+bool ED_undo_is_memfile_compatible(const bContext *C)
+{
+ /* Some modes don't co-exist with memfile undo, disable their use: T60593
+ * (this matches 2.7x behavior). */
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ if (view_layer != NULL) {
+ Object *obact = OBACT(view_layer);
+ if (obact != NULL) {
+ if (obact->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+
/**
* Ideally we wont access the stack directly,
* this is needed for modes which handle undo themselves (bypassing #ED_undo_push).
@@ -306,6 +324,15 @@ static int ed_undo_exec(bContext *C, wmOperator *op)
static int ed_undo_push_exec(bContext *C, wmOperator *op)
{
+ if (G.background) {
+ /* Exception for background mode, see: T60934.
+ * Note: since the undo stack isn't initialized on startup, background mode behavior
+ * won't match regular usage, this is just for scripts to do explicit undo pushes. */
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm->undo_stack == NULL) {
+ wm->undo_stack = BKE_undosys_stack_create();
+ }
+ }
char str[BKE_UNDO_STR_MAX];
RNA_string_get(op->ptr, "message", str);
ED_undo_push(C, str);
@@ -334,11 +361,31 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
return ret;
}
+/* Disable in background mode, we could support if it's useful, T60934. */
+
+static bool ed_undo_is_init_poll(bContext *C)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm->undo_stack == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "Undo disabled at startup");
+ return false;
+ }
+ return true;
+}
+
+static bool ed_undo_is_init_and_screenactive_poll(bContext *C)
+{
+ if (ed_undo_is_init_poll(C) == false) {
+ return false;
+ }
+ return ED_operator_screenactive(C);
+}
+
static bool ed_undo_redo_poll(bContext *C)
{
wmOperator *last_op = WM_operator_last_redo(C);
- return last_op && ED_operator_screenactive(C) &&
- WM_operator_check_ui_enabled(C, last_op->type->name);
+ return (last_op && ed_undo_is_init_and_screenactive_poll(C) &&
+ WM_operator_check_ui_enabled(C, last_op->type->name));
}
void ED_OT_undo(wmOperatorType *ot)
@@ -350,7 +397,7 @@ void ED_OT_undo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_undo_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_push(wmOperatorType *ot)
@@ -362,6 +409,8 @@ void ED_OT_undo_push(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_undo_push_exec;
+ /* Unlike others undo operators this initializes undo stack. */
+ ot->poll = ED_operator_screenactive;
ot->flag = OPTYPE_INTERNAL;
@@ -377,7 +426,7 @@ void ED_OT_redo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_redo_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_redo(wmOperatorType *ot)
@@ -588,7 +637,7 @@ void ED_OT_undo_history(wmOperatorType *ot)
/* api callbacks */
ot->invoke = undo_history_invoke;
ot->exec = undo_history_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
@@ -615,4 +664,37 @@ void ED_undo_object_set_active_or_warn(ViewLayer *view_layer, Object *ob, const
}
}
+void ED_undo_object_editmode_restore_helper(
+ struct bContext *C, Object **object_array, uint object_array_len, uint object_array_stride)
+{
+ Main *bmain = CTX_data_main(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ uint bases_len = 0;
+ /* Don't request unique data because we wan't to de-select objects when exiting edit-mode
+ * for that to be done on all objects we can't skip ones that share data. */
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(
+ view_layer, NULL, &bases_len);
+ for (uint i = 0; i < bases_len; i++) {
+ ((ID *)bases[i]->object->data)->tag |= LIB_TAG_DOIT;
+ }
+ Scene *scene = CTX_data_scene(C);
+ Object **ob_p = object_array;
+ for (uint i = 0; i < object_array_len; i++, ob_p = POINTER_OFFSET(ob_p, object_array_stride)) {
+ Object *obedit = *ob_p;
+ ED_object_editmode_enter_ex(bmain, scene, obedit, EM_NO_CONTEXT);
+ ((ID *)obedit->data)->tag &= ~LIB_TAG_DOIT;
+ }
+ for (uint i = 0; i < bases_len; i++) {
+ ID *id = bases[i]->object->data;
+ if (id->tag & LIB_TAG_DOIT) {
+ ED_object_editmode_exit_ex(bmain, scene, bases[i]->object, EM_FREEDATA);
+ /* Ideally we would know the selection state it was before entering edit-mode,
+ * for now follow the convention of having them unselected when exiting the mode. */
+ ED_object_base_select(bases[i], BA_DESELECT);
+
+ }
+ }
+ MEM_freeN(bases);
+}
+
/** \} */
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index 4b38ab282a0..c6719f6433a 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/memfile_undo.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*
* Wrapper between 'ED_undo.h' and 'BKE_undo_system.h' API's.
*/
@@ -38,8 +34,7 @@
#include "ED_object.h"
#include "ED_undo.h"
-#include "ED_render.h"
-
+#include "ED_util.h"
#include "../blenloader/BLO_undofile.h"
@@ -54,22 +49,29 @@ typedef struct MemFileUndoStep {
MemFileUndoData *data;
} MemFileUndoStep;
-static bool memfile_undosys_poll(bContext *UNUSED(C))
+static bool memfile_undosys_poll(bContext *C)
{
/* other poll functions must run first, this is a catch-all. */
if ((U.uiflag & USER_GLOBALUNDO) == 0) {
return false;
}
+
+ /* Allow a single memfile undo step (the first). */
+ UndoStack *ustack = ED_undo_stack_get();
+ if ((ustack->step_active != NULL) &&
+ (ED_undo_is_memfile_compatible(C) == false))
+ {
+ return false;
+ }
return true;
}
-static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p)
{
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
/* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
- struct Main *bmain = CTX_data_main(C);
UndoStack *ustack = ED_undo_stack_get();
/* can be NULL, use when set. */
@@ -80,14 +82,30 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- /* Loading the content will correctly switch into compatible non-object modes. */
- ED_object_mode_exit(C);
+ ED_editors_exit(bmain, false);
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
BKE_memfile_undo_decode(us->data, C);
+ for (UndoStep *us_iter = us_p->next; us_iter; us_iter = us_iter->next) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = false;
+ }
+ for (UndoStep *us_iter = us_p; us_iter; us_iter = us_iter->prev) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = true;
+ }
+
+ /* bmain has been freed. */
+ bmain = CTX_data_main(C);
+ ED_editors_init_for_undo(bmain);
+
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
}
@@ -115,7 +133,6 @@ void ED_memfile_undosys_type(UndoType *ut)
ut->step_decode = memfile_undosys_step_decode;
ut->step_free = memfile_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MemFileUndoStep);
diff --git a/source/blender/editors/undo/undo_intern.h b/source/blender/editors/undo/undo_intern.h
index 03f9d248ba0..8184e7bfbdc 100644
--- a/source/blender/editors/undo/undo_intern.h
+++ b/source/blender/editors/undo/undo_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/undo_intern.h
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#ifndef __UNDO_INTERN_H__
diff --git a/source/blender/editors/undo/undo_system_types.c b/source/blender/editors/undo/undo_system_types.c
index 75c3d2cc1b7..0f052920993 100644
--- a/source/blender/editors/undo/undo_system_types.c
+++ b/source/blender/editors/undo/undo_system_types.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/undo_system_types.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#include <string.h>
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 6bef0f77e1a..55298e5c4ab 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c
index 011e9fc008c..ccd35983551 100644
--- a/source/blender/editors/util/ed_transverts.c
+++ b/source/blender/editors/util/ed_transverts.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/ed_transverts.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index b3ec0a4388f..ea99dd9996e 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/ed_util.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include <stdlib.h>
@@ -46,9 +39,6 @@
#include "BLI_string.h"
#include "BLI_path_util.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
#include "BLT_translation.h"
#include "BKE_context.h"
@@ -62,6 +52,7 @@
#include "BKE_screen.h"
#include "BKE_undo_system.h"
#include "BKE_workspace.h"
+#include "BKE_material.h"
#include "ED_armature.h"
#include "ED_buttons.h"
@@ -88,22 +79,40 @@
/* ********* general editor util funcs, not BKE stuff please! ********* */
+void ED_editors_init_for_undo(Main *bmain)
+{
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Base *base = BASACT(view_layer);
+ if (base != NULL) {
+ Object *ob = base->object;
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
+ Scene *scene = WM_window_get_active_scene(win);
+
+ BKE_texpaint_slots_refresh_object(ob);
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ }
+ }
+ }
+}
+
void ED_editors_init(bContext *C)
{
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
wmWindowManager *wm = CTX_wm_manager(C);
- if (wm->undo_stack == NULL) {
- wm->undo_stack = BKE_undosys_stack_create();
- }
-
/* This is called during initialization, so we don't want to store any reports */
ReportList *reports = CTX_wm_reports(C);
int reports_flag_prev = reports->flag & ~RPT_STORE;
SWAP(int, reports->flag, reports_flag_prev);
+ /* Don't do undo pushes when calling an operator. */
+ wm->op_undo_depth++;
+
/* toggle on modes for objects that were saved with these enabled. for
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
@@ -111,53 +120,86 @@ void ED_editors_init(bContext *C)
if (obact != NULL) {
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
int mode = ob->mode;
-
if (mode == OB_MODE_OBJECT) {
- /* pass */
+ continue;
+ }
+ else if (BKE_object_has_mode_data(ob, mode)) {
+ continue;
}
- else if (!BKE_object_has_mode_data(ob, mode)) {
+ else if (ob->type == OB_GPENCIL) {
/* For multi-edit mode we may already have mode data.
- * (grease pencil does not need it)
- */
- if (ob->type != OB_GPENCIL) {
- ID *data = ob->data;
- ob->mode = OB_MODE_OBJECT;
- if ((ob->type == obact->type) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) {
- if (mode == OB_MODE_EDIT) {
- ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ * (grease pencil does not need it) */
+ continue;
+ }
+
+ ID *ob_data = ob->data;
+ ob->mode = OB_MODE_OBJECT;
+ if ((ob->type == obact->type) &&
+ !ID_IS_LINKED(ob) &&
+ !(ob_data && ID_IS_LINKED(ob_data)))
+ {
+ if (mode == OB_MODE_EDIT) {
+ ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ }
+ else if (mode == OB_MODE_POSE) {
+ ED_object_posemode_enter_ex(bmain, ob);
+ }
+ else if (mode & OB_MODE_ALL_SCULPT) {
+ if (obact == ob) {
+ if (mode == OB_MODE_SCULPT) {
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
}
- else if (mode == OB_MODE_POSE) {
- ED_object_posemode_enter_ex(bmain, ob);
+ else if (mode == OB_MODE_VERTEX_PAINT) {
+ ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+ }
+ else if (mode == OB_MODE_WEIGHT_PAINT) {
+ ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
}
else {
- ED_object_mode_toggle(C, mode);
+ BLI_assert(0);
+ }
+ }
+ else {
+ /* Create data for non-active objects which need it for
+ * mode-switching but don't yet support multi-editing. */
+ if (mode & OB_MODE_ALL_SCULPT) {
+ ob->mode = mode;
+ BKE_object_sculpt_data_create(ob);
}
}
}
+ else {
+ /* TODO(campbell): avoid operator calls. */
+ if (obact == ob) {
+ ED_object_mode_toggle(C, mode);
+ }
+ }
}
}
}
+
/* image editor paint mode */
if (scene) {
ED_space_image_paint_update(bmain, wm, scene);
}
SWAP(int, reports->flag, reports_flag_prev);
+ wm->op_undo_depth--;
}
/* frees all editmode stuff */
-void ED_editors_exit(bContext *C)
+void ED_editors_exit(Main *bmain, bool do_undo_system)
{
- Main *bmain = CTX_data_main(C);
-
- if (!bmain)
+ if (!bmain) {
return;
+ }
/* frees all editmode undos */
- if (G_MAIN->wm.first) {
+ if (do_undo_system && G_MAIN->wm.first) {
wmWindowManager *wm = G_MAIN->wm.first;
- /* normally we don't check for NULL undo stack, do here since it may run in different context. */
+ /* normally we don't check for NULL undo stack,
+ * do here since it may run in different context. */
if (wm->undo_stack) {
BKE_undosys_stack_destroy(wm->undo_stack);
wm->undo_stack = NULL;
@@ -167,10 +209,10 @@ void ED_editors_exit(bContext *C)
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
- me->edit_btmesh = NULL;
+ if (me->edit_mesh) {
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
+ me->edit_mesh = NULL;
}
}
else if (ob->type == OB_ARMATURE) {
@@ -188,11 +230,10 @@ void ED_editors_exit(bContext *C)
/* flush any temp data from object editing to DNA before writing files,
* rendering, copying, etc. */
-bool ED_editors_flush_edits(const bContext *C, bool for_render)
+bool ED_editors_flush_edits(Main *bmain, bool for_render)
{
bool has_edited = false;
Object *ob;
- Main *bmain = CTX_data_main(C);
/* loop through all data to find edit mode or object mode, because during
* exiting we might not have a context for edit object and multiple sculpt
@@ -200,7 +241,8 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_SCULPT) {
/* Don't allow flushing while in the middle of a stroke (frees data in use).
- * Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
+ * Auto-save prevents this from happening but scripts
+ * may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
/* flush multires changes (for sculpt) */
multires_force_update(ob);
@@ -390,7 +432,8 @@ void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, ID *old_id,
static int ed_flush_edits_exec(bContext *C, wmOperator *UNUSED(op))
{
- ED_editors_flush_edits(C, false);
+ Main *bmain = CTX_data_main(C);
+ ED_editors_flush_edits(bmain, false);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/util/gizmo_utils.c b/source/blender/editors/util/gizmo_utils.c
index 6b150f93e38..002425b11b6 100644
--- a/source/blender/editors/util/gizmo_utils.c
+++ b/source/blender/editors/util/gizmo_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_utils.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*
* \name Generic Gizmo Utilities.
*/
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 52cf1b2d708..aeb764f9960 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,14 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Jonathan Smith
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/numinput.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "MEM_guardedalloc.h"
@@ -51,23 +45,30 @@
/* Numeric input which isn't allowing full numeric editing. */
#define USE_FAKE_EDIT
-/* NumInput.flag */
+/** #NumInput.flag
+ * (1 << 8) and below are reserved for public flags!
+ */
enum {
- /* (1 << 8) and below are reserved for public flags! */
- NUM_EDIT_FULL = (1 << 9), /* Enable full editing, with units and math operators support. */
+ /** Enable full editing, with units and math operators support. */
+ NUM_EDIT_FULL = (1 << 9),
#ifdef USE_FAKE_EDIT
- NUM_FAKE_EDITED = (1 << 10), /* Fake edited state (temp, avoids issue with backspace). */
+ /** Fake edited state (temp, avoids issue with backspace). */
+ NUM_FAKE_EDITED = (1 << 10),
#endif
};
/* NumInput.val_flag[] */
enum {
/* (1 << 8) and below are reserved for public flags! */
- NUM_EDITED = (1 << 9), /* User has edited this value somehow. */
- NUM_INVALID = (1 << 10), /* Current expression for this value is invalid. */
+ /** User has edited this value somehow. */
+ NUM_EDITED = (1 << 9),
+ /** Current expression for this value is invalid. */
+ NUM_INVALID = (1 << 10),
#ifdef USE_FAKE_EDIT
- NUM_NEGATE = (1 << 11), /* Current expression's result has to be negated. */
- NUM_INVERSE = (1 << 12), /* Current expression's result has to be inverted. */
+ /** Current expression's result has to be negated. */
+ NUM_NEGATE = (1 << 11),
+ /** Current expression's result has to be inverted. */
+ NUM_INVERSE = (1 << 12),
#endif
};
@@ -134,7 +135,8 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings)
n->unit_sys, n->unit_type[i], true, false);
}
- BLI_strncpy(before_cursor, n->str, n->str_cur + 1); /* +1 because of trailing '\0' */
+ /* +1 because of trailing '\0' */
+ BLI_strncpy(before_cursor, n->str, n->str_cur + 1);
BLI_snprintf(&str[j * ln], ln, "[%s%s|%s%s] = %s",
heading_exp, before_cursor, &n->str[n->str_cur], trailing_exp, val);
}
@@ -155,7 +157,8 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings)
const char *cur = (i == n->idx) ? "|" : "";
BLI_snprintf(&str[j * ln], ln, "%sNONE%s", cur, cur);
}
- /* We might have cut some multi-bytes utf8 chars (e.g. trailing '°' of degrees values can become only 'A')... */
+ /* We might have cut some multi-bytes utf8 chars
+ * (e.g. trailing '°' of degrees values can become only 'A')... */
BLI_utf8_invalid_strip(&str[j * ln], strlen(&str[j * ln]));
}
}
@@ -258,13 +261,7 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni
{
#ifdef WITH_PYTHON
double unit_scale = BKE_scene_unit_scale(unit, type, 1.0);
- if (!bUnit_ContainsUnit(str, unit->system, type)) {
- int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
- *r_value *= bUnit_PreferredUnitScalar(unit, type);
- *r_value /= unit_scale;
- return success;
- }
- else {
+ if (bUnit_ContainsUnit(str, type)) {
char str_unit_convert[256];
BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
bUnit_ReplaceString(
@@ -273,6 +270,12 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni
return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value);
}
+ else {
+ int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
+ *r_value *= bUnit_PreferredInputUnitScalar(unit, type);
+ *r_value /= unit_scale;
+ return success;
+ }
#else
*r_value = atof(str);
return true;
@@ -354,7 +357,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
updated = true;
break;
}
- /* Else, common behavior with DELKEY, only difference is remove char(s) before/after the cursor. */
+ /* Else, common behavior with DELKEY,
+ * only difference is remove char(s) before/after the cursor. */
dir = STRCUR_DIR_PREV;
ATTR_FALLTHROUGH;
case DELKEY:
@@ -369,7 +373,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
SWAP(int, t_cur, cur);
n->str_cur = cur;
}
- memmove(&n->str[cur], &n->str[t_cur], strlen(&n->str[t_cur]) + 1); /* +1 for trailing '\0'. */
+ /* +1 for trailing '\0'. */
+ memmove(&n->str[cur], &n->str[t_cur], strlen(&n->str[t_cur]) + 1);
updated = true;
}
if (!n->str[0]) {
@@ -423,7 +428,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
return true;
case PADPERIOD:
case PERIODKEY:
- /* Force numdot, some OSs/countries generate a comma char in this case, sic... (T37992) */
+ /* Force numdot, some OSs/countries generate a comma char in this case,
+ * sic... (T37992) */
ascii[0] = '.';
utf8_buf = ascii;
break;
@@ -542,7 +548,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
return false;
}
- /* At this point, our value has changed, try to interpret it with python (if str is not empty!). */
+ /* At this point, our value has changed, try to interpret it with python
+ * (if str is not empty!). */
if (n->str[0]) {
const float val_prev = n->val[idx];
Scene *sce = CTX_data_scene(C);
@@ -565,7 +572,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
}
if (n->val_flag[idx] & NUM_INVERSE) {
val = n->val[idx];
- /* If we invert on radians when user is in degrees, you get unexpected results... See T53463. */
+ /* If we invert on radians when user is in degrees,
+ * you get unexpected results... See T53463. */
if (!n->unit_use_radians && n->unit_type[idx] == B_UNIT_ROTATION) {
val = RAD2DEG(val);
}
diff --git a/source/blender/editors/util/select_utils.c b/source/blender/editors/util/select_utils.c
index 92de124800b..b0b001ee238 100644
--- a/source/blender/editors/util/select_utils.c
+++ b/source/blender/editors/util/select_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file select_utils.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index a933717fe98..c54c3851ee7 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index 4af46ffa610..6f8bfac8c57 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_buttons.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#include <string.h>
@@ -237,7 +231,7 @@ void ED_uvedit_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
strcpy(pt->idname, "IMAGE_PT_uv");
- strcpy(pt->label, N_("UV Vertex")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("UV Vertex")); /* XXX C panels unavailable through RNA bpy.types! */
pt->draw = image_panel_uv;
pt->poll = image_panel_uv_poll;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index dcdcc50db6e..8bc2be11934 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_draw.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -47,8 +41,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_buffer.h"
-#include "BLI_bitmap.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
@@ -57,8 +49,6 @@
#include "BKE_scene.h"
-#include "BIF_glutil.h"
-
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
@@ -79,10 +69,8 @@
#include "uvedit_intern.h"
-static int draw_uvs_face_check(Scene *scene)
+static int draw_uvs_face_check(const ToolSettings *ts)
{
- ToolSettings *ts = scene->toolsettings;
-
/* checks if we are selecting only faces */
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode == SCE_SELECT_FACE)
@@ -96,34 +84,6 @@ static int draw_uvs_face_check(Scene *scene)
return (ts->uv_selectmode == UV_SELECT_FACE);
}
-static uchar get_state(SpaceImage *sima, Scene *scene)
-{
- ToolSettings *ts = scene->toolsettings;
- int drawfaces = draw_uvs_face_check(scene);
- const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
- uchar state = UVEDIT_EDGES | UVEDIT_DATA;
-
- if (drawfaces) {
- state |= UVEDIT_FACEDOTS;
- }
- if (draw_stretch || !(sima->flag & SI_NO_DRAWFACES)) {
- state |= UVEDIT_FACES;
-
- if (draw_stretch) {
- if (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA) {
- state |= UVEDIT_STRETCH_AREA;
- }
- else {
- state |= UVEDIT_STRETCH_ANGLE;
- }
- }
- }
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- state |= UVEDIT_SYNC_SEL;
- }
- return state;
-}
-
/* ------------------------- */
void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
@@ -192,20 +152,52 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
GPU_matrix_translate_2f(-cursor[0], -cursor[1]);
}
-static void draw_uvs_shadow(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *depsgraph)
+static void uvedit_get_batches(
+ Object *ob, SpaceImage *sima, const ToolSettings *ts,
+ GPUBatch **faces, GPUBatch **edges, GPUBatch **verts, GPUBatch **facedots)
+{
+ int drawfaces = draw_uvs_face_check(ts);
+ const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
+ const bool draw_faces = (sima->flag & SI_NO_DRAWFACES) == 0;
+
+ *edges = DRW_mesh_batch_cache_get_edituv_edges(ob->data);
+ *verts = DRW_mesh_batch_cache_get_edituv_verts(ob->data);
+
+ if (drawfaces) {
+ *facedots = DRW_mesh_batch_cache_get_edituv_facedots(ob->data);
+ }
+ else {
+ *facedots = NULL;
+ }
+
+ if (draw_stretch && (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces_strech_area(ob->data);
+ }
+ else if (draw_stretch) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces_strech_angle(ob->data);
+ }
+ else if (draw_faces) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces(ob->data);
+ }
+ else {
+ *faces = NULL;
+ }
+
+ DRW_mesh_batch_cache_create_requested(ob, ob->data, ts, false, false);
+}
+
+static void draw_uvs_shadow(SpaceImage *UNUSED(sima), Scene *scene, Object *obedit, Depsgraph *depsgraph)
{
Object *eval_ob = DEG_get_evaluated_object(depsgraph, obedit);
- GPUBatch *faces, *edges, *verts, *facedots;
- uchar state = UVEDIT_EDGES | UVEDIT_DATA;
+ Mesh *me = eval_ob->data;
float col[4];
UI_GetThemeColor4fv(TH_UV_SHADOW, col);
- DRW_mesh_cache_uvedit(
- eval_ob, sima, scene, state,
- &faces, &edges, &verts, &facedots);
+ GPUBatch *edges = DRW_mesh_batch_cache_get_uv_edges(me);
+ DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false);
if (edges) {
- GPU_batch_program_set_builtin(edges, GPU_SHADER_2D_UNIFORM_COLOR);
+ GPU_batch_program_set_builtin(edges, GPU_SHADER_2D_UV_UNIFORM_COLOR);
GPU_batch_uniform_4fv(edges, "color", col);
GPU_batch_draw(edges);
}
@@ -216,14 +208,17 @@ static void draw_uvs_texpaint(Scene *scene, Object *ob, Depsgraph *depsgraph)
Object *eval_ob = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me = eval_ob->data;
ToolSettings *ts = scene->toolsettings;
- GPUBatch *geom = DRW_mesh_batch_cache_get_texpaint_loop_wire(me);
float col[4];
UI_GetThemeColor4fv(TH_UV_SHADOW, col);
- if (!geom)
+ if (me->mloopuv == NULL) {
return;
+ }
- GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_UNIFORM_COLOR);
+ GPUBatch *geom = DRW_mesh_batch_cache_get_uv_edges(me);
+ DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false);
+
+ GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_UV_UNIFORM_COLOR);
GPU_batch_uniform_4fv(geom, "color", col);
const bool do_material_masking = (ts->uv_flag & UV_SHOW_SAME_IMAGE);
@@ -268,12 +263,16 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
{
GPUBatch *faces, *edges, *verts, *facedots;
Object *eval_ob = DEG_get_evaluated_object(depsgraph, obedit);
- ToolSettings *ts = scene->toolsettings;
+ const ToolSettings *ts = scene->toolsettings;
float col1[4], col2[4], col3[4], transparent[4] = {0.0f, 0.0f, 0.0f, 0.0f};
if (sima->flag & SI_DRAWSHADOW) {
- /* XXX TODO: Need to check if shadow mesh is different than original mesh. */
- bool is_cage_like_final_meshes = true;
+ bool is_cage_like_final_meshes = false;
+ Mesh *me = (Mesh *)eval_ob->data;
+ BMEditMesh *embm = me->edit_mesh;
+ is_cage_like_final_meshes = embm &&
+ embm->mesh_eval_final &&
+ embm->mesh_eval_final->runtime.is_original;
/* When sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, there is no point in drawing this. */
@@ -282,16 +281,15 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
}
}
- uchar state = get_state(sima, scene);
-
- DRW_mesh_cache_uvedit(
- eval_ob, sima, scene, state,
+ uvedit_get_batches(
+ eval_ob, sima, ts,
&faces, &edges, &verts, &facedots);
+
bool interpedges;
bool do_elem_order_fix = (ts->uv_flag & UV_SYNC_SELECTION) && (ts->selectmode & SCE_SELECT_FACE);
bool do_selected_edges = ((sima->flag & SI_NO_DRAWEDGES) == 0);
- bool draw_stretch = (state & (UVEDIT_STRETCH_AREA | UVEDIT_STRETCH_ANGLE)) != 0;
+ bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
if (ts->uv_flag & UV_SYNC_SELECTION) {
interpedges = (ts->selectmode & SCE_SELECT_VERTEX) != 0;
}
@@ -303,7 +301,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
if (faces) {
GPU_batch_program_set_builtin(faces, (draw_stretch)
- ? GPU_SHADER_2D_UV_FACES_STRETCH
+ ? (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)
+ ? GPU_SHADER_2D_UV_FACES_STRETCH_AREA
+ : GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE
: GPU_SHADER_2D_UV_FACES);
if (!draw_stretch) {
@@ -317,6 +317,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
GPU_batch_uniform_4fv(faces, "selectColor", col2);
GPU_batch_uniform_4fv(faces, "activeColor", col3);
}
+ else if (sima->dt_uvstretch == SI_UVDT_STRETCH_ANGLE) {
+ float asp[2];
+ ED_space_image_get_uv_aspect(sima, &asp[0], &asp[1]);
+ GPU_batch_uniform_2fv(faces, "aspect", asp);
+ }
GPU_batch_draw(faces);
@@ -369,7 +374,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
UI_GetThemeColor4fv(TH_WIRE_EDIT, col1);
UI_GetThemeColor4fv(TH_EDGE_SELECT, col2);
- /* We could modify the vbo's data filling instead of modifying the provoking vert. */
+ /* We could modify the vbo's data filling
+ * instead of modifying the provoking vert. */
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
GPU_line_width(1.0f);
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index eed9d68f39c..5510549ba0e 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,32 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_intern.h
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#ifndef __UVEDIT_INTERN_H__
#define __UVEDIT_INTERN_H__
+struct BMEditMesh;
+struct BMFace;
+struct BMLoop;
struct Image;
struct Object;
struct Scene;
struct SpaceImage;
struct wmOperatorType;
-struct BMEditMesh;
-struct BMFace;
-struct BMLoop;
-
-/* visibility and selection */
-bool uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
/* geometric utilities */
void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index bb0c11b171b..11420aa32f0 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_ops.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -243,35 +235,38 @@ static void uvedit_vertex_select_tagged(BMEditMesh *em, Scene *scene, bool selec
}
}
-bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
+bool uvedit_face_visible_nolocal_ex(const ToolSettings *ts, BMFace *efa)
{
- ToolSettings *ts = scene->toolsettings;
-
if (ts->uv_flag & UV_SYNC_SELECTION)
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0);
else
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0 && BM_elem_flag_test(efa, BM_ELEM_SELECT));
}
-
-bool uvedit_face_visible_test(Scene *scene, Object *obedit, Image *ima, BMFace *efa)
+bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
{
- ToolSettings *ts = scene->toolsettings;
+ return uvedit_face_visible_nolocal_ex(scene->toolsettings, efa);
+}
+bool uvedit_face_visible_test_ex(const ToolSettings *ts, Object *obedit, Image *ima, BMFace *efa)
+{
if (ts->uv_flag & UV_SHOW_SAME_IMAGE) {
Image *face_image;
ED_object_get_active_image(obedit, efa->mat_nr + 1, &face_image, NULL, NULL, NULL);
- return (face_image == ima) ? uvedit_face_visible_nolocal(scene, efa) : false;
+ return (face_image == ima) ? uvedit_face_visible_nolocal_ex(ts, efa) : false;
}
else {
- return uvedit_face_visible_nolocal(scene, efa);
+ return uvedit_face_visible_nolocal_ex(ts, efa);
}
}
+bool uvedit_face_visible_test(Scene *scene, Object *obedit, Image *ima, BMFace *efa)
+{
+ return uvedit_face_visible_test_ex(scene->toolsettings, obedit, ima, efa);
+}
-bool uvedit_face_select_test(
- Scene *scene, BMFace *efa,
+bool uvedit_face_select_test_ex(
+ const ToolSettings *ts, BMFace *efa,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
return (BM_elem_flag_test(efa, BM_ELEM_SELECT));
}
@@ -289,6 +284,10 @@ bool uvedit_face_select_test(
return true;
}
}
+bool uvedit_face_select_test(Scene *scene, BMFace *efa, const int cd_loop_uv_offset)
+{
+ return uvedit_face_select_test_ex(scene->toolsettings, efa, cd_loop_uv_offset);
+}
bool uvedit_face_select_set(
struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select,
@@ -355,12 +354,10 @@ bool uvedit_face_select_disable(
return false;
}
-bool uvedit_edge_select_test(
- Scene *scene, BMLoop *l,
+bool uvedit_edge_select_test_ex(
+ const ToolSettings *ts, BMLoop *l,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
-
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode & SCE_SELECT_FACE) {
return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
@@ -382,6 +379,10 @@ bool uvedit_edge_select_test(
return (luv1->flag & MLOOPUV_VERTSEL) && (luv2->flag & MLOOPUV_VERTSEL);
}
}
+bool uvedit_edge_select_test(Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
+{
+ return uvedit_edge_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
+}
void uvedit_edge_select_set(
BMEditMesh *em, Scene *scene, BMLoop *l, const bool select,
@@ -456,12 +457,10 @@ void uvedit_edge_select_disable(
}
}
-bool uvedit_uv_select_test(
- Scene *scene, BMLoop *l,
+bool uvedit_uv_select_test_ex(
+ const ToolSettings *ts, BMLoop *l,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
-
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode & SCE_SELECT_FACE)
return BM_elem_flag_test_bool(l->f, BM_ELEM_SELECT);
@@ -473,6 +472,10 @@ bool uvedit_uv_select_test(
return (luv->flag & MLOOPUV_VERTSEL) != 0;
}
}
+bool uvedit_uv_select_test(Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
+{
+ return uvedit_uv_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
+}
void uvedit_uv_select_set(
BMEditMesh *em, Scene *scene, BMLoop *l, const bool select,
@@ -1791,7 +1794,8 @@ static void UV_OT_align(wmOperatorType *ot)
"Automatically choose the axis on which there is most alignment already"},
{UV_ALIGN_X, "ALIGN_X", 0, "Align X", "Align UVs on X axis"},
{UV_ALIGN_Y, "ALIGN_Y", 0, "Align Y", "Align UVs on Y axis"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Align";
@@ -2328,7 +2332,9 @@ static int uv_mouse_select_multi(
UvNearestHit hit = UV_NEAREST_HIT_INIT;
int i, selectmode, sticky, sync, *hitv = NULL;
bool select = true;
- int flush = 0, hitlen = 0; /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
+ /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
+ int flush = 0;
+ int hitlen = 0;
float limit[2], **hituv = NULL;
/* notice 'limit' is the same no matter the zoom level, since this is like
@@ -2460,7 +2466,8 @@ static int uv_mouse_select_multi(
/* TODO(MULTI_EDIT): We only need to de-select non-active */
uv_select_all_perform_multi(scene, ima, objects, objects_len, SEL_DESELECT);
}
- /* Current behavior of 'extend' is actually toggling, so pass extend flag as 'toggle' here */
+ /* Current behavior of 'extend'
+ * is actually toggling, so pass extend flag as 'toggle' here */
uv_select_linked_multi(scene, ima, objects, objects_len, limit, &hit, false, false, extend, false);
}
else if (extend) {
@@ -3665,7 +3672,8 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
static const EnumPropertyItem target_items[] = {
{0, "PIXELS", 0, "Pixels", ""},
{1, "SELECTED", 0, "Selected", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Snap Cursor";
@@ -3898,7 +3906,8 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
{1, "CURSOR", 0, "Cursor", ""},
{2, "CURSOR_OFFSET", 0, "Cursor (Offset)", ""},
{3, "ADJACENT_UNSELECTED", 0, "Adjacent Unselected", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Snap Selection";
@@ -4105,9 +4114,9 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
if (ts->uv_flag & UV_SYNC_SELECTION) {
- EDBM_mesh_hide(em, swap);
- EDBM_update_generic(em, true, false);
-
+ if (EDBM_mesh_hide(em, swap)) {
+ EDBM_update_generic(em, true, false);
+ }
return OPERATOR_FINISHED;
}
@@ -4228,9 +4237,9 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
/* call the mesh function if we are in mesh sync sel */
if (ts->uv_flag & UV_SYNC_SELECTION) {
- EDBM_mesh_reveal(em, select);
- EDBM_update_generic(em, true, false);
-
+ if (EDBM_mesh_reveal(em, select)) {
+ EDBM_update_generic(em, true, false);
+ }
return OPERATOR_FINISHED;
}
if (use_face_center) {
@@ -4423,7 +4432,7 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
UvVertMap *vmap;
@@ -4453,7 +4462,8 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
UvMapVert *mv1, *mvinit1, *mv2, *mvinit2, *mviter;
/* mv2cache stores the first of the list of coincident uv's for later comparison
- * mv2sep holds the last separator and is copied to mv2cache when a hit is first found */
+ * mv2sep holds the last separator and is copied to mv2cache
+ * when a hit is first found */
UvMapVert *mv2cache = NULL, *mv2sep = NULL;
mvinit1 = vmap->vert[BM_elem_index_get(editedge->v1)];
@@ -4564,10 +4574,12 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, ((View3D *)NULL), &objects_len);
+ bool changed = false;
+
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
if (synced_selection && (bm->totedgesel == 0)) {
@@ -4576,8 +4588,6 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
- bool changed = false;
-
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_edge_select_test(scene, loop, cd_loop_uv_offset)) {
@@ -4588,14 +4598,15 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
}
if (changed) {
- if (scene->toolsettings->edge_mode_live_unwrap) {
- ED_unwrap_lscm(scene, ob, false, false);
- }
-
DEG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
}
}
+
+ if (changed) {
+ ED_uvedit_live_unwrap(scene, objects, objects_len);
+ }
+
MEM_freeN(objects);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index c2775014519..1a4e040472e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,20 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_parametrizer.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_alloca.h"
#include "BLI_memarena.h"
#include "BLI_math.h"
#include "BLI_rand.h"
@@ -72,7 +65,7 @@
#endif
typedef enum PBool {
P_TRUE = 1,
- P_FALSE = 0
+ P_FALSE = 0,
} PBool;
/* Special Purpose Hash */
@@ -92,11 +85,11 @@ typedef struct PHash {
-struct PVert;
+struct PChart;
struct PEdge;
struct PFace;
-struct PChart;
struct PHandle;
+struct PVert;
/* Simplices */
@@ -155,7 +148,7 @@ enum PVertFlag {
PVERT_SELECT = 2,
PVERT_INTERIOR = 4,
PVERT_COLLAPSE = 8,
- PVERT_SPLIT = 16
+ PVERT_SPLIT = 16,
};
enum PEdgeFlag {
@@ -167,7 +160,7 @@ enum PEdgeFlag {
PEDGE_FILLED = 32,
PEDGE_COLLAPSE = 64,
PEDGE_COLLAPSE_EDGE = 128,
- PEDGE_COLLAPSE_PAIR = 256
+ PEDGE_COLLAPSE_PAIR = 256,
};
/* for flipping faces */
@@ -176,7 +169,7 @@ enum PEdgeFlag {
enum PFaceFlag {
PFACE_CONNECTED = 1,
PFACE_FILLED = 2,
- PFACE_COLLAPSE = 4
+ PFACE_COLLAPSE = 4,
};
/* Chart */
@@ -208,14 +201,14 @@ typedef struct PChart {
} PChart;
enum PChartFlag {
- PCHART_NOPACK = 1
+ PCHART_HAS_PINS = 1,
};
enum PHandleState {
PHANDLE_STATE_ALLOCATED,
PHANDLE_STATE_CONSTRUCTED,
PHANDLE_STATE_LSCM,
- PHANDLE_STATE_STRETCH
+ PHANDLE_STATE_STRETCH,
};
typedef struct PHandle {
@@ -248,7 +241,7 @@ typedef struct PHandle {
static int PHashSizes[] = {
1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
- 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459
+ 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459,
};
#define PHASH_hash(ph, item) (((uintptr_t) (item)) % ((unsigned int) (ph)->cursize))
@@ -996,6 +989,10 @@ static void p_split_vert(PChart *chart, PEdge *e)
PVert *v = e->vert;
PBool copy = P_TRUE;
+ if (e->flag & PEDGE_PIN) {
+ chart->flag |= PCHART_HAS_PINS;
+ }
+
if (e->flag & PEDGE_VERTEX_SPLIT)
return;
@@ -3062,9 +3059,6 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
chart->u.lscm.pin1 = pin1;
chart->u.lscm.pin2 = pin2;
}
- else {
- chart->flag |= PCHART_NOPACK;
- }
for (v = chart->verts; v; v = v->nextlink)
v->u.id = id++;
@@ -4350,7 +4344,7 @@ void param_lscm_solve(ParamHandle *handle)
if (chart->u.lscm.context) {
result = p_chart_lscm_solve(phandle, chart);
- if (result && !(chart->flag & PCHART_NOPACK))
+ if (result && !(chart->flag & PCHART_HAS_PINS))
p_chart_rotate_minimum_area(chart);
if (!result || (chart->u.lscm.pin1))
@@ -4457,7 +4451,7 @@ void param_smooth_area(ParamHandle *handle)
}
/* don't pack, just rotate (used for better packing) */
-static void param_pack_rotate(ParamHandle *handle)
+static void param_pack_rotate(ParamHandle *handle, bool ignore_pinned)
{
PChart *chart;
int i;
@@ -4470,7 +4464,7 @@ static void param_pack_rotate(ParamHandle *handle)
chart = phandle->charts[i];
- if (chart->flag & PCHART_NOPACK) {
+ if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) {
continue;
}
@@ -4490,7 +4484,7 @@ static void param_pack_rotate(ParamHandle *handle)
}
}
-void param_pack(ParamHandle *handle, float margin, bool do_rotate)
+void param_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
{
/* box packing variables */
BoxPack *boxarray, *box;
@@ -4508,7 +4502,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
/* this could be its own function */
if (do_rotate) {
- param_pack_rotate(handle);
+ param_pack_rotate(handle, ignore_pinned);
}
if (phandle->aspx != phandle->aspy)
@@ -4521,7 +4515,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
- if (chart->flag & PCHART_NOPACK) {
+ if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) {
unpacked++;
continue;
}
@@ -4537,7 +4531,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
box->w = chart->u.pack.size[0] + trans[0];
box->h = chart->u.pack.size[1] + trans[1];
- box->index = i; /* warning this index skips PCHART_NOPACK boxes */
+ box->index = i; /* warning this index skips PCHART_HAS_PINS boxes */
if (margin > 0.0f)
area += (double)sqrtf(box->w * box->h);
@@ -4546,13 +4540,14 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
if (margin > 0.0f) {
/* multiply the margin by the area to give predictable results not dependent on UV scale,
* ...Without using the area running pack multiple times also gives a bad feedback loop.
- * multiply by 0.1 so the margin value from the UI can be from 0.0 to 1.0 but not give a massive margin */
+ * multiply by 0.1 so the margin value from the UI can be from
+ * 0.0 to 1.0 but not give a massive margin */
margin = (margin * (float)area) * 0.1f;
unpacked = 0;
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
- if (chart->flag & PCHART_NOPACK) {
+ if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) {
unpacked++;
continue;
}
@@ -4588,7 +4583,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
param_scale(handle, phandle->aspx, phandle->aspy);
}
-void param_average(ParamHandle *handle)
+void param_average(ParamHandle *handle, bool ignore_pinned)
{
PChart *chart;
int i;
@@ -4604,8 +4599,9 @@ void param_average(ParamHandle *handle)
PFace *f;
chart = phandle->charts[i];
- if (chart->flag & PCHART_NOPACK)
+ if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) {
continue;
+ }
chart->u.pack.area = 0.0f; /* 3d area */
chart->u.pack.rescale = 0.0f; /* UV area, abusing rescale for tmp storage, oh well :/ */
@@ -4629,8 +4625,9 @@ void param_average(ParamHandle *handle)
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
- if (chart->flag & PCHART_NOPACK)
+ if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) {
continue;
+ }
if (chart->u.pack.area != 0.0f && chart->u.pack.rescale != 0.0f) {
fac = chart->u.pack.area / chart->u.pack.rescale;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index e42944f3da4..6724b568f57 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,17 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __UVEDIT_PARAMETRIZER_H__
#define __UVEDIT_PARAMETRIZER_H__
-/** \file blender/editors/uvedit/uvedit_parametrizer.h
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#ifdef __cplusplus
@@ -37,7 +31,7 @@ typedef void ParamHandle; /* handle to a set of charts */
typedef intptr_t ParamKey; /* (hash) key for identifying verts and faces */
typedef enum ParamBool {
PARAM_TRUE = 1,
- PARAM_FALSE = 0
+ PARAM_FALSE = 0,
} ParamBool;
/* Chart construction:
@@ -98,11 +92,11 @@ void param_smooth_area(ParamHandle *handle);
/* Packing */
-void param_pack(ParamHandle *handle, float margin, bool do_rotate);
+void param_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned);
/* Average area for all charts */
-void param_average(ParamHandle *handle);
+void param_average(ParamHandle *handle, bool ignore_pinned);
/* Simple x,y scale */
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index b7103ad90f0..91167e247f4 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_smart_stitch.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -48,8 +40,6 @@
#include "BLT_translation.h"
-#include "BIF_gl.h"
-
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_mesh_mapping.h"
@@ -89,7 +79,8 @@ typedef struct StitchPreviewer {
unsigned int *uvs_per_polygon;
/*number of preview polygons */
unsigned int num_polys;
- /* preview data. These will be either the previewed vertices or edges depending on stitch mode settings */
+ /* preview data. These will be either the previewed vertices or edges
+ * depending on stitch mode settings */
float *preview_stitchable;
float *preview_unstitchable;
/* here we'll store the number of elements to be drawn */
@@ -134,16 +125,19 @@ typedef struct UVVertAverage {
} UVVertAverage;
typedef struct UvEdge {
- /* index to uv buffer */
+ /** index to uv buffer */
unsigned int uv1;
unsigned int uv2;
- /* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */
+ /** general use flag
+ * (Used to check if edge is boundary here, and propagates to adjacency elements) */
unsigned char flag;
- /* element that guarantees element->face has the edge on element->tfindex and element->tfindex+1 is the second uv */
+ /** element that guarantees element->face
+ * has the edge on element->tfindex and element->tfindex+1 is the second uv */
UvElement *element;
- /* next uv edge with the same exact vertices as this one.. Calculated at startup to save time */
+ /** next uv edge with the same exact vertices as this one.
+ * Calculated at startup to save time */
struct UvEdge *next;
- /* point to first of common edges. Needed for iteration */
+ /** point to first of common edges. Needed for iteration */
struct UvEdge *first;
} UvEdge;
@@ -230,7 +224,7 @@ typedef struct PreviewPosition {
enum StitchModes {
STITCH_VERT,
- STITCH_EDGE
+ STITCH_EDGE,
};
/* UvElement identification. */
@@ -347,7 +341,8 @@ static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2],
uv[1] *= aspect;
}
-/* check if two uvelements are stitchable. This should only operate on -different- separate UvElements */
+/* check if two uvelements are stitchable.
+ * This should only operate on -different- separate UvElements */
static bool stitch_check_uvs_stitchable(
UvElement *element, UvElement *element_iter,
StitchStateContainer *ssc, StitchState *state)
@@ -566,8 +561,9 @@ static void stitch_island_calculate_edge_rotation(
index1 = edge->uv1;
index2 = edge->uv2;
}
- /* the idea here is to take the directions of the edges and find the rotation between final and initial
- * direction. This, using inner and outer vector products, gives the angle. Directions are differences so... */
+ /* the idea here is to take the directions of the edges and find the rotation between
+ * final and initial direction. This, using inner and outer vector products,
+ * gives the angle. Directions are differences so... */
uv1[0] = luv2->uv[0] - luv1->uv[0];
uv1[1] = luv2->uv[1] - luv1->uv[1];
@@ -770,7 +766,8 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
* I am not too sure we want this though */
last_set->next = edge2;
last_set = edge2;
- /* set first, similarly to uv elements. Now we can iterate among common edges easily */
+ /* set first, similarly to uv elements.
+ * Now we can iterate among common edges easily */
edge2->first = edge;
}
}
@@ -1063,7 +1060,8 @@ static int stitch_process_data(
while (!(island_stitch_data[ssc->static_island].stitchableCandidate)) {
ssc->static_island++;
ssc->static_island %= state->element_map->totalIslands;
- /* this is entirely possible if for example limit stitching with no stitchable verts or no selection */
+ /* this is entirely possible if for example limit stitching
+ * with no stitchable verts or no selection */
if (ssc->static_island == previous_island) {
break;
}
@@ -1219,7 +1217,8 @@ static int stitch_process_data(
/* copy data from MLoopUVs to the preview display buffers */
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- /* just to test if face was added for processing. uvs of unselected vertices will return NULL */
+ /* just to test if face was added for processing.
+ * uvs of unselected vertices will return NULL */
UvElement *element = BM_uv_element_get(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
if (element) {
@@ -1366,7 +1365,8 @@ static int stitch_process_data(
}
}
- /* take mean position here. For edge case, this can't be done inside the loop for shared uvverts */
+ /* take mean position here.
+ * For edge case, this can't be done inside the loop for shared uvverts */
if (ssc->mode == STITCH_EDGE && stitch_midpoints) {
for (i = 0; i < state->total_separate_uvs; i++) {
final_position[i].uv[0] /= final_position[i].count;
@@ -1899,7 +1899,8 @@ static StitchState *stitch_init(
}
}
- /* explicitly set preview to NULL, to avoid deleting an invalid pointer on stitch_process_data */
+ /* explicitly set preview to NULL,
+ * to avoid deleting an invalid pointer on stitch_process_data */
state->stitch_preview = NULL;
/* Allocate the unique uv buffers */
state->uvs = MEM_mallocN(sizeof(*state->uvs) * counter, "uv_stitch_unique_uvs");
@@ -2493,9 +2494,9 @@ static StitchState *stitch_select(
if (ssc->mode == STITCH_VERT) {
if (uv_find_nearest_vert_multi(scene, ima, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) {
- /* Add vertex to selection, deselect all common uv's of vert other
- * than selected and update the preview. This behavior was decided so that
- * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */
+ /* Add vertex to selection, deselect all common uv's of vert other than selected and
+ * update the preview. This behavior was decided so that you can do stuff like deselect
+ * the opposite stitchable vertex and the initial still gets deselected */
/* find StitchState from hit->ob */
StitchState *state = NULL;
@@ -2702,7 +2703,7 @@ void UV_OT_stitch(wmOperatorType *ot)
static const EnumPropertyItem stitch_modes[] = {
{STITCH_VERT, "VERTEX", 0, "Vertex", ""},
{STITCH_EDGE, "EDGE", 0, "Edge", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2743,8 +2744,8 @@ void UV_OT_stitch(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
/* test should not be editable or viewed in toolbar */
- prop = RNA_def_int_array(ot->srna, "objects_selection_count", 1, NULL, 0, INT_MAX, "objects_selection_count",
- "objects_selection_count", 0, INT_MAX);
+ prop = RNA_def_int_array(ot->srna, "objects_selection_count", 1, NULL, 0, INT_MAX, "Objects Selection Count",
+ "", 0, INT_MAX);
RNA_def_property_array(prop, 6);
RNA_def_property_flag(prop, PROP_HIDDEN);
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 55026c9e788..1dc681e8ec1 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_unwrap_ops.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -164,7 +156,14 @@ static bool ED_uvedit_ensure_uvs(bContext *C, Scene *UNUSED(scene), Object *obed
/****************** Parametrizer Conversion ***************/
-static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
+typedef struct UnwrapOptions {
+ bool topology_from_uvs; /* Connectivity based on UV coordinates instead of seams. */
+ bool only_selected; /* Only affect selected faces. */
+ bool fill_holes; /* Fill holes to better preserve shape. */
+ bool correct_aspect; /* Correct for mapped image texture aspect ratio. */
+} UnwrapOptions;
+
+static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, const UnwrapOptions *options)
{
BMFace *efa;
BMLoop *l;
@@ -190,7 +189,7 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
break;
}
- if (implicit && !l)
+ if (options->topology_from_uvs && !l)
continue;
return true;
@@ -200,13 +199,14 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
}
static bool uvedit_have_selection_multi(
- Scene *scene, Object **objects, const uint objects_len, bool implicit)
+ Scene *scene, Object **objects, const uint objects_len,
+ const UnwrapOptions *options)
{
bool have_select = false;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- if (uvedit_have_selection(scene, em, implicit)) {
+ if (uvedit_have_selection(scene, em, options)) {
have_select = true;
break;
}
@@ -268,8 +268,7 @@ static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene,
/* See: construct_param_handle_multi to handle multiple objects at once. */
static ParamHandle *construct_param_handle(
Scene *scene, Object *ob, BMesh *bm,
- const bool implicit, const bool fill, const bool sel,
- const bool correct_aspect)
+ const UnwrapOptions *options)
{
ParamHandle *handle;
BMFace *efa;
@@ -282,7 +281,7 @@ static ParamHandle *construct_param_handle(
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
float aspx, aspy;
ED_uvedit_get_aspect(scene, ob, bm, &aspx, &aspy);
@@ -296,11 +295,13 @@ static ParamHandle *construct_param_handle(
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
- if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0)) {
+ if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) ||
+ (options->only_selected && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
+ {
continue;
}
- if (implicit) {
+ if (options->topology_from_uvs) {
bool is_loopsel = false;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -317,7 +318,7 @@ static ParamHandle *construct_param_handle(
construct_param_handle_face_add(handle, scene, efa, i, cd_loop_uv_offset);
}
- if (!implicit) {
+ if (!options->topology_from_uvs) {
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
ParamKey vkeys[2];
@@ -328,7 +329,7 @@ static ParamHandle *construct_param_handle(
}
}
- param_construct_end(handle, fill, implicit);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
return handle;
}
@@ -338,8 +339,7 @@ static ParamHandle *construct_param_handle(
*/
static ParamHandle *construct_param_handle_multi(
Scene *scene, Object **objects, const uint objects_len,
- const bool implicit, const bool fill, const bool sel,
- const bool correct_aspect)
+ const UnwrapOptions *options)
{
ParamHandle *handle;
BMFace *efa;
@@ -348,10 +348,9 @@ static ParamHandle *construct_param_handle_multi(
BMIter iter, liter;
int i;
-
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
Object *ob = objects[0];
BMEditMesh *em = BKE_editmesh_from_object(ob);
BMesh *bm = em->bm;
@@ -377,11 +376,13 @@ static ParamHandle *construct_param_handle_multi(
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
- if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0)) {
+ if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) ||
+ (options->only_selected && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
+ {
continue;
}
- if (implicit) {
+ if (options->topology_from_uvs) {
bool is_loopsel = false;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -398,7 +399,7 @@ static ParamHandle *construct_param_handle_multi(
construct_param_handle_face_add(handle, scene, efa, i + offset, cd_loop_uv_offset);
}
- if (!implicit) {
+ if (!options->topology_from_uvs) {
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
ParamKey vkeys[2];
@@ -411,7 +412,7 @@ static ParamHandle *construct_param_handle_multi(
offset += bm->totface;
}
- param_construct_end(handle, fill, implicit);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
return handle;
}
@@ -444,7 +445,7 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para
/* unwrap handle initialization for subsurf aware-unwrapper. The many modifications required to make the original function(see above)
* work justified the existence of a new function. */
-static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, const UnwrapOptions *options)
{
ParamHandle *handle;
/* index pointers */
@@ -470,7 +471,8 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
/* number of vertices and faces for subsurfed mesh*/
int numOfEdges, numOfFaces;
- /* holds a map to editfaces for every subsurfed MFace. These will be used to get hidden/ selected flags etc. */
+ /* holds a map to editfaces for every subsurfed MFace.
+ * These will be used to get hidden/ selected flags etc. */
BMFace **faceMap;
/* similar to the above, we need a way to map edges to their original ones */
BMEdge **edgeMap;
@@ -479,7 +481,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
float aspx, aspy;
ED_uvedit_get_aspect(scene, ob, em->bm, &aspx, &aspy);
@@ -545,8 +547,11 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
continue;
}
else {
- if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN) || (sel && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
+ if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN) ||
+ (options->only_selected && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
+ {
continue;
+ }
}
mloop = &subsurfedLoops[mpoly->loopstart];
@@ -584,7 +589,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
}
}
- param_construct_end(handle, fill, 0);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
/* cleanup */
MEM_freeN(faceMap);
@@ -612,26 +617,29 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- MinStretch *ms;
- const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
- bool implicit = true;
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .fill_holes = RNA_boolean_get(op->ptr, "fill_holes"),
+ .only_selected = true,
+ .correct_aspect = true,
+ };
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return false;
}
- ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
+ MinStretch *ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
ms->scene = scene;
ms->objects_edit = objects;
ms->objects_len = objects_len;
ms->blend = RNA_float_get(op->ptr, "blend");
ms->iterations = RNA_int_get(op->ptr, "iterations");
ms->i = 0;
- ms->handle = construct_param_handle_multi(scene, objects, objects_len, implicit, fill_holes, true, true);
+ ms->handle = construct_param_handle_multi(scene, objects, objects_len, &options);
ms->lasttime = PIL_check_seconds_timer();
param_stretch_begin(ms->handle);
@@ -678,7 +686,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
}
@@ -714,7 +722,7 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
@@ -837,38 +845,61 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
/* ******************** Pack Islands operator **************** */
-
-void ED_uvedit_pack_islands(Scene *scene, Object *ob, BMesh *bm, bool selected, bool correct_aspect, bool do_rotate)
+static void uvedit_pack_islands(Scene *scene, Object *ob, BMesh *bm)
{
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = false,
+ .fill_holes = false,
+ .correct_aspect = false,
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = false;
+
ParamHandle *handle;
- handle = construct_param_handle(scene, ob, bm, true, false, selected, correct_aspect);
- param_pack(handle, scene->toolsettings->uvcalc_margin, do_rotate);
+ handle = construct_param_handle(scene, ob, bm, &options);
+ param_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
param_flush(handle);
param_delete(handle);
}
-void ED_uvedit_pack_islands_multi(
+static void uvedit_pack_islands_multi(
Scene *scene, Object **objects, const uint objects_len,
- bool selected, bool correct_aspect, bool do_rotate, bool implicit)
+ const UnwrapOptions *options, bool rotate, bool ignore_pinned)
{
ParamHandle *handle;
- handle = construct_param_handle_multi(
- scene, objects, objects_len, implicit, false, selected, correct_aspect);
- param_pack(handle, scene->toolsettings->uvcalc_margin, do_rotate);
+ handle = construct_param_handle_multi(scene, objects, objects_len, options);
+ param_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
param_flush(handle);
param_delete(handle);
+
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
+ }
}
static int pack_islands_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
- bool do_rotate = RNA_boolean_get(op->ptr, "rotate");
+
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = true,
+ .fill_holes = false,
+ .correct_aspect = true,
+ };
+
+ bool rotate = RNA_boolean_get(op->ptr, "rotate");
+ bool ignore_pinned = false;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, true)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
@@ -878,13 +909,7 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
else
RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
- ED_uvedit_pack_islands_multi(scene, objects, objects_len, true, true, do_rotate, true);
-
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *obedit = objects[ob_index];
- DEG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
- }
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
MEM_freeN(objects);
@@ -917,19 +942,24 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
ViewLayer *view_layer = CTX_data_view_layer(C);
ToolSettings *ts = scene->toolsettings;
const bool synced_selection = (ts->uv_flag & UV_SYNC_SELECTION) != 0;
- const bool implicit = true;
- ParamHandle *handle;
+
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = true,
+ .fill_holes = false,
+ .correct_aspect = true,
+ };
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
- handle = construct_param_handle_multi(scene, objects, objects_len, implicit, false, true, true);
- param_average(handle);
+ ParamHandle *handle = construct_param_handle_multi(scene, objects, objects_len, &options);
+ param_average(handle, false);
param_flush(handle);
param_delete(handle);
@@ -941,7 +971,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -974,7 +1004,6 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
ParamHandle *handle = NULL;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
const bool abf = (scene->toolsettings->unwrapper == 0);
- const bool fillholes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0;
bool use_subsurf;
modifier_unwrap_state(obedit, scene, &use_subsurf);
@@ -983,10 +1012,17 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
return;
}
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = false,
+ .fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0,
+ .correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0,
+ };
+
if (use_subsurf)
- handle = construct_param_handle_subsurfed(scene, obedit, em, fillholes, false, true);
+ handle = construct_param_handle_subsurfed(scene, obedit, em, &options);
else
- handle = construct_param_handle(scene, obedit, em->bm, false, fillholes, false, true);
+ handle = construct_param_handle(scene, obedit, em->bm, &options);
param_lscm_begin(handle, PARAM_TRUE, abf);
@@ -1030,17 +1066,6 @@ void ED_uvedit_live_unwrap_end(short cancel)
}
}
-void ED_uvedit_live_unwrap(Scene *scene, Object *obedit)
-{
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
-
- if (scene->toolsettings->edge_mode_live_unwrap &&
- CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV))
- {
- ED_unwrap_lscm(scene, obedit, false, false); /* unwrap all not just sel */
- }
-}
-
/*************** UV Map Common Transforms *****************/
#define VIEW_ON_EQUATOR 0
@@ -1225,12 +1250,12 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
{VIEW_ON_EQUATOR, "VIEW_ON_EQUATOR", 0, "View on Equator", "3D view is on the equator"},
{VIEW_ON_POLES, "VIEW_ON_POLES", 0, "View on Poles", "3D view is on the poles"},
{ALIGN_TO_OBJECT, "ALIGN_TO_OBJECT", 0, "Align to Object", "Align according to object transform"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem align_items[] = {
{POLAR_ZX, "POLAR_ZX", 0, "Polar ZX", "Polar 0 is X"},
{POLAR_ZY, "POLAR_ZY", 0, "Polar ZY", "Polar 0 is Y"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(ot->srna, "direction", direction_items, VIEW_ON_EQUATOR, "Direction",
@@ -1385,38 +1410,62 @@ static void uv_map_clip_correct(Scene *scene, Object *ob, wmOperator *op)
/* ******************** Unwrap operator **************** */
-/* assumes UV Map is checked, doesn't run update funcs */
-void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel, const bool pack)
+/* Assumes UV Map exists, doesn't run update funcs. */
+static void uvedit_unwrap(Scene *scene, Object *obedit, const UnwrapOptions *options)
{
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- ParamHandle *handle;
+ if (!CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) {
+ return;
+ }
- const bool fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0;
- const bool correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0;
bool use_subsurf;
-
modifier_unwrap_state(obedit, scene, &use_subsurf);
+ ParamHandle *handle;
if (use_subsurf)
- handle = construct_param_handle_subsurfed(scene, obedit, em, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle_subsurfed(scene, obedit, em, options);
else
- handle = construct_param_handle(scene, obedit, em->bm, false, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle(scene, obedit, em->bm, options);
param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
param_lscm_solve(handle);
param_lscm_end(handle);
- param_average(handle);
-
- if (pack) {
- param_pack(handle, scene->toolsettings->uvcalc_margin, false);
- }
+ param_average(handle, true);
param_flush(handle);
param_delete(handle);
}
+static void uvedit_unwrap_multi(Scene *scene, Object **objects, const int objects_len, const UnwrapOptions *options)
+{
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ uvedit_unwrap(scene, obedit, options);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
+ }
+}
+
+void ED_uvedit_live_unwrap(Scene *scene, Object **objects, int objects_len)
+{
+ if (scene->toolsettings->edge_mode_live_unwrap) {
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = false,
+ .fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0,
+ .correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0,
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = true;
+
+ uvedit_unwrap_multi(scene, objects, objects_len, &options);
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
+ }
+}
+
enum {
UNWRAP_ERROR_NONUNIFORM = (1 << 0),
UNWRAP_ERROR_NEGATIVE = (1 << 1),
@@ -1427,18 +1476,26 @@ static int unwrap_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
int method = RNA_enum_get(op->ptr, "method");
- const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
- const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
const bool use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data");
- bool implicit = false;
int reported_errors = 0;
- /* We will report an error unless at least one object has the subsurf modifier in the right place. */
+ /* We will report an error unless at least one object
+ * has the subsurf modifier in the right place. */
bool subsurf_error = use_subsurf;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = true,
+ .fill_holes = RNA_boolean_get(op->ptr, "fill_holes"),
+ .correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"),
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = true;
+
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
@@ -1454,7 +1511,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
}
if (subsurf_error) {
- /* Double up the check here but better keep ED_unwrap_lscm interface simple and not
+ /* Double up the check here but better keep uvedit_unwrap interface simple and not
* pass operator for warning append. */
modifier_unwrap_state(obedit, scene, &use_subsurf_final);
if (use_subsurf_final) {
@@ -1499,24 +1556,18 @@ static int unwrap_exec(bContext *C, wmOperator *op)
else
RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
- if (fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
+ if (options.fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
else scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
- if (correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
+ if (options.correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
else scene->toolsettings->uvcalc_flag |= UVCALC_NO_ASPECT_CORRECT;
if (use_subsurf) scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
else scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
/* execute unwrap */
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *obedit = objects[ob_index];
- ED_unwrap_lscm(scene, obedit, true, false);
- DEG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
- }
-
- ED_uvedit_pack_islands_multi(scene, objects, objects_len, true, true, true, implicit);
+ uvedit_unwrap_multi(scene, objects, objects_len, &options);
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
MEM_freeN(objects);
@@ -1528,7 +1579,7 @@ void UV_OT_unwrap(wmOperatorType *ot)
static const EnumPropertyItem method_items[] = {
{0, "ANGLE_BASED", 0, "Angle Based", ""},
{1, "CONFORMAL", 0, "Conformal", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1670,7 +1721,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
if (changed) {
changed_multi = true;
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
else {
@@ -1752,7 +1803,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
ED_mesh_uv_loop_reset(C, me);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -1865,7 +1916,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -1953,7 +2004,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -1981,7 +2032,7 @@ void UV_OT_cylinder_project(wmOperatorType *ot)
/******************* Cube Project operator ****************/
-void ED_uvedit_unwrap_cube_project(BMesh *bm, float cube_size, bool use_select, const float center[3])
+static void uvedit_unwrap_cube_project(BMesh *bm, float cube_size, bool use_select, const float center[3])
{
BMFace *efa;
BMLoop *l;
@@ -2066,11 +2117,11 @@ static int cube_project_exec(bContext *C, wmOperator *op)
}
}
- ED_uvedit_unwrap_cube_project(em->bm, cube_size, true, center);
+ uvedit_unwrap_cube_project(em->bm, cube_size, true, center);
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -2095,3 +2146,37 @@ void UV_OT_cube_project(wmOperatorType *ot)
RNA_def_float(ot->srna, "cube_size", 1.0f, 0.0f, FLT_MAX, "Cube Size", "Size of the cube to project on", 0.001f, 100.0f);
uv_map_clip_correct_properties(ot);
}
+
+/************************* Simple UVs for texture painting *****************/
+
+void ED_uvedit_add_simple_uvs(Main *bmain, Scene *scene, Object *ob)
+{
+ Mesh *me = ob->data;
+ bool sync_selection = (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
+
+ BMesh *bm = BM_mesh_create(
+ &bm_mesh_allocsize_default,
+ &((struct BMeshCreateParams){.use_toolflags = false,}));
+
+ /* turn sync selection off,
+ * since we are not in edit mode we need to ensure only the uv flags are tested */
+ scene->toolsettings->uv_flag &= ~UV_SYNC_SELECTION;
+
+ ED_mesh_uv_texture_ensure(me, NULL);
+
+ BM_mesh_bm_from_me(
+ bm, me, (&(struct BMeshFromMeshParams){
+ .calc_face_normal = true,
+ }));
+ /* select all uv loops first - pack parameters needs this to make sure charts are registered */
+ ED_uvedit_select_all(bm);
+ uvedit_unwrap_cube_project(bm, 1.0, false, NULL);
+ /* set the margin really quickly before the packing operation*/
+ scene->toolsettings->uvcalc_margin = 0.001f;
+ uvedit_pack_islands(scene, ob, bm);
+ BM_mesh_bm_to_me(bmain, bm, me, (&(struct BMeshToMeshParams){0}));
+ BM_mesh_free(bm);
+
+ if (sync_selection)
+ scene->toolsettings->uv_flag |= UV_SYNC_SELECTION;
+}