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:
authorJacques Lucke <jacques@blender.org>2021-10-30 19:18:27 +0300
committerJacques Lucke <jacques@blender.org>2021-10-30 19:18:27 +0300
commit2267f19486338eb142e8a2f46632e8d749ff8c3d (patch)
tree3c912b6be2d926e332fba32534d6f618cc7e5a88
parentacd8874205b299e544295865a2502f4eac04c3ee (diff)
progress
-rw-r--r--source/blender/blenlib/BLI_virtual_array.hh23
-rw-r--r--source/blender/functions/intern/field.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc8
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc2
7 files changed, 28 insertions, 15 deletions
diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh
index 5dd45f8cf8a..642b585a2a1 100644
--- a/source/blender/blenlib/BLI_virtual_array.hh
+++ b/source/blender/blenlib/BLI_virtual_array.hh
@@ -79,11 +79,6 @@ template<typename T> class VArrayImpl {
return size_ == 0;
}
- IndexRange index_range() const
- {
- return IndexRange(size_);
- }
-
/* Returns true when the virtual array is stored as a span internally. */
bool is_span() const
{
@@ -760,6 +755,24 @@ template<typename T> class VArrayCommon {
BLI_assert(*this);
return impl_->get(index);
}
+
+ int64_t size() const
+ {
+ if (impl_ == nullptr) {
+ return 0;
+ }
+ return impl_->size();
+ }
+
+ bool is_empty() const
+ {
+ return this->size() == 0;
+ }
+
+ IndexRange index_range() const
+ {
+ return IndexRange(this->size());
+ }
};
} // namespace detail
diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc
index 03de4c1ae62..d29d2564ad3 100644
--- a/source/blender/functions/intern/field.cc
+++ b/source/blender/functions/intern/field.cc
@@ -627,7 +627,7 @@ static Vector<int64_t> indices_from_selection(const VArray<bool> &selection)
}
}
else {
- for (const int i : selection->index_range()) {
+ for (const int i : selection.index_range()) {
if (selection[i]) {
indices.append(i);
}
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc
index 0f10e49df04..ff048e5eb1c 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc
@@ -76,7 +76,7 @@ static void calculate_mesh_proximity(const VArray<float3> &positions,
return;
}
- threading::parallel_for(positions->index_range(), 512, [&](IndexRange range) {
+ threading::parallel_for(positions.index_range(), 512, [&](IndexRange range) {
BVHTreeNearest nearest;
copy_v3_fl(nearest.co, FLT_MAX);
nearest.index = -1;
@@ -111,7 +111,7 @@ static void calculate_pointcloud_proximity(const VArray<float3> &positions,
return;
}
- threading::parallel_for(positions->index_range(), 512, [&](IndexRange range) {
+ threading::parallel_for(positions.index_range(), 512, [&](IndexRange range) {
BVHTreeNearest nearest;
copy_v3_fl(nearest.co, FLT_MAX);
nearest.index = -1;
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc
index 9ff86bbe43d..d66e4f34c09 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc
@@ -108,7 +108,7 @@ static void get_closest_in_bvhtree(BVHTreeFromMesh &tree_data,
BLI_assert(positions->size() == r_distances_sq.size() || r_distances_sq.is_empty());
BLI_assert(positions->size() == r_positions.size() || r_positions.is_empty());
- for (const int i : positions->index_range()) {
+ for (const int i : positions.index_range()) {
BVHTreeNearest nearest;
nearest.dist_sq = FLT_MAX;
const float3 position = positions[i];
@@ -137,7 +137,7 @@ static void get_closest_pointcloud_points(const PointCloud &pointcloud,
BVHTreeFromPointCloud tree_data;
BKE_bvhtree_from_pointcloud_get(&tree_data, &pointcloud, 2);
- for (const int i : positions->index_range()) {
+ for (const int i : positions.index_range()) {
BVHTreeNearest nearest;
nearest.dist_sq = FLT_MAX;
const float3 position = positions[i];
@@ -202,7 +202,7 @@ static void get_closest_mesh_polygons(const Mesh &mesh,
const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh),
BKE_mesh_runtime_looptri_len(&mesh)};
- for (const int i : positions->index_range()) {
+ for (const int i : positions.index_range()) {
const MLoopTri &looptri = looptris[looptri_indices[i]];
r_poly_indices[i] = looptri.poly;
}
@@ -219,7 +219,7 @@ static void get_closest_mesh_corners(const Mesh &mesh,
Array<int> poly_indices(positions->size());
get_closest_mesh_polygons(mesh, positions, poly_indices, {}, {});
- for (const int i : positions->index_range()) {
+ for (const int i : positions.index_range()) {
const float3 position = positions[i];
const int poly_index = poly_indices[i];
const MPoly &poly = mesh.mpoly[poly_index];
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc
index ad2ff57f928..0a30110910f 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc
@@ -595,7 +595,7 @@ static void delete_mesh_selection(MeshComponent &component,
/* Check if there is anything to delete. */
bool delete_nothing = true;
- for (const int i : selection->index_range()) {
+ for (const int i : selection.index_range()) {
if (selection[i] != invert) {
delete_nothing = false;
break;
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc
index 61ab8bc405a..38c23f837ba 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc
@@ -101,7 +101,7 @@ static void raycast_to_mesh(const Mesh &mesh,
return;
}
- for (const int i : ray_origins->index_range()) {
+ for (const int i : ray_origins.index_range()) {
const float ray_length = ray_lengths[i];
const float3 ray_origin = ray_origins[i];
const float3 ray_direction = ray_directions[i].normalized();
diff --git a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
index 72981d87355..86bbdc3c6f9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
@@ -102,7 +102,7 @@ static void geo_node_subdivision_surface_exec(GeoNodeExecParams params)
OutputAttribute_Typed<float> crease = mesh_component.attribute_try_get_for_output_only<float>(
"crease", domain);
MutableSpan<float> crease_span = crease.as_span();
- for (auto i : creases->index_range()) {
+ for (auto i : creases.index_range()) {
crease_span[i] = std::clamp(creases[i], 0.0f, 1.0f);
}
crease.save();