GPencil: Make Sculpt Auto-masking Global and not by Brush

The auto-masking was working by Brush and this was very
inconvenient because it was necessary set the options by
Brush, now the options are global and can be set at once.

Also, the automa-masking now works with `and` logic
and not with `or` as before. That means that a stroke
must meet all the conditions of the masking.

Added new Layer and Material options to masking the 
strokes using the same Layer/Material of the selected stroke.
Before, only Active Layer and Active Material could be masked.

The options of masking has been moved to the top-bar using
the same design of Mesh Sculpt masking.

As result of the changes above, the following props changed:

Removed:

`brush.gpencil_settings.use_automasking_strokes`
`brush.gpencil_settings.use_automasking_layer`
`brush.gpencil_settings.use_automasking_material`

Added:

`tool_settings.gpencil_sculpt.use_automasking_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_stroke`
`tool_settings.gpencil_sculpt.use_automasking_material_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_active`
`tool_settings.gpencil_sculpt.use_automasking_material_active`


Reviewed by: Julien Kaspar, Matias Mendiola, Daniel Martinez Lara
This commit is contained in:
Antonio Vazquez
2022-11-08 16:55:59 +01:00
parent bbb1d3e5e7
commit 4c182aef7c
9 changed files with 298 additions and 134 deletions

View File

@@ -3969,6 +3969,8 @@ def km_grease_pencil_stroke_sculpt_mode(params):
op_menu("VIEW3D_MT_gpencil_animation", {"type": 'I', "value": 'PRESS'}),
# Context menu
*_template_items_context_panel("VIEW3D_PT_gpencil_sculpt_context_menu", params.context_menu_event),
# Automasking Pie menu
op_menu_pie("VIEW3D_MT_sculpt_gpencil_automasking_pie", {"type": 'A', "shift": True, "alt": True, "value": 'PRESS'}),
])
return keymap

View File

@@ -51,11 +51,6 @@ class GreasePencilSculptAdvancedPanel:
tool = brush.gpencil_sculpt_tool
gp_settings = brush.gpencil_settings
col = layout.column(heading="Auto-Masking", align=True)
col.prop(gp_settings, "use_automasking_stroke", text="Stroke")
col.prop(gp_settings, "use_automasking_layer", text="Layer")
col.prop(gp_settings, "use_automasking_material", text="Material")
if tool in {'SMOOTH', 'RANDOMIZE'}:
col = layout.column(heading="Affect", align=True)
col.prop(gp_settings, "use_edit_position", text="Position")

View File

@@ -108,7 +108,7 @@ class VIEW3D_HT_tool_header(Header):
brush = context.tool_settings.gpencil_sculpt_paint.brush
if brush:
tool = brush.gpencil_sculpt_tool
if tool != 'CLONE':
if tool in {'SMOOTH', 'RANDOMIZE'}:
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover")
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
elif tool_mode == 'WEIGHT_GPENCIL':
@@ -837,14 +837,18 @@ class VIEW3D_HT_header(Header):
panel="VIEW3D_PT_gpencil_guide",
text="Guides",
)
if object_mode == 'SCULPT_GPENCIL':
layout.popover(
panel="VIEW3D_PT_gpencil_sculpt_automasking",
text="",
icon="MOD_MASK"
)
elif object_mode == 'SCULPT':
layout.popover(
panel="VIEW3D_PT_sculpt_automasking",
text="",
icon="MOD_MASK"
)
else:
# Transform settings depending on tool header visibility
VIEW3D_HT_header.draw_xform_template(layout, context)
@@ -5519,6 +5523,22 @@ class VIEW3D_MT_sculpt_automasking_pie(Menu):
pie.prop(sculpt, "use_automasking_view_normal", text="View Normal")
class VIEW3D_MT_sculpt_gpencil_automasking_pie(Menu):
bl_label = "Automasking"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
tool_settings = context.tool_settings
pie.prop(tool_settings.gpencil_sculpt, "use_automasking_stroke", text="Stroke")
pie.prop(tool_settings.gpencil_sculpt, "use_automasking_layer_stroke", text="Layer")
pie.prop(tool_settings.gpencil_sculpt, "use_automasking_material_stroke", text="Material")
pie.prop(tool_settings.gpencil_sculpt, "use_automasking_layer_active", text="Active Layer")
pie.prop(tool_settings.gpencil_sculpt, "use_automasking_material_active", text="Active Material")
class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
bl_label = "Face Sets Edit"
@@ -7467,6 +7487,27 @@ def draw_gpencil_material_active(context, layout):
row.prop(ma, "name", text="")
class VIEW3D_PT_gpencil_sculpt_automasking(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Auto-masking"
bl_ui_units_x = 10
def draw(self, context):
layout = self.layout
tool_settings = context.scene.tool_settings
layout.label(text="Auto-masking")
col = layout.column(align=True)
col.prop(tool_settings.gpencil_sculpt, "use_automasking_stroke", text="Stroke")
col.prop(tool_settings.gpencil_sculpt, "use_automasking_layer_stroke", text="Layer")
col.prop(tool_settings.gpencil_sculpt, "use_automasking_material_stroke", text="Material")
col.separator()
col.prop(tool_settings.gpencil_sculpt, "use_automasking_layer_active", text="Active Layer")
col.prop(tool_settings.gpencil_sculpt, "use_automasking_material_active", text="Active Material")
class VIEW3D_PT_gpencil_sculpt_context_menu(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'WINDOW'
@@ -8103,6 +8144,7 @@ classes = (
VIEW3D_MT_proportional_editing_falloff_pie,
VIEW3D_MT_sculpt_mask_edit_pie,
VIEW3D_MT_sculpt_automasking_pie,
VIEW3D_MT_sculpt_gpencil_automasking_pie,
VIEW3D_MT_wpaint_vgroup_lock_pie,
VIEW3D_MT_sculpt_face_sets_edit_pie,
VIEW3D_MT_sculpt_curves,
@@ -8117,6 +8159,7 @@ classes = (
VIEW3D_PT_annotation_onion,
VIEW3D_PT_gpencil_multi_frame,
VIEW3D_PT_gpencil_curve_edit,
VIEW3D_PT_gpencil_sculpt_automasking,
VIEW3D_PT_quad_view,
VIEW3D_PT_view3d_stereo,
VIEW3D_PT_shading,

View File

@@ -1964,7 +1964,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_brush_advanced(GreasePencilSculptAdva
return False
tool = brush.gpencil_sculpt_tool
return tool != 'CLONE'
return tool in {'SMOOTH', 'RANDOMIZE'}
class VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover(GreasePencilSculptAdvancedPanel, View3DPanel, Panel):
@@ -1982,7 +1982,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover(GreasePencilSculptAdvan
return False
tool = brush.gpencil_sculpt_tool
return tool != 'CLONE'
return tool in {'SMOOTH', 'RANDOMIZE'}
# Grease Pencil weight painting tools