diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-21 04:37:49 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-21 04:37:49 +0300 |
commit | 5eb505e3682260d47b319b56d8d56310de766cab (patch) | |
tree | c53182ade491bc8478ce7eaf0bc2203ab6c31278 /source/blender/nodes | |
parent | 17021adceaee28295b89301b4f715b6bcd8d5fca (diff) |
Cleanup: Remove debugging change, add comments
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc index 1dbb1f20915..245394d3057 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -106,12 +106,6 @@ class SampleCurveFunction : public fn::MultiFunction { void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - // MutableSpan<float3> sampled_positions = params.uninitialized_single_output<float3>(1, - // "Position"); - // MutableSpan<float3> sampled_tangents = params.uninitialized_single_output<float3>(2, - // "Tangent"); - // MutableSpan<float3> sampled_normals = params.uninitialized_single_output<float3>(3, - // "Normal"); MutableSpan<float3> sampled_positions = params.uninitialized_single_output_if_required<float3>( 1, "Position"); MutableSpan<float3> sampled_tangents = params.uninitialized_single_output_if_required<float3>( @@ -161,6 +155,7 @@ class SampleCurveFunction : public fn::MultiFunction { spline_indices[i] = std::max(index, 0); } + /* Storing lookups in an array is unecessary but will simplify custom attribute transfer. */ Array<Spline::LookupResult> lookups(mask.min_array_size()); for (const int i : mask) { const float length_in_spline = lengths[i] - spline_lengths_[spline_indices[i]]; @@ -207,7 +202,7 @@ static Field<float> get_length_input_field(const GeoNodeExecParams ¶ms, const GeometryNodeCurveSampleMode mode = (GeometryNodeCurveSampleMode)node_storage.mode; if (mode == GEO_NODE_CURVE_SAMPLE_LENGTH) { - return params.get_input<Field<float>>("Length"); + /* Just make sure the length is in bounds of the curve. */ Field<float> length_field = params.get_input<Field<float>>("Length"); auto clamp_fn = std::make_unique<fn::CustomMF_SI_SO<float, float>>( __func__, [curve_total_length](float length) { @@ -219,6 +214,7 @@ static Field<float> get_length_input_field(const GeoNodeExecParams ¶ms, return Field<float>(std::move(clamp_op), 0); } + /* Convert the factor to a length and clamp it to the bounds of the curve. */ Field<float> factor_field = params.get_input<Field<float>>("Factor"); auto clamp_fn = std::make_unique<fn::CustomMF_SI_SO<float, float>>( __func__, [curve_total_length](float factor) { |