[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37605] branches/soc-2011-pepper/source/ blender/collada: unskinned armature import improved but unfinished.

Sukhitha Jayathilake pr.jayathilake at gmail.com
Fri Jun 17 22:01:25 CEST 2011


Revision: 37605
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37605
Author:   phabtar
Date:     2011-06-17 20:01:24 +0000 (Fri, 17 Jun 2011)
Log Message:
-----------
unskinned armature import improved but unfinished.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp
    branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp	2011-06-17 19:48:26 UTC (rev 37604)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp	2011-06-17 20:01:24 UTC (rev 37605)
@@ -383,7 +383,22 @@
 
 		create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data);
 
+		fix_leaf_bones();
+
+	// exit armature edit mode
+	
+
+	if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && ob_arm->parent!=NULL)
+		ob_arm->parent = joint_parent_map[(*ri)->getUniqueId()];
+	
+	unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
+
+	ED_armature_from_edit(ob_arm);
+	ED_armature_edit_free(ob_arm);
+	DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
 	}
+
+	
 }
 
 void ArmatureImporter::create_armature_bones(SkinInfo& skin)
@@ -558,9 +573,7 @@
 		skin.free();
 	}
 
-	//if skin_by_data_uid is empty 
-	if( skin_by_data_uid.empty() )
-		create_armature_bones();
+	create_armature_bones();
 
 }
 
@@ -657,6 +670,11 @@
 			return skin.get_armature();
 	}
 
+	std::map<COLLADAFW::UniqueId, Object*>::iterator arm;
+	for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) {
+		if(arm->first == node->getUniqueId() )
+			return arm->second;
+	}
 	return NULL;
 }
 

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h	2011-06-17 19:48:26 UTC (rev 37604)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h	2011-06-17 20:01:24 UTC (rev 37605)
@@ -89,6 +89,7 @@
 	std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> joint_by_uid; // contains all joints
 	std::vector<COLLADAFW::Node*> root_joints;
 	std::map<COLLADAFW::UniqueId, Object*> joint_parent_map;
+	std::map<COLLADAFW::UniqueId, Object*> unskinned_armature_map;
 
 	MeshImporterBase *mesh_importer;
 	AnimationImporterBase *anim_importer;




More information about the Bf-blender-cvs mailing list