diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-10-22 13:53:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-10-22 13:54:27 +0400 |
commit | 86dbc9dd9a0f6426de5431ddab22a9a9da945e63 (patch) | |
tree | 7e8415d99eba3d42550b1daab4742f6e26b45862 /source/blender/editors/transform/transform_conversions.c | |
parent | 769c0bee9fafec1ffce05af4e0d1f443dfb95ed7 (diff) |
Cleanup: avoid loop-in-loop when mirror isn't used
Also name 'children' is normally used for a list
Diffstat (limited to 'source/blender/editors/transform/transform_conversions.c')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 6d6a1eace73..16c4a87b763 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1058,7 +1058,7 @@ void restoreBones(TransInfo *t) { bArmature *arm = t->obedit->data; BoneInitData *bid = t->customData; - EditBone *ebo, *children; + EditBone *ebo; while (bid->bone) { ebo = bid->bone; @@ -1071,19 +1071,23 @@ void restoreBones(TransInfo *t) copy_v3_v3(ebo->head, bid->head); copy_v3_v3(ebo->tail, bid->tail); - /* Also move connected children, in case children's name aren't mirrored properly */ - for (children = arm->edbo->first; children; children = children->next) { - if (children->parent == ebo && children->flag & BONE_CONNECTED) { - copy_v3_v3(children->head, ebo->tail); - children->rad_head = ebo->rad_tail; + if (arm->flag & ARM_MIRROR_EDIT) { + EditBone *ebo_child; + + /* Also move connected ebo_child, in case ebo_child's name aren't mirrored properly */ + for (ebo_child = arm->edbo->first; ebo_child; ebo_child = ebo_child->next) { + if ((ebo_child->flag & BONE_CONNECTED) && (ebo_child->parent == ebo)) { + copy_v3_v3(ebo_child->head, ebo->tail); + ebo_child->rad_head = ebo->rad_tail; + } + } + + /* Also move connected parent, in case parent's name isn't mirrored properly */ + if ((ebo->flag & BONE_CONNECTED) && ebo->parent) { + EditBone *parent = ebo->parent; + copy_v3_v3(parent->tail, ebo->head); + parent->rad_tail = ebo->rad_head; } - } - - /* Also move connected parent, in case parent's name isn't mirrored properly */ - if (ebo->parent && ebo->flag & BONE_CONNECTED) { - EditBone *parent = ebo->parent; - copy_v3_v3(parent->tail, ebo->head); - parent->rad_tail = ebo->rad_head; } bid++; |