diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-06 01:41:48 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-06 01:50:20 +0300 |
commit | bb0b4b008edb59dc5ff0902b0f132cbd72cadf56 (patch) | |
tree | ea6b10ee267e5103d4437276055d6aa6c6c0a337 /source/blender/editors/armature/armature_naming.c | |
parent | d5e72c0e96b1e46a95bfcd2c3fc84a376fc9db7d (diff) |
Pseudo-fix for ARMATURE_OT_autoside_names and x-mirror
It now works like 2.7x. That said this operator is kind of incompatible with
x-mirror (the way it is implemented anyways). But if people were happy with
this in 2.7x they will be multi-object happier.
That said, do turn off x-mirror before using this or select all bones, or just
stop using this operator altogether ;)
Jokes aside, the operator can also be fixed. It shouldn't be hard.
Diffstat (limited to 'source/blender/editors/armature/armature_naming.c')
-rw-r--r-- | source/blender/editors/armature/armature_naming.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 0135df646f9..687dad4745e 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -503,6 +503,20 @@ static int armature_autoside_names_exec(bContext *C, wmOperator *op) for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (EBONE_EDITABLE(ebone)) { + + /* We first need to do the flipped bone, then the original one. + * Otherwise we can't find the flipped one because of the bone name change. */ + if (arm->flag & ARM_MIRROR_EDIT) { + EditBone *flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone); + if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) { + BLI_strncpy(newname, flipbone->name, sizeof(newname)); + if (bone_autoside_name(newname, 1, axis, flipbone->head[axis], flipbone->tail[axis])) { + ED_armature_bone_rename(bmain, arm, flipbone->name, newname); + changed = true; + } + } + } + BLI_strncpy(newname, ebone->name, sizeof(newname)); if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis])) { ED_armature_bone_rename(bmain, arm, ebone->name, newname); |