diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-11 09:53:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-11 09:53:59 +0300 |
commit | 32339a56f11ac1392c4b8d8651ff452a2a5511cc (patch) | |
tree | 15bf50d82f588225375e1c86b08e146758ad17ca /source/blender/editors/armature | |
parent | f55adabb3e5d3a75ecdb30f90487e314f0afb753 (diff) |
Cleanup: minor changes to pose-mode switching API
Prepare for multi-object pose mode
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 2f536ebff6e..f1ae006f958 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -81,33 +81,40 @@ Object *ED_pose_object_from_context(bContext *C) } /* This function is used to process the necessary updates for */ -void ED_armature_enter_posemode(bContext *C, Base *base) +bool ED_object_posemode_enter_ex(Base *base) { - ReportList *reports = CTX_wm_reports(C); Object *ob = base->object; - - if (ID_IS_LINKED(ob)) { - BKE_report(reports, RPT_WARNING, "Cannot pose libdata"); - return; - } + BLI_assert(!ID_IS_LINKED(ob)); + bool ok = false; switch (ob->type) { case OB_ARMATURE: ob->restore_mode = ob->mode; ob->mode |= OB_MODE_POSE; - - WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); - + ok = true; + break; default: - return; + break; } - - /* XXX: disabled as this would otherwise cause a nasty loop... */ - //ED_object_mode_toggle(C, ob->mode); + + return ok; +} +bool ED_object_posemode_enter(bContext *C, Base *base) +{ + ReportList *reports = CTX_wm_reports(C); + if (ID_IS_LINKED(base->object)) { + BKE_report(reports, RPT_WARNING, "Cannot pose libdata"); + return false; + } + bool ok = ED_object_posemode_enter_ex(base); + if (ok) { + WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); + } + return ok; } -void ED_armature_exit_posemode(bContext *C, Base *base) +void ED_object_posemode_exit(bContext *C, Base *base) { if (base) { Object *ob = base->object; |