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-04-26 16:06:04 +0300
committerHans Goudey <h.goudey@me.com>2022-04-26 16:06:04 +0300
commitdb45292d8e0c29f399cba191e33f8388d9254357 (patch)
treec5540f9c433449f1d0e1d05a9a7daa209db8b62f /source/blender/blenkernel/intern/attribute_access.cc
parentb7458f909cc2ada343207603f0ecbf0c42b28173 (diff)
Cleanup: Move anonymous attribute removal to geometry component
Implementing removal of anonymous attributes with `GeometryComponent` instead of `Mesh` makes it more reusable for other types like curves.
Diffstat (limited to 'source/blender/blenkernel/intern/attribute_access.cc')
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 98db5013a00..d33b64c493b 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -926,6 +926,21 @@ bool GeometryComponent::attribute_try_delete(const AttributeIDRef &attribute_id)
return success;
}
+void GeometryComponent::attributes_remove_anonymous()
+{
+ using namespace blender;
+ Vector<const AnonymousAttributeID *> anonymous_ids;
+ for (const AttributeIDRef &id : this->attribute_ids()) {
+ if (id.is_anonymous()) {
+ anonymous_ids.append(&id.anonymous_id());
+ }
+ }
+
+ while (!anonymous_ids.is_empty()) {
+ this->attribute_try_delete(anonymous_ids.pop_last());
+ }
+}
+
bool GeometryComponent::attribute_try_create(const AttributeIDRef &attribute_id,
const AttributeDomain domain,
const CustomDataType data_type,