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:
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh5
-rw-r--r--source/blender/blenkernel/intern/geometry_component_instances.cc18
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc2
3 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 0f9c2c1062b..88e45baad15 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -923,9 +923,10 @@ class InstancesComponent : public GeometryComponent {
int references_amount() const;
/**
- * Remove the indices in the selection mask and remove unused instance references afterwards.
+ * Remove the indices that are not contained in the mask input, and remove unused instance
+ * references afterwards.
*/
- void remove_instances(const blender::IndexMask selection);
+ void remove_instances(const blender::IndexMask mask);
blender::Span<int> almost_unique_ids() const;
diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc
index a7e3c5b60dc..b411c793298 100644
--- a/source/blender/blenkernel/intern/geometry_component_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_component_instances.cc
@@ -148,27 +148,27 @@ static void copy_data_based_on_mask(Span<T> src, MutableSpan<T> dst, IndexMask m
});
}
-void InstancesComponent::remove_instances(const IndexMask selection)
+void InstancesComponent::remove_instances(const IndexMask mask)
{
using namespace blender;
- if (selection.is_range() && selection.index_range().first() == 0) {
+ if (mask.is_range() && mask.as_range().start() == 0) {
/* Deleting from the end of the array can be much faster since no data has to be shifted. */
- this->resize(selection.size());
+ this->resize(mask.size());
this->remove_unused_references();
return;
}
- Vector<int> new_handles(selection.size());
- copy_data_based_on_mask<int>(this->instance_reference_handles(), new_handles, selection);
+ Vector<int> new_handles(mask.size());
+ copy_data_based_on_mask<int>(this->instance_reference_handles(), new_handles, mask);
instance_reference_handles_ = std::move(new_handles);
- Vector<float4x4> new_transforms(selection.size());
- copy_data_based_on_mask<float4x4>(this->instance_transforms(), new_transforms, selection);
+ Vector<float4x4> new_transforms(mask.size());
+ copy_data_based_on_mask<float4x4>(this->instance_transforms(), new_transforms, mask);
instance_transforms_ = std::move(new_transforms);
const bke::CustomDataAttributes &src_attributes = attributes_;
bke::CustomDataAttributes dst_attributes;
- dst_attributes.reallocate(selection.size());
+ dst_attributes.reallocate(mask.size());
src_attributes.foreach_attribute(
[&](const bke::AttributeIDRef &id, const AttributeMetaData &meta_data) {
@@ -182,7 +182,7 @@ void InstancesComponent::remove_instances(const IndexMask selection)
attribute_math::convert_to_static_type(src.type(), [&](auto dummy) {
using T = decltype(dummy);
- copy_data_based_on_mask<T>(src.typed<T>(), dst.typed<T>(), selection);
+ copy_data_based_on_mask<T>(src.typed<T>(), dst.typed<T>(), mask);
});
return true;
},
diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
index 7d41242b8bc..77546f1ea77 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
@@ -545,7 +545,7 @@ static void separate_instance_selection(GeometrySet &geometry_set,
Vector<int64_t> indices;
const IndexMask mask = index_mask_indices(selection, invert, indices);
- if (mask.size() == 0) {
+ if (mask.is_empty()) {
geometry_set.remove<InstancesComponent>();
return;
}