Fix memfile undo decoding creating undo steps
authorCampbell Barton <ideasman42@gmail.com>
Wed, 9 Jan 2019 05:53:44 +0000 (16:53 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 9 Jan 2019 21:02:51 +0000 (08:02 +1100)
Exiting modes shouldn't be needed since loading the new memfile
will free the old data.

Sculpt mode dynamic topology was adding undo data on exiting the mode
which isn't logical in this case and can be avoided altogether.

source/blender/editors/undo/memfile_undo.c

index bb81da74f88720b2803098313eeaff03a5291d92..e61835fd7612ac85e9cd16d1144a19e826d27f04 100644 (file)
@@ -76,14 +76,12 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
        MemFileUndoStep *us_prev = (MemFileUndoStep *)BKE_undosys_step_find_by_type(ustack, BKE_UNDOSYS_TYPE_MEMFILE);
        us->data = BKE_memfile_undo_encode(bmain, us_prev ? us_prev->data : NULL);
        us->step.data_size = us->data->undo_size;
+
        return true;
 }
 
 static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
 {
-       /* Loading the content will correctly switch into compatible non-object modes. */
-       ED_object_mode_set(C, OB_MODE_OBJECT);
-
        /* This is needed so undoing/redoing doesn't crash with threaded previews going */
        ED_viewport_render_kill_jobs(CTX_wm_manager(C), CTX_data_main(C), true);
        MemFileUndoStep *us = (MemFileUndoStep *)us_p;