Page MenuHome

Collada import doesn't import some bones in some armatures
Open, Confirmed, MediumPublic

Description

System Information
Operating system: Windows 10
Graphics card: Nvidia 970

Blender Version
Broken: 2.79 (most likely all earlier versions)

Short description of error
With some Collada files, importing an armature only imports a subset of the bones. For the attached .dae file, there are 69 bones, but the import only brings in 54 of them.

Exact steps for others to reproduce the error
Using a default installation of 2.79 Blender (latest patch version), import the attached .dae file from:
File -> Import -> Collada.
Select Fix Leaf Bones, Find Bone Chaines and Auto Connect.

The full bone list from the Collada file:

>>> boneNames
['Bip01', 'Bip01_Pelvis', 'Bip01_L_Hip', 'Bip01_L_Leg_Flap_Front', 'Bip01_Pitch', 'Bip01_R_Hip', 'Bip01_R_Leg_Flap_Front', 'Bip01_L_Thigh', 'Bip01_L_Calf', 'Bip01_L_Foot', 'target06', 'Bip01_L_Heel', 'Bip01_L_index1', 'Bip01_L_pinky1', 'Bip01_L_talon1', 'Bip01_L_Toe0', 'Bip01_L_index2', 'Bip01_L_index2_Nub', 'Bip01_L_pinky2', 'Bip01_L_pinky2_Nub', 'Bip01_L_talon2', 'Bip01_L_talon2_Nub', 'Bip01_L_Toe0Helper', 'Bip01_L_Toe0Nub', 'Bip01_L_Leg_Flap_Front_Nub', 'Bip01_Spine', 'Bip01_Spine1', 'Bip01_Spine2', 'Bip01_L_Clavicle', 'Bip01_R_Clavicle', 'Bip01_Torso_Flap_Front', 'COCKPIT', 'COCKPIT_CAM', 'jet1_l', 'jet2_l', 'target01', 'target02', 'target03', 'Bip01_L_UpperArm', 'Bip01_L_Forearm', 'Bip01_L_UpperArm_Door', 'Bip01_L_Hand', 'target05', 'Bip01_L_UpperArm_DoorNub', 'Bip01_R_UpperArm', 'Bip01_R_Forearm', 'Bip01_R_UpperArm_Door', 'Bip01_R_Hand', 'target04', 'Bip01_R_UpperArm_DoorNub', 'Bip01_Torso_Flap_Front_Nub', 'Bip01_R_Thigh', 'Bip01_R_Calf', 'Bip01_R_Foot', 'target07', 'Bip01_R_Heel', 'Bip01_R_index1', 'Bip01_R_pinky1', 'Bip01_R_talon1', 'Bip01_R_Toe0', 'Bip01_R_index2', 'Bip01_R_index2_Nub', 'Bip01_R_pinky2', 'Bip01_R_pinky2_Nub', 'Bip01_R_talon2', 'Bip01_R_talon2_Nub', 'Bip01_R_Toe0Helper', 'Bip01_R_Toe0Nub', 'Bip01_R_Leg_Flap_Front_Nub']
>>> len(boneNames)
69

After File -> Import -> Collada and selecting the .dae file:

>>> arm = bpy.data.armatures['Armature']
>>> armBones = [o.name for o in arm.bones]
>>> armBones
['Bip01', 'Bip01_Pelvis', 'Bip01_L_Hip', 'Bip01_L_Thigh', 'Bip01_L_Calf', 'Bip01_L_Foot', 'Bip01_L_Heel', 'Bip01_L_index1', 'Bip01_L_index2', 'Bip01_L_pinky1', 'Bip01_L_pinky2', 'Bip01_L_pinky2_Nub', 'Bip01_L_talon1', 'Bip01_L_talon2', 'Bip01_L_talon2_Nub', 'Bip01_L_Toe0', 'Bip01_L_Toe0Helper', 'Bip01_L_Toe0Nub', 'Bip01_L_Leg_Flap_Front', 'Bip01_L_Leg_Flap_Front_Nub', 'Bip01_Pitch', 'Bip01_Spine', 'Bip01_Spine1', 'Bip01_Spine2', 'Bip01_L_Clavicle', 'Bip01_L_Hand', 'Bip01_L_UpperArm_Door', 'Bip01_R_Clavicle', 'Bip01_R_Hand', 'Bip01_R_UpperArm_Door', 'Bip01_Torso_Flap_Front', 'jet1_l', 'jet2_l', 'target01', 'target02', 'target03', 'Bip01_R_Hip', 'Bip01_R_Thigh', 'Bip01_R_Calf', 'Bip01_R_Foot', 'Bip01_R_Heel', 'Bip01_R_index1', 'Bip01_R_index2', 'Bip01_R_pinky1', 'Bip01_R_pinky2', 'Bip01_R_pinky2_Nub', 'Bip01_R_talon1', 'Bip01_R_talon2', 'Bip01_R_talon2_Nub', 'Bip01_R_Toe0', 'Bip01_R_Toe0Helper', 'Bip01_R_Toe0Nub', 'Bip01_R_Leg_Flap_Front', 'Bip01_R_Leg_Flap_Front_Nub']
>>> len(armBones)
54
>>> list(set(bonesNames) - set(arm2Bones))
['Bip01_Torso_Flap_Front_Nub', 'COCKPIT', 'Bip01_L_pinky2_Nub', 'COCKPIT_CAM', 'Bip01_R_talon2_Nub', 'Bip01_L_index2_Nub', 'target07', 'Bip01_L_talon2_Nub', 'jet1_l']

Bones that didn't get imported:

>>> list(set(boneNames) - set(armBones))
['Bip01_L_Forearm', 'Bip01_R_UpperArm_DoorNub', 'Bip01_Torso_Flap_Front_Nub', 'COCKPIT', 'COCKPIT_CAM', 'target05', 'Bip01_L_index2_Nub', 'Bip01_R_UpperArm', 'target06', 'target07', 'Bip01_R_Forearm', 'Bip01_L_UpperArm', 'Bip01_L_UpperArm_DoorNub', 'target04', 'Bip01_R_index2_Nub']

If you select Find Bone Chains and Auto Connect, you get 60 bones imported:

>>> len(arm2Bones)
60
>>> list(set(bonesNames) - set(arm2Bones))
['Bip01_Torso_Flap_Front_Nub', 'COCKPIT', 'Bip01_L_pinky2_Nub', 'COCKPIT_CAM', 'Bip01_R_talon2_Nub', 'Bip01_L_index2_Nub', 'target07', 'Bip01_L_talon2_Nub', 'jet1_l']

Various options for the Collada import result in a different number of bones imported. Just Auto Connect selected imported 58. Just selecting Keep Bind Info imported 57 bones. Just selecting 'Fix Leaf Bones' imported just 44. Just selecting 'Find Bone Chains' imported 60. The number of bones imported is consistent, just for this particular collada file (and a couple others), it never imports the full amount.

Also attached is another .dae file that has 73 bones in it, which all import properly:

I did run Blender through Visual Studio and the debugger to attempt to trace the error, but it didn't throw any errors when it decided to skip a bone. I'll continue to stretch my c++ skills to see if I can figure out where it's happening, but figure this could use some professional help.

Details

Type
Bug

Event Timeline

Sebastian Parborg (zeddb) triaged this task as Confirmed, Medium priority.

As a quick first note: One reason why bones get silently dropped is when their size is calculated to be 0, in python it would happen if for example:

(bone.tail - bone.head).magnitude == 0

This could also explain why some bones are not dropped when bone chains are calculated because then the bone tails get forced to match the locations of their child's head. So in the debugger you could check if head and tail are identical for the bones that get dropped.

I wonder though i thought there was a warning about zero sized bones. But maybe that is only in Blender 2.80. Anyways i will take care of that, but for now only in Blender 2.80.

I tested this morning in Blender 2.80 (debugging mode through Visual Studio), and it was able to import all 69 bones using a couple of different import options selected. This might be a 2.79 or earlier issue only, but I will do more testing on this.