Expose flush edits as an operator (for Py access)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 3 Dec 2015 09:18:32 +0000 (20:18 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 3 Dec 2015 09:19:44 +0000 (20:19 +1100)
source/blender/editors/include/ED_util.h
source/blender/editors/screen/screen_ops.c
source/blender/editors/util/ed_util.c

index 496ce7f2c608e04c2094fd68e89b3bb72bd0c26a..cb331554a8fd58db3487710ba79a33c4752e0026 100644 (file)
@@ -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 */
index 7b683279502484b20246feb89edc5e8edbbab59a..7c1ff0db2a975a3df9f829430b23e3aafdbebed9 100644 (file)
@@ -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);
        
 }
 
index f727f48e99304f3039307bd392ee2643da0f1fb7..0463980dacd2fc91c09a04e3c7a2fbf89c746eec 100644 (file)
@@ -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;
+}