Fix T72555: Brush Radius/Size and Strength not linked on header tools settings when Unified Brush is active

Patch by Demeter Dzadik

Differential Revision: https://developer.blender.org/D6473
This commit is contained in:
William Reynish 2019-12-23 17:28:21 +01:00
parent 50b478e328
commit 2ff996040d
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #72555, Brush Radius/Size and Strength not linked on header tools settings when Unified Brush is active.
3 changed files with 30 additions and 9 deletions

View File

@ -104,14 +104,14 @@ class UnifiedPaintPanel:
icon='NONE',
text=None,
slider=False,
display_unified_toggle=True,
header=False,
):
""" Generalized way of adding brush options to the UI,
along with their pen pressure setting and global toggle, if they exist. """
row = layout.row(align=True)
ups = context.tool_settings.unified_paint_settings
prop_owner = brush
if unified_name and getattr(ups, unified_name) and display_unified_toggle:
if unified_name and getattr(ups, unified_name):
prop_owner = ups
row.prop(prop_owner, prop_name, icon=icon, text=text, slider=slider)
@ -119,7 +119,8 @@ class UnifiedPaintPanel:
if pressure_name:
row.prop(brush, pressure_name, text="")
if unified_name and display_unified_toggle:
if unified_name and not header:
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
row.prop(ups, unified_name, text="", icon="WORLD")
return row
@ -871,7 +872,7 @@ def draw_color_settings(context, layout, brush, color_type=False):
"secondary_color",
unified_name="use_unified_color",
text="Background Color",
display_unified_toggle=False,
header=True,
)
col.prop(brush, "gradient_stroke_mode", text="Gradient Mapping")
@ -961,7 +962,6 @@ def brush_mask_texture_settings(layout, brush):
def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
"""Draw Tool Settings header for Vertex Paint and 2D and 3D Texture Paint modes."""
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
capabilities = brush.image_paint_capabilities
if capabilities.has_color:
@ -974,8 +974,10 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
brush,
"size",
pressure_name="use_pressure_size",
unified_name="use_unified_size",
slider=True,
text="Radius",
header=True
)
UnifiedPaintPanel.prop_unified(
layout,
@ -983,6 +985,8 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
brush,
"strength",
pressure_name="use_pressure_strength",
unified_name="use_unified_strength",
header=True
)

View File

@ -589,14 +589,15 @@ class _draw_tool_settings_context_mode:
uv_sculpt = tool_settings.uv_sculpt
brush = uv_sculpt.brush
if brush:
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
UnifiedPaintPanel.prop_unified(
layout,
context,
brush,
"size",
pressure_name="use_pressure_size",
unified_name="use_unified_size",
slider=True,
header=True
)
UnifiedPaintPanel.prop_unified(
layout,
@ -604,7 +605,9 @@ class _draw_tool_settings_context_mode:
brush,
"strength",
pressure_name="use_pressure_strength",
unified_name="use_unified_strength",
slider=True,
header=True
)
@staticmethod

View File

@ -260,15 +260,16 @@ class _draw_tool_settings_context_mode:
if size_owner.use_locked_size == 'SCENE':
size = "unprojected_radius"
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
UnifiedPaintPanel.prop_unified(
layout,
context,
brush,
size,
pressure_name="use_pressure_size",
unified_name="use_unified_size",
text="Radius",
slider=True,
header=True
)
# strength, use_strength_pressure
@ -279,7 +280,9 @@ class _draw_tool_settings_context_mode:
brush,
"strength",
pressure_name=pressure_name,
unified_name="use_unified_strength",
text="Strength",
header=True
)
# direction
@ -331,10 +334,17 @@ class _draw_tool_settings_context_mode:
if brush is None:
return False
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
capabilities = brush.weight_paint_capabilities
if capabilities.has_weight:
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", slider=True)
UnifiedPaintPanel.prop_unified(
layout,
context,
brush,
"weight",
unified_name="use_unified_weight",
slider=True,
header=True
)
UnifiedPaintPanel.prop_unified(
layout,
@ -342,8 +352,10 @@ class _draw_tool_settings_context_mode:
brush,
"size",
pressure_name="use_pressure_size",
unified_name="use_unified_size",
slider=True,
text="Radius",
header=True
)
UnifiedPaintPanel.prop_unified(
layout,
@ -351,6 +363,8 @@ class _draw_tool_settings_context_mode:
brush,
"strength",
pressure_name="use_pressure_strength",
unified_name="use_unified_strength",
header=True
)
return True