Revision: 37832
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37832
Author:   phabtar
Date:     2011-06-26 18:56:06 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
set_pose function completed. Algorithms to be checked. 

(Still not the desired results ) 

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-26 17:18:37 UTC (rev 37831)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp        
2011-06-26 18:56:06 UTC (rev 37832)
@@ -405,11 +405,12 @@
 
        // exit armature edit mode
        
-       //      set_pose(ob_arm , *ri, NULL, NULL ); 
-
        unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
 
        ED_armature_from_edit(ob_arm);
+
+       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);
        }
@@ -537,51 +538,46 @@
 // is a child of a node (not joint), root should be true since
 // this is where we build armature bones from
 
-//void ArmatureImporter::set_pose ( Object * ob_arm ,  COLLADAFW::Node * 
root_node , EditBone *parent, float parent_mat[][4])
-//{ 
-//     char * bone_name = (char *) bc_get_joint_name ( root_node);
-//     float mat[4][4];
-//   float obmat[4][4];
-//
-//   bArmature * arm = (bArmature * ) ob_arm-> data ; 
-//     EditBone *edbone = NULL ;
-//     for (edBone=arm->edbo->first; edBone; edBone=edBone->next){
-//             bone = get_named_bone_bonechildren (curBone, name);
-//             if (bone)
-//                     return bone;
-//     }
-//
-//     // object-space
-//     get_node_mat(obmat, root_node, NULL, NULL);
-//
-//     //if(*edbone)
-//     bPoseChannel * pchan  = get_pose_channel(ob_arm -> pose ,  bone_name); 
-//     //else fprintf ( "",
-//
-//     // get world-space
-//     if (parent){
-//             mul_m4_m4m4(mat, obmat, parent_mat);
-//             bPoseChannel *parchan = get_pose_channel(ob_arm->pose, 
parent->name);
-//
-//             mul_m4_m4m4(pchan->pose_mat, mat , parchan->pose_mat);
-//     }
-//     else {
-//             copy_m4_m4(mat, obmat);
-//              float invObmat[4][4];
-//       invert_m4_m4(invObmat, ob_arm->obmat);
-//       mul_m4_m4m4(pchan->pose_mat, mat, invObmat);
-//     }
-//             
-//
-//     
-//
-//   COLLADAFW::NodePointerArray& children = root_node->getChildNodes();
-//     for (unsigned int i = 0; i < children.getCount(); i++) {
-//             set_pose(ob_arm, children[i], edbone, mat);
-//     }
-//
-//}
+void ArmatureImporter::set_pose ( Object * ob_arm ,  COLLADAFW::Node * 
root_node , char *parentname, float parent_mat[][4])
+{ 
+       char * bone_name = (char *) bc_get_joint_name ( root_node);
+       float mat[4][4];
+   float obmat[4][4];
 
+   bArmature * arm = (bArmature * ) ob_arm-> data ; 
+       EditBone *edbone = NULL ;
+       
+       // object-space
+       get_node_mat(obmat, root_node, NULL, NULL);
+
+       //if(*edbone)
+       bPoseChannel * pchan  = get_pose_channel(ob_arm -> pose ,  bone_name); 
+       //else fprintf ( "",
+
+       // get world-space
+       if (parentname){
+               mul_m4_m4m4(mat, obmat, parent_mat);
+               bPoseChannel *parchan = get_pose_channel(ob_arm->pose, 
parentname);
+
+               mul_m4_m4m4(pchan->pose_mat, mat , parchan->pose_mat);
+       }
+       else {
+               copy_m4_m4(mat, obmat);
+                float invObmat[4][4];
+       invert_m4_m4(invObmat, ob_arm->obmat);
+       mul_m4_m4m4(pchan->pose_mat, mat, invObmat);
+       }
+               
+
+       
+
+   COLLADAFW::NodePointerArray& children = root_node->getChildNodes();
+       for (unsigned int i = 0; i < children.getCount(); i++) {
+               set_pose(ob_arm, children[i], bone_name, mat);
+       }
+
+}
+
 void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object 
*parent, Scene *sce)
 {
        joint_by_uid[node->getUniqueId()] = node;

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h  
2011-06-26 17:18:37 UTC (rev 37831)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.h  
2011-06-26 18:56:06 UTC (rev 37832)
@@ -113,7 +113,7 @@
 
        void fix_leaf_bones();
        
-//     void set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node , 
EditBone *parent, float parent_mat[][4]);
+    void set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node ,char * 
parentname, float parent_mat[][4]);
 
 
 #if 0

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to