diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-03 12:18:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-03 12:19:44 +0300 |
commit | 981f544f5ff954beb9b9ddd53d9ff62a4a5fcc20 (patch) | |
tree | db9568658e5b7d4b24fbe82b51733acef286ed99 /source/blender | |
parent | 5c63415afe1a9bca8839fff87ce668caa65166ca (diff) |
Expose flush edits as an operator (for Py access)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/ED_util.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 20 |
3 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 496ce7f2c60..cb331554a8f 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -44,6 +44,8 @@ bool ED_editors_flush_edits(const struct bContext *C, bool for_render); void ED_spacedata_id_unref(struct SpaceLink *sl, const struct ID *id); +void ED_OT_flush_edits(struct wmOperatorType *ot); + /* ************** Undo ************************ */ /* undo.c */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7b683279502..7c1ff0db2a9 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4231,6 +4231,8 @@ void ED_operatortypes_screen(void) WM_operatortype_append(ED_OT_undo_push); WM_operatortype_append(ED_OT_redo); WM_operatortype_append(ED_OT_undo_history); + + WM_operatortype_append(ED_OT_flush_edits); } diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index f727f48e993..0463980dacd 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -344,3 +344,23 @@ void ED_spacedata_id_unref(struct SpaceLink *sl, const ID *id) break; } } + +static int ed_flush_edits_exec(bContext *C, wmOperator *UNUSED(op)) +{ + ED_editors_flush_edits(C, false); + return OPERATOR_FINISHED; +} + +void ED_OT_flush_edits(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Flush Edits"; + ot->description = "Flush edit data from active editing modes"; + ot->idname = "ED_OT_flush_edits"; + + /* api callbacks */ + ot->exec = ed_flush_edits_exec; + + /* flags */ + ot->flag = OPTYPE_INTERNAL; +} |