Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_files.c
| Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | static void wm_window_match_keep_current_wm(const bContext *C, | ||||
| wmWindowManager *wm = current_wm_list->first; | wmWindowManager *wm = current_wm_list->first; | ||||
| bScreen *screen = NULL; | bScreen *screen = NULL; | ||||
| /* match oldwm to new dbase, only old files */ | /* match oldwm to new dbase, only old files */ | ||||
| wm->initialized &= ~WM_WINDOW_IS_INITIALIZED; | wm->initialized &= ~WM_WINDOW_IS_INITIALIZED; | ||||
| /* when loading without UI, no matching needed */ | /* when loading without UI, no matching needed */ | ||||
| if (load_ui && (screen = CTX_wm_screen(C))) { | if (load_ui && (screen = CTX_wm_screen(C))) { | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| WorkSpace *workspace; | WorkSpace *workspace; | ||||
| BKE_workspace_layout_find_global(bmain, screen, &workspace); | BKE_workspace_layout_find_global(bmain, screen, &workspace); | ||||
| BKE_workspace_active_set(win->workspace_hook, workspace); | BKE_workspace_active_set(win->workspace_hook, workspace); | ||||
| win->scene = CTX_data_scene(C); | win->scene = CTX_data_scene(C); | ||||
| /* all windows get active screen from file */ | /* all windows get active screen from file */ | ||||
| if (screen->winid == 0) { | if (screen->winid == 0) { | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static void wm_window_match_replace_by_file_wm(bContext *C, | ||||
| wm->initialized = 0; | wm->initialized = 0; | ||||
| wm->winactive = NULL; | wm->winactive = NULL; | ||||
| /* Clearing drawable of before deleting any context | /* Clearing drawable of before deleting any context | ||||
| * to avoid clearing the wrong wm. */ | * to avoid clearing the wrong wm. */ | ||||
| wm_window_clear_drawable(oldwm); | wm_window_clear_drawable(oldwm); | ||||
| /* only first wm in list has ghostwins */ | /* only first wm in list has ghostwins */ | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| for (wmWindow *oldwin = oldwm->windows.first; oldwin; oldwin = oldwin->next) { | LISTBASE_FOREACH (wmWindow *, oldwin, &oldwm->windows) { | ||||
| if (oldwin->winid == win->winid) { | if (oldwin->winid == win->winid) { | ||||
| has_match = true; | has_match = true; | ||||
| wm_window_substitute_old(oldwm, wm, oldwin, win); | wm_window_substitute_old(oldwm, wm, oldwin, win); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* make sure at least one window is kept open so we don't lose the context, check T42303 */ | /* make sure at least one window is kept open so we don't lose the context, check T42303 */ | ||||
| ▲ Show 20 Lines • Show All 1,195 Lines • ▼ Show 20 Lines | |||||
| void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt)) | void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt)) | ||||
| { | { | ||||
| char filepath[FILE_MAX]; | char filepath[FILE_MAX]; | ||||
| WM_event_remove_timer(wm, NULL, wm->autosavetimer); | WM_event_remove_timer(wm, NULL, wm->autosavetimer); | ||||
| /* if a modal operator is running, don't autosave, but try again in 10 seconds */ | /* if a modal operator is running, don't autosave, but try again in 10 seconds */ | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { | LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { | ||||
| if (handler_base->type == WM_HANDLER_TYPE_OP) { | if (handler_base->type == WM_HANDLER_TYPE_OP) { | ||||
| wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; | wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; | ||||
| if (handler->op) { | if (handler->op) { | ||||
| wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0); | wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0); | ||||
| if (G.debug) { | if (G.debug) { | ||||
| printf("Skipping auto-save, modal operator running, retrying in ten seconds...\n"); | printf("Skipping auto-save, modal operator running, retrying in ten seconds...\n"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,718 Lines • Show Last 20 Lines | |||||