Page MenuHome

Fix: Add the name of the parent armature to the bone name to create unique bone ids for Collada export.
Needs ReviewPublic

Authored by Jon Allee (jacknimble) on Mar 8 2017, 10:09 PM.

Details

Reviewers
None
Group Reviewers
Collada
Summary

Collada bone ids must be unique.

Blender requires armature names to be unique. Blender requires bone names to be unique under an armature. Prepending the armature name to the bone name creates a unique id suitable for Collada.

To see the problem:
Create two single bone armatures.
Name both the bones "bone".
Export.
Validate the output.

Validation fails
untitled.dae:124: element node: validity error : ID Bone already defined
untitled.dae:124: element node: Schemas validity error : Element '{http://www.collada.org/2005/11/COLLADASchema}node', attribute 'id': 'Bone' is not a valid value of the atomic type 'xs:ID'.
untitled.dae fails to validate

Diff Detail

Repository
rB Blender

Event Timeline

Jon Allee (jacknimble) retitled this revision from to Fix: Add the name of the parent armature to the bone name to create unique bone ids for Collada export..
Jon Allee (jacknimble) updated this object.
Jon Allee (jacknimble) added a reviewer: Collada.
Jon Allee (jacknimble) set the repository for this revision to rB Blender.

Wouldn't this patch actually rename bones during export? While this might be a working solution, i prefer to first check if we can get this solved differently without need to rename the bones.

Also as far as i recall we actually do not support multiple armatures in one export very well. So possibly we need to improve multiple armature export first.

In Blender, we won't ever see these ids in the UI. The bones have a name property that retains the name "bone" even after export and re-import.

For reference, here's the Collada I think Blender should export:
<node id="Armature_001_Bone" name="Bone" sid="Armature_001_Bone" type="JOINT"

As far as improving multiple armature support first, I don't know enough about that to respond. This is the first patch I've made for Blender. Thanks for looking!

By the way, the bit of code that was commented out apparently made its appearance in that form here:
Apply patch 4636051. COLLADA: Export selection.
https://git.blender.org/gitweb/gitweb.cgi/blender.git/commit/cf43e48fc781611c0850e09dae6f6fa1c95cc28b

Hi, Jon

Thanks again for reporting!
I added some lines to your patch for better support for bone id and bone sid.
It is now committed

-gaia

Thank you. That's clearly a better change than I proposed.