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:
authorHans Goudey <h.goudey@me.com>2021-06-21 06:05:57 +0300
committerHans Goudey <h.goudey@me.com>2021-06-21 06:05:57 +0300
commitfeb6fd632f6d6c645c715c5e5e8bcdb9b3eab057 (patch)
tree767e68a6bd4e1a84fbf75b0b53517ae7a9c56da2 /source/blender/nodes
parenta1c3e451002b79b5822da78e9562f12a6f1b0cc6 (diff)
Cleanup: Rename spline interpolation functions
The names were slightly longer than they needed to be clear, and when they are shorter they tend to fit on one line better.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc14
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc38
3 files changed, 26 insertions, 28 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index bf122bab613..fc65d1754e9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -94,16 +94,16 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count)
Array<float> uniform_samples = input_spline.sample_uniform_index_factors(count);
- input_spline.sample_based_on_index_factors<float3>(
+ input_spline.sample_with_index_factors<float3>(
input_spline.evaluated_positions(), uniform_samples, output_spline->positions());
- input_spline.sample_based_on_index_factors<float>(
- input_spline.interpolate_to_evaluated_points(input_spline.radii()),
+ input_spline.sample_with_index_factors<float>(
+ input_spline.interpolate_to_evaluated(input_spline.radii()),
uniform_samples,
output_spline->radii());
- input_spline.sample_based_on_index_factors<float>(
- input_spline.interpolate_to_evaluated_points(input_spline.tilts()),
+ input_spline.sample_with_index_factors<float>(
+ input_spline.interpolate_to_evaluated(input_spline.tilts()),
uniform_samples,
output_spline->tilts());
@@ -123,8 +123,8 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count)
return false;
}
- input_spline.sample_based_on_index_factors(
- *input_spline.interpolate_to_evaluated_points(*input_attribute),
+ input_spline.sample_with_index_factors(
+ *input_spline.interpolate_to_evaluated(*input_attribute),
uniform_samples,
*output_attribute);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
index b6f04352929..fc8558dfd2f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
@@ -181,7 +181,7 @@ static void spline_extrude_to_mesh_data(const Spline &spline,
Span<float3> normals = spline.evaluated_normals();
Span<float3> profile_positions = profile_spline.evaluated_positions();
- GVArray_Typed<float> radii = spline.interpolate_to_evaluated_points(spline.radii());
+ GVArray_Typed<float> radii = spline.interpolate_to_evaluated(spline.radii());
for (const int i_ring : IndexRange(spline_vert_len)) {
float4x4 point_matrix = float4x4::from_normalized_axis_data(
positions[i_ring], normals[i_ring], tangents[i_ring]);
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 26ff1dbe9dc..dbfe3211ac4 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
@@ -186,7 +186,7 @@ static ResultAttributes create_point_attributes(PointCloudComponent &points,
/**
* TODO: For non-poly splines, this has double copies that could be avoided as part
- * of a general look at optimizing uses of #interpolate_to_evaluated_points.
+ * of a general look at optimizing uses of #Spline::interpolate_to_evaluated.
*/
static void copy_evaluated_point_attributes(Span<SplinePtr> splines,
Span<int> offsets,
@@ -199,10 +199,8 @@ static void copy_evaluated_point_attributes(Span<SplinePtr> splines,
const int size = offsets[i + 1] - offsets[i];
data.positions.slice(offset, size).copy_from(spline.evaluated_positions());
- spline.interpolate_to_evaluated_points(spline.radii())
- ->materialize(data.radii.slice(offset, size));
- spline.interpolate_to_evaluated_points(spline.tilts())
- ->materialize(data.tilts.slice(offset, size));
+ spline.interpolate_to_evaluated(spline.radii())->materialize(data.radii.slice(offset, size));
+ spline.interpolate_to_evaluated(spline.tilts())->materialize(data.tilts.slice(offset, size));
for (const Map<std::string, GMutableSpan>::Item &item : data.point_attributes.items()) {
const StringRef name = item.key;
@@ -211,7 +209,7 @@ static void copy_evaluated_point_attributes(Span<SplinePtr> splines,
BLI_assert(spline.attributes.get_for_read(name));
GSpan spline_span = *spline.attributes.get_for_read(name);
- spline.interpolate_to_evaluated_points(spline_span)
+ spline.interpolate_to_evaluated(spline_span)
->materialize(point_span.slice(offset, size).data());
}
@@ -236,18 +234,16 @@ static void copy_uniform_sample_point_attributes(Span<SplinePtr> splines,
const Array<float> uniform_samples = spline.sample_uniform_index_factors(size);
- spline.sample_based_on_index_factors<float3>(
+ spline.sample_with_index_factors<float3>(
spline.evaluated_positions(), uniform_samples, data.positions.slice(offset, size));
- spline.sample_based_on_index_factors<float>(
- spline.interpolate_to_evaluated_points(spline.radii()),
- uniform_samples,
- data.radii.slice(offset, size));
+ spline.sample_with_index_factors<float>(spline.interpolate_to_evaluated(spline.radii()),
+ uniform_samples,
+ data.radii.slice(offset, size));
- spline.sample_based_on_index_factors<float>(
- spline.interpolate_to_evaluated_points(spline.tilts()),
- uniform_samples,
- data.tilts.slice(offset, size));
+ spline.sample_with_index_factors<float>(spline.interpolate_to_evaluated(spline.tilts()),
+ uniform_samples,
+ data.tilts.slice(offset, size));
for (const Map<std::string, GMutableSpan>::Item &item : data.point_attributes.items()) {
const StringRef name = item.key;
@@ -256,18 +252,18 @@ static void copy_uniform_sample_point_attributes(Span<SplinePtr> splines,
BLI_assert(spline.attributes.get_for_read(name));
GSpan spline_span = *spline.attributes.get_for_read(name);
- spline.sample_based_on_index_factors(*spline.interpolate_to_evaluated_points(spline_span),
- uniform_samples,
- point_span.slice(offset, size));
+ spline.sample_with_index_factors(*spline.interpolate_to_evaluated(spline_span),
+ uniform_samples,
+ point_span.slice(offset, size));
}
- spline.sample_based_on_index_factors<float3>(
+ spline.sample_with_index_factors<float3>(
spline.evaluated_tangents(), uniform_samples, data.tangents.slice(offset, size));
for (float3 &tangent : data.tangents) {
tangent.normalize();
}
- spline.sample_based_on_index_factors<float3>(
+ spline.sample_with_index_factors<float3>(
spline.evaluated_normals(), uniform_samples, data.normals.slice(offset, size));
for (float3 &normals : data.normals) {
normals.normalize();
@@ -330,6 +326,8 @@ static void geo_node_curve_to_points_exec(GeoNodeExecParams params)
geometry_set = bke::geometry_set_realize_instances(geometry_set);
+ SCOPED_TIMER(__func__);
+
if (!geometry_set.has_curve()) {
params.set_output("Geometry", GeometrySet());
return;