[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45085] trunk/blender/source/blender/ collada/DocumentImporter.cpp: #collada skeleton animation import, fixes #29246

Arystanbek Dyussenov arystan.d at gmail.com
Thu Mar 22 14:35:57 CET 2012


Revision: 45085
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45085
Author:   kazanbas
Date:     2012-03-22 13:35:52 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
#collada skeleton animation import, fixes #29246

Apply part of the patch #30070 by Juha M?\195?\164ki-Kanto, that takes into account the transform of non-joint type parent in bone animation computation. Thanks!

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

Modified: trunk/blender/source/blender/collada/DocumentImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/DocumentImporter.cpp	2012-03-22 13:27:24 UTC (rev 45084)
+++ trunk/blender/source/blender/collada/DocumentImporter.cpp	2012-03-22 13:35:52 UTC (rev 45085)
@@ -239,7 +239,15 @@
 
 void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = NULL, Object *parob = NULL)
 {
-	if (par && par->getType() == COLLADAFW::Node::JOINT) {
+
+	// The split in #29246, rootmap must point at actual root when
+	// calculating bones in apply_curves_as_matrix.
+	// This has to do with inverse bind poses being world space
+	// (the sources for skinned bones' restposes) and the way
+	// non-skinning nodes have their "restpose" recursively calculated.
+	// XXX TODO: design issue, how to support unrelated joints taking
+	// part in skinning.
+	if (par) { // && par->getType() == COLLADAFW::Node::JOINT) {
 		// par is root if there's no corresp. key in root_map
 		if (root_map.find(par->getUniqueId()) == root_map.end())
 			root_map[node->getUniqueId()] = par;
@@ -319,6 +327,8 @@
 
 Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
 {
+	fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
+
 	Object *obn = copy_object(source_ob);
 	obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 	scene_add_base(sce, obn);
@@ -429,7 +439,7 @@
 		while (inst_done < inst_node.getCount()) {
 			const COLLADAFW::UniqueId& node_id = inst_node[inst_done]->getInstanciatedObjectId();
 			if (object_map.find(node_id) == object_map.end()) {
-				fprintf(stderr, "Cannot find node to instanciate.\n");
+				fprintf(stderr, "Cannot find object for node referenced by <instance_node name=\"%s\">.\n", inst_node[inst_done]->getName().c_str());
 				ob = NULL;
 			}
 			else {




More information about the Bf-blender-cvs mailing list