unskinned armature import improved but unfinished.

This commit is contained in:
Sukhitha Prabhath Jayathilake
2011-06-17 20:01:24 +00:00
parent c9b0ce8693
commit 3f0e480ba9
2 changed files with 22 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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;