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:
authorgaiaclary <gaia.clary@machinimatrix.org>2014-02-27 18:23:18 +0400
committergaiaclary <gaia.clary@machinimatrix.org>2014-02-27 18:23:32 +0400
commit3111f08ad956352e9dfeedb8600fb35b4e38543d (patch)
treedaf6b59456e119efead090bc614889debfa096cb /source/blender/collada/ArmatureImporter.cpp
parent5031ca05aab9d3659ebdc5a95b20d5d713222ccd (diff)
Fix T38847: Reject reuse of child bones as root bones. That doesn't make sense anyways.
Diffstat (limited to 'source/blender/collada/ArmatureImporter.cpp')
-rw-r--r--source/blender/collada/ArmatureImporter.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 6d4308be5b5..c52ee656217 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -337,18 +337,23 @@ void ArmatureImporter::create_armature_bones( )
if (get_armature_for_joint(*ri) != NULL) continue;
Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
-
if (!ob_arm)
continue;
- ED_armature_to_edit((bArmature *)ob_arm->data);
+ bArmature * armature = (bArmature *)ob_arm->data;
+ if (!armature)
+ continue;
+
+ char * bone_name = (char *)bc_get_joint_name(*ri);
+ Bone *bone = BKE_armature_find_bone_name(armature, bone_name);
+ if(bone) {
+ fprintf(stderr, "Reuse of child bone [%s] as root bone in same Armature is not supported.\n", bone_name);
+ continue;
+ }
- /*
- * TODO:
- * check if bones have already been created for a given joint
- */
+ ED_armature_to_edit(armature);
- create_bone(NULL, *ri , NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature *)ob_arm->data);
+ create_bone(NULL, *ri , NULL, (*ri)->getChildNodes().getCount(), NULL, armature);
//leaf bone tails are derived from the matrix, so no need of this.
fix_leaf_bones();
@@ -356,12 +361,12 @@ void ArmatureImporter::create_armature_bones( )
// exit armature edit mode
unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
- ED_armature_from_edit((bArmature *)ob_arm->data);
+ ED_armature_from_edit(armature);
//This serves no purpose, as pose is automatically reset later, in BKE_where_is_bone()
//set_pose(ob_arm, *ri, NULL, NULL);
- ED_armature_edit_free((bArmature *)ob_arm->data);
+ ED_armature_edit_free(armature);
DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
}
}