Cleanup: Remove unnecessary name copy when removing attribute

BKE_defgroup_listbase_name_find has a StringRef argument nowadays.
This commit is contained in:
Hans Goudey 2024-12-10 14:33:56 -05:00
parent d3fdfe013d
commit 2fd3a633db
2 changed files with 4 additions and 9 deletions

View file

@ -88,19 +88,16 @@ class CurvesVertexGroupsAttributeProvider final : public DynamicAttributesProvid
return {varray_for_mutable_deform_verts(dverts, vertex_group_index), AttrDomain::Point};
}
bool try_delete(void *owner, const StringRef attribute_id) const final
bool try_delete(void *owner, const StringRef name) const final
{
CurvesGeometry *curves = static_cast<CurvesGeometry *>(owner);
if (curves == nullptr) {
return true;
}
const std::string name = attribute_id;
int index;
bDeformGroup *group;
if (!BKE_defgroup_listbase_name_find(
&curves->vertex_group_names, name.c_str(), &index, &group))
{
if (!BKE_defgroup_listbase_name_find(&curves->vertex_group_names, name, &index, &group)) {
return false;
}
BLI_remlink(&curves->vertex_group_names, group);

View file

@ -767,18 +767,16 @@ class MeshVertexGroupsAttributeProvider final : public DynamicAttributesProvider
return {varray_for_mutable_deform_verts(dverts, vertex_group_index), AttrDomain::Point};
}
bool try_delete(void *owner, const StringRef attribute_id) const final
bool try_delete(void *owner, const StringRef name) const final
{
Mesh *mesh = static_cast<Mesh *>(owner);
if (mesh == nullptr) {
return true;
}
const std::string name = attribute_id;
int index;
bDeformGroup *group;
if (!BKE_id_defgroup_name_find(&mesh->id, name.c_str(), &index, &group)) {
if (!BKE_id_defgroup_name_find(&mesh->id, name, &index, &group)) {
return false;
}
BLI_remlink(&mesh->vertex_group_names, group);