Fix T89526: "Toggle Maximize Area" clears context screen properties

Removed in b787581c9c as it's comment
noted it was bad code, the reason for it's necessity was no longer valid.

Add this back with comment explaining why it's still needed.
This commit is contained in:
Campbell Barton 2021-06-29 20:50:53 +10:00 committed by Jeroen Bakker
parent 03d5c8b4ed
commit cf9cacd091
Notes: blender-bot 2023-02-14 04:10:15 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #89526, `bpy.ops.screen.screen_full_area()` resets certain fields of the context
Referenced by issue #88481, view2d operator poll fails after calling bpy.ops.screen.screen_full_area()
1 changed files with 8 additions and 0 deletions

View File

@ -1416,6 +1416,14 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const
BLI_assert(CTX_wm_screen(C) == screen);
BLI_assert(CTX_wm_area(C) == NULL); /* May have been freed. */
/* Setting the area is only needed for Python scripts that call
* operators in succession before returning to the main event loop.
* Without this, scripts can't run any operators that require
* an area after toggling full-screen for example (see: T89526).
* NOTE: an old comment stated this was "bad code",
* however it doesn't cause problems so leave as-is. */
CTX_wm_area_set(C, screen->areabase.first);
return screen->areabase.first;
}