diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/space_view3d.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 178 |
1 files changed, 144 insertions, 34 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 1af70895be9..1a30c666bcb 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Header, @@ -97,7 +95,7 @@ class VIEW3D_HT_tool_header(Header): elif tool_mode == 'PAINT_GPENCIL': if is_valid_context: brush = context.tool_settings.gpencil_paint.brush - if brush.gpencil_tool != 'ERASE': + if brush and brush.gpencil_tool != 'ERASE': if brush.gpencil_tool != 'TINT': layout.popover("VIEW3D_PT_tools_grease_pencil_brush_advanced") @@ -108,10 +106,11 @@ class VIEW3D_HT_tool_header(Header): elif tool_mode == 'SCULPT_GPENCIL': if is_valid_context: brush = context.tool_settings.gpencil_sculpt_paint.brush - tool = brush.gpencil_sculpt_tool - if tool != 'CLONE': - layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover") - layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance") + if brush: + tool = brush.gpencil_sculpt_tool + if tool != 'CLONE': + layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover") + layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance") elif tool_mode == 'WEIGHT_GPENCIL': if is_valid_context: layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance") @@ -512,28 +511,55 @@ class _draw_tool_settings_context_mode: header=True, ) - if brush.curves_sculpt_tool == 'COMB': + curves_tool = brush.curves_sculpt_tool + + if curves_tool == 'COMB': layout.prop(brush, "falloff_shape", expand=True) layout.popover("VIEW3D_PT_tools_brush_falloff") - - if brush.curves_sculpt_tool == 'ADD': + elif curves_tool == 'ADD': layout.prop(brush, "falloff_shape", expand=True) layout.prop(brush.curves_sculpt_settings, "add_amount") layout.popover("VIEW3D_PT_curves_sculpt_add_shape", text="Curve Shape") layout.prop(brush, "use_frontface", text="Front Faces Only") - - if brush.curves_sculpt_tool == 'GROW_SHRINK': + elif curves_tool == 'GROW_SHRINK': layout.prop(brush, "direction", expand=True, text="") layout.prop(brush, "falloff_shape", expand=True) layout.popover("VIEW3D_PT_curves_sculpt_grow_shrink_scaling", text="Scaling") layout.popover("VIEW3D_PT_tools_brush_falloff") - - if brush.curves_sculpt_tool == 'SNAKE_HOOK': + elif curves_tool == 'SNAKE_HOOK': layout.prop(brush, "falloff_shape", expand=True) layout.popover("VIEW3D_PT_tools_brush_falloff") - - if brush.curves_sculpt_tool == 'DELETE': + elif curves_tool == 'DELETE': + layout.prop(brush, "falloff_shape", expand=True) + elif curves_tool == 'SELECTION_PAINT': + layout.prop(brush, "direction", expand=True, text="") + layout.prop(brush, "falloff_shape", expand=True) + layout.popover("VIEW3D_PT_tools_brush_falloff") + elif curves_tool == 'PINCH': + layout.prop(brush, "direction", expand=True, text="") layout.prop(brush, "falloff_shape", expand=True) + layout.popover("VIEW3D_PT_tools_brush_falloff") + elif curves_tool == 'SMOOTH': + layout.prop(brush, "falloff_shape", expand=True) + layout.popover("VIEW3D_PT_tools_brush_falloff") + elif curves_tool == 'PUFF': + layout.prop(brush, "falloff_shape", expand=True) + layout.popover("VIEW3D_PT_tools_brush_falloff") + elif curves_tool == 'DENSITY': + layout.prop(brush, "falloff_shape", expand=True) + row = layout.row(align=True) + row.prop(brush.curves_sculpt_settings, "density_mode", text="", expand=True) + row = layout.row(align=True) + row.prop(brush.curves_sculpt_settings, "minimum_distance", text="Distance Min") + row.operator_context = 'INVOKE_REGION_WIN' + row.operator("sculpt_curves.min_distance_edit", text="", icon='DRIVER_DISTANCE') + row = layout.row(align=True) + row.enabled = brush.curves_sculpt_settings.density_mode != 'REMOVE' + row.prop(brush.curves_sculpt_settings, "density_add_attempts", text="Count Max") + layout.popover("VIEW3D_PT_tools_brush_falloff") + layout.popover("VIEW3D_PT_curves_sculpt_add_shape", text="Curve Shape") + elif curves_tool == "SLIDE": + layout.popover("VIEW3D_PT_tools_brush_falloff") class VIEW3D_HT_header(Header): @@ -577,8 +603,8 @@ class VIEW3D_HT_header(Header): show_snap = True else: if (object_mode not in { - 'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', - 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL' + 'SCULPT', 'SCULPT_CURVES', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', + 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL', }) or has_pose_mode: show_snap = True else: @@ -687,6 +713,22 @@ class VIEW3D_HT_header(Header): if object_mode == 'PARTICLE_EDIT': row = layout.row() row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True) + elif object_mode == 'SCULPT_CURVES' and obj.type == 'CURVES': + curves = obj.data + + row = layout.row(align=True) + + # Combine the "use selection" toggle with the "set domain" operators + # to allow turning selection off directly. + domain = curves.selection_domain + if domain == 'POINT': + row.prop(curves, "use_sculpt_selection", text="", icon='CURVE_BEZCIRCLE') + else: + row.operator("curves.set_selection_domain", text="", icon='CURVE_BEZCIRCLE').domain = 'POINT' + if domain == 'CURVE': + row.prop(curves, "use_sculpt_selection", text="", icon='CURVE_PATH') + else: + row.operator("curves.set_selection_domain", text="", icon='CURVE_PATH').domain = 'CURVE' # Grease Pencil if obj and obj.type == 'GPENCIL' and context.gpencil_data: @@ -939,6 +981,7 @@ class VIEW3D_MT_editor_menus(Menu): layout.menu("VIEW3D_MT_mask") layout.menu("VIEW3D_MT_face_sets") if mode_string == 'SCULPT_CURVES': + layout.menu("VIEW3D_MT_select_sculpt_curves") layout.menu("VIEW3D_MT_sculpt_curves") else: @@ -1976,6 +2019,20 @@ class VIEW3D_MT_select_edit_curves(Menu): pass +class VIEW3D_MT_select_sculpt_curves(Menu): + bl_label = "Select" + + def draw(self, _context): + layout = self.layout + + layout.operator("sculpt_curves.select_all", text="All").action = 'SELECT' + layout.operator("sculpt_curves.select_all", text="None").action = 'DESELECT' + layout.operator("sculpt_curves.select_all", text="Invert").action = 'INVERT' + layout.operator("sculpt_curves.select_random", text="Random") + layout.operator("sculpt_curves.select_end", text="Endpoints") + layout.operator("sculpt_curves.select_grow", text="Grow") + + class VIEW3D_MT_angle_control(Menu): bl_label = "Angle Control" @@ -2052,14 +2109,13 @@ class VIEW3D_MT_curve_add(Menu): layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE') layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH') - experimental = context.preferences.experimental - if experimental.use_new_curves_type: - layout.separator() + layout.separator() - layout.operator("object.curves_empty_hair_add", text="Empty Hair", icon='CURVES_DATA') + layout.operator("object.curves_empty_hair_add", text="Empty Hair", icon='CURVES_DATA') - if experimental.use_new_curves_tools: - layout.operator("object.curves_random_add", text="Random", icon='CURVES_DATA') + experimental = context.preferences.experimental + if experimental.use_new_curves_tools: + layout.operator("object.curves_random_add", text="Random", icon='CURVES_DATA') class VIEW3D_MT_surface_add(Menu): @@ -2295,8 +2351,6 @@ class VIEW3D_MT_object_relations(Menu): layout = self.layout layout.operator("object.make_override_library", text="Make Library Override...") - layout.operator("object.make_override_library", - text="Make Library Override - Fully Editable...").do_fully_editable = True layout.operator("object.make_dupli_face") @@ -6590,6 +6644,30 @@ class VIEW3D_PT_overlay_sculpt(Panel): row.prop(overlay, "sculpt_mode_face_sets_opacity", text="Face Sets") +class VIEW3D_PT_overlay_sculpt_curves(Panel): + bl_space_type = 'VIEW_3D' + bl_context = ".curves_sculpt" + bl_region_type = 'HEADER' + bl_parent_id = 'VIEW3D_PT_overlay' + bl_label = "Sculpt" + + @classmethod + def poll(cls, context): + return context.mode == 'SCULPT_CURVES' and (context.object) + + def draw(self, context): + layout = self.layout + tool_settings = context.tool_settings + sculpt = tool_settings.sculpt + + view = context.space_data + overlay = view.overlay + + row = layout.row(align=True) + row.active = overlay.show_overlays + row.prop(overlay, "sculpt_mode_mask_opacity", text="Selection Opacity") + + class VIEW3D_PT_overlay_bones(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' @@ -6742,23 +6820,53 @@ class VIEW3D_PT_snapping(Panel): col.prop(tool_settings, "use_snap_grid_absolute") if snap_elements != {'INCREMENT'}: - col.label(text="Snap With") - row = col.row(align=True) - row.prop(tool_settings, "snap_target", expand=True) - - col.prop(tool_settings, "use_snap_backface_culling") + if snap_elements != {'FACE_NEAREST'}: + col.label(text="Snap With") + row = col.row(align=True) + row.prop(tool_settings, "snap_target", expand=True) if obj: + col.label(text="Target Selection") + col_targetsel = col.column(align=True) if object_mode == 'EDIT' and obj.type not in {'LATTICE', 'META', 'FONT'}: - sub = col.column() - sub.active = not (tool_settings.use_proportional_edit and obj.type == 'MESH') - sub.prop(tool_settings, "use_snap_self") + col_targetsel.prop( + tool_settings, + "use_snap_self", + text="Include Active", + icon='EDITMODE_HLT', + ) + col_targetsel.prop( + tool_settings, + "use_snap_edit", + text="Include Edited", + icon='OUTLINER_DATA_MESH', + ) + col_targetsel.prop( + tool_settings, + "use_snap_nonedit", + text="Include Non-Edited", + icon='OUTLINER_OB_MESH', + ) + col_targetsel.prop( + tool_settings, + "use_snap_selectable", + text="Exclude Non-Selectable", + icon='RESTRICT_SELECT_OFF', + ) + if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}: col.prop(tool_settings, "use_snap_align_rotation") + col.prop(tool_settings, "use_snap_backface_culling") + if 'FACE' in snap_elements: col.prop(tool_settings, "use_snap_project") + if 'FACE_NEAREST' in snap_elements: + col.prop(tool_settings, 'use_snap_to_same_target') + if object_mode == 'EDIT': + col.prop(tool_settings, 'snap_face_nearest_steps') + if 'VOLUME' in snap_elements: col.prop(tool_settings, "use_snap_peel_object") @@ -7703,6 +7811,7 @@ classes = ( VIEW3D_MT_select_paint_mask, VIEW3D_MT_select_paint_mask_vertex, VIEW3D_MT_select_edit_curves, + VIEW3D_MT_select_sculpt_curves, VIEW3D_MT_angle_control, VIEW3D_MT_mesh_add, VIEW3D_MT_curve_add, @@ -7876,6 +7985,7 @@ classes = ( VIEW3D_PT_overlay_weight_paint, VIEW3D_PT_overlay_bones, VIEW3D_PT_overlay_sculpt, + VIEW3D_PT_overlay_sculpt_curves, VIEW3D_PT_snapping, VIEW3D_PT_proportional_edit, VIEW3D_PT_gpencil_origin, |