Commit: 2382d1c401d1c271fa47122a36b77f9b6f06a32f
Author: Gaia Clary
Date:   Tue Sep 20 17:32:44 2016 +0200
Branches: master
https://developer.blender.org/rB2382d1c401d1c271fa47122a36b77f9b6f06a32f

regression fix for 1346482d23f167fa57049128384246397fda8d27: The length of leaf 
bones should always be set to the length of the smallest bone. since the 
mentioned commit the importer did only recalculate the leaf bone length when 
the 'fix leaf bones' option was also enabled.

===================================================================

M       source/blender/collada/ArmatureImporter.cpp
M       source/blender/collada/ArmatureImporter.h

===================================================================

diff --git a/source/blender/collada/ArmatureImporter.cpp 
b/source/blender/collada/ArmatureImporter.cpp
index 1bc2bff..d97fb55 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -221,7 +221,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
   * tail locations for the affected bones (nodes which don't have any 
connected child)
   * Hint: The extended_bones set gets populated in 
ArmatureImporter::create_bone
 **/
-void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone)
+void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone, bool 
fix_orientation)
 {
        if (bone == NULL)
                return;
@@ -237,7 +237,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, 
Bone *bone)
                        EditBone *ebone = bc_get_edit_bone(armature, 
bone->name);
                        float vec[3];
 
-                       if (ebone->parent != NULL) {
+                       if (ebone->parent != NULL && fix_orientation) {
                                EditBone *parent = ebone->parent;
                                sub_v3_v3v3(vec, ebone->head, parent->head);
                                if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH)
@@ -257,7 +257,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, 
Bone *bone)
        }
 
        for (Bone *child = (Bone *)bone->childbase.first; child; child = 
child->next) {
-               fix_leaf_bones(armature, child);
+               fix_leaf_bones(armature, child, fix_orientation);
        }
 }
 
@@ -756,17 +756,10 @@ void ArmatureImporter::make_armatures(bContext *C, 
std::vector<Object *> &object
                /* and step back to edit mode to fix the leaf nodes */
                ED_armature_to_edit(armature);
 
-               if (this->import_settings->fix_orientation || 
this->import_settings->find_chains) {
+               if (this->import_settings->find_chains)
+                       connect_bone_chains(armature, (Bone 
*)armature->bonebase.first, UNLIMITED_CHAIN_MAX);
 
-                       if (this->import_settings->find_chains)
-                               connect_bone_chains(armature, (Bone 
*)armature->bonebase.first, UNLIMITED_CHAIN_MAX);
-
-                       if (this->import_settings->fix_orientation)
-                               fix_leaf_bones(armature, (Bone 
*)armature->bonebase.first);
-
-                       // exit armature edit mode
-
-               }
+               fix_leaf_bones(armature, (Bone *)armature->bonebase.first, 
this->import_settings->fix_orientation);
 
                fix_parent_connect(armature, (Bone *)armature->bonebase.first);
 
diff --git a/source/blender/collada/ArmatureImporter.h 
b/source/blender/collada/ArmatureImporter.h
index e006ccb..524c524 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -111,7 +111,7 @@ private:
        BoneExtended &add_bone_extended(EditBone *bone, COLLADAFW::Node * node, 
int sibcount, std::vector<std::string> &layer_labels);
        void clear_extended_boneset();
 
-       void fix_leaf_bones(bArmature *armature, Bone *bone);
+       void fix_leaf_bones(bArmature *armature, Bone *bone, bool 
fix_orientation);
        void fix_parent_connect(bArmature *armature, Bone *bone);
        void connect_bone_chains(bArmature *armature, Bone *bone, const int 
max_chain_length);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to