patch [#23221] Merge bone : Within chains : infinite loop
authorCampbell Barton <ideasman42@gmail.com>
Mon, 13 Sep 2010 07:30:11 +0000 (07:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 13 Sep 2010 07:30:11 +0000 (07:30 +0000)
from Yvon Tanguy (vono)

source/blender/editors/armature/editarmature.c

index 6bda6b5..85ae2fb 100644 (file)
@@ -3107,8 +3107,8 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
        /* step 2a: parent children of in-between bones to newbone */
        for (chain= chains->first; chain; chain= chain->next) {
                /* ick: we need to check if parent of each bone in chain is one of the bones in the */
+               short found= 0;
                for (ebo= chain->data; ebo; ebo= ebo->parent) {
-                       short found= 0;
                        
                        /* try to find which bone from the list to be removed, is the parent */
                        for (ebone= end; ebone; ebone= ebone->parent) {
@@ -3124,6 +3124,9 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
                                break;
                        }
                }
+               if (found) {
+                       break;
+               }
        }
        
        /* step 2b: parent child of end to newbone (child from this chain) */
@@ -3135,6 +3138,9 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
                ebone= (ebo == start) ? (NULL) : (ebo->parent);
                bone_free(arm, ebo);
        }
+       
+       newbone->flag |= (BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
+       ED_armature_sync_selection(arm->edbo);
 }