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:
authorGaia Clary <gaia.clary@machinimatrix.org>2019-06-03 00:33:22 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2019-06-03 00:33:22 +0300
commit19dcb22a885d637a08e2c459aa47e855dc5114f3 (patch)
tree0d08f18e405b7637e9ddc4dfe4b187f440532f2b /source/blender/collada
parentb7bd8d813fd92d25eceedc7b1f23894c12bba6f9 (diff)
fix collada Importer: Set bone transformation type when importing unskinned skeleton
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/ArmatureImporter.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 9bafc58a658..de8b8aab93c 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -479,11 +479,12 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
/* if there is an armature created for root_joint next root_joint */
for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
- if (get_armature_for_joint(*ri) != NULL) {
+ COLLADAFW::Node *node = *ri;
+ if (get_armature_for_joint(node) != NULL) {
continue;
}
- Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
+ Object *ob_arm = joint_parent_map[node->getUniqueId()];
if (!ob_arm) {
continue;
}
@@ -493,7 +494,7 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
continue;
}
- char *bone_name = (char *)bc_get_joint_name(*ri);
+ char *bone_name = (char *)bc_get_joint_name(node);
Bone *bone = BKE_armature_find_bone_name(armature, bone_name);
if (bone) {
fprintf(stderr,
@@ -505,7 +506,7 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
ED_armature_to_edit(armature);
armature->layer = 0; // layer is set according to imported bone set in create_bone()
- create_bone(NULL, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, armature, layer_labels);
+ create_bone(NULL, node, NULL, node->getChildNodes().getCount(), NULL, armature, layer_labels);
if (this->import_settings->find_chains) {
connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX);
}
@@ -513,16 +514,17 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
/* exit armature edit mode to populate the Armature object */
ED_armature_from_edit(bmain, armature);
ED_armature_edit_free(armature);
-
ED_armature_to_edit(armature);
fix_leaf_bone_hierarchy(
armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation);
- unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
+ unskinned_armature_map[node->getUniqueId()] = ob_arm;
ED_armature_from_edit(bmain, armature);
ED_armature_edit_free(armature);
+ set_bone_transformation_type(node, ob_arm);
+
int index = std::find(ob_arms.begin(), ob_arms.end(), ob_arm) - ob_arms.begin();
if (index == 0) {
ob_arms.push_back(ob_arm);
@@ -593,7 +595,8 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin)
std::vector<COLLADAFW::Node *>::iterator ri;
for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) {
- if (a->uses_joint_or_descendant(*ri)) {
+ COLLADAFW::Node *node = *ri;
+ if (a->uses_joint_or_descendant(node)) {
shared = b->BKE_armature_from_object();
break;
}
@@ -636,21 +639,22 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin)
std::vector<COLLADAFW::Node *>::iterator ri;
for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
+ COLLADAFW::Node *node = *ri;
/* for shared armature check if bone tree is already created */
- if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) !=
+ if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), node) !=
skin_root_joints.end()) {
continue;
}
/* since root_joints may contain joints for multiple controllers, we need to filter */
- if (skin.uses_joint_or_descendant(*ri)) {
+ if (skin.uses_joint_or_descendant(node)) {
create_bone(
- &skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, armature, layer_labels);
+ &skin, node, NULL, node->getChildNodes().getCount(), NULL, armature, layer_labels);
- if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() &&
+ if (joint_parent_map.find(node->getUniqueId()) != joint_parent_map.end() &&
!skin.get_parent()) {
- skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]);
+ skin.set_parent(joint_parent_map[node->getUniqueId()]);
}
}
}