Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-01-16 16:03:31 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-01-16 22:36:22 +0300
commit702bc5ba26d5ff2a4da9e92cabb2fa34ed3f2312 (patch)
tree80d347528a1174128f2b4ce98fa1045fd2051b05 /source/blender/editors/armature/pose_edit.c
parent92fbcbb4bf0ec613907ebf20c3874ce684243e86 (diff)
Fix T50393: Flip names working just on one side when both are selected.
Just store bones that could not get renamed to desired flipped name on the first try into a temp list, and try to rename them a second time. This is rather simple solution, will induce 'over numbering' in case you flip a bone to another unselected bone's name (since number will be incremented in both rename attempts), but think this is acceptable minor glitch, for a corner case situation that does not have any good resolution anyway. Also, set `strip_numbers` option of `BKE_deform_flip_side_name` to false, otherwise chains of bones with same names would get their numbers completely messed up after name flipping. Based on work by @dfelinto in D2456 (https://developer.blender.org/D2456), thanks.
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r--source/blender/editors/armature/pose_edit.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 322476dcca0..86b7271bfff 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -593,20 +593,24 @@ static int pose_flip_names_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
-
+
/* paranoia checks */
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
+
arm = ob->data;
-
- /* loop through selected bones, auto-naming them */
+
+ ListBase bones_names = {NULL};
+
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
- char name_flip[MAXBONENAME];
- BKE_deform_flip_side_name(name_flip, pchan->name, true);
- ED_armature_bone_rename(arm, pchan->name, name_flip);
+ BLI_addtail(&bones_names, BLI_genericNodeN(pchan->name));
}
CTX_DATA_END;
+
+ ED_armature_bones_flip_names(arm, &bones_names);
+
+ BLI_freelistN(&bones_names);
/* since we renamed stuff... */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);