[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37628] branches/soc-2011-pepper/source/ blender/collada:

Sukhitha Jayathilake pr.jayathilake at gmail.com
Sun Jun 19 06:20:43 CEST 2011


Revision: 37628
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37628
Author:   phabtar
Date:     2011-06-19 04:20:43 +0000 (Sun, 19 Jun 2011)
Log Message:
-----------


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

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp	2011-06-19 01:23:50 UTC (rev 37627)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp	2011-06-19 04:20:43 UTC (rev 37628)
@@ -681,6 +681,7 @@
 	
 	COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
 	Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()];
+	
 	const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
     
 	if ( ! is_object_animated(node) ) return ;  

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp	2011-06-19 01:23:50 UTC (rev 37627)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp	2011-06-19 04:20:43 UTC (rev 37628)
@@ -134,9 +134,9 @@
 	}
 
 	// in second case it's not a leaf bone, but we handle it the same way
-	if (!children.getCount() || children.getCount() > 1) {
-		add_leaf_bone(mat, bone);
-	}
+	/*if (!children.getCount() || children.getCount() > 1) {
+		add_leaf_bone(mat, bone);*/
+	//}
 
 }
 
@@ -369,8 +369,10 @@
 			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 = add_object(scene, OB_ARMATURE);
 
+		Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
+		//ob_arm->type = OB_ARMATURE;
 		ED_armature_to_edit(ob_arm);
 
 		// min_angle = 360.0f;		// minimum angle between bone head-tail and a row of bone matrix
@@ -388,8 +390,8 @@
 	// 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()];
+	//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;
 
@@ -520,14 +522,18 @@
 // root - if this joint is the top joint in hierarchy, if a joint
 // is a child of a node (not joint), root should be true since
 // this is where we build armature bones from
-void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent)
+void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent, Scene *sce)
 {
 	joint_by_uid[node->getUniqueId()] = node;
 	if (root) {
 		root_joints.push_back(node);
 
-		if (parent)
+		if (parent) {
+			Object * par = parent->parent;
+			parent = add_object(sce, OB_ARMATURE );
+			parent->parent = par;
 			joint_parent_map[node->getUniqueId()] = parent;
+		}
 	}
 }
 

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h	2011-06-19 01:23:50 UTC (rev 37627)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h	2011-06-19 04:20:43 UTC (rev 37628)
@@ -137,7 +137,7 @@
 	// root - if this joint is the top joint in hierarchy, if a joint
 	// is a child of a node (not joint), root should be true since
 	// this is where we build armature bones from
-	void add_joint(COLLADAFW::Node *node, bool root, Object *parent);
+	void add_joint(COLLADAFW::Node *node, bool root, Object *parent, Scene *sce);
 
 #if 0
 	void add_root_joint(COLLADAFW::Node *node);

Modified: branches/soc-2011-pepper/source/blender/collada/DocumentImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/DocumentImporter.cpp	2011-06-19 01:23:50 UTC (rev 37627)
+++ branches/soc-2011-pepper/source/blender/collada/DocumentImporter.cpp	2011-06-19 04:20:43 UTC (rev 37628)
@@ -378,7 +378,7 @@
 	bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
 
 	if (is_joint) {
-		armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par);
+		armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce);
 	}
 	else {
 		COLLADAFW::InstanceGeometryPointerArray &geom = node->getInstanceGeometries();




More information about the Bf-blender-cvs mailing list