Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-06-26 22:56:06 +0400
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-06-26 22:56:06 +0400
commit87f242fab09bcdd1eebaa898d2b4ce7caa6a31e4 (patch)
tree3214ac66d8561627c6d0a2fa1858cd61dc503ef6
parent12e5d69af0cbb7c42601ea2541a9bdd536147d42 (diff)
set_pose function completed. Algorithms to be checked.
(Still not the desired results )
-rw-r--r--source/blender/collada/ArmatureImporter.cpp88
-rw-r--r--source/blender/collada/ArmatureImporter.h2
2 files changed, 43 insertions, 47 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index df35e0ad986..ad8ad690ef5 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -405,11 +405,12 @@ void ArmatureImporter::create_armature_bones( )
// 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,50 +538,45 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
// 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)
{
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index d78a41af803..2471e97007c 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -113,7 +113,7 @@ private:
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