diff options
author | Johnny Matthews <guitargeek> | 2021-08-04 06:14:03 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-08-04 06:14:03 +0300 |
commit | 0f455765907528ea9d6c15e9d224d81d507e51ad (patch) | |
tree | 7126ab14f23854afc121cea99d278736bc8396e5 /source/blender/makesrna | |
parent | 26f1a5e2c8d705443ab51a608b5721b8f0178de3 (diff) |
Geometry Nodes: Curve Set Spline Type
This node sets the selected (or all) splines in curve to a chosen target
spline type. Poly, Bezier, and NURB splines can be converted to any of
the other types. This is meant to be a building block node, useful in
many procedural situations.
In the future the node could be optimized with multi-threading, or by
avoiding copying in many cases, either by retrieving the curve for write
access or by passing the raw vectors to the new splines where possible.
With edits from Hans Goudey (@HooglyBoogly)
Differential Revision: https://developer.blender.org/D12013
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 3d4256db335..cd7cbbf76d3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -9441,6 +9441,23 @@ static void def_geo_attribute_vector_rotate(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_curve_spline_type(StructRNA *srna) +{ + static const EnumPropertyItem type_items[] = { + {GEO_NODE_SPLINE_TYPE_BEZIER, "BEZIER", ICON_NONE, "Bezier", "Set the splines to Bezier"}, + {GEO_NODE_SPLINE_TYPE_NURBS, "NURBS", ICON_NONE, "NURBS", "Set the splines to NURBS"}, + {GEO_NODE_SPLINE_TYPE_POLY, "POLY", ICON_NONE, "Poly", "Set the splines to Poly"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSplineType", "storage"); + + prop = RNA_def_property(srna, "spline_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "spline_type"); + RNA_def_property_enum_items(prop, type_items); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + static void def_geo_curve_set_handles(StructRNA *srna) { static const EnumPropertyItem type_items[] = { |