diff options
author | Jacques Lucke <jacques@blender.org> | 2022-04-05 16:24:12 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-04-05 16:24:12 +0300 |
commit | 190334b47df46f0e912c873077163e6129e4cbae (patch) | |
tree | 23972d3063cdd88204b4d55f7204349767ddc000 /source/blender/makesrna/intern/rna_brush.c | |
parent | e40b0d52cfcc44486fe3c2a96c5746dd1c8f4471 (diff) |
Curves: new Grow/Shrink brush
This adds a new Grow/Shrink brush which is similar to the Length
brush in the old hair system.
* It's possible to switch between growing and shrinking by hold
down ctrl and/or by changing the direction enum.
* 3d brush is supported.
* Different brush falloffs are supported.
* Supports scaling curves uniformly or shrinking/extrapolating
them. Extrapolation is linear only in this patch.
* A minimum length settings helps to avoid creating zero-sized curves.
Differential Revision: https://developer.blender.org/D14474
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index b2b6bdbcffc..062c827b9d0 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -248,8 +248,8 @@ const EnumPropertyItem rna_enum_brush_curves_sculpt_tool_items[] = { {CURVES_SCULPT_TOOL_DELETE, "DELETE", ICON_NONE, "Delete", ""}, {CURVES_SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_NONE, "Snake Hook", ""}, {CURVES_SCULPT_TOOL_ADD, "ADD", ICON_NONE, "Add", ""}, + {CURVES_SCULPT_TOOL_GROW_SHRINK, "GROW_SHRINK", ICON_NONE, "Grow / Shrink", ""}, {CURVES_SCULPT_TOOL_TEST1, "TEST1", ICON_NONE, "Test 1", ""}, - {CURVES_SCULPT_TOOL_TEST2, "TEST2", ICON_NONE, "Test 2", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -883,7 +883,13 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, default: return DummyRNA_DEFAULT_items; } - + case PAINT_MODE_SCULPT_CURVES: + switch (me->curves_sculpt_tool) { + case CURVES_SCULPT_TOOL_GROW_SHRINK: + return prop_direction_items; + default: + return DummyRNA_DEFAULT_items; + } default: return DummyRNA_DEFAULT_items; } @@ -1927,6 +1933,18 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna) prop = RNA_def_property(srna, "add_amount", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 1, INT32_MAX); RNA_def_property_ui_text(prop, "Add Amount", "Number of curves added by the Add brush"); + + prop = RNA_def_property(srna, "scale_uniform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVES_SCULPT_FLAG_SCALE_UNIFORM); + RNA_def_property_ui_text(prop, + "Scale Uniform", + "Grow or shrink curves by changing their size uniformly instead of " + "using trimming or extrapolation"); + + prop = RNA_def_property(srna, "minimum_length", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text( + prop, "Minimum Length", "Avoid shrinking curves shorter than this length"); } static void rna_def_brush(BlenderRNA *brna) |