diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/space_toolsystem_toolbar.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | 145 |
1 files changed, 128 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index e64a7c9731b..1aa5dde168b 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -137,7 +137,6 @@ class _defs_view3d_generic: idname="builtin.measure", label="Measure", description=description, - cursor='CROSSHAIR', icon="ops.view3d.ruler", widget="VIEW3D_GGT_ruler", keymap="3D View Tool: Measure", @@ -407,7 +406,6 @@ class _defs_view3d_select: label="Select Lasso", icon="ops.generic.select_lasso", widget=None, - cursor='DEFAULT', keymap="3D View Tool: Select Lasso", draw_settings=draw_settings, ) @@ -432,17 +430,130 @@ class _defs_view3d_select: label="Select Circle", icon="ops.generic.select_circle", widget=None, - cursor='DEFAULT', keymap="3D View Tool: Select Circle", draw_settings=draw_settings, draw_cursor=draw_cursor, ) +class _defs_view3d_add: + + # Layout tweaks here would be good to avoid, + # this shows limits in layout engine, as buttons are using a lot of space. + @staticmethod + def draw_settings_interactive_add(layout, tool): + props = tool.operator_properties("view3d.interactive_add") + row = layout.row() + row.scale_x = 0.8 + row.label(text="Depth:") + row = layout.row() + row.scale_x = 0.9 + row.prop(props, "plane_depth", text="") + row = layout.row() + row.prop(props, "plane_axis", text="") + row = layout.row() + row.scale_x = 0.7 + row.prop(props, "plane_origin") + + @ToolDef.from_fn + def cube_add(): + def draw_settings(_context, layout, tool): + _defs_view3d_add.draw_settings_interactive_add(layout, tool) + return dict( + idname="builtin.primitive_cube_add", + label="Add Cube", + icon="ops.mesh.primitive_cube_add_gizmo", + description=( + "Add cube to mesh interactively" + ), + widget="VIEW3D_GGT_placement", + keymap="3D View Tool: Object, Add Primitive", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def cone_add(): + def draw_settings(_context, layout, tool): + _defs_view3d_add.draw_settings_interactive_add(layout, tool) + + props = tool.operator_properties("mesh.primitive_cone_add") + layout.prop(props, "vertices") + layout.prop(props, "end_fill_type") + return dict( + idname="builtin.primitive_cone_add", + label="Add Cone", + icon="ops.mesh.primitive_cube_add_gizmo", + description=( + "Add cone to mesh interactively" + ), + widget="VIEW3D_GGT_placement", + keymap="3D View Tool: Object, Add Primitive", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def cylinder_add(): + def draw_settings(_context, layout, tool): + _defs_view3d_add.draw_settings_interactive_add(layout, tool) + + props = tool.operator_properties("mesh.primitive_cylinder_add") + layout.prop(props, "vertices") + layout.prop(props, "end_fill_type") + return dict( + idname="builtin.primitive_cylinder_add", + label="Add Cylinder", + icon="ops.mesh.primitive_cylinder_add_gizmo", + description=( + "Add cylinder to mesh interactively" + ), + widget="VIEW3D_GGT_placement", + keymap="3D View Tool: Object, Add Primitive", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def uv_sphere_add(): + def draw_settings(_context, layout, tool): + _defs_view3d_add.draw_settings_interactive_add(layout, tool) + + props = tool.operator_properties("mesh.primitive_uv_sphere_add") + layout.prop(props, "segments") + layout.prop(props, "ring_count") + return dict( + idname="builtin.primitive_uv_sphere_add", + label="Add UV Sphere", + icon="ops.mesh.primitive_sphere_add_gizmo", + description=( + "Add cylinder to mesh interactively" + ), + widget="VIEW3D_GGT_placement", + keymap="3D View Tool: Object, Add Primitive", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def ico_sphere_add(): + def draw_settings(_context, layout, tool): + _defs_view3d_add.draw_settings_interactive_add(layout, tool) + + props = tool.operator_properties("mesh.primitive_ico_sphere_add") + layout.prop(props, "subdivisions") + return dict( + idname="builtin.primitive_ico_sphere_add", + label="Add Ico Sphere", + icon="ops.mesh.primitive_sphere_add_gizmo", + description=( + "Add cylinder to mesh interactively" + ), + widget="VIEW3D_GGT_placement", + keymap="3D View Tool: Object, Add Primitive", + draw_settings=draw_settings, + ) + + # ----------------------------------------------------------------------------- # Object Modes (named based on context.mode) - class _defs_edit_armature: @ToolDef.from_fn @@ -501,19 +612,6 @@ class _defs_edit_armature: class _defs_edit_mesh: @ToolDef.from_fn - def cube_add(): - return dict( - idname="builtin.add_cube", - label="Add Cube", - icon="ops.mesh.primitive_cube_add_gizmo", - description=( - "Add cube to mesh interactively" - ), - widget=None, - keymap=(), - ) - - @ToolDef.from_fn def rip_region(): def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.rip_move") @@ -2150,6 +2248,14 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ), ) + _tools_view3d_add = ( + _defs_view3d_add.cube_add, + _defs_view3d_add.cone_add, + _defs_view3d_add.cylinder_add, + _defs_view3d_add.uv_sphere_add, + _defs_view3d_add.ico_sphere_add, + ) + _tools_default = ( *_tools_select, _defs_view3d_generic.cursor, @@ -2168,6 +2274,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], 'OBJECT': [ *_tools_default, + + None, + _tools_view3d_add, ], 'POSE': [ *_tools_default, @@ -2196,6 +2305,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): 'EDIT_MESH': [ *_tools_default, None, + _tools_view3d_add, + None, ( _defs_edit_mesh.extrude, _defs_edit_mesh.extrude_dissolve_and_intersect, |