Page MenuHome

Problem when importing FBX file with 2 armatures
Closed, ResolvedPublic

Description

Not sure this is really a bug, and sorry I assigned this directly to you, but I have no idea how to contact you about FBX addon and I ran into really weird problem there. Certain model that I bought on the net in FBX format wouldn't import correctly - it has one bone and nothing else, but certainly there was full armature and all viewers show the skeleton properly, animation works and so on.

So I started debugging, having no idea how complex that addon is. After a while I managed to pin the problem to some armature with really weird name. I thought the name may be the problem (I attach screenshot of bone hierarchy to this ticket), as it has weird unicode characters in it. But I think there is something weird with how addon processes possible armatures, as it seems to loop through main "root" nodes and once it finds a node that seems like a root of an armature it just stops there and picks that one. On the screenshot you see this weird named object is before "Bip01" main armature hierarchy, and it seems only that one was picked.

I managed to confirm that setting is_bone=False for "\x\x04" suddenly caused that third in line object to become main armature and load properly. I did it with dirty hack by just comparing the uuid of objects and if it was the wrong one I forced is_bone to false, but there must be some way to make it work properly without such hacks.

Could you explain how exactly find_armatures decides on what should be and what shouldn't be imported into Blender as armature hierarchy?

def find_armatures(self):
       needs_armature = False
       for child in self.children:
           if child.is_bone: 
               needs_armature = True  # <<<<
               break

Above line marked with an arrow is the one that caused problem, creating hiearchy for some loose root bone, while ignoring the correct armature that was next in line. Maybe there should be some box to type the name of object that acts as main armature, or the addon should just import all of them?

Event Timeline

Kamil N (noizex) raised the priority of this task from to 90.
Kamil N (noizex) updated the task description. (Show Details)
Kamil N (noizex) edited a custom field.
Kamil N (noizex) added a subscriber: Kamil N (noizex).

Hierarchy dumped from some FBX viewer

Bastien Montagne (mont29) lowered the priority of this task from 90 to 30.Jun 23 2016, 11:43 AM

Can you please attach here an as simple as possible FBX file reproducing the issue (or if not possible to reproduce it, the original FBX file)? Cannot do much without it…

Regarding is_bone, an FBX node is considered a bone if its type is LimbNode or Limb - have to check your file to understand why it fails, suspect yet another broken mess of FBX though (it seems to have very fuzzy definition of armatures/bones, with many possible types for root node of those… usual nightmare :( ).

Kamil N (noizex) added a comment.EditedJun 23 2016, 11:49 AM

I will post the original file when I get back home, I can't really reproduce it as a smaller FBX as I don't have any means to edit these files or create another one, it's just an asset I bought made by someone else. That hierarchy dump:

should show you how it looks inside, and my assumption is that it failed because in find_armature it goes like this:

  1. Check if U3DMesh is_bone == True -> false
  2. Check if ##04 is_bone == True -> true
  3. Proceed to build armature for node ##04
  4. Skip Bip01 node completly (as find_armature exits on first "node" that seems like an armature)

To me it looks like the author left some root bone without real armature, and then added another one that holds models correct armature, and somehow this wrong root bone appears first on the list and gets processed by addon, instead of correct one.

Once I attach the file you will be able to check it yourself, I don't know anything about FBX structure so that's just my guess. And yeah, looking through addon and it's comments I quickly realized that FBX files are a huge mess :(

Yeah… But if guys produce several, totally independent chains of bones supposed to be a single armature… not sure how we can detect that? imho that kind of hierarchy should simply produce two totally independent armatures.

I think in this case it's just a messy file, and that single chain with weird chinese characters is just some leftover that wasn't deleted. So the correct armature is a single chain, the problem is that it gets skipped and only the wrong one is created. I'd be totally happy if both chains were imported, creating separete armatures in Blender's terms, and I could just delete the one that is useless, but right now it skips the second chain alltogether.

Yep, both should be imported for sure, that’s bug (and need file to reproduce it and fix it ;) ).

This comment was removed by Kamil N (noizex).