Fix: 'Reset Curve' on brush falloff curve applies incorrect default
Introduced in f4e670af2c
The `use_negative_slope` parameter was effectively ignored when `brush`
was also passed in as a parameter, always defaulting to a positive
slope (ascending from left to right).
Additionally, the `use_negative_slope` property was incorrectly
specified for many properties: In general, most brush properties have
positive slope as they correspond to a pressure value being modulated.
This commit fixes the behavior and updates the corresponding
properties so they continue to work.
Pull Request: https://projects.blender.org/blender/blender/pulls/145823
This commit is contained in:
@@ -182,7 +182,7 @@ class GreasePencilBrushFalloff:
|
||||
col.prop(brush, "curve_preset", text="")
|
||||
|
||||
if brush.curve_preset == 'CUSTOM':
|
||||
layout.template_curve_mapping(brush, "curve", brush=True)
|
||||
layout.template_curve_mapping(brush, "curve", brush=True, use_negative_slope=True)
|
||||
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
|
||||
@@ -554,7 +554,7 @@ class StrokePanel(BrushPanel):
|
||||
col.row().prop(brush, "jitter_unit", expand=True)
|
||||
# Pen pressure mapping curve for Jitter.
|
||||
if brush.use_pressure_jitter and self.is_popover is False:
|
||||
col.template_curve_mapping(brush, "curve_jitter", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(brush, "curve_jitter", brush=True)
|
||||
|
||||
col.separator()
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
@@ -636,7 +636,7 @@ class FalloffPanel(BrushPanel):
|
||||
col.prop(brush, "curve_preset", text="")
|
||||
|
||||
if brush.curve_preset == 'CUSTOM':
|
||||
layout.template_curve_mapping(brush, "curve", brush=True)
|
||||
layout.template_curve_mapping(brush, "curve", brush=True, use_negative_slope=True)
|
||||
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
@@ -1151,7 +1151,7 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
||||
)
|
||||
if mode in {'PAINT_TEXTURE', 'PAINT_2D', 'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'SCULPT_CURVES'}:
|
||||
if brush.use_pressure_size:
|
||||
layout.template_curve_mapping(brush, "curve_size", brush=True, use_negative_slope=True)
|
||||
layout.template_curve_mapping(brush, "curve_size", brush=True)
|
||||
if size_mode:
|
||||
layout.row().prop(size_owner, "use_locked_size", expand=True)
|
||||
layout.separator()
|
||||
@@ -1169,7 +1169,7 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
||||
)
|
||||
if mode in {'PAINT_TEXTURE', 'PAINT_2D', 'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'SCULPT_CURVES'}:
|
||||
if strength_pressure and brush.use_pressure_strength:
|
||||
layout.template_curve_mapping(brush, "curve_strength", brush=True, use_negative_slope=True)
|
||||
layout.template_curve_mapping(brush, "curve_strength", brush=True)
|
||||
layout.separator()
|
||||
|
||||
if direction:
|
||||
@@ -1290,7 +1290,7 @@ def brush_settings_advanced(layout, context, settings, brush, popover=False):
|
||||
col.prop(brush, "use_automasking_custom_cavity_curve", text="Custom Curve")
|
||||
|
||||
if brush.use_automasking_custom_cavity_curve:
|
||||
col.template_curve_mapping(brush, "automasking_cavity_curve")
|
||||
col.template_curve_mapping(brush, "automasking_cavity_curve", brush=True)
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -1659,7 +1659,7 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
|
||||
|
||||
if brush.use_pressure_size and not compact:
|
||||
col = layout.column()
|
||||
col.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(brush, "strength", slider=True, text="Strength")
|
||||
@@ -1667,7 +1667,7 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
|
||||
|
||||
if brush.use_pressure_strength and not compact:
|
||||
col = layout.column()
|
||||
col.template_curve_mapping(gp_settings, "curve_strength", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_strength", brush=True)
|
||||
|
||||
if props:
|
||||
layout.prop(props, "subdivision")
|
||||
|
||||
@@ -8783,7 +8783,7 @@ class VIEW3D_PT_sculpt_automasking(Panel):
|
||||
col.prop(sculpt, "use_automasking_custom_cavity_curve", text="Custom Curve")
|
||||
|
||||
if sculpt.use_automasking_custom_cavity_curve:
|
||||
col.template_curve_mapping(sculpt, "automasking_cavity_curve")
|
||||
col.template_curve_mapping(sculpt, "automasking_cavity_curve", brush=True)
|
||||
|
||||
col.separator()
|
||||
|
||||
@@ -8985,7 +8985,11 @@ class VIEW3D_PT_curves_sculpt_parameter_falloff(Panel):
|
||||
settings = UnifiedPaintPanel.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
layout.template_curve_mapping(brush.curves_sculpt_settings, "curve_parameter_falloff")
|
||||
layout.template_curve_mapping(
|
||||
brush.curves_sculpt_settings,
|
||||
"curve_parameter_falloff",
|
||||
brush=True,
|
||||
use_negative_slope=True)
|
||||
row = layout.row(align=True)
|
||||
row.operator("brush.sculpt_curves_falloff_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
|
||||
row.operator("brush.sculpt_curves_falloff_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
|
||||
|
||||
@@ -1399,7 +1399,7 @@ class VIEW3D_PT_tools_imagepaint_options_cavity(Panel):
|
||||
|
||||
col = layout.column()
|
||||
col.active = ipaint.use_cavity
|
||||
col.template_curve_mapping(ipaint, "cavity_curve", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(ipaint, "cavity_curve", brush=True)
|
||||
|
||||
|
||||
# TODO, move to space_view3d.py
|
||||
@@ -2092,21 +2092,21 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_random(View3DPanel, Panel):
|
||||
row.prop(gp_settings, "use_stroke_random_radius", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(gp_settings, "use_random_press_radius", text="", icon='STYLUS_PRESSURE')
|
||||
if gp_settings.use_random_press_radius and self.is_popover is False:
|
||||
col.template_curve_mapping(gp_settings, "curve_random_pressure", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_random_pressure", brush=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(gp_settings, "random_strength", text="Strength", slider=True, text_ctxt=i18n_contexts.id_gpencil)
|
||||
row.prop(gp_settings, "use_stroke_random_strength", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(gp_settings, "use_random_press_strength", text="", icon='STYLUS_PRESSURE')
|
||||
if gp_settings.use_random_press_strength and self.is_popover is False:
|
||||
col.template_curve_mapping(gp_settings, "curve_random_strength", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_random_strength", brush=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(gp_settings, "uv_random", text="Rotation", slider=True)
|
||||
row.prop(gp_settings, "use_stroke_random_uv", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(gp_settings, "use_random_press_uv", text="", icon='STYLUS_PRESSURE')
|
||||
if gp_settings.use_random_press_uv and self.is_popover is False:
|
||||
col.template_curve_mapping(gp_settings, "curve_random_uv", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_random_uv", brush=True)
|
||||
|
||||
col.separator()
|
||||
|
||||
@@ -2117,21 +2117,21 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_random(View3DPanel, Panel):
|
||||
row.prop(brush, "use_stroke_random_hue", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(brush, "use_random_press_hue", text="", icon='STYLUS_PRESSURE')
|
||||
if brush.use_random_press_hue and self.is_popover is False:
|
||||
col1.template_curve_mapping(brush, "curve_random_hue", brush=True, use_negative_slope=True)
|
||||
col1.template_curve_mapping(brush, "curve_random_hue", brush=True)
|
||||
|
||||
row = col1.row(align=True)
|
||||
row.prop(brush, "saturation_jitter", slider=True)
|
||||
row.prop(brush, "use_stroke_random_sat", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(brush, "use_random_press_sat", text="", icon='STYLUS_PRESSURE')
|
||||
if brush.use_random_press_sat and self.is_popover is False:
|
||||
col1.template_curve_mapping(brush, "curve_random_saturation", brush=True, use_negative_slope=True)
|
||||
col1.template_curve_mapping(brush, "curve_random_saturation", brush=True)
|
||||
|
||||
row = col1.row(align=True)
|
||||
row.prop(brush, "value_jitter", slider=True)
|
||||
row.prop(brush, "use_stroke_random_val", text="", icon='GP_SELECT_STROKES')
|
||||
row.prop(brush, "use_random_press_val", text="", icon='STYLUS_PRESSURE')
|
||||
if brush.use_random_press_val and self.is_popover is False:
|
||||
col1.template_curve_mapping(brush, "curve_random_value", brush=True, use_negative_slope=True)
|
||||
col1.template_curve_mapping(brush, "curve_random_value", brush=True)
|
||||
|
||||
col.separator()
|
||||
|
||||
@@ -2139,7 +2139,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_random(View3DPanel, Panel):
|
||||
row.prop(gp_settings, "pen_jitter", slider=True)
|
||||
row.prop(gp_settings, "use_jitter_pressure", text="", icon='STYLUS_PRESSURE')
|
||||
if gp_settings.use_jitter_pressure and self.is_popover is False:
|
||||
col.template_curve_mapping(gp_settings, "curve_jitter", brush=True, use_negative_slope=True)
|
||||
col.template_curve_mapping(gp_settings, "curve_jitter", brush=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_grease_pencil_v3_brush_stabilizer(Panel, View3DPanel):
|
||||
|
||||
@@ -310,7 +310,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cb
|
||||
static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cb_v)
|
||||
{
|
||||
return curvemap_tools_func(
|
||||
C, region, *static_cast<RNAUpdateCb *>(cb_v), false, CURVEMAP_SLOPE_POSITIVE);
|
||||
C, region, *static_cast<RNAUpdateCb *>(cb_v), false, CURVEMAP_SLOPE_NEGATIVE);
|
||||
}
|
||||
|
||||
static void curvemap_buttons_redraw(bContext &C)
|
||||
|
||||
Reference in New Issue
Block a user