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>2012-07-03 20:26:38 +0400
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2012-07-03 20:26:38 +0400
commit45c6d10a2d763e0127e45c8965a4eaec5990d685 (patch)
tree4c89b4c74457a217f1e807ac109de526c715445c /source/blender/collada
parenta9bbf4d3df195b7607d3da8e698b34265e023e65 (diff)
Armature Importer fix.
Bone length and tail values.
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/ArmatureImporter.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 4dd608e6e4e..bd5bd9a1a8b 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -93,6 +93,7 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
float mat[4][4];
float obmat[4][4];
+ float bonemat[3][3];
// TODO rename from Node "name" attrs later
EditBone *bone = ED_armature_edit_bone_add(arm, (char *)bc_get_joint_name(node));
@@ -104,12 +105,13 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
}
// create a bone even if there's no joint data for it (i.e. it has no influence)
else {
- // object-space
+ // bone-space
get_node_mat(obmat, node, NULL, NULL);
// get world-space
- if (parent)
- mult_m4_m4m4(mat, parent_mat, mat);
+ if (parent){
+ mult_m4_m4m4(mat, parent_mat, obmat);
+ }
else
copy_m4_m4(mat, obmat);
}
@@ -117,10 +119,12 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
if (parent) bone->parent = parent;
////mult_m4_m4m4(mat, ob_arm->obmat , mat);
- float loc[3], size[3], rot[3][3], angle;
+ //float loc[3], size[3], rot[3][3],
+ float angle;
float vec[3] = {0.0f, 0.5f, 0.0f};
- mat4_to_loc_rot_size(loc, rot, size, mat);
- mat3_to_vec_roll(rot, vec, &angle);
+ // mat4_to_loc_rot_size(loc, rot, size, mat);
+ copy_m3_m4(bonemat,mat);
+ mat3_to_vec_roll(bonemat, vec, &angle);
bone->roll = angle;
// set head
copy_v3_v3(bone->head, mat[3]);
@@ -128,9 +132,11 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
// set tail, don't set it to head because 0-length bones are not allowed
add_v3_v3v3(bone->tail, bone->head, vec);
+ bone->length = len_v3v3(bone->head, bone->tail);
+
// set parent tail
if (parent && totchild == 1) {
- copy_v3_v3(parent->tail, bone->head);
+ copy_v3_v3(parent->tail, bone->head);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
// bone->flag |= BONE_CONNECTED;