Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Tue, 15 May 2018 17:53:34 +0000 (19:53 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 15 May 2018 17:53:34 +0000 (19:53 +0200)
1  2 
source/blender/blenkernel/intern/undo_system.c
source/blender/windowmanager/intern/wm_files.c

@@@ -524,17 -516,7 +524,7 @@@ static void wm_file_read_post(bContext 
        if (addons_loaded) {
                wm_file_read_report(C);
        }
 -      
 +
-       if (!G.background) {
-               /* in background mode this makes it hard to load
-                * a blend file and do anything since the screen
-                * won't be set to a valid value again */
-               CTX_wm_window_set(C, NULL); /* exits queues */
-               /* Ensure tools are registered. */
-               WM_toolsystem_init(C);
-       }
        if (!G.background) {
                if (wm->undo_stack == NULL) {
                        wm->undo_stack = BKE_undosys_stack_create();
                        BKE_undosys_stack_clear(wm->undo_stack);
                }
                BKE_undosys_stack_init_from_main(wm->undo_stack, CTX_data_main(C));
+               BKE_undosys_stack_init_from_context(wm->undo_stack, C);
+       }
+       if (!G.background) {
+               /* in background mode this makes it hard to load
+                * a blend file and do anything since the screen
+                * won't be set to a valid value again */
+               CTX_wm_window_set(C, NULL); /* exits queues */
++
++              /* Ensure tools are registered. */
++              WM_toolsystem_init(C);
        }
  }