diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_context.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc index c38e765caee..e55a7cae6a6 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc @@ -373,6 +373,21 @@ void ED_spreadsheet_context_path_set_evaluated_object(SpaceSpreadsheet *sspreads BLI_addtail(&sspreadsheet->context_path, context); } +static bScreen *find_screen_to_search_for_context(wmWindow *window, + SpaceSpreadsheet *current_space) +{ + bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + if (ELEM(screen->state, SCREENMAXIMIZED, SCREENFULL)) { + /* If the spreadsheet is maximized, try to find the context in the unmaximized screen. */ + ScrArea *main_area = (ScrArea *)screen->areabase.first; + SpaceLink *sl = (SpaceLink *)main_area->spacedata.first; + if (sl == (SpaceLink *)current_space) { + return main_area->full; + } + } + return screen; +} + void ED_spreadsheet_context_path_guess(const bContext *C, SpaceSpreadsheet *sspreadsheet) { ED_spreadsheet_context_path_clear(sspreadsheet); @@ -385,9 +400,12 @@ void ED_spreadsheet_context_path_guess(const bContext *C, SpaceSpreadsheet *sspr if (sspreadsheet->object_eval_state == SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE) { LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { - bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + bScreen *screen = find_screen_to_search_for_context(window, sspreadsheet); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { SpaceLink *sl = (SpaceLink *)area->spacedata.first; + if (sl == nullptr) { + continue; + } if (sl->spacetype == SPACE_NODE) { SpaceNode *snode = (SpaceNode *)sl; if (snode->edittree != nullptr) { @@ -466,9 +484,12 @@ bool ED_spreadsheet_context_path_is_active(const bContext *C, SpaceSpreadsheet * } LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { - bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + bScreen *screen = find_screen_to_search_for_context(window, sspreadsheet); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { SpaceLink *sl = (SpaceLink *)area->spacedata.first; + if (sl == nullptr) { + continue; + } if (sl->spacetype != SPACE_NODE) { continue; } |