diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-30 23:49:26 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-30 23:49:26 +0300 |
commit | 0827245a91fa9af07c324bb823c5ee0f7b2dba09 (patch) | |
tree | 46f345d6fca0a9250aed17ebdce3da0fe7402fcd | |
parent | 2f284f42b6e3adf5b76251fab6ed6509ce789afe (diff) |
cleanup
5 files changed, 24 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc index 605669535b3..771e8ca0d0b 100644 --- a/source/blender/blenkernel/intern/spline_base.cc +++ b/source/blender/blenkernel/intern/spline_base.cc @@ -30,10 +30,12 @@ using blender::float3; using blender::IndexRange; using blender::MutableSpan; using blender::Span; +using blender::VArray; using blender::attribute_math::convert_to_static_type; using blender::bke::AttributeIDRef; using blender::fn::GMutableSpan; using blender::fn::GSpan; +using blender::fn::GVArray; Spline::Type Spline::type() const { @@ -412,7 +414,7 @@ Span<float3> Spline::evaluated_normals() const } /* Rotate the generated normals with the interpolated tilt data. */ - blender::VArray<float> tilts = this->interpolate_to_evaluated(this->tilts()); + VArray<float> tilts = this->interpolate_to_evaluated(this->tilts()); for (const int i : normals.index_range()) { normals[i] = rotate_direction_around_axis(normals[i], tangents[i], tilts[i]); } @@ -525,9 +527,9 @@ void Spline::bounds_min_max(float3 &min, float3 &max, const bool use_evaluated) } } -blender::fn::GVArray Spline::interpolate_to_evaluated(GSpan data) const +GVArray Spline::interpolate_to_evaluated(GSpan data) const { - return this->interpolate_to_evaluated(blender::fn::GVArray::ForSpan(data)); + return this->interpolate_to_evaluated(GVArray::ForSpan(data)); } /** @@ -535,7 +537,7 @@ blender::fn::GVArray Spline::interpolate_to_evaluated(GSpan data) const * points) to arbitrary parameters in between the evaluated points. The interpolation is quite * simple, but this handles the cyclic and end point special cases. */ -void Spline::sample_with_index_factors(const blender::fn::GVArray &src, +void Spline::sample_with_index_factors(const GVArray &src, Span<float> index_factors, GMutableSpan dst) const { @@ -543,7 +545,7 @@ void Spline::sample_with_index_factors(const blender::fn::GVArray &src, blender::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); - const blender::VArray<T> src_typed = src.typed<T>(); + const VArray<T> src_typed = src.typed<T>(); MutableSpan<T> dst_typed = dst.typed<T>(); if (src.size() == 1) { dst_typed.fill(src_typed[0]); diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index c7ab7633a4d..93263b09adb 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -25,6 +25,8 @@ using blender::float3; using blender::IndexRange; using blender::MutableSpan; using blender::Span; +using blender::VArray; +using blender::fn::GVArray; void BezierSpline::copy_settings(Spline &dst) const { @@ -694,7 +696,7 @@ static void interpolate_to_evaluated_impl(const BezierSpline &spline, } } -blender::fn::GVArray BezierSpline::interpolate_to_evaluated(const blender::fn::GVArray &src) const +GVArray BezierSpline::interpolate_to_evaluated(const GVArray &src) const { BLI_assert(src.size() == this->size()); @@ -707,13 +709,13 @@ blender::fn::GVArray BezierSpline::interpolate_to_evaluated(const blender::fn::G return src; } - blender::fn::GVArray new_varray; + GVArray new_varray; blender::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); if constexpr (!std::is_void_v<blender::attribute_math::DefaultMixer<T>>) { Array<T> values(eval_size); interpolate_to_evaluated_impl<T>(*this, src.typed<T>(), values); - new_varray = blender::VArray<T>::ForContainer(std::move(values)); + new_varray = VArray<T>::ForContainer(std::move(values)); } }); diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index b05a4b5286f..7fa332a0330 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -26,6 +26,8 @@ using blender::float3; using blender::IndexRange; using blender::MutableSpan; using blender::Span; +using blender::VArray; +using blender::fn::GVArray; void NURBSpline::copy_settings(Spline &dst) const { @@ -406,7 +408,7 @@ void interpolate_to_evaluated_impl(Span<NURBSpline::BasisCache> weights, mixer.finalize(); } -blender::fn::GVArray NURBSpline::interpolate_to_evaluated(const blender::fn::GVArray &src) const +GVArray NURBSpline::interpolate_to_evaluated(const GVArray &src) const { BLI_assert(src.size() == this->size()); @@ -416,13 +418,13 @@ blender::fn::GVArray NURBSpline::interpolate_to_evaluated(const blender::fn::GVA Span<BasisCache> basis_cache = this->calculate_basis_cache(); - blender::fn::GVArray new_varray; + GVArray new_varray; blender::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); if constexpr (!std::is_void_v<blender::attribute_math::DefaultMixer<T>>) { Array<T> values(this->evaluated_points_size()); interpolate_to_evaluated_impl<T>(basis_cache, src.typed<T>(), values); - new_varray = blender::VArray<T>::ForContainer(std::move(values)); + new_varray = VArray<T>::ForContainer(std::move(values)); } }); @@ -444,7 +446,7 @@ Span<float3> NURBSpline::evaluated_positions() const evaluated_position_cache_.resize(eval_size); /* TODO: Avoid copying the evaluated data from the temporary array. */ - blender::VArray<float3> evaluated = Spline::interpolate_to_evaluated(positions_.as_span()); + VArray<float3> evaluated = Spline::interpolate_to_evaluated(positions_.as_span()); evaluated.materialize(evaluated_position_cache_); position_cache_dirty_ = false; diff --git a/source/blender/blenkernel/intern/spline_poly.cc b/source/blender/blenkernel/intern/spline_poly.cc index 97fe2a885d4..d495c977285 100644 --- a/source/blender/blenkernel/intern/spline_poly.cc +++ b/source/blender/blenkernel/intern/spline_poly.cc @@ -22,6 +22,7 @@ using blender::float3; using blender::MutableSpan; using blender::Span; +using blender::fn::GVArray; void PolySpline::copy_settings(Spline &UNUSED(dst)) const { @@ -116,11 +117,11 @@ Span<float3> PolySpline::evaluated_positions() const /** * Poly spline interpolation from control points to evaluated points is a special case, since - * the result data is the same as the input data. This function returns a GVArray that points - * to the original data. Therefore the lifetime of the returned virtual array must not be longer - * than the source data. + * the result data is the same as the input data. This function returns a GVArray that points to + * the original data. Therefore the lifetime of the returned virtual array must not be longer than + * the source data. */ -blender::fn::GVArray PolySpline::interpolate_to_evaluated(const blender::fn::GVArray &src) const +GVArray PolySpline::interpolate_to_evaluated(const GVArray &src) const { BLI_assert(src.size() == this->size()); return src; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc index 8d9e4c3fe94..236c619884d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc @@ -173,7 +173,7 @@ static void gather_point_data_from_component(GeoNodeExecParams ¶ms, const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_POINT); r_positions.resize(r_positions.size() + domain_size); - positions->materialize(r_positions.as_mutable_span().take_back(domain_size)); + positions.materialize(r_positions.as_mutable_span().take_back(domain_size)); r_radii.resize(r_radii.size() + domain_size); fn::FieldEvaluator evaluator{field_context, domain_size}; |