[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44419] trunk/blender/source/blender/ collada/ArmatureExporter.cpp: Collada export: bone parenting is actually against the tail.

Juha Mäki-Kanto kiskosika at gmail.com
Fri Feb 24 22:46:08 CET 2012


Revision: 44419
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44419
Author:   kanttori
Date:     2012-02-24 21:45:59 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/collada/ArmatureExporter.cpp

Modified: trunk/blender/source/blender/collada/ArmatureExporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/ArmatureExporter.cpp	2012-02-24 21:15:58 UTC (rev 44418)
+++ trunk/blender/source/blender/collada/ArmatureExporter.cpp	2012-02-24 21:45:59 UTC (rev 44419)
@@ -196,33 +196,34 @@
 		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++;




More information about the Bf-blender-cvs mailing list