diff options
author | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-06-18 00:01:24 +0400 |
---|---|---|
committer | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-06-18 00:01:24 +0400 |
commit | 3f0e480ba9ebf3f3455ffae30b9d82d1dca8c1bc (patch) | |
tree | 25d5449407fac6d2f2e754882ada654c82f39bfd /source/blender | |
parent | c9b0ce8693ace816e49e157587ebe295dfd9b379 (diff) |
unskinned armature import improved but unfinished.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/collada/ArmatureImporter.cpp | 24 | ||||
-rw-r--r-- | source/blender/collada/ArmatureImporter.h | 1 |
2 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index e64afa1f7b6..6eb03a21d6e 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -383,7 +383,22 @@ void ArmatureImporter::create_armature_bones( ) create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data); + fix_leaf_bones(); + + // exit armature edit mode + + + if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && ob_arm->parent!=NULL) + ob_arm->parent = joint_parent_map[(*ri)->getUniqueId()]; + + unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm; + + ED_armature_from_edit(ob_arm); + ED_armature_edit_free(ob_arm); + DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA); } + + } void ArmatureImporter::create_armature_bones(SkinInfo& skin) @@ -558,9 +573,7 @@ void ArmatureImporter::make_armatures(bContext *C) skin.free(); } - //if skin_by_data_uid is empty - if( skin_by_data_uid.empty() ) - create_armature_bones(); + create_armature_bones(); } @@ -657,6 +670,11 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) return skin.get_armature(); } + std::map<COLLADAFW::UniqueId, Object*>::iterator arm; + for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) { + if(arm->first == node->getUniqueId() ) + return arm->second; + } return NULL; } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index 90cb0271e60..f83a492afb6 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -89,6 +89,7 @@ private: std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> joint_by_uid; // contains all joints std::vector<COLLADAFW::Node*> root_joints; std::map<COLLADAFW::UniqueId, Object*> joint_parent_map; + std::map<COLLADAFW::UniqueId, Object*> unskinned_armature_map; MeshImporterBase *mesh_importer; AnimationImporterBase *anim_importer; |