Commit: 8c49e6f99e412c5752f70f506b5554c283ad9dbc
Author: Joshua Leung
Date:   Thu May 3 16:34:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8c49e6f99e412c5752f70f506b5554c283ad9dbc

Multi-Object Pose: Fix POSE_OT_flip_names

===================================================================

M       source/blender/editors/armature/pose_edit.c

===================================================================

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index c1e9346efdd..4d29bef63ee 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -618,34 +618,31 @@ static void pose_copy_menu(Scene *scene)
 
 static int pose_flip_names_exec(bContext *C, wmOperator *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;
-
+       ViewLayer *view_layer = CTX_data_view_layer(C);
        const bool do_strip_numbers = RNA_boolean_get(op->ptr, 
"do_strip_numbers");
-
-       arm = ob->data;
-
-       ListBase bones_names = {NULL};
-
-       CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
+       
+       FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, OB_MODE_POSE, ob)
        {
-               BLI_addtail(&bones_names, BLI_genericNodeN(pchan->name));
-       }
-       CTX_DATA_END;
+               bArmature *arm = ob->data;
+               ListBase bones_names = {NULL};
 
-       ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers);
+               FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob, pchan)
+               {
+                       BLI_addtail(&bones_names, 
BLI_genericNodeN(pchan->name));
+               }
+               FOREACH_PCHAN_SELECTED_IN_OBJECT_END;
 
-       BLI_freelistN(&bones_names);
-       
-       /* since we renamed stuff... */
-       DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+               ED_armature_bones_flip_names(arm, &bones_names, 
do_strip_numbers);
 
-       /* note, notifier might evolve */
-       WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
+               BLI_freelistN(&bones_names);
+               
+               /* since we renamed stuff... */
+               DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+
+               /* note, notifier might evolve */
+               WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
+       }
+       FOREACH_OBJECT_IN_MODE_END;
        
        return OPERATOR_FINISHED;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to