diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-11 10:02:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-11 10:02:32 +0300 |
commit | debe3011f62e5935dc54d7033052d7d4e24ad449 (patch) | |
tree | 4858e23ac7e2a49441e76e4ce6eddc2f74e766b7 /source/blender/editors/armature/pose_edit.c | |
parent | 1b78f05b1ca466695b39d4fd60570790c1ab9e13 (diff) | |
parent | 32339a56f11ac1392c4b8d8651ff452a2a5511cc (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 15ffd09ebd4..5b1975a92a0 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -82,34 +82,42 @@ 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(struct Main *bmain, 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; /* Inform all CoW versions that we changed the mode. */ - DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE); - WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); - + DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_COPY_ON_WRITE); + 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; + } + struct Main *bmain = CTX_data_main(C); + bool ok = ED_object_posemode_enter_ex(bmain, 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; |