diff options
author | Jacques Lucke <jacques@blender.org> | 2022-06-30 16:09:13 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-06-30 16:09:13 +0300 |
commit | 416aef4e13ccc30e82ecaa691f26af54dbd5ee7e (patch) | |
tree | a4f8e3b96e01031e5f8049b48043ed3208bfe168 /source/blender/makesrna/intern/rna_brush.c | |
parent | 0f22b5599a03d5ce61450528c74ad2f2e47cf913 (diff) |
Curves: New tools for curves sculpt mode.
This commit contains various new features for curves sculpt mode
that have been developed in parallel.
* Selection:
* Operator to select points/curves randomly.
* Operator to select endpoints of curves.
* Operator to grow/shrink an existing selection.
* New Brushes:
* Pinch: Moves points towards the brush center.
* Smooth: Makes individual curves straight without changing the root
or tip position.
* Puff: Makes curves stand up, aligning them with the surface normal.
* Density: Add or remove curves to achieve a certain density defined
by a minimum distance value.
* Slide: Move root points on the surface.
Differential Revision: https://developer.blender.org/D15134
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 80a61543b5a..e0d55050c63 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -251,6 +251,11 @@ const EnumPropertyItem rna_enum_brush_curves_sculpt_tool_items[] = { {CURVES_SCULPT_TOOL_ADD, "ADD", ICON_BRUSH_CURVES_ADD, "Add Curves", ""}, {CURVES_SCULPT_TOOL_GROW_SHRINK, "GROW_SHRINK", ICON_BRUSH_CURVES_GROW_SHRINK, "Grow / Shrink Curves", ""}, {CURVES_SCULPT_TOOL_SELECTION_PAINT, "SELECTION_PAINT", ICON_BRUSH_PAINT_SELECT, "Paint Selection", ""}, + {CURVES_SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_CURVES_PINCH, "Pinch Curves", ""}, + {CURVES_SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_CURVES_SMOOTH, "Smooth Curves", ""}, + {CURVES_SCULPT_TOOL_PUFF, "PUFF", ICON_BRUSH_CURVES_PUFF, "Puff Curves", ""}, + {CURVES_SCULPT_TOOL_DENSITY, "DENSITY", ICON_BRUSH_CURVES_DENSITY, "Density Curves", ""}, + {CURVES_SCULPT_TOOL_SLIDE, "SLIDE", ICON_BRUSH_CURVES_SLIDE, "Slide Curves", ""}, {0, NULL, 0, NULL, NULL}, }; /* clang-format on */ @@ -889,6 +894,7 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, switch (me->curves_sculpt_tool) { case CURVES_SCULPT_TOOL_GROW_SHRINK: case CURVES_SCULPT_TOOL_SELECTION_PAINT: + case CURVES_SCULPT_TOOL_PINCH: return prop_direction_items; default: return DummyRNA_DEFAULT_items; @@ -1949,6 +1955,26 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static const EnumPropertyItem density_mode_items[] = { + {BRUSH_CURVES_SCULPT_DENSITY_MODE_AUTO, + "AUTO", + ICON_AUTO, + "Auto", + "Either add or remove curves depending on the minimum distance of the curves under the " + "cursor"}, + {BRUSH_CURVES_SCULPT_DENSITY_MODE_ADD, + "ADD", + ICON_ADD, + "Add", + "Add new curves between existing curves, taking the minimum distance into account"}, + {BRUSH_CURVES_SCULPT_DENSITY_MODE_REMOVE, + "REMOVE", + ICON_REMOVE, + "Remove", + "Remove curves whose root points are too close"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "BrushCurvesSculptSettings", NULL); RNA_def_struct_sdna(srna, "BrushCurvesSculptSettings"); RNA_def_struct_ui_text(srna, "Curves Sculpt Brush Settings", ""); @@ -1997,6 +2023,22 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna) prop, "Curve Length", "Length of newly added curves when it is not interpolated from other curves"); + + prop = RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 1000.0f, 0.001, 2); + RNA_def_property_ui_text( + prop, "Minimum Distance", "Goal distance between curve roots for the Density brush"); + + prop = RNA_def_property(srna, "density_add_attempts", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, INT32_MAX); + RNA_def_property_ui_text( + prop, "Density Add Attempts", "How many times the Density brush tries to add a new curve"); + + prop = RNA_def_property(srna, "density_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, density_mode_items); + RNA_def_property_ui_text( + prop, "Density Mode", "Determines whether the brush adds or removes curves"); } static void rna_def_brush(BlenderRNA *brna) |