Fix: USD import: deform group name collision #111747

Open
Michael Kowalski wants to merge 7 commits from makowalski/blender:usd_deform_group_name_collision into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

7 Commits

Author SHA1 Message Date
Michael Kowalski 45b6faffcd Format comments. 2023-09-12 23:55:54 -04:00
Michael Kowalski d1b3055abd Merge branch 'main' into usd_deform_group_name_collision 2023-09-12 23:27:39 -04:00
Michael Kowalski 9d75a9d9df USD import: rename attributes on name collision.
buildbot/vexp-code-patch-coordinator Build done. Details
Now renaming, rather than deleting, attributes that have the same
name as bone vertex groups.
2023-09-11 22:53:01 -04:00
Michael Kowalski a4dfee9a89 Merge branch 'main' into usd_deform_group_name_collision 2023-09-11 19:26:54 -04:00
Michael Kowalski 2bbbbe4fc8 USD import: warn when deleting attributes.
buildbot/vexp-code-patch-coordinator Build done. Details
Added warning when deleting attributes to avoid name collision
with deform groups.
2023-09-02 17:13:39 -04:00
Michael Kowalski 415f098fdb Merge branch 'main' into usd_deform_group_name_collision 2023-09-02 11:57:37 -04:00
Michael Kowalski ea9a66b0f6 Fix: USD import: deform group name collision.
buildbot/vexp-code-patch-coordinator Build done. Details
This addresses a bug when importing USD skeleton data, where
deform groups are misnamed due to name collisions with existing
mesh attributes. The incorrectly named deform groups fail to
bind to the armature animation.

The issue is that the call to BKE_object_defgroup_add_name()
assigns a unique name to the deform group if an attribute
with the same name already exists in the imported mesh.

The solution implemented in this commit is to remove attributes
with colliding names before creating the deform groups.

To reproduce, import the attached arm_test.usda, which contains
skeletal joints Hand, Shoulder and Elbow as well as mesh
attributes with the same names.  Note that the imported deform
groups are renamed Hand.001, Shoulder.001 and Elbow.001 and that
the mesh fails to bind to the armature animation.

This issue would be prone to happening on round trips
Blender -> USD -> Blender, because the Blender deform groups would
be exported as both mesh attributes and USD skeleton binding data.
2023-08-31 10:46:03 -04:00