From 2d8227f20400767bcf0fbb0877a055534d8a99ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20M=C3=A4ki-Kanto?= Date: Fri, 24 Feb 2012 21:45:59 +0000 Subject: Collada export: bone parenting is actually against the tail. Don't know the reasoning for having it be against the tail and not the head. --- source/blender/collada/ArmatureExporter.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 9399ce6771d..47d41a9680f 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -196,33 +196,34 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, if((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) { float backup_parinv[4][4]; + copy_m4_m4(backup_parinv, (*i)->parentinv); - // SECOND_LIFE_COMPATIBILITY // crude, temporary change to parentinv // so transform gets exported correctly. + + // Add bone tail- translation... don't know why + // bone parenting is against the tail of a bone + // and not it's head, seems arbitrary. + (*i)->parentinv[3][1] += bone->length; + + // SECOND_LIFE_COMPATIBILITY // TODO: when such objects are animated as // single matrix the tweak must be applied // to the result. if(export_settings->second_life) { - copy_m4_m4(backup_parinv, (*i)->parentinv); - // tweak objects parentinverse to match - // the second life- compatibility + // tweak objects parentinverse to match compatibility float temp[4][4]; copy_m4_m4(temp, bone->arm_mat); temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; - mult_m4_m4m4((*i)->parentinv, temp, backup_parinv); + mult_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv); } se->writeNodes(*i, sce); - // restore original parentinv - if(export_settings->second_life) - { - copy_m4_m4((*i)->parentinv, backup_parinv); - } + copy_m4_m4((*i)->parentinv, backup_parinv); child_objects.erase(i++); } else i++; -- cgit v1.2.3