diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-05-03 17:34:25 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-05-03 19:04:29 +0300 |
commit | 8c49e6f99e412c5752f70f506b5554c283ad9dbc (patch) | |
tree | 4e062ed4e2a45c1b7a2f273745b3e5db4475a220 | |
parent | 656d6f47b921c0f5c9e12ea0eeae48d860b7b66f (diff) |
Multi-Object Pose: Fix POSE_OT_flip_names
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 43 |
1 files changed, 20 insertions, 23 deletions
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; } |