Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / undo_system.c
index 62710240109773136719cb1616b8a365e20fb8ea..f5e4c354a02b58820cd1e5908cc9e1235763a848 100644 (file)
@@ -252,6 +252,15 @@ void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain)
        undosys_stack_push_main(ustack, "original", bmain);
 }
 
+/* called after 'BKE_undosys_stack_init_from_main' */
+void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
+{
+       const UndoType *ut = BKE_undosys_type_from_context(C);
+       if ((ut != NULL) && (ut != BKE_UNDOSYS_TYPE_MEMFILE) && (ut->mode == BKE_UNDOTYPE_MODE_STORE)) {
+               BKE_undosys_step_push_with_type(ustack, C, "original mode", ut);
+       }
+}
+
 /* name optional */
 bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name)
 {