Incorrect parent tree when exporting and importing scene with multiple rigged objects #56677

Open
opened 2018-09-04 07:04:20 +02:00 by Campbell Suter · 10 comments

System Information
Arch GNU+Linux, Kernel 4.18.5

Blender Version
Broken: 2.79.6, Git 19c65cd (branch master)
Worked: None that I'm aware of

Short description of error

If you have a scene with multiple rigged objects, the armatures and meshes are incorrectly parented upon exporting then importing them. Rather than there being two armatures at the root of the scene with each one containing a single mesh, there will be (if you have two objects) one armature at the root, the other armature as a child of it, with both meshes attached to the inner-most armature.

Note that this certainly seems to be a fault of the importer and not the exporter: I've manually reviewed the exported model and it appears fine. Additionally, upon attempting to import a Collada file generated by custom software I've got the exact same problem as importing the file generated by Blender.

Exact steps for others to reproduce the error

Start with an empty scene, and create a cube. Add a single bone. Make the cube a child of the bone, using the armature deform with automatic weights option (not using any weights prevents this problem from occurring).

Repeat this a second time.

Export the scene as a Collada file.

Open a new instance of Blender, and import the scene with Collada.

The objects will have incorrect parents, and this has consistently occurred each time I have tried it:

Here are the screenshots of the scene, before exporting (matches attached blend file): Screenshot_20180904_165511.png

And after export/import: Screenshot_20180904_165717.png

Sample Blender file before export: expimptest.blend

**System Information** Arch GNU+Linux, Kernel 4.18.5 **Blender Version** Broken: 2.79.6, Git 19c65cd (branch master) Worked: None that I'm aware of **Short description of error** If you have a scene with multiple rigged objects, the armatures and meshes are incorrectly parented upon exporting then importing them. Rather than there being two armatures at the root of the scene with each one containing a single mesh, there will be (if you have two objects) one armature at the root, the other armature as a child of it, with both meshes attached to the inner-most armature. Note that this certainly seems to be a fault of the importer and not the exporter: I've manually reviewed the exported model and it appears fine. Additionally, upon attempting to import a Collada file generated by custom software I've got the exact same problem as importing the file generated by Blender. **Exact steps for others to reproduce the error** Start with an empty scene, and create a cube. Add a single bone. Make the cube a child of the bone, using the armature deform with automatic weights option (not using any weights prevents this problem from occurring). Repeat this a second time. Export the scene as a Collada file. Open a new instance of Blender, and import the scene with Collada. The objects will have incorrect parents, and this has consistently occurred each time I have tried it: Here are the screenshots of the scene, before exporting (matches attached blend file): ![Screenshot_20180904_165511.png](https://archive.blender.org/developer/F4549446/Screenshot_20180904_165511.png) And after export/import: ![Screenshot_20180904_165717.png](https://archive.blender.org/developer/F4549475/Screenshot_20180904_165717.png) Sample Blender file before export: [expimptest.blend](https://archive.blender.org/developer/F4549308/expimptest.blend)
Author

Added subscriber: @ZNix

Added subscriber: @ZNix
Gaia Clary was assigned by Bastien Montagne 2018-09-04 09:19:28 +02:00
Gaia Clary was unassigned by Dalai Felinto 2019-12-23 16:36:00 +01:00

Added subscriber: @GaiaClary

Added subscriber: @GaiaClary
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

I can confirm

I can confirm

Added subscriber: @cgbloor

Added subscriber: @cgbloor

I noticed there's a comment in the ArmatureImporter that says:

This is not safe when we have more than one armatures in the import.

A bit of printf debugging reveals that unsafe path is taken when importing a COLLADA file exported from Campbell's expimptest.blend. Perhaps that's related. I don't understand the code, but commenting out that if block results in each armature being given its own child armature (so, 4 armatures when importing 2), but the armatures in the COLLADA file do become seperate, top-level armatures.

I noticed there's [a comment in the ArmatureImporter ](https://developer.blender.org/diffusion/B/browse/master/source/blender/io/collada/ArmatureImporter.cpp;v2.83$617) that says: > This is not safe when we have more than one armatures in the import. A bit of printf debugging reveals that unsafe path is taken when importing a COLLADA file exported from Campbell's expimptest.blend. Perhaps that's related. I don't understand the code, but commenting out that if block results in each armature being given its own child armature (so, 4 armatures when importing 2), but the armatures in the COLLADA file do become seperate, top-level armatures.

So, I think more or less understand the problem, though solving it is another matter. In the COLLADA file itself, the root joint node points to the instance controller, which has a skin that points to the geometry. The OpenCOLLADA Sax parser, however, has a different structure, and it's not super clear how you go from a COLLADAFWSkinController, COLLADAFWSkinControllerData or COLLADAFWMesh to the COLLADAFWNode (or vice versa).

Blender creates its armatures when it encounters the armature nodes and needs to add data to them when it encounters the skin controllers, but it's not really clear which node the skin controller is for. So, the author of the importer just picked the first one and put a TODO to fix it for files containing multiple armatures.

So, I think more or less understand the problem, though solving it is another matter. In the COLLADA file itself, the root joint node points to the instance controller, which has a skin that points to the geometry. The OpenCOLLADA Sax parser, however, has a different structure, and it's not super clear how you go from a COLLADAFWSkinController, COLLADAFWSkinControllerData or COLLADAFWMesh to the COLLADAFWNode (or vice versa). Blender creates its armatures when it encounters the armature nodes and needs to add data to them when it encounters the skin controllers, but it's not really clear which node the skin controller is for. So, the author of the importer just picked the first one and put a TODO to fix it for files containing multiple armatures.
Member

I would say this is more of a missing feature than a bug. I actually tried to solve this issue a while back (some years ago) but at that time i was not able to fix that. I guess the original developer skipped that for a reason ... And i am also not sure if this is a nice to have feature or a must fix issue.

Opinions are welcome :)

I would say this is more of a missing feature than a bug. I actually tried to solve this issue a while back (some years ago) but at that time i was not able to fix that. I guess the original developer skipped that for a reason ... And i am also not sure if this is a nice to have feature or a must fix issue. Opinions are welcome :)

For me, it's just nice-to-have. I can concaternate all my objects together, or script importing a series of files, and it will be almost as good.

One thing that would have helped me is a warning in the log or console when trying to import a file with multiple armatures. I spent a while thinking I had screwed something up in writing my COLLADA file. A message from the importer would have saved a bunch of debugging.

For me, it's just nice-to-have. I can concaternate all my objects together, or script importing a series of files, and it will be almost as good. One thing that would have helped me is a warning in the log or console when trying to import a file with multiple armatures. I spent a while thinking I had screwed something up in writing my COLLADA file. A message from the importer would have saved a bunch of debugging.
Gaia Clary self-assigned this 2020-06-10 23:06:43 +02:00
Member

This is a valid complaint :)
I add a warning.

This is a valid complaint :) I add a warning.
Philipp Oeser removed the
Interest
Pipeline, Assets & IO
label 2023-02-10 08:54:23 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#56677
No description provided.