diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_undo_system.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/undo_system.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 53ea8ddefe8..05093deec70 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -137,6 +137,7 @@ void BKE_undosys_stack_destroy(UndoStack *ustack); void BKE_undosys_stack_clear(UndoStack *ustack); bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name); void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain); +void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C); UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut); UndoStep *BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut); void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size_t memory_limit); diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 5a0081bff16..7eaf42591f0 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -251,6 +251,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) { |