Fix: #36184 Collada import/export... leaf bone size was not set as needed.

This commit is contained in:
Gaia Clary 2013-07-17 20:22:08 +00:00
parent 64a172907a
commit f2db6949c2

@ -133,11 +133,7 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
add_v3_v3v3(bone->tail, bone->head, vec); add_v3_v3v3(bone->tail, bone->head, vec);
// set parent tail // set parent tail
if (parent && totchild == 1) { if (parent) {
copy_v3_v3(parent->tail, bone->head);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
bone->flag |= BONE_CONNECTED;
// XXX increase this to prevent "very" small bones? // XXX increase this to prevent "very" small bones?
const float epsilon = 0.000001f; const float epsilon = 0.000001f;
@ -148,9 +144,17 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
leaf_bone_length = length; leaf_bone_length = length;
} }
// treat zero-sized bone like a leaf bone if (totchild == 1) {
if (length <= epsilon) { copy_v3_v3(parent->tail, bone->head);
add_leaf_bone(parent_mat, parent, node);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
bone->flag |= BONE_CONNECTED;
// treat zero-sized bone like a leaf bone
if (length <= epsilon) {
add_leaf_bone(parent_mat, parent, node);
}
} }
} }