diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-05-02 17:05:04 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-05-02 17:05:04 +0300 |
commit | ab5d52a6db559b78ffaca71c7963e48371c786ff (patch) | |
tree | 99426ba2db29776a19a5703ad1a3b32ada1e9e84 /release | |
parent | 4c3efb4320c16d5edf4bbd1062ee4587364587c3 (diff) |
GPencil: New Sculpt Auto masking options
Now it's possible to use auto masking at 3 levels:
* Stroke
* Layer
* Material
The masking options can be combined and allows to limit the effect of the sculpt brush.
Diff Revision: https://developer.blender.org/D14589
Diffstat (limited to 'release')
4 files changed, 55 insertions, 30 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 78620c41d1e..d7fb5673ff5 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -3977,6 +3977,8 @@ def km_grease_pencil_stroke_sculpt_mode(params): ("gpencil.active_frames_delete_all", {"type": 'DEL', "value": 'PRESS', "shift": True}, None), # Active layer op_menu("GPENCIL_MT_layer_active", {"type": 'Y', "value": 'PRESS'}), + # Active material + op_menu("GPENCIL_MT_material_active", {"type": 'U', "value": 'PRESS'}), # Merge Layer ("gpencil.layer_merge", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Keyframe menu diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 481753d5e79..189210d8540 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -41,17 +41,7 @@ class AnnotationDrawingToolsPanel: row.prop_enum(tool_settings, "annotation_stroke_placement_view2d", 'IMAGE', text="Image") -class GreasePencilSculptOptionsPanel: - bl_label = "Sculpt Strokes" - - @classmethod - def poll(cls, context): - tool_settings = context.scene.tool_settings - settings = tool_settings.gpencil_sculpt_paint - brush = settings.brush - tool = brush.gpencil_sculpt_tool - - return bool(tool in {'SMOOTH', 'RANDOMIZE'}) +class GreasePencilSculptAdvancedPanel: def draw(self, context): layout = self.layout @@ -59,17 +49,21 @@ class GreasePencilSculptOptionsPanel: layout.use_property_decorate = False tool_settings = context.scene.tool_settings - settings = tool_settings.gpencil_sculpt_paint - brush = settings.brush - gp_settings = brush.gpencil_settings + brush = context.tool_settings.gpencil_sculpt_paint.brush tool = brush.gpencil_sculpt_tool + gp_settings = brush.gpencil_settings - if tool in {'SMOOTH', 'RANDOMIZE'}: - layout.prop(gp_settings, "use_edit_position", text="Affect Position") - layout.prop(gp_settings, "use_edit_strength", text="Affect Strength") - layout.prop(gp_settings, "use_edit_thickness", text="Affect Thickness") + 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") - layout.prop(gp_settings, "use_edit_uv", text="Affect UV") + if tool in {'SMOOTH', 'RANDOMIZE'}: + col = layout.column(heading="Affect", align=True) + col.prop(gp_settings, "use_edit_position", text="Position") + col.prop(gp_settings, "use_edit_strength", text="Strength") + col.prop(gp_settings, "use_edit_thickness", text="Thickness") + col.prop(gp_settings, "use_edit_uv", text="UV") # GP Object Tool Settings diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 69477c80c07..d1c0c6c9dac 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -109,8 +109,8 @@ class VIEW3D_HT_tool_header(Header): if is_valid_context: brush = context.tool_settings.gpencil_sculpt_paint.brush tool = brush.gpencil_sculpt_tool - if tool in {'SMOOTH', 'RANDOMIZE'}: - layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options") + 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: diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 570d7c12e30..d448103aa7b 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -3,7 +3,7 @@ # <pep8 compliant> from bpy.types import Menu, Panel, UIList from bl_ui.properties_grease_pencil_common import ( - GreasePencilSculptOptionsPanel, + GreasePencilSculptAdvancedPanel, GreasePencilDisplayPanel, GreasePencilBrushFalloff, ) @@ -1907,6 +1907,41 @@ class VIEW3D_PT_tools_grease_pencil_brush_sculpt_falloff(GreasePencilBrushFallof return (settings and settings.brush and settings.brush.curve) +class VIEW3D_PT_tools_grease_pencil_sculpt_brush_advanced(GreasePencilSculptAdvancedPanel, View3DPanel, Panel): + bl_context = ".greasepencil_sculpt" + bl_label = "Advanced" + bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_sculpt_settings' + bl_category = "Tool" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + brush = context.tool_settings.gpencil_sculpt_paint.brush + if brush is None: + return False + + tool = brush.gpencil_sculpt_tool + return tool != 'CLONE' + + +class VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover(GreasePencilSculptAdvancedPanel, View3DPanel, Panel): + bl_context = ".greasepencil_sculpt" + bl_label = "Brush" + bl_category = "Tool" + + @classmethod + def poll(cls, context): + if context.region.type != 'TOOL_HEADER': + return False + + brush = context.tool_settings.gpencil_sculpt_paint.brush + if brush is None: + return False + + tool = brush.gpencil_sculpt_tool + return tool != 'CLONE' + + # Grease Pencil weight painting tools class GreasePencilWeightPanel: bl_context = ".greasepencil_weight" @@ -2240,13 +2275,6 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel): col.template_palette(settings, "palette", color=True) -class VIEW3D_PT_tools_grease_pencil_sculpt_options(GreasePencilSculptOptionsPanel, Panel, View3DPanel): - bl_context = ".greasepencil_sculpt" - bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_sculpt_settings' - bl_category = "Tool" - bl_label = "Sculpt Strokes" - - # Grease Pencil Brush Appearance (one for each mode) class VIEW3D_PT_tools_grease_pencil_paint_appearance(GreasePencilDisplayPanel, Panel, View3DPanel): bl_context = ".greasepencil_paint" @@ -2357,7 +2385,8 @@ classes = ( VIEW3D_PT_tools_grease_pencil_paint_appearance, VIEW3D_PT_tools_grease_pencil_sculpt_select, VIEW3D_PT_tools_grease_pencil_sculpt_settings, - VIEW3D_PT_tools_grease_pencil_sculpt_options, + VIEW3D_PT_tools_grease_pencil_sculpt_brush_advanced, + VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover, VIEW3D_PT_tools_grease_pencil_sculpt_appearance, VIEW3D_PT_tools_grease_pencil_weight_paint_select, VIEW3D_PT_tools_grease_pencil_weight_paint_settings, |