From 51bba03b319319d59f739673c3fafb71bc308e0d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 31 Jan 2019 11:34:57 +1100 Subject: Undo System: add Main argument to encode/decode Needed since we don't always have the context, and avoids adding G_MAIN into undo callbacks. --- source/blender/editors/undo/memfile_undo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/undo') diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index 1b0fe9a0c3d..dc1870c2d19 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -71,12 +71,11 @@ static bool memfile_undosys_poll(bContext *C) return true; } -static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p) +static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p) { MemFileUndoStep *us = (MemFileUndoStep *)us_p; /* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */ - struct Main *bmain = CTX_data_main(C); UndoStack *ustack = ED_undo_stack_get(); /* can be NULL, use when set. */ @@ -87,9 +86,8 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p) return true; } -static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir)) +static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir)) { - struct Main *bmain = CTX_data_main(C); ED_editors_exit(bmain, false); MemFileUndoStep *us = (MemFileUndoStep *)us_p; -- cgit v1.2.3