[Bf-blender-cvs] [69582bf5b74] geometry-nodes-curve-to-points-node: Change default to "Count", divide radius by 10
Hans Goudey
noreply at git.blender.org
Thu Jun 10 16:44:15 CEST 2021
Commit: 69582bf5b7464501475173226250f7d97c81d75a
Author: Hans Goudey
Date: Thu Jun 10 09:42:30 2021 -0500
Branches: geometry-nodes-curve-to-points-node
https://developer.blender.org/rB69582bf5b7464501475173226250f7d97c81d75a
Change default to "Count", divide radius by 10
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 069b9031466..af3c2d5f5e9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -48,7 +48,7 @@ static void geo_node_curve_to_points_init(bNodeTree *UNUSED(tree), bNode *node)
NodeGeometryCurveToPoints *data = (NodeGeometryCurveToPoints *)MEM_callocN(
sizeof(NodeGeometryCurveToPoints), __func__);
- data->mode = GEO_NODE_CURVE_SAMPLE_EVALUATED;
+ data->mode = GEO_NODE_CURVE_SAMPLE_COUNT;
node->storage = data;
}
@@ -85,14 +85,14 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams ¶ms,
const CurveEval &curve,
const Span<SplinePtr> splines)
{
- const int splines_size = curve.splines().size();
+ const int size = curve.splines().size();
switch (mode) {
case GEO_NODE_CURVE_SAMPLE_COUNT: {
const int count = params.extract_input<int>("Count");
if (count < 1) {
return {0};
}
- Array<int> offsets(splines_size + 1);
+ Array<int> offsets(size + 1);
for (const int i : offsets.index_range()) {
offsets[i] = count * i;
}
@@ -101,9 +101,9 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams ¶ms,
case GEO_NODE_CURVE_SAMPLE_LENGTH: {
/* Don't allow asymptotic count increase for low resolution values. */
const float resolution = std::max(params.extract_input<float>("Length"), 0.0001f);
- Array<int> offsets(splines_size + 1);
+ Array<int> offsets(size + 1);
int offset = 0;
- for (const int i : IndexRange(splines_size)) {
+ for (const int i : IndexRange(size)) {
offsets[i] = offset;
offset += splines[i]->length() / resolution;
}
@@ -367,6 +367,11 @@ static void geo_node_curve_to_points_exec(GeoNodeExecParams params)
copy_spline_domain_attributes(curve_component, offsets, point_component);
create_default_rotation_attribute(new_attributes);
+ /* The default radius is way too large for points, divide by 10. */
+ for (float &radius : new_attributes.radii) {
+ radius *= 0.1f;
+ }
+
params.set_output("Geometry", std::move(result));
}
More information about the Bf-blender-cvs
mailing list