[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44636] trunk/blender/source/blender/ collada/ArmatureImporter.cpp: #collada skeleton import, bugfix #29621

Arystanbek Dyussenov arystan.d at gmail.com
Sun Mar 4 14:43:35 CET 2012


Revision: 44636
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44636
Author:   kazanbas
Date:     2012-03-04 13:43:23 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
#collada skeleton import, bugfix #29621

Do not crash when joint SIDs cannot be resolved.

OpenCOLLADA cannot resolve joint SIDs connected to skin if the <skeleton> tag is missing.

Page 148 of COLLADA spec 1.4.1 states: "<skeleton> elements define where to start the sid lookup". So I think this is a bug in "FBX COLLADA exporter" which did not add the <skeleton> tag.

The problem can be fixed by manually adding the <skeleton> tag into <instance_controller>.

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

Modified: trunk/blender/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/ArmatureImporter.cpp	2012-03-04 11:58:55 UTC (rev 44635)
+++ trunk/blender/source/blender/collada/ArmatureImporter.cpp	2012-03-04 13:43:23 UTC (rev 44636)
@@ -410,12 +410,16 @@
 	std::vector<COLLADAFW::Node*>::iterator ri;
 	//if there is an armature created for root_joint next root_joint
 	for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
-			if ( get_armature_for_joint(*ri) != NULL ) continue;
+		if ( get_armature_for_joint(*ri) != NULL ) continue;
 		
 		//add armature object for current joint
 		//Object *ob_arm = add_object(scene, OB_ARMATURE);
 
 		Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
+
+		if (!ob_arm)
+			continue;
+
 		//ob_arm->type = OB_ARMATURE;
 		ED_armature_to_edit(ob_arm);
 
@@ -423,24 +427,24 @@
 
 		// create unskinned bones
 		/*
-		   TODO:
-		   check if bones have already been created for a given joint
+		  TODO:
+		  check if bones have already been created for a given joint
 		*/
 		leaf_bone_length = FLT_MAX;
 		create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm);
 
 		fix_leaf_bones();
 
-	// exit armature edit mode
+		// exit armature edit mode
 	
-	unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
+		unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
 
-	ED_armature_from_edit(ob_arm);
+		ED_armature_from_edit(ob_arm);
 
-	set_pose(ob_arm , *ri, NULL, NULL ); 
+		set_pose(ob_arm , *ri, NULL, NULL ); 
 
-	ED_armature_edit_free(ob_arm);
-	DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
+		ED_armature_edit_free(ob_arm);
+		DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
 	}
 
 	




More information about the Bf-blender-cvs mailing list