Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_edit.c
| Show First 20 Lines • Show All 409 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void region_cursor_set(wmWindow *win, bool swin_changed) | static void region_cursor_set(wmWindow *win, bool swin_changed) | ||||
| { | { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| ED_screen_areas_iter(win, screen, area) | ED_screen_areas_iter(win, screen, area) | ||||
| { | { | ||||
| for (ARegion *region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region == screen->active_region) { | if (region == screen->active_region) { | ||||
| region_cursor_set_ex(win, area, region, swin_changed); | region_cursor_set_ex(win, area, region, swin_changed); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | if (screen->animtimer) { | ||||
| Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id); | Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id); | ||||
| BKE_sound_stop_scene(scene_eval); | BKE_sound_stop_scene(scene_eval); | ||||
| } | } | ||||
| screen->animtimer = NULL; | screen->animtimer = NULL; | ||||
| screen->scrubbing = false; | screen->scrubbing = false; | ||||
| screen->active_region = NULL; | screen->active_region = NULL; | ||||
| for (ARegion *region = screen->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { | ||||
| ED_region_exit(C, region); | ED_region_exit(C, region); | ||||
| } | } | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| ED_area_exit(C, area); | ED_area_exit(C, area); | ||||
| } | } | ||||
| /* Don't use ED_screen_areas_iter here, it skips hidden areas. */ | /* Don't use ED_screen_areas_iter here, it skips hidden areas. */ | ||||
| for (ScrArea *area = window->global_areas.areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &window->global_areas.areabase) { | ||||
| ED_area_exit(C, area); | ED_area_exit(C, area); | ||||
| } | } | ||||
| /* mark it available for use for other windows */ | /* mark it available for use for other windows */ | ||||
| screen->winid = 0; | screen->winid = 0; | ||||
| if (!WM_window_is_temp_screen(prevwin)) { | if (!WM_window_is_temp_screen(prevwin)) { | ||||
| /* use previous window if possible */ | /* use previous window if possible */ | ||||
| ▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | |||||
| void ED_screen_global_areas_sync(wmWindow *win) | void ED_screen_global_areas_sync(wmWindow *win) | ||||
| { | { | ||||
| /* Update screen flags from height in window, this is weak and perhaps | /* Update screen flags from height in window, this is weak and perhaps | ||||
| * global areas should just become part of the screen instead. */ | * global areas should just become part of the screen instead. */ | ||||
| bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); | bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); | ||||
| screen->flag &= ~SCREEN_COLLAPSE_STATUSBAR; | screen->flag &= ~SCREEN_COLLAPSE_STATUSBAR; | ||||
| for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { | ||||
| if (area->global->cur_fixed_height == area->global->size_min) { | if (area->global->cur_fixed_height == area->global->size_min) { | ||||
| if (area->spacetype == SPACE_STATUSBAR) { | if (area->spacetype == SPACE_STATUSBAR) { | ||||
| screen->flag |= SCREEN_COLLAPSE_STATUSBAR; | screen->flag |= SCREEN_COLLAPSE_STATUSBAR; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | bScreen *screen_change_prepare( | ||||
| if (!(screen_new->winid == 0 || screen_new->winid == win->winid)) { | if (!(screen_new->winid == 0 || screen_new->winid == win->winid)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (screen_old != screen_new) { | if (screen_old != screen_new) { | ||||
| wmTimer *wt = screen_old->animtimer; | wmTimer *wt = screen_old->animtimer; | ||||
| /* remove handlers referencing areas in old screen */ | /* remove handlers referencing areas in old screen */ | ||||
| for (ScrArea *area = screen_old->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen_old->areabase) { | ||||
| WM_event_remove_area_handler(&win->modalhandlers, area); | WM_event_remove_area_handler(&win->modalhandlers, area); | ||||
| } | } | ||||
| /* we put timer to sleep, so screen_exit has to think there's no timer */ | /* we put timer to sleep, so screen_exit has to think there's no timer */ | ||||
| screen_old->animtimer = NULL; | screen_old->animtimer = NULL; | ||||
| if (wt) { | if (wt) { | ||||
| WM_event_timer_sleep(CTX_wm_manager(C), win, wt, true); | WM_event_timer_sleep(CTX_wm_manager(C), win, wt, true); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | if (view_layer_old) { | ||||
| eObjectMode object_mode_old = workspace->object_mode; | eObjectMode object_mode_old = workspace->object_mode; | ||||
| Object *obact_old = OBACT(view_layer_old); | Object *obact_old = OBACT(view_layer_old); | ||||
| UNUSED_VARS(obact_old, object_mode_old); | UNUSED_VARS(obact_old, object_mode_old); | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* Update 3D view cameras. */ | /* Update 3D view cameras. */ | ||||
| const bScreen *screen = WM_window_get_active_screen(win); | const bScreen *screen = WM_window_get_active_screen(win); | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { | LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { | ||||
| if (sl->spacetype == SPACE_VIEW3D) { | if (sl->spacetype == SPACE_VIEW3D) { | ||||
| View3D *v3d = (View3D *)sl; | View3D *v3d = (View3D *)sl; | ||||
| screen_set_3dview_camera(scene, view_layer, area, v3d); | screen_set_3dview_camera(scene, view_layer, area, v3d); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if (area && area->full) { | ||||
| BLI_assert(BKE_workspace_layout_screen_get(layout_old) != sc); | BLI_assert(BKE_workspace_layout_screen_get(layout_old) != sc); | ||||
| BLI_assert(BKE_workspace_layout_screen_get(layout_old)->state != SCREENNORMAL); | BLI_assert(BKE_workspace_layout_screen_get(layout_old)->state != SCREENNORMAL); | ||||
| sc->state = SCREENNORMAL; | sc->state = SCREENNORMAL; | ||||
| sc->flag = oldscreen->flag; | sc->flag = oldscreen->flag; | ||||
| /* find old area to restore from */ | /* find old area to restore from */ | ||||
| ScrArea *fullsa = NULL; | ScrArea *fullsa = NULL; | ||||
| for (ScrArea *old = sc->areabase.first; old; old = old->next) { | LISTBASE_FOREACH (ScrArea *, old, &sc->areabase) { | ||||
| /* area to restore from is always first */ | /* area to restore from is always first */ | ||||
| if (old->full && !fullsa) { | if (old->full && !fullsa) { | ||||
| fullsa = old; | fullsa = old; | ||||
| } | } | ||||
| /* clear full screen state */ | /* clear full screen state */ | ||||
| old->full = NULL; | old->full = NULL; | ||||
| } | } | ||||
| area->full = NULL; | area->full = NULL; | ||||
| if (fullsa == NULL) { | if (fullsa == NULL) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("%s: something wrong in areafullscreen\n", __func__); | printf("%s: something wrong in areafullscreen\n", __func__); | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (state == SCREENFULL) { | if (state == SCREENFULL) { | ||||
| /* unhide global areas */ | /* unhide global areas */ | ||||
| for (ScrArea *glob_area = win->global_areas.areabase.first; glob_area; | LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | ||||
| glob_area = glob_area->next) { | |||||
| glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN; | glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN; | ||||
| } | } | ||||
| /* restore the old side panels/header visibility */ | /* restore the old side panels/header visibility */ | ||||
| for (region = area->regionbase.first; region; region = region->next) { | for (region = area->regionbase.first; region; region = region->next) { | ||||
| region->flag = region->flagfullscreen; | region->flag = region->flagfullscreen; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | else { | ||||
| newa = (ScrArea *)sc->areabase.first; | newa = (ScrArea *)sc->areabase.first; | ||||
| /* copy area */ | /* copy area */ | ||||
| ED_area_data_swap(newa, area); | ED_area_data_swap(newa, area); | ||||
| newa->flag = area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ | newa->flag = area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ | ||||
| if (state == SCREENFULL) { | if (state == SCREENFULL) { | ||||
| /* temporarily hide global areas */ | /* temporarily hide global areas */ | ||||
| for (ScrArea *glob_area = win->global_areas.areabase.first; glob_area; | LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | ||||
| glob_area = glob_area->next) { | |||||
| glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN; | glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN; | ||||
| } | } | ||||
| /* temporarily hide the side panels/header */ | /* temporarily hide the side panels/header */ | ||||
| for (region = newa->regionbase.first; region; region = region->next) { | for (region = newa->regionbase.first; region; region = region->next) { | ||||
| region->flagfullscreen = region->flag; | region->flagfullscreen = region->flag; | ||||
| if (ELEM(region->regiontype, | if (ELEM(region->regiontype, | ||||
| RGN_TYPE_UI, | RGN_TYPE_UI, | ||||
| ▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | |||||
| * Find the scene displayed in \a screen. | * Find the scene displayed in \a screen. | ||||
| * \note Assumes \a screen to be visible/active! | * \note Assumes \a screen to be visible/active! | ||||
| */ | */ | ||||
| Scene *ED_screen_scene_find_with_window(const bScreen *screen, | Scene *ED_screen_scene_find_with_window(const bScreen *screen, | ||||
| const wmWindowManager *wm, | const wmWindowManager *wm, | ||||
| struct wmWindow **r_window) | struct wmWindow **r_window) | ||||
| { | { | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| if (WM_window_get_active_screen(win) == screen) { | if (WM_window_get_active_screen(win) == screen) { | ||||
| if (r_window) { | if (r_window) { | ||||
| *r_window = win; | *r_window = win; | ||||
| } | } | ||||
| return WM_window_get_active_scene(win); | return WM_window_get_active_scene(win); | ||||
| } | } | ||||
| } | } | ||||
| /* Can by NULL when accessing a screen that isn't active. */ | /* Can by NULL when accessing a screen that isn't active. */ | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, | ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, | ||||
| const SpaceLink *sl, | const SpaceLink *sl, | ||||
| const bool only_visible) | const bool only_visible) | ||||
| { | { | ||||
| if (only_visible) { | if (only_visible) { | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| if (area->spacedata.first == sl) { | if (area->spacedata.first == sl) { | ||||
| return area; | return area; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| if (BLI_findindex(&area->spacedata, sl) != -1) { | if (BLI_findindex(&area->spacedata, sl) != -1) { | ||||
| return area; | return area; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Scene *ED_screen_scene_find(const bScreen *screen, const wmWindowManager *wm) | Scene *ED_screen_scene_find(const bScreen *screen, const wmWindowManager *wm) | ||||
| { | { | ||||
| return ED_screen_scene_find_with_window(screen, wm, NULL); | return ED_screen_scene_find_with_window(screen, wm, NULL); | ||||
| } | } | ||||
| wmWindow *ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm) | wmWindow *ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm) | ||||
| { | { | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| if (WM_window_get_active_screen(win) == screen) { | if (WM_window_get_active_screen(win) == screen) { | ||||
| return win; | return win; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||