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:
-rw-r--r--source/blender/collada/ArmatureImporter.cpp39
-rw-r--r--source/blender/collada/ArmatureImporter.h9
-rw-r--r--source/blender/collada/DocumentImporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.h2
4 files changed, 39 insertions, 13 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 4e330738026..9489ddd1525 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -145,7 +145,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
// treat zero-sized bone like a leaf bone
if (length <= epsilon) {
- add_leaf_bone(parent_mat, parent);
+ add_leaf_bone(parent_mat, parent, node);
}
}
@@ -157,7 +157,8 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
// 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);
+
+ add_leaf_bone(mat, bone, node);
}
}
@@ -220,7 +221,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
// treat zero-sized bone like a leaf bone
if (length <= epsilon) {
- add_leaf_bone(parent_mat, parent);
+ add_leaf_bone(parent_mat, parent, node);
}
/*
@@ -258,22 +259,35 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
// 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);
+ add_leaf_bone(mat, bone , node);
}
}
-void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone)
+void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW::Node * node)
{
LeafBone leaf;
leaf.bone = bone;
copy_m4_m4(leaf.mat, mat);
BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name));
-
+
+ TagsMap::iterator etit;
+ ExtraTags *et = 0;
+ etit = uid_tags_map.find(node->getUniqueId().toAscii());
+ if(etit != uid_tags_map.end())
+ et = etit->second;
+
+ float x,y,z;
+ et->setData("tip_x",&x);
+ et->setData("tip_y",&y);
+ et->setData("tip_z",&z);
+ float vec[3] = {x,y,z};
+ copy_v3_v3(leaf.bone->tail, leaf.bone->head);
+ add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
leaf_bones.push_back(leaf);
}
-void ArmatureImporter::fix_leaf_bones()
+void ArmatureImporter::fix_leaf_bones( )
{
// just setting tail for leaf bones here
@@ -283,7 +297,7 @@ void ArmatureImporter::fix_leaf_bones()
// pointing up
float vec[3] = {0.0f, 0.0f, 1.0f};
-
+
mul_v3_fl(vec, leaf_bone_length);
copy_v3_v3(leaf.bone->tail, leaf.bone->head);
@@ -407,7 +421,7 @@ void ArmatureImporter::create_armature_bones( )
leaf_bone_length = FLT_MAX;
create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm);
- fix_leaf_bones();
+ //fix_leaf_bones();
// exit armature edit mode
@@ -750,6 +764,11 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node)
return NULL;
}
+void ArmatureImporter::set_tags_map(TagsMap & tagsMap)
+{
+ this->uid_tags_map = tagsMap;
+}
+
void ArmatureImporter::get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count)
{
BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", bc_get_joint_name(node));
@@ -771,3 +790,5 @@ bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint)
return found;
}
+
+
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index 2471e97007c..92d070ef575 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -46,6 +46,7 @@ extern "C" {
#include "MeshImporter.h"
#include "SkinInfo.h"
#include "TransformReader.h"
+#include "ExtraTags.h"
#include <map>
#include <vector>
@@ -109,7 +110,7 @@ private:
void create_unskinned_bone(COLLADAFW::Node *node, EditBone *parent, int totchild,
float parent_mat[][4], Object * ob_arm);
- void add_leaf_bone(float mat[][4], EditBone *bone);
+ void add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW::Node * node);
void fix_leaf_bones();
@@ -132,6 +133,9 @@ private:
void create_armature_bones(SkinInfo& skin);
void create_armature_bones( );
+ /** TagsMap typedef for uid_tags_map. */
+ typedef std::map<std::string, ExtraTags*> TagsMap;
+ TagsMap uid_tags_map;
public:
ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce);
@@ -166,7 +170,8 @@ public:
// gives a world-space mat
bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint);
-
+
+ void set_tags_map( TagsMap& tags_map);
};
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index c3090eebc9f..27442420f90 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -190,7 +190,7 @@ void DocumentImporter::finish()
write_node(roots[i], NULL, sce, NULL, false);
}
}
-
+ armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext);
#if 0
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index f6917c2e9bf..a347eed3e5a 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -47,7 +47,7 @@
#include "AnimationImporter.h"
#include "ArmatureImporter.h"
#include "MeshImporter.h"
-#include "ExtraTags.h"
+
struct Main;