Code cleanup: use scene variable rather then calling CTX_data_scene

This commit is contained in:
Campbell Barton 2014-07-01 18:51:54 +10:00
parent 2575be541b
commit fe9110edc4
1 changed files with 6 additions and 2 deletions

View File

@ -286,6 +286,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
CTX_wm_area_set(C, NULL);
CTX_wm_region_set(C, NULL);
CTX_wm_menu_set(C, NULL);
curscene = bfd->curscene;
}
/* this can happen when active scene was lib-linked, and doesn't exist anymore */
@ -299,6 +300,9 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
curscene = CTX_data_scene(C);
}
BLI_assert(curscene == CTX_data_scene(C));
/* special cases, override loaded flags: */
if (G.f != bfd->globalf) {
const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
@ -349,12 +353,12 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
for (win = wm->windows.first; win; win = win->next) {
if (win->screen && win->screen->scene) /* zealous check... */
if (win->screen->scene != CTX_data_scene(C))
if (win->screen->scene != curscene)
BKE_scene_set_background(G.main, win->screen->scene);
}
}
}
BKE_scene_set_background(G.main, CTX_data_scene(C));
BKE_scene_set_background(G.main, curscene);
if (mode != LOAD_UNDO) {
IMB_colormanagement_check_file_config(G.main);