Fix #20863: when loading a file without UI, with multiple windows open,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 Jul 2010 16:50:25 +0000 (16:50 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 Jul 2010 16:50:25 +0000 (16:50 +0000)
the other windows would not preserve the screens correctly, code for
reading 2.4x files was running when it didn't need to.

source/blender/windowmanager/intern/wm_files.c

index 6457e18..04f5175 100644 (file)
@@ -179,21 +179,23 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
                
                /* we've read file without wm..., keep current one entirely alive */
                if(G.main->wm.first==NULL) {
-                       bScreen *screen= CTX_wm_screen(C);
-                       
-                       /* match oldwm to new dbase, only old files */
-                       
-                       for(wm= oldwmlist->first; wm; wm= wm->id.next) {
-                               
-                               for(win= wm->windows.first; win; win= win->next) {
-                                       /* all windows get active screen from file */
-                                       if(screen->winid==0)
-                                               win->screen= screen;
-                                       else 
-                                               win->screen= ED_screen_duplicate(win, screen);
+                       /* when loading without UI, no matching needed */
+                       if(!(G.fileflags & G_FILE_NO_UI)) {
+                               bScreen *screen= CTX_wm_screen(C);
+
+                               /* match oldwm to new dbase, only old files */
+                               for(wm= oldwmlist->first; wm; wm= wm->id.next) {
                                        
-                                       BLI_strncpy(win->screenname, win->screen->id.name+2, 21);
-                                       win->screen->winid= win->winid;
+                                       for(win= wm->windows.first; win; win= win->next) {
+                                               /* all windows get active screen from file */
+                                               if(screen->winid==0)
+                                                       win->screen= screen;
+                                               else 
+                                                       win->screen= ED_screen_duplicate(win, screen);
+                                               
+                                               BLI_strncpy(win->screenname, win->screen->id.name+2, 21);
+                                               win->screen->winid= win->winid;
+                                       }
                                }
                        }