diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-25 04:48:08 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-25 04:48:08 +0300 |
commit | 6e72e3fdb295fdfd3e252bd48be96e2d832e43f2 (patch) | |
tree | 70e439dfb872a2bb6dc2be33163f5fa13f82c434 /source/blender | |
parent | d3999683ff5ac8b42de74cb453b459096f76f542 (diff) |
Cleanup: Further renaming in new curves code
A follow-up to e253f9f66d6f. Follow the policy from T85728
completely (using "num" as a prefix) and rename another function.
Diffstat (limited to 'source/blender')
19 files changed, 108 insertions, 108 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh index 5039b6f0f57..6a95bc7d2d2 100644 --- a/source/blender/blenkernel/BKE_curves.hh +++ b/source/blender/blenkernel/BKE_curves.hh @@ -122,8 +122,8 @@ class CurvesGeometry : public ::CurvesGeometry { * Accessors. */ - int num_points() const; - int num_curves() const; + int points_num() const; + int curves_num() const; IndexRange points_range() const; IndexRange curves_range() const; @@ -243,7 +243,7 @@ class CurvesGeometry : public ::CurvesGeometry { * The total number of points in the evaluated poly curve. * This can depend on the resolution attribute if it exists. */ - int evaluated_points_size() const; + int evaluated_points_num() const; /** * Access a range of indices of point data for a specific curve. @@ -275,7 +275,7 @@ class CurvesGeometry : public ::CurvesGeometry { * Change the number of elements. New values for existing attributes should be properly * initialized afterwards. */ - void resize(int num_points, int num_curves); + void resize(int points_num, int curves_num); /** Call after deforming the position attribute. */ void tag_positions_changed(); @@ -314,9 +314,9 @@ namespace curves { * and the fact that curves with two points cannot be cyclic. The logic is simple, but this * function should be used to make intentions clearer. */ -inline int curve_segment_size(const int num_points, const bool cyclic) +inline int curve_segment_size(const int points_num, const bool cyclic) { - return (cyclic && num_points > 2) ? num_points : num_points - 1; + return (cyclic && points_num > 2) ? points_num : points_num - 1; } namespace bezier { @@ -381,10 +381,10 @@ namespace catmull_rom { /** * Calculate the number of evaluated points that #interpolate_to_evaluated is expected to produce. - * \param num_points: The number of points in the curve. + * \param points_num: The number of points in the curve. * \param resolution: The resolution for each segment. */ -int calculate_evaluated_size(int num_points, bool cyclic, int resolution); +int calculate_evaluated_size(int points_num, bool cyclic, int resolution); /** * Evaluate the Catmull Rom curve. The length of the #dst span should be calculated with @@ -399,7 +399,7 @@ namespace nurbs { /** * Checks the conditions that a NURBS curve needs to evaluate. */ -bool check_valid_size_and_order(int num_points, int8_t order, bool cyclic, KnotsMode knots_mode); +bool check_valid_size_and_order(int points_num, int8_t order, bool cyclic, KnotsMode knots_mode); /** * Calculate the standard evaluated size for a NURBS curve, using the standard that @@ -410,14 +410,14 @@ bool check_valid_size_and_order(int num_points, int8_t order, bool cyclic, Knots * shared. */ int calculate_evaluated_size( - int num_points, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode); + int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode); /** * Calculate the length of the knot vector for a NURBS curve with the given properties. * The knots must be longer for a cyclic curve, for example, in order to provide weights for the * last evaluated points that are also influenced by the first control points. */ -int knots_size(int num_points, int8_t order, bool cyclic); +int knots_size(int points_num, int8_t order, bool cyclic); /** * Calculate the knots for a spline given its properties, based on built-in standards defined by @@ -428,7 +428,7 @@ int knots_size(int num_points, int8_t order, bool cyclic); * changes, and is generally more intuitive than defining the knot vector manually. */ void calculate_knots( - int num_points, KnotsMode mode, int8_t order, bool cyclic, MutableSpan<float> knots); + int points_num, KnotsMode mode, int8_t order, bool cyclic, MutableSpan<float> knots); /** * Based on the knots, the order, and other properties of a NURBS curve, calculate a cache that can @@ -436,7 +436,7 @@ void calculate_knots( * two pieces of information for every evaluated point: the first control point that influences it, * and a weight for each control point. */ -void calculate_basis_cache(int num_points, +void calculate_basis_cache(int points_num, int evaluated_size, int8_t order, bool cyclic, @@ -461,11 +461,11 @@ void interpolate_to_evaluated(const BasisCache &basis_cache, } // namespace curves -Curves *curves_new_nomain(int num_points, int num_curves); +Curves *curves_new_nomain(int points_num, int curves_num); /** * Create a new curves data-block containing a single curve with the given length and type. */ -Curves *curves_new_nomain_single(int num_points, CurveType type); +Curves *curves_new_nomain_single(int points_num, CurveType type); } // namespace blender::bke diff --git a/source/blender/blenkernel/intern/curve_catmull_rom.cc b/source/blender/blenkernel/intern/curve_catmull_rom.cc index 5b6d0cac21f..ea3672dd56b 100644 --- a/source/blender/blenkernel/intern/curve_catmull_rom.cc +++ b/source/blender/blenkernel/intern/curve_catmull_rom.cc @@ -9,11 +9,11 @@ namespace blender::bke::curves::catmull_rom { -int calculate_evaluated_size(const int num_points, const bool cyclic, const int resolution) +int calculate_evaluated_size(const int points_num, const bool cyclic, const int resolution) { - const int eval_size = resolution * curve_segment_size(num_points, cyclic); + const int eval_size = resolution * curve_segment_size(points_num, cyclic); /* If the curve isn't cyclic, one last point is added to the final point. */ - return (cyclic && num_points > 2) ? eval_size : eval_size + 1; + return (cyclic && points_num > 2) ? eval_size : eval_size + 1; } /* Adapted from Cycles #catmull_rom_basis_eval function. */ diff --git a/source/blender/blenkernel/intern/curve_nurbs.cc b/source/blender/blenkernel/intern/curve_nurbs.cc index bd6bd222aa3..31fe5426b5b 100644 --- a/source/blender/blenkernel/intern/curve_nurbs.cc +++ b/source/blender/blenkernel/intern/curve_nurbs.cc @@ -10,53 +10,53 @@ namespace blender::bke::curves::nurbs { -bool check_valid_size_and_order(const int num_points, +bool check_valid_size_and_order(const int points_num, const int8_t order, const bool cyclic, const KnotsMode knots_mode) { - if (num_points < order) { + if (points_num < order) { return false; } if (ELEM(knots_mode, NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT_BEZIER)) { - if (knots_mode == NURBS_KNOT_MODE_BEZIER && num_points <= order) { + if (knots_mode == NURBS_KNOT_MODE_BEZIER && points_num <= order) { return false; } - return (!cyclic || num_points % (order - 1) == 0); + return (!cyclic || points_num % (order - 1) == 0); } return true; } -int calculate_evaluated_size(const int num_points, +int calculate_evaluated_size(const int points_num, const int8_t order, const bool cyclic, const int resolution, const KnotsMode knots_mode) { - if (!check_valid_size_and_order(num_points, order, cyclic, knots_mode)) { + if (!check_valid_size_and_order(points_num, order, cyclic, knots_mode)) { return 0; } - return resolution * curve_segment_size(num_points, cyclic); + return resolution * curve_segment_size(points_num, cyclic); } -int knots_size(const int num_points, const int8_t order, const bool cyclic) +int knots_size(const int points_num, const int8_t order, const bool cyclic) { if (cyclic) { - return num_points + order * 2 - 1; + return points_num + order * 2 - 1; } - return num_points + order; + return points_num + order; } -void calculate_knots(const int num_points, +void calculate_knots(const int points_num, const KnotsMode mode, const int8_t order, const bool cyclic, MutableSpan<float> knots) { - BLI_assert(knots.size() == knots_size(num_points, order, cyclic)); - UNUSED_VARS_NDEBUG(num_points); + BLI_assert(knots.size() == knots_size(points_num, order, cyclic)); + UNUSED_VARS_NDEBUG(points_num); const bool is_bezier = ELEM(mode, NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT_BEZIER); const bool is_end_point = ELEM(mode, NURBS_KNOT_MODE_ENDPOINT, NURBS_KNOT_MODE_ENDPOINT_BEZIER); @@ -94,7 +94,7 @@ void calculate_knots(const int num_points, } static void calculate_basis_for_point(const float parameter, - const int num_points, + const int points_num, const int degree, const Span<float> knots, MutableSpan<float> r_weights, @@ -104,7 +104,7 @@ static void calculate_basis_for_point(const float parameter, int start = 0; int end = 0; - for (const int i : IndexRange(num_points + degree)) { + for (const int i : IndexRange(points_num + degree)) { const bool knots_equal = knots[i] == knots[i + 1]; if (knots_equal || parameter < knots[i] || parameter > knots[i + 1]) { continue; @@ -121,7 +121,7 @@ static void calculate_basis_for_point(const float parameter, for (const int i_order : IndexRange(2, degree)) { if (end + i_order >= knots.size()) { - end = num_points + degree - i_order; + end = points_num + degree - i_order; } for (const int i : IndexRange(end - start + 1)) { const int knot_index = start + i; @@ -146,14 +146,14 @@ static void calculate_basis_for_point(const float parameter, r_start_index = start; } -void calculate_basis_cache(const int num_points, +void calculate_basis_cache(const int points_num, const int evaluated_size, const int8_t order, const bool cyclic, const Span<float> knots, BasisCache &basis_cache) { - BLI_assert(num_points > 0); + BLI_assert(points_num > 0); BLI_assert(evaluated_size > 0); const int8_t degree = order - 1; @@ -168,7 +168,7 @@ void calculate_basis_cache(const int num_points, MutableSpan<float> basis_weights(basis_cache.weights); MutableSpan<int> basis_start_indices(basis_cache.start_indices); - const int last_control_point_index = cyclic ? num_points + degree : num_points; + const int last_control_point_index = cyclic ? points_num + degree : points_num; const int evaluated_segment_size = curve_segment_size(evaluated_size, cyclic); const float start = knots[degree]; @@ -176,7 +176,7 @@ void calculate_basis_cache(const int num_points, const float step = (end - start) / evaluated_segment_size; for (const int i : IndexRange(evaluated_size)) { /* Clamp parameter due to floating point inaccuracy. */ - const float parameter = std::clamp(start + step * i, knots[0], knots[num_points + degree]); + const float parameter = std::clamp(start + step * i, knots[0], knots[points_num + degree]); MutableSpan<float> point_weights = basis_weights.slice(i * order, order); diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc index e88d25ae56a..82db1176759 100644 --- a/source/blender/blenkernel/intern/curves.cc +++ b/source/blender/blenkernel/intern/curves.cc @@ -366,19 +366,19 @@ void BKE_curves_batch_cache_free(Curves *curves) namespace blender::bke { -Curves *curves_new_nomain(const int num_points, const int num_curves) +Curves *curves_new_nomain(const int points_num, const int curves_num) { Curves *curves = static_cast<Curves *>(BKE_id_new_nomain(ID_CV, nullptr)); CurvesGeometry &geometry = CurvesGeometry::wrap(curves->geometry); - geometry.resize(num_points, num_curves); + geometry.resize(points_num, curves_num); return curves; } -Curves *curves_new_nomain_single(const int num_points, const CurveType type) +Curves *curves_new_nomain_single(const int points_num, const CurveType type) { - Curves *curves = curves_new_nomain(num_points, 1); + Curves *curves = curves_new_nomain(points_num, 1); CurvesGeometry &geometry = CurvesGeometry::wrap(curves->geometry); - geometry.offsets().last() = num_points; + geometry.offsets().last() = points_num; geometry.curve_types().first() = type; return curves; } diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index f9c925b626d..a069176c6f3 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -149,21 +149,21 @@ CurvesGeometry::~CurvesGeometry() /** \name Accessors * \{ */ -int CurvesGeometry::num_points() const +int CurvesGeometry::points_num() const { return this->point_size; } -int CurvesGeometry::num_curves() const +int CurvesGeometry::curves_num() const { return this->curve_size; } IndexRange CurvesGeometry::points_range() const { - return IndexRange(this->num_points()); + return IndexRange(this->points_num()); } IndexRange CurvesGeometry::curves_range() const { - return IndexRange(this->num_curves()); + return IndexRange(this->curves_num()); } IndexRange CurvesGeometry::points_for_curve(const int index) const @@ -186,7 +186,7 @@ IndexRange CurvesGeometry::points_for_curves(const IndexRange curves) const static int domain_size(const CurvesGeometry &curves, const AttributeDomain domain) { - return domain == ATTR_DOMAIN_POINT ? curves.num_points() : curves.num_curves(); + return domain == ATTR_DOMAIN_POINT ? curves.points_num() : curves.curves_num(); } static CustomData &domain_custom_data(CurvesGeometry &curves, const AttributeDomain domain) @@ -457,7 +457,7 @@ static void calculate_evaluated_offsets(const CurvesGeometry &curves, }); } -int CurvesGeometry::evaluated_points_size() const +int CurvesGeometry::evaluated_points_num() const { /* This could avoid calculating offsets in the future in simple circumstances. */ return this->evaluated_offsets().last(); @@ -482,10 +482,10 @@ Span<int> CurvesGeometry::evaluated_offsets() const } threading::isolate_task([&]() { - this->runtime->evaluated_offsets_cache.resize(this->num_curves() + 1); + this->runtime->evaluated_offsets_cache.resize(this->curves_num() + 1); if (this->has_curve_with_type(CURVE_TYPE_BEZIER)) { - this->runtime->bezier_evaluated_offsets.resize(this->num_points()); + this->runtime->bezier_evaluated_offsets.resize(this->points_num()); } else { this->runtime->bezier_evaluated_offsets.clear_and_make_inline(); @@ -536,7 +536,7 @@ void CurvesGeometry::ensure_nurbs_basis_cache() const return; } - this->runtime->nurbs_basis_cache.resize(this->num_curves()); + this->runtime->nurbs_basis_cache.resize(this->curves_num()); MutableSpan<curves::nurbs::BasisCache> basis_caches(this->runtime->nurbs_basis_cache); VArray<bool> cyclic = this->cyclic(); @@ -579,7 +579,7 @@ Span<float3> CurvesGeometry::evaluated_positions() const } threading::isolate_task([&]() { - this->runtime->evaluated_position_cache.resize(this->evaluated_points_size()); + this->runtime->evaluated_position_cache.resize(this->evaluated_points_num()); MutableSpan<float3> evaluated_positions = this->runtime->evaluated_position_cache; VArray<int8_t> types = this->curve_types(); @@ -645,16 +645,16 @@ Span<float3> CurvesGeometry::evaluated_positions() const /** \name Operations * \{ */ -void CurvesGeometry::resize(const int num_points, const int num_curves) +void CurvesGeometry::resize(const int points_num, const int curves_num) { - if (num_points != this->point_size) { - CustomData_realloc(&this->point_data, num_points); - this->point_size = num_points; + if (points_num != this->point_size) { + CustomData_realloc(&this->point_data, points_num); + this->point_size = points_num; } - if (num_curves != this->curve_size) { - CustomData_realloc(&this->curve_data, num_curves); - this->curve_size = num_curves; - this->curve_offsets = (int *)MEM_reallocN(this->curve_offsets, sizeof(int) * (num_curves + 1)); + if (curves_num != this->curve_size) { + CustomData_realloc(&this->curve_data, curves_num); + this->curve_size = curves_num; + this->curve_offsets = (int *)MEM_reallocN(this->curve_offsets, sizeof(int) * (curves_num + 1)); } this->tag_topology_changed(); this->update_customdata_pointers(); @@ -727,7 +727,7 @@ static std::optional<bounds::MinMaxResult<float3>> curves_bounds(const CurvesGeo { Span<float3> positions = curves.positions(); if (curves.radius) { - Span<float> radii{curves.radius, curves.num_points()}; + Span<float> radii{curves.radius, curves.points_num()}; return bounds::min_max_with_radii(positions, radii); } return bounds::min_max(positions); @@ -926,7 +926,7 @@ static bool layer_matches_name_and_type(const CustomDataLayer &layer, void CurvesGeometry::reverse_curves(const IndexMask curves_to_reverse) { - CustomData_duplicate_referenced_layers(&this->point_data, this->num_points()); + CustomData_duplicate_referenced_layers(&this->point_data, this->points_num()); /* Collect the Bezier handle attributes while iterating through the point custom data layers; * they need special treatment later. */ @@ -940,22 +940,22 @@ void CurvesGeometry::reverse_curves(const IndexMask curves_to_reverse) if (positions_left.is_empty() && layer_matches_name_and_type(layer, ATTR_HANDLE_POSITION_LEFT, CD_PROP_FLOAT3)) { - positions_left = {static_cast<float3 *>(layer.data), this->num_points()}; + positions_left = {static_cast<float3 *>(layer.data), this->points_num()}; continue; } if (positions_right.is_empty() && layer_matches_name_and_type(layer, ATTR_HANDLE_POSITION_RIGHT, CD_PROP_FLOAT3)) { - positions_right = {static_cast<float3 *>(layer.data), this->num_points()}; + positions_right = {static_cast<float3 *>(layer.data), this->points_num()}; continue; } if (types_left.is_empty() && layer_matches_name_and_type(layer, ATTR_HANDLE_TYPE_LEFT, CD_PROP_INT8)) { - types_left = {static_cast<int8_t *>(layer.data), this->num_points()}; + types_left = {static_cast<int8_t *>(layer.data), this->points_num()}; continue; } if (types_right.is_empty() && layer_matches_name_and_type(layer, ATTR_HANDLE_TYPE_RIGHT, CD_PROP_INT8)) { - types_right = {static_cast<int8_t *>(layer.data), this->num_points()}; + types_right = {static_cast<int8_t *>(layer.data), this->points_num()}; continue; } @@ -963,7 +963,7 @@ void CurvesGeometry::reverse_curves(const IndexMask curves_to_reverse) attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); reverse_curve_point_data<T>( - *this, curves_to_reverse, {static_cast<T *>(layer.data), this->num_points()}); + *this, curves_to_reverse, {static_cast<T *>(layer.data), this->points_num()}); }); } @@ -1001,7 +1001,7 @@ static void adapt_curve_domain_point_to_curve_impl(const CurvesGeometry &curves, MutableSpan<T> r_values) { attribute_math::DefaultMixer<T> mixer(r_values); - for (const int i_curve : IndexRange(curves.num_curves())) { + for (const int i_curve : IndexRange(curves.curves_num())) { for (const int i_point : curves.points_for_curve(i_curve)) { mixer.mix_in(i_curve, old_values[i_point]); } @@ -1022,7 +1022,7 @@ void adapt_curve_domain_point_to_curve_impl(const CurvesGeometry &curves, MutableSpan<bool> r_values) { r_values.fill(true); - for (const int i_curve : IndexRange(curves.num_curves())) { + for (const int i_curve : IndexRange(curves.curves_num())) { for (const int i_point : curves.points_for_curve(i_curve)) { if (!old_values[i_point]) { r_values[i_curve] = false; @@ -1039,7 +1039,7 @@ static GVArray adapt_curve_domain_point_to_curve(const CurvesGeometry &curves, attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) { using T = decltype(dummy); if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) { - Array<T> values(curves.num_curves()); + Array<T> values(curves.curves_num()); adapt_curve_domain_point_to_curve_impl<T>(curves, varray.typed<T>(), values); new_varray = VArray<T>::ForContainer(std::move(values)); } @@ -1059,7 +1059,7 @@ static void adapt_curve_domain_curve_to_point_impl(const CurvesGeometry &curves, const VArray<T> &old_values, MutableSpan<T> r_values) { - for (const int i_curve : IndexRange(curves.num_curves())) { + for (const int i_curve : IndexRange(curves.curves_num())) { r_values.slice(curves.points_for_curve(i_curve)).fill(old_values[i_curve]); } } @@ -1070,7 +1070,7 @@ static GVArray adapt_curve_domain_curve_to_point(const CurvesGeometry &curves, GVArray new_varray; attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) { using T = decltype(dummy); - Array<T> values(curves.num_points()); + Array<T> values(curves.points_num()); adapt_curve_domain_curve_to_point_impl<T>(curves, varray.typed<T>(), values); new_varray = VArray<T>::ForContainer(std::move(values)); }); diff --git a/source/blender/blenkernel/intern/curves_geometry_test.cc b/source/blender/blenkernel/intern/curves_geometry_test.cc index fd994d5abf4..bc99785de1c 100644 --- a/source/blender/blenkernel/intern/curves_geometry_test.cc +++ b/source/blender/blenkernel/intern/curves_geometry_test.cc @@ -46,7 +46,7 @@ TEST(curves_geometry, Move) CurvesGeometry other = std::move(curves); /* The old curves should be empty, and the offsets are expected to be null. */ - EXPECT_EQ(curves.num_points(), 0); /* NOLINT: bugprone-use-after-move */ + EXPECT_EQ(curves.points_num(), 0); /* NOLINT: bugprone-use-after-move */ EXPECT_EQ(curves.curve_offsets, nullptr); /* NOLINT: bugprone-use-after-move */ /* Just a basic check that the new curves work okay. */ @@ -206,7 +206,7 @@ TEST(curves_geometry, CatmullRomTwoPointCyclic) /* The cyclic value should be ignored when there are only two control points. There should * be 12 evaluated points for the single segment and an extra for the last point. */ - EXPECT_EQ(curves.evaluated_points_size(), 13); + EXPECT_EQ(curves.evaluated_points_num(), 13); } TEST(curves_geometry, BezierPositionEvaluation) diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc index 83b8e5fb262..27689d70c77 100644 --- a/source/blender/blenkernel/intern/geometry_component_curves.cc +++ b/source/blender/blenkernel/intern/geometry_component_curves.cc @@ -236,10 +236,10 @@ int CurveComponent::attribute_domain_size(const AttributeDomain domain) const const blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap( curves_->geometry); if (domain == ATTR_DOMAIN_POINT) { - return geometry.num_points(); + return geometry.points_num(); } if (domain == ATTR_DOMAIN_CURVE) { - return geometry.num_curves(); + return geometry.curves_num(); } return 0; } diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index e6604eafd3d..501a250e1a0 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -50,7 +50,7 @@ void BLI_covariance_m_vn_ex(int n, * \return r_center the computed center (mean) of 3D points (may be NULL). */ void BLI_covariance_m3_v3n(const float (*cos_v3)[3], - int cos_vn_num, + int cos_v3_num, bool use_sample_correction, float r_covmat[3][3], float r_center[3]); diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc index 3fe74b3b590..a21a6409ca5 100644 --- a/source/blender/draw/intern/draw_cache_impl_curves.cc +++ b/source/blender/draw/intern/draw_cache_impl_curves.cc @@ -218,7 +218,7 @@ static void curves_batch_cache_fill_strands_data(Curves *curves, const blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap( curves->geometry); - for (const int i : IndexRange(geometry.num_curves())) { + for (const int i : IndexRange(geometry.curves_num())) { const IndexRange curve_range = geometry.points_for_curve(i); *(uint *)GPU_vertbuf_raw_step(data_step) = curve_range.start(); diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc index fadaac27431..17108619a4d 100644 --- a/source/blender/editors/curves/intern/curves_add.cc +++ b/source/blender/editors/curves/intern/curves_add.cc @@ -21,7 +21,7 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi float *radius_data = (float *)CustomData_add_layer_named( &curves.point_data, CD_PROP_FLOAT, CD_DEFAULT, nullptr, curves.point_size, "radius"); - MutableSpan<float> radii{radius_data, curves.num_points()}; + MutableSpan<float> radii{radius_data, curves.points_num()}; for (const int i : offsets.index_range()) { offsets[i] = points_per_curve * i; diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc index e444b3de2d5..809511d0106 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc @@ -174,8 +174,8 @@ struct AddOperationExecutor { use_interpolation_ = interpolate_length_ || interpolate_shape_; new_curve_length_ = curves_sculpt_->curve_length; - tot_old_curves_ = curves_->num_curves(); - tot_old_points_ = curves_->num_points(); + tot_old_curves_ = curves_->curves_num(); + tot_old_points_ = curves_->points_num(); if (add_amount_ == 0) { return; @@ -216,8 +216,8 @@ struct AddOperationExecutor { const int tot_added_curves = added_points.bary_coords.size(); const int tot_added_points = tot_added_curves * points_per_curve_; - curves_->resize(curves_->num_points() + tot_added_points, - curves_->num_curves() + tot_added_curves); + curves_->resize(curves_->points_num() + tot_added_points, + curves_->curves_num() + tot_added_curves); threading::parallel_invoke([&]() { this->initialize_curve_offsets(tot_added_curves); }, [&]() { this->initialize_attributes(added_points); }); @@ -515,7 +515,7 @@ struct AddOperationExecutor { void ensure_curve_roots_kdtree() { if (self_->curve_roots_kdtree_ == nullptr) { - self_->curve_roots_kdtree_ = BLI_kdtree_3d_new(curves_->num_curves()); + self_->curve_roots_kdtree_ = BLI_kdtree_3d_new(curves_->curves_num()); for (const int curve_i : curves_->curves_range()) { const int root_point_i = curves_->offsets()[curve_i]; const float3 &root_pos_cu = curves_->positions()[root_point_i]; diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc index 16cb8c8c60c..d062fe32cfe 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc @@ -324,7 +324,7 @@ struct CombOperationExecutor { void initialize_segment_lengths() { const Span<float3> positions_cu = curves_->positions(); - self_->segment_lengths_cu_.reinitialize(curves_->num_points()); + self_->segment_lengths_cu_.reinitialize(curves_->points_num()); threading::parallel_for(curves_->curves_range(), 128, [&](const IndexRange range) { for (const int curve_i : range) { const IndexRange points = curves_->points_for_curve(curve_i); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc index 94d31e1985d..382f0529daa 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc @@ -304,7 +304,7 @@ class DensityAddOperation : public CurvesSculptStrokeOperation { if (old_kdtree_ == nullptr && minimum_distance > 0.0f) { old_kdtree_ = this->kdtree_from_curve_roots_and_positions(curves, curves.curves_range(), {}); - old_kdtree_size_ = curves.num_curves(); + old_kdtree_size_ = curves.curves_num(); } float density; @@ -525,7 +525,7 @@ class DensityAddOperation : public CurvesSculptStrokeOperation { { Array<bool> elimination_mask(points.positions.size(), false); - const int curves_added_previously = curves.num_curves() - old_kdtree_size_; + const int curves_added_previously = curves.curves_num() - old_kdtree_size_; KDTree_3d *new_points_kdtree = this->kdtree_from_curve_roots_and_positions( curves, IndexRange(old_kdtree_size_, curves_added_previously), points.positions); @@ -589,14 +589,14 @@ class DensityAddOperation : public CurvesSculptStrokeOperation { const int tot_new_curves = new_points.positions.size(); const int points_per_curve = 8; - curves.resize(curves.num_points() + tot_new_curves * points_per_curve, - curves.num_curves() + tot_new_curves); + curves.resize(curves.points_num() + tot_new_curves * points_per_curve, + curves.curves_num() + tot_new_curves); MutableSpan<int> offsets = curves.offsets(); MutableSpan<float3> positions = curves.positions(); for (const int i : IndexRange(tot_new_curves)) { - const int curve_i = curves.num_curves() - tot_new_curves + i; + const int curve_i = curves.curves_num() - tot_new_curves + i; const int first_point_i = offsets[curve_i]; offsets[curve_i + 1] = offsets[curve_i] + points_per_curve; diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 414c90b06e1..8d186edc607 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -1139,8 +1139,8 @@ static void execute_realize_curve_task(const RealizeInstancesOptions &options, const Curves &curves_id = *curves_info.curves; const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); - const IndexRange dst_point_range{task.start_indices.point, curves.num_points()}; - const IndexRange dst_curve_range{task.start_indices.curve, curves.num_curves()}; + const IndexRange dst_point_range{task.start_indices.point, curves.points_num()}; + const IndexRange dst_curve_range{task.start_indices.curve, curves.curves_num()}; copy_transformed_positions( curves.positions(), task.transform, dst_curves.positions().slice(dst_point_range)); @@ -1194,9 +1194,9 @@ static void execute_realize_curve_task(const RealizeInstancesOptions &options, [&](const AttributeDomain domain) { switch (domain) { case ATTR_DOMAIN_POINT: - return IndexRange(task.start_indices.point, curves.num_points()); + return IndexRange(task.start_indices.point, curves.points_num()); case ATTR_DOMAIN_CURVE: - return IndexRange(task.start_indices.curve, curves.num_curves()); + return IndexRange(task.start_indices.curve, curves.curves_num()); default: BLI_assert_unreachable(); return IndexRange(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc index 87fc6bcbad4..6794671f707 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -241,7 +241,7 @@ static void read_curve_positions(const Curves &curves_id, Vector<float3> *r_coords) { const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); - const int total_size = curves.evaluated_points_size(); + const int total_size = curves.evaluated_points_num(); r_coords->reserve(r_coords->size() + total_size * transforms.size()); r_coords->as_mutable_span().take_back(total_size).copy_from(curves.evaluated_positions()); for (const float3 &position : curves.evaluated_positions()) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc index 1ef4705ed75..bbc8758952d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc @@ -55,19 +55,19 @@ class EndpointFieldInput final : public GeometryFieldInput { const Curves &curves_id = *curve_component.get_for_read(); const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); - if (curves.num_points() == 0) { + if (curves.points_num() == 0) { return nullptr; } GeometryComponentFieldContext size_context{curve_component, ATTR_DOMAIN_CURVE}; - fn::FieldEvaluator evaluator{size_context, curves.num_curves()}; + fn::FieldEvaluator evaluator{size_context, curves.curves_num()}; evaluator.add(start_size_); evaluator.add(end_size_); evaluator.evaluate(); const VArray<int> &start_size = evaluator.get_evaluated<int>(0); const VArray<int> &end_size = evaluator.get_evaluated<int>(1); - Array<bool> selection(curves.num_points(), false); + Array<bool> selection(curves.points_num(), false); MutableSpan<bool> selection_span = selection.as_mutable_span(); devirtualize_varray2(start_size, end_size, [&](const auto &start_size, const auto &end_size) { threading::parallel_for(curves.curves_range(), 1024, [&](IndexRange curves_range) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc index 5c7c9f22e15..f29b193d98b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc @@ -45,8 +45,8 @@ static meshintersect::CDT_result<double> do_cdt(const bke::CurvesGeometry &curve { meshintersect::CDT_input<double> input; input.need_ids = false; - input.vert.reinitialize(curves.evaluated_points_size()); - input.face.reinitialize(curves.num_curves()); + input.vert.reinitialize(curves.evaluated_points_num()); + input.face.reinitialize(curves.curves_num()); VArray<bool> cyclic = curves.cyclic(); Span<float3> positions = curves.evaluated_positions(); @@ -118,7 +118,7 @@ static void curve_fill_calculate(GeometrySet &geometry_set, const GeometryNodeCu const Curves &curves_id = *geometry_set.get_curves_for_read(); const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); - if (curves.num_curves() == 0) { + if (curves.curves_num() == 0) { geometry_set.replace_curves(nullptr); return; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc index b85ef07e9fe..f46c5d3bee1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -345,7 +345,7 @@ static void duplicate_curves(GeometrySet &geometry_set, const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); GeometryComponentFieldContext field_context{src_component, ATTR_DOMAIN_CURVE}; - FieldEvaluator evaluator{field_context, curves.num_curves()}; + FieldEvaluator evaluator{field_context, curves.curves_num()}; evaluator.add(count_field); evaluator.set_selection(selection_field); evaluator.evaluate(); @@ -800,12 +800,12 @@ static void duplicate_points_curve(GeometrySet &geometry_set, const CurveComponent &src_component = *geometry_set.get_component_for_read<CurveComponent>(); const Curves &src_curves_id = *src_component.get_for_read(); const bke::CurvesGeometry &src_curves = bke::CurvesGeometry::wrap(src_curves_id.geometry); - if (src_curves.num_points() == 0) { + if (src_curves.points_num() == 0) { return; } GeometryComponentFieldContext field_context{src_component, ATTR_DOMAIN_POINT}; - FieldEvaluator evaluator{field_context, src_curves.num_points()}; + FieldEvaluator evaluator{field_context, src_curves.points_num()}; evaluator.add(count_field); evaluator.set_selection(selection_field); evaluator.evaluate(); @@ -815,7 +815,7 @@ static void duplicate_points_curve(GeometrySet &geometry_set, Array<int> offsets = accumulate_counts_to_offsets(selection, counts); const int dst_size = offsets.last(); - Array<int> point_to_curve_map(src_curves.num_points()); + Array<int> point_to_curve_map(src_curves.points_num()); threading::parallel_for(src_curves.curves_range(), 1024, [&](const IndexRange range) { for (const int i_curve : range) { const IndexRange point_range = src_curves.points_for_curve(i_curve); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc index 3cf5aebda12..ab6f6b40d5e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc @@ -89,10 +89,10 @@ static VArray<int> construct_spline_count_gvarray(const CurveComponent &componen auto count_fn = [curves](int64_t i) { return curves.points_for_curve(i).size(); }; if (domain == ATTR_DOMAIN_CURVE) { - return VArray<int>::ForFunc(curves.num_curves(), count_fn); + return VArray<int>::ForFunc(curves.curves_num(), count_fn); } if (domain == ATTR_DOMAIN_POINT) { - VArray<int> count = VArray<int>::ForFunc(curves.num_curves(), count_fn); + VArray<int> count = VArray<int>::ForFunc(curves.curves_num(), count_fn); return component.attribute_try_adapt_domain<int>( std::move(count), ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT); } |