bugfix [#24341] Problems running blender headless

bg mode didnt have the screen context callback set. Though this sounds logical, bg mode defines a screen it should be set.
This commit is contained in:
Campbell Barton 2010-10-27 16:05:31 +00:00
parent 7a56940207
commit fd3532f1a9
2 changed files with 23 additions and 19 deletions

@ -1029,23 +1029,26 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
ScrArea *sa;
rcti winrct= {0, win->sizex-1, 0, win->sizey-1};
screen_test_scale(win->screen, win->sizex, win->sizey);
/* exception for bg mode, we only need the screen context */
if (!G.background) {
screen_test_scale(win->screen, win->sizex, win->sizey);
if(win->screen->mainwin==0)
win->screen->mainwin= wm_subwindow_open(win, &winrct);
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
ED_area_initialize(wm, win, sa);
}
if(win->screen->mainwin==0)
win->screen->mainwin= wm_subwindow_open(win, &winrct);
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
ED_area_initialize(wm, win, sa);
/* wake up animtimer */
if(win->screen->animtimer)
WM_event_timer_sleep(wm, win, win->screen->animtimer, 0);
}
/* wake up animtimer */
if(win->screen->animtimer)
WM_event_timer_sleep(wm, win, win->screen->animtimer, 0);
if(G.f & G_DEBUG) printf("set screen\n");
win->screen->do_refresh= 0;

@ -232,12 +232,13 @@ void WM_check(bContext *C)
/* case: no open windows at all, for old file reads */
wm_window_add_ghostwindows(C, wm);
}
/* case: fileread */
if((wm->initialized & WM_INIT_WINDOW) == 0) {
ED_screens_initialize(wm);
wm->initialized |= WM_INIT_WINDOW;
}
/* case: fileread */
/* note: this runs in bg mode to set the screen context cb */
if((wm->initialized & WM_INIT_WINDOW) == 0) {
ED_screens_initialize(wm);
wm->initialized |= WM_INIT_WINDOW;
}
}