Fix: USD import: deform group name collision #111747
|
@ -1018,6 +1018,13 @@ void import_mesh_skel_bindings(Main *bmain, Object *mesh_obj, const pxr::UsdPrim
|
|||
/* If there is an attribute with the same name, remove it. */
|
||||
bke::AttributeIDRef attr_id(joint_name);
|
||||
makowalski marked this conversation as resolved
Outdated
|
||||
if (attributes.contains(attr_id)) {
|
||||
makowalski marked this conversation as resolved
Outdated
Hans Goudey
commented
You can rely on the implicit conversion to You can rely on the implicit conversion to `bke::AttributeIDRef`, no need to create it on a separate line.
|
||||
WM_reportf(
|
||||
RPT_WARNING,
|
||||
"%s: Removing attribute '%s' from mesh '%s', as it conflicts with a deform group "
|
||||
makowalski marked this conversation as resolved
Outdated
Hans Goudey
commented
I think the message could be a bit more concise. Also not sure about adding the function name in there, that seems a bit "low level" for a warning message in the UI. How about something like this?
(vertex group is what "defgroup" is called in the UI, I guess the code was just never updated for a rename or something) I think the message could be a bit more concise. Also not sure about adding the function name in there, that seems a bit "low level" for a warning message in the UI. How about something like this?
```
Attribute '%s' removed from mesh '%s` because of name conflict with vertex group
```
(vertex group is what "defgroup" is called in the UI, I guess the code was just never updated for a rename or something)
|
||||
"for a bone with the same name",
|
||||
__func__,
|
||||
joint_name.c_str(),
|
||||
mesh->id.name + 2);
|
||||
attributes.remove(attr_id);
|
||||
}
|
||||
bDeformGroup *def_grp = BKE_object_defgroup_add_name(mesh_obj, joint_name.c_str());
|
||||
|
|
Loading…
Reference in New Issue
You can use
if (attributes.remove(joint_name))
, since it returns whether an attribute was deleted or not.