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.
This commit is contained in:
2022-04-26 08:06:04 -05:00
parent b7458f909c
commit db45292d8e
9 changed files with 34 additions and 36 deletions

View File

@@ -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,