Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/blendfile.c
| Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | if (mode != LOAD_UI) { | ||||
| * This means users can have 2+ windows open and undo in both without screens switching. | * This means users can have 2+ windows open and undo in both without screens switching. | ||||
| * But if they close one of the screens, | * But if they close one of the screens, | ||||
| * undo will ensure that the scene being operated on will be activated | * undo will ensure that the scene being operated on will be activated | ||||
| * (otherwise we'd be undoing on an off-screen scene which isn't acceptable). | * (otherwise we'd be undoing on an off-screen scene which isn't acceptable). | ||||
| * see: T43424 | * see: T43424 | ||||
| */ | */ | ||||
| wmWindow *win; | wmWindow *win; | ||||
| bScreen *curscreen = NULL; | bScreen *curscreen = NULL; | ||||
| SceneLayer *cur_render_layer; | ViewLayer *cur_render_layer; | ||||
| bool track_undo_scene; | bool track_undo_scene; | ||||
| /* comes from readfile.c */ | /* comes from readfile.c */ | ||||
| SWAP(ListBase, G.main->wm, bfd->main->wm); | SWAP(ListBase, G.main->wm, bfd->main->wm); | ||||
| SWAP(ListBase, G.main->workspaces, bfd->main->workspaces); | SWAP(ListBase, G.main->workspaces, bfd->main->workspaces); | ||||
| SWAP(ListBase, G.main->screen, bfd->main->screen); | SWAP(ListBase, G.main->screen, bfd->main->screen); | ||||
| /* we re-use current window and screen */ | /* we re-use current window and screen */ | ||||
| Show All 9 Lines | if (curscene == NULL) { | ||||
| curscene = bfd->main->scene.first; | curscene = bfd->main->scene.first; | ||||
| } | } | ||||
| /* empty file, we add a scene to make Blender work */ | /* empty file, we add a scene to make Blender work */ | ||||
| if (curscene == NULL) { | if (curscene == NULL) { | ||||
| curscene = BKE_scene_add(bfd->main, "Empty"); | curscene = BKE_scene_add(bfd->main, "Empty"); | ||||
| } | } | ||||
| if (cur_render_layer == NULL) { | if (cur_render_layer == NULL) { | ||||
| /* fallback to scene layer */ | /* fallback to scene layer */ | ||||
| cur_render_layer = BKE_scene_layer_from_scene_get(curscene); | cur_render_layer = BKE_view_layer_from_scene_get(curscene); | ||||
| } | } | ||||
| if (track_undo_scene) { | if (track_undo_scene) { | ||||
| /* keep the old (free'd) scene, let 'blo_lib_link_screen_restore' | /* keep the old (free'd) scene, let 'blo_lib_link_screen_restore' | ||||
| * replace it with 'curscene' if its needed */ | * replace it with 'curscene' if its needed */ | ||||
| } | } | ||||
| /* and we enforce curscene to be in current screen */ | /* and we enforce curscene to be in current screen */ | ||||
| else if (win) { /* can run in bgmode */ | else if (win) { /* can run in bgmode */ | ||||
| ▲ Show 20 Lines • Show All 488 Lines • Show Last 20 Lines | |||||