diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:54:31 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:59:03 +0300 |
commit | a58be397e2bfbefa0324dbe861b018dd2784ee0d (patch) | |
tree | 4ad14d927e10974e95d3be0a32436888a5260a91 /source/blender/makesrna/intern/rna_brush.c | |
parent | f8d19ec5a3d8c14d0c71464867ad1af10ee50eb5 (diff) |
Curves: new Add brush
This adds a new Add brush for the new curves object type in sculpt mode.
The brush is used to insert new curves (typically hair) on the surface object.
Supported features:
* Add single curve exactly at the cursor position when `Add Amount` is 1.
* Front faces only.
* Independent interpolate shape and interpolate length settings.
* Smooth and flat shading affects curve shape interpolation.
* Spherical and projection brush.
This also adds the `surface_triangle_index` and `surface_triangle_coordinate`
attributes. Those store information about what position on the surface each
added curve is attached to:
* `surface_triangle_index` (`int`): Index of the internal triangle that a curve
is attached to. `-1` when the curve is not attached to the surface.
* `surface_triangle_coordinate` (`float2`): First two numbers of a barycentric
coordinate that reference a specific position within the triangle.
Ref T96444.
Differential Revision: https://developer.blender.org/D14340
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index ee4718aff03..c86a852b0ea 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -247,6 +247,7 @@ const EnumPropertyItem rna_enum_brush_curves_sculpt_tool_items[] = { {CURVES_SCULPT_TOOL_COMB, "COMB", ICON_NONE, "Comb", ""}, {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_TEST1, "TEST1", ICON_NONE, "Test 1", ""}, {CURVES_SCULPT_TOOL_TEST2, "TEST2", ICON_NONE, "Test 2", ""}, {0, NULL, 0, NULL, NULL}, @@ -1913,6 +1914,20 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } +static void rna_def_curves_sculpt_options(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "BrushCurvesSculptSettings", NULL); + RNA_def_struct_sdna(srna, "BrushCurvesSculptSettings"); + RNA_def_struct_ui_text(srna, "Curves Sculpt Brush Settings", ""); + + 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"); +} + static void rna_def_brush(BlenderRNA *brna) { StructRNA *srna; @@ -3491,6 +3506,11 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "gpencil_settings"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Gpencil Settings", ""); + + prop = RNA_def_property(srna, "curves_sculpt_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "BrushCurvesSculptSettings"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Curves Sculpt Settings", ""); } /** @@ -3577,6 +3597,7 @@ void RNA_def_brush(BlenderRNA *brna) rna_def_vertex_paint_capabilities(brna); rna_def_weight_paint_capabilities(brna); rna_def_gpencil_options(brna); + rna_def_curves_sculpt_options(brna); rna_def_brush_texture_slot(brna); rna_def_operator_stroke_element(brna); } |