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.
This commit is contained in:
Dalai Felinto 2018-10-05 19:41:48 -03:00
parent d5e72c0e96
commit bb0b4b008e
1 changed files with 14 additions and 0 deletions

View File

@ -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);