From e353593b30092563a2f140a7709bb425cd69fddf Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Sun, 14 Jul 2013 17:21:12 +0000 Subject: fix: #36060 Collada Import: animated armature+mesh problem --- source/blender/collada/ArmatureImporter.cpp | 15 +++++---------- source/blender/collada/ArmatureImporter.h | 6 +----- source/blender/collada/DocumentImporter.cpp | 4 +++- 3 files changed, 9 insertions(+), 16 deletions(-) (limited to 'source/blender') diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 121e4d1d605..0cd48707566 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -166,7 +166,7 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo } bone->length = len_v3v3(bone->head, bone->tail); - + joint_by_uid[node->getUniqueId()] = node; finished_joints.push_back(node); } @@ -517,16 +517,11 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con // 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_root_joint(COLLADAFW::Node *node, Object *parent) { - joint_by_uid[node->getUniqueId()] = node; - if (root) { - root_joints.push_back(node); - - if (parent) { - - joint_parent_map[node->getUniqueId()] = parent; - } + root_joints.push_back(node); + if (parent) { + joint_parent_map[node->getUniqueId()] = parent; } } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index bd17a925f3a..beeac85cc4d 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -140,11 +140,7 @@ public: ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce); ~ArmatureImporter(); - void add_joint(COLLADAFW::Node *node, bool root, Object *parent); - -#if 0 - void add_root_joint(COLLADAFW::Node *node); -#endif + void add_root_joint(COLLADAFW::Node *node, Object *parent); // here we add bones to armatures, having armatures previously created in write_controller void make_armatures(bContext *C); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index af1113b337a..60ef69379de 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -480,7 +480,9 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA object_map.insert(std::pair(node->getUniqueId(), par)); node_map[node->getUniqueId()] = node; } - armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par); + if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) { + armature_importer.add_root_joint(node, par); + } if (parent_node == NULL) { // for skeletons without root node all has been done above. -- cgit v1.2.3