Fix #140615: Grease Pencil: Use brush.strength for context panel

Grease Pencil from 4.3 and above uses `brush.strength` instead of the one from
Grease Pencil brush settings. This fix makes the UI consistent.

Pull Request: https://projects.blender.org/blender/blender/pulls/140632
This commit is contained in:
YimingWu
2025-07-07 11:12:01 +02:00
committed by Falk David
parent f01bc4d811
commit 6957242a53
2 changed files with 42 additions and 16 deletions

View File

@@ -1641,6 +1641,8 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
tool_settings = context.tool_settings
settings = tool_settings.gpencil_paint
gp_settings = brush.gpencil_settings
ups = tool_settings.unified_paint_settings
brush_prop_owner = ups if ups.use_unified_size else brush
tool = context.workspace.tools.from_space_view3d_mode(context.mode, create=False)
if gp_settings is None:
return
@@ -1649,15 +1651,16 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
if brush.gpencil_tool == 'ERASE':
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
row.prop(gp_settings, "use_occlude_eraser", text="", icon='XRAY')
row = layout.row(align=True)
row.prop(gp_settings, "eraser_mode", expand=True)
if gp_settings.eraser_mode == 'SOFT':
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(brush_prop_owner, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
row = layout.row(align=True)
row.prop(gp_settings, "eraser_strength_factor")
row = layout.row(align=True)
@@ -1692,8 +1695,9 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
col.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True, use_negative_slope=True)
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(brush_prop_owner, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
if gp_settings.use_strength_pressure and not compact:
col = layout.column()
@@ -1891,18 +1895,21 @@ def brush_basic_gpencil_weight_settings(layout, _context, brush, *, compact=Fals
layout.prop(brush, "direction", expand=True, text="" if compact else "Direction")
def brush_basic_gpencil_vertex_settings(layout, _context, brush, *, compact=False):
def brush_basic_gpencil_vertex_settings(layout, context, brush, *, compact=False):
gp_settings = brush.gpencil_settings
ups = context.tool_settings.unified_paint_settings
brush_prop_owner = ups if ups.use_unified_size else brush
# Brush details
row = layout.row(align=True)
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
row.prop(brush_prop_owner, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
if brush.gpencil_vertex_tool in {'DRAW', 'REPLACE'}:
row = layout.row(align=True)

View File

@@ -8454,12 +8454,22 @@ class VIEW3D_PT_greasepencil_draw_context_menu(Panel):
col.separator()
if brush.gpencil_tool not in {'FILL', 'CUTTER', 'ERASE'}:
radius = "size" if (brush.use_locked_size == 'VIEW') else "unprojected_radius"
layout.prop(brush, radius, text="Radius", slider=True)
if brush.use_locked_size == 'VIEW':
row = layout.row(align=True)
row.prop(brush, "size", slider=True)
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
else:
row = layout.row(align=True)
row.prop(brush, "unprojected_radius", text="Size", slider=True)
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_tool == 'ERASE':
layout.prop(brush, "size", slider=True)
row = layout.row(align=True)
row.prop(brush, "size", slider=True)
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_tool not in {'ERASE', 'FILL', 'CUTTER'}:
layout.prop(gp_settings, "pen_strength")
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
layer = context.object.data.layers.active
@@ -8493,8 +8503,14 @@ class VIEW3D_PT_greasepencil_sculpt_context_menu(Panel):
ups = tool_settings.unified_paint_settings
size_owner = ups if ups.use_unified_size else brush
strength_owner = ups if ups.use_unified_strength else brush
layout.prop(size_owner, "size", text="")
layout.prop(strength_owner, "strength", text="")
row = layout.row(align=True)
row.prop(size_owner, "size", text="")
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_size", text="", icon='BRUSHES_ALL')
row = layout.row(align=True)
row.prop(strength_owner, "strength", text="")
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
layer = context.object.data.layers.active
@@ -8537,9 +8553,12 @@ class VIEW3D_PT_greasepencil_vertex_paint_context_menu(Panel):
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
ups = tool_settings.unified_paint_settings
strength_owner = ups if ups.use_unified_strength else brush
row = layout.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(strength_owner, "strength", text="")
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
layer = context.object.data.layers.active