From 1fe8fbd93acbfe5fe7e669d2470723f9e24049e4 Mon Sep 17 00:00:00 2001 From: Nika Kutsniashvili Date: Mon, 3 Jun 2024 16:36:32 +0200 Subject: [PATCH] UI: Reorganize mesh sculpt mode menus Reorganization of the mesh Sculpt mode menu for simplicity and consistency. Changes include: - Moved transform operators into its own menu, consistent with other modes. - Group Box, Lasso, Line, and Polyline Show/Hide operators - Box, Lasso, Line, and Polyline Trim/Add operators moved to a new "Trim/Add" - Cleanup and simplification of labels Detailed explanation and example images in the pull request. Pull Request: https://projects.blender.org/blender/blender/pulls/122437 --- scripts/startup/bl_ui/space_view3d.py | 158 ++++++++++++++++---------- 1 file changed, 97 insertions(+), 61 deletions(-) diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index e6edd460f6c..adbe91d86c3 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -3770,38 +3770,7 @@ class VIEW3D_MT_sculpt(Menu): def draw(self, context): layout = self.layout - layout.operator("transform.translate") - layout.operator("transform.rotate") - layout.operator("transform.resize", text="Scale") - - props = layout.operator("sculpt.mesh_filter", text="Sphere") - props.type = 'SPHERE' - - layout.separator() - - props = layout.operator("paint.hide_show", text="Box Hide") - props.action = 'HIDE' - - props = layout.operator("paint.hide_show", text="Box Show") - props.action = 'SHOW' - - props = layout.operator("paint.hide_show_lasso_gesture", text="Lasso Hide") - props.action = 'HIDE' - - props = layout.operator("paint.hide_show_lasso_gesture", text="Lasso Show") - props.action = 'SHOW' - - props = layout.operator("paint.hide_show_line_gesture", text="Line Hide") - props.action = 'HIDE' - - props = layout.operator("paint.hide_show_line_gesture", text="Line Show") - props.action = 'SHOW' - - props = layout.operator("paint.hide_show_polyline_gesture", text="Polyline Hide") - props.action = 'HIDE' - - props = layout.operator("paint.hide_show_polyline_gesture", text="Polyline Show") - props.action = 'SHOW' + layout.menu("VIEW3D_MT_sculpt_transform", text="Transform") layout.separator() @@ -3825,30 +3794,7 @@ class VIEW3D_MT_sculpt(Menu): props = layout.operator("paint.visibility_filter", text="Shrink Visibility") props.action = "SHRINK" - layout.separator() - - props = layout.operator("sculpt.trim_box_gesture", text="Box Trim") - props.trim_mode = 'DIFFERENCE' - - props = layout.operator("sculpt.trim_lasso_gesture", text="Lasso Trim") - props.trim_mode = 'DIFFERENCE' - - props = layout.operator("sculpt.trim_line_gesture", text="Line Trim") - props.trim_mode = 'DIFFERENCE' - - props = layout.operator("sculpt.trim_polyline_gesture", text="Polyline Trim") - props.trim_mode = 'DIFFERENCE' - - props = layout.operator("sculpt.trim_box_gesture", text="Box Add") - props.trim_mode = 'JOIN' - - props = layout.operator("sculpt.trim_lasso_gesture", text="Lasso Add") - props.trim_mode = 'JOIN' - - props = layout.operator("sculpt.trim_polyline_gesture", text="Polyline Add") - props.trim_mode = 'JOIN' - - layout.operator("sculpt.project_line_gesture", text="Line Project") + layout.menu("VIEW3D_MT_sculpt_showhide", text="Show/Hide") layout.separator() @@ -3860,6 +3806,12 @@ class VIEW3D_MT_sculpt(Menu): props = layout.operator("sculpt.face_set_edit", text="Fair Tangency") props.mode = 'FAIR_TANGENCY' + # Project + layout.operator("sculpt.project_line_gesture", text="Line Project") + + # Trim/Add + layout.menu("VIEW3D_MT_sculpt_trim", text="Trim/Add") + layout.separator() sculpt_filters_types = [ @@ -3892,7 +3844,7 @@ class VIEW3D_MT_sculpt(Menu): layout.operator("sculpt.optimize") layout.operator( - "sculpt.dynamic_topology_toggle", + "sculpt.dynamic_topology_toggle", text="Dynamic Topology", icon='CHECKBOX_HLT' if context.sculpt_object.use_dynamic_topology_sculpting else 'CHECKBOX_DEHLT', ) @@ -3901,6 +3853,84 @@ class VIEW3D_MT_sculpt(Menu): layout.operator("object.transfer_mode", text="Transfer Sculpt Mode") +class VIEW3D_MT_sculpt_transform(Menu): + bl_label = "Transform" + + def draw(self, _context): + layout = self.layout + + layout.operator("transform.translate") + layout.operator("transform.rotate") + layout.operator("transform.resize", text="Scale") + + layout.separator() + props = layout.operator("sculpt.mesh_filter", text="To Sphere") + props.type = 'SPHERE' + + +class VIEW3D_MT_sculpt_showhide(Menu): + bl_label = "Show/Hide" + + def draw(self, _context): + layout = self.layout + + props = layout.operator("paint.hide_show", text="Box Hide") + props.action = 'HIDE' + + props = layout.operator("paint.hide_show_lasso_gesture", text="Lasso Hide") + props.action = 'HIDE' + + props = layout.operator("paint.hide_show_line_gesture", text="Line Hide") + props.action = 'HIDE' + + props = layout.operator("paint.hide_show_polyline_gesture", text="Polyline Hide") + props.action = 'HIDE' + + layout.separator() + + props = layout.operator("paint.hide_show", text="Box Show") + props.action = 'SHOW' + + props = layout.operator("paint.hide_show_lasso_gesture", text="Lasso Show") + props.action = 'SHOW' + + props = layout.operator("paint.hide_show_line_gesture", text="Line Show") + props.action = 'SHOW' + + props = layout.operator("paint.hide_show_polyline_gesture", text="Polyline Show") + props.action = 'SHOW' + + +class VIEW3D_MT_sculpt_trim(Menu): + bl_label = "Trim/Add" + + def draw(self, _context): + layout = self.layout + + props = layout.operator("sculpt.trim_box_gesture", text="Box Trim") + props.trim_mode = 'DIFFERENCE' + + props = layout.operator("sculpt.trim_lasso_gesture", text="Lasso Trim") + props.trim_mode = 'DIFFERENCE' + + props = layout.operator("sculpt.trim_line_gesture", text="Line Trim") + props.trim_mode = 'DIFFERENCE' + + props = layout.operator("sculpt.trim_polyline_gesture", text="Polyline Trim") + props.trim_mode = 'DIFFERENCE' + + layout.separator() + + props = layout.operator("sculpt.trim_box_gesture", text="Box Add") + props.trim_mode = 'JOIN' + + props = layout.operator("sculpt.trim_lasso_gesture", text="Lasso Add") + props.trim_mode = 'JOIN' + + props = layout.operator("sculpt.trim_polyline_gesture", text="Polyline Add") + props.trim_mode = 'JOIN' + + class VIEW3D_MT_sculpt_curves(Menu): bl_label = "Curves" @@ -3921,9 +3951,6 @@ class VIEW3D_MT_mask(Menu): def draw(self, _context): layout = self.layout - props = layout.operator("paint.mask_flood_fill", text="Invert Mask") - props.mode = 'INVERT' - props = layout.operator("paint.mask_flood_fill", text="Fill Mask") props.mode = 'VALUE' props.value = 1 @@ -3932,11 +3959,17 @@ class VIEW3D_MT_mask(Menu): props.mode = 'VALUE' props.value = 0 + props = layout.operator("paint.mask_flood_fill", text="Invert Mask") + props.mode = 'INVERT' + + layout.separator() + props = layout.operator("paint.mask_box_gesture", text="Box Mask") props.mode = 'VALUE' props.value = 0 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask") + props = layout.operator("paint.mask_line_gesture", text="Line Mask") props = layout.operator("paint.mask_polyline_gesture", text="Polyline Mask") layout.separator() @@ -3991,7 +4024,7 @@ class VIEW3D_MT_mask(Menu): layout.separator() - props = layout.operator("sculpt.mask_from_cavity", text="Mask From Cavity") + props = layout.operator("sculpt.mask_from_cavity", text="Mask from Cavity") props.settings_source = 'OPERATOR' layout.separator() @@ -9269,6 +9302,9 @@ classes = ( VIEW3D_MT_paint_weight_lock, VIEW3D_MT_sculpt, VIEW3D_MT_sculpt_set_pivot, + VIEW3D_MT_sculpt_transform, + VIEW3D_MT_sculpt_showhide, + VIEW3D_MT_sculpt_trim, VIEW3D_MT_mask, VIEW3D_MT_face_sets, VIEW3D_MT_face_sets_init,