Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-03-21 20:54:31 +0300
committerJacques Lucke <jacques@blender.org>2022-03-21 20:59:03 +0300
commita58be397e2bfbefa0324dbe861b018dd2784ee0d (patch)
tree4ad14d927e10974e95d3be0a32436888a5260a91 /source/blender/makesrna
parentf8d19ec5a3d8c14d0c71464867ad1af10ee50eb5 (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')
-rw-r--r--source/blender/makesrna/intern/rna_brush.c21
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c17
2 files changed, 38 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);
}
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 40f3d79b363..97e1f325816 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1518,6 +1518,23 @@ static void rna_def_curves_sculpt(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Distance", "Radius around curves roots in which no new curves can be added");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "interpolate_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Interpolate Length", "Use length of the curves in close proximity");
+
+ prop = RNA_def_property(srna, "interpolate_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE);
+ RNA_def_property_ui_text(
+ prop, "Interpolate Shape", "Use shape of the curves in close proximity");
+
+ prop = RNA_def_property(srna, "curve_length", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Curve Length",
+ "Length of newly added curves when it is not interpolated from other curves");
}
void RNA_def_sculpt_paint(BlenderRNA *brna)