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>2022-03-24 07:01:02 +0300
committerHans Goudey <h.goudey@me.com>2022-03-24 07:05:46 +0300
commite253f9f66d6f63592ffd97afe207ef7c72547d03 (patch)
tree9a9345ab1184f0f6fda51740967595cc2f52a4bf /source/blender/editors/sculpt_paint
parenta1598d6835d0c579579881bca900f9259b26d11a (diff)
Cleanup: Adjust naming in new curves code
Rename "size" variables and functions to use "num" instead, based on T85728 (though this doesn't apply to simple C++ containers, it applies here). Rename "range" to "points" in some functions, so be more specific. Differential Revision: https://developer.blender.org/D14431
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_add.cc14
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_comb.cc10
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_delete.cc2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_ops.cc12
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc2
6 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
index 94c0f5536b7..51997cd9e1e 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
@@ -93,7 +93,7 @@ static std::optional<float3> find_curves_brush_position(const CurvesGeometry &cu
BrushPositionCandidate best_candidate = init;
for (const int curve_i : curves_range) {
- const IndexRange points = curves.range_for_curve(curve_i);
+ const IndexRange points = curves.points_for_curve(curve_i);
const int tot_segments = points.size() - 1;
for (const int segment_i : IndexRange(tot_segments)) {
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index e57a6e43983..2f39e6eec20 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_->curves_size();
- tot_old_points_ = curves_->points_size();
+ tot_old_curves_ = curves_->num_curves();
+ tot_old_points_ = curves_->num_points();
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_->points_size() + tot_added_points,
- curves_->curves_size() + tot_added_curves);
+ curves_->resize(curves_->num_points() + tot_added_points,
+ curves_->num_curves() + 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_->curves_size());
+ self_->curve_roots_kdtree_ = BLI_kdtree_3d_new(curves_->num_curves());
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];
@@ -609,7 +609,7 @@ struct AddOperationExecutor {
const Span<NeighborInfo> neighbors = neighbors_per_curve[added_curve_i];
float length_sum = 0.0f;
for (const NeighborInfo &neighbor : neighbors) {
- const IndexRange neighbor_points = curves_->range_for_curve(neighbor.index);
+ const IndexRange neighbor_points = curves_->points_for_curve(neighbor.index);
float neighbor_length = 0.0f;
const int tot_segments = neighbor_points.size() - 1;
for (const int segment_i : IndexRange(tot_segments)) {
@@ -744,7 +744,7 @@ struct AddOperationExecutor {
float normal_rotation_cu[3][3];
rotation_between_vecs_to_mat3(normal_rotation_cu, neighbor_normal_cu, normal_cu);
- const IndexRange neighbor_points = curves_->range_for_curve(neighbor_curve_i);
+ const IndexRange neighbor_points = curves_->points_for_curve(neighbor_curve_i);
const float3 &neighbor_root_cu = positions_cu[neighbor_points[0]];
/* Use a temporary #PolySpline, because that's the easiest way to resample an
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc
index 35b2b2ce956..16cb8c8c60c 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc
@@ -202,7 +202,7 @@ struct CombOperationExecutor {
Vector<int> &local_changed_curves = r_changed_curves.local();
for (const int curve_i : curves_range) {
bool curve_changed = false;
- const IndexRange points = curves_->range_for_curve(curve_i);
+ const IndexRange points = curves_->points_for_curve(curve_i);
for (const int point_i : points.drop_front(1)) {
const float3 old_pos_cu = positions_cu[point_i];
@@ -274,7 +274,7 @@ struct CombOperationExecutor {
Vector<int> &local_changed_curves = r_changed_curves.local();
for (const int curve_i : curves_range) {
bool curve_changed = false;
- const IndexRange points = curves_->range_for_curve(curve_i);
+ const IndexRange points = curves_->points_for_curve(curve_i);
for (const int point_i : points.drop_front(1)) {
const float3 pos_old_cu = positions_cu[point_i];
@@ -324,10 +324,10 @@ struct CombOperationExecutor {
void initialize_segment_lengths()
{
const Span<float3> positions_cu = curves_->positions();
- self_->segment_lengths_cu_.reinitialize(curves_->points_size());
+ self_->segment_lengths_cu_.reinitialize(curves_->num_points());
threading::parallel_for(curves_->curves_range(), 128, [&](const IndexRange range) {
for (const int curve_i : range) {
- const IndexRange points = curves_->range_for_curve(curve_i);
+ const IndexRange points = curves_->points_for_curve(curve_i);
for (const int point_i : points.drop_back(1)) {
const float3 &p1_cu = positions_cu[point_i];
const float3 &p2_cu = positions_cu[point_i + 1];
@@ -349,7 +349,7 @@ struct CombOperationExecutor {
threading::parallel_for_each(changed_curves, [&](const Vector<int> &changed_curves) {
threading::parallel_for(changed_curves.index_range(), 256, [&](const IndexRange range) {
for (const int curve_i : changed_curves.as_span().slice(range)) {
- const IndexRange points = curves_->range_for_curve(curve_i);
+ const IndexRange points = curves_->points_for_curve(curve_i);
for (const int segment_i : IndexRange(points.size() - 1)) {
const float3 &p1_cu = positions_cu[points[segment_i]];
float3 &p2_cu = positions_cu[points[segment_i] + 1];
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
index efe85dc132a..ae87f414dd5 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
@@ -70,7 +70,7 @@ class DeleteOperation : public CurvesSculptStrokeOperation {
Vector<int64_t> indices;
const IndexMask curves_to_remove = index_mask_ops::find_indices_based_on_predicate(
curves.curves_range(), 512, indices, [&](const int curve_i) {
- const IndexRange point_range = curves.range_for_curve(curve_i);
+ const IndexRange point_range = curves.points_for_curve(curve_i);
for (const int segment_i : IndexRange(point_range.size() - 1)) {
const float3 pos1 = positions[point_range[segment_i]];
const float3 pos2 = positions[point_range[segment_i + 1]];
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index b9a019a012c..94d31e1985d 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -117,7 +117,7 @@ class ShrinkOperation : public CurvesSculptStrokeOperation {
threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange curves_range) {
for (const int curve_i : curves_range) {
- const IndexRange curve_points = curves.range_for_curve(curve_i);
+ const IndexRange curve_points = curves.points_for_curve(curve_i);
const int last_point_i = curve_points.last();
const float3 old_tip_position = positions[last_point_i];
@@ -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.curves_size();
+ old_kdtree_size_ = curves.num_curves();
}
float density;
@@ -525,7 +525,7 @@ class DensityAddOperation : public CurvesSculptStrokeOperation {
{
Array<bool> elimination_mask(points.positions.size(), false);
- const int curves_added_previously = curves.curves_size() - old_kdtree_size_;
+ const int curves_added_previously = curves.num_curves() - 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.points_size() + tot_new_curves * points_per_curve,
- curves.curves_size() + tot_new_curves);
+ curves.resize(curves.num_points() + tot_new_curves * points_per_curve,
+ curves.num_curves() + 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.curves_size() - tot_new_curves + i;
+ const int curve_i = curves.num_curves() - 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/editors/sculpt_paint/curves_sculpt_snake_hook.cc b/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc
index bd6b238ea72..682cd3b47ca 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc
@@ -83,7 +83,7 @@ class SnakeHookOperation : public CurvesSculptStrokeOperation {
threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange curves_range) {
for (const int curve_i : curves_range) {
- const IndexRange curve_points = curves.range_for_curve(curve_i);
+ const IndexRange curve_points = curves.points_for_curve(curve_i);
const int last_point_i = curve_points.last();
const float3 old_position = positions[last_point_i];