bpy.ops.screen.screen_full_area() resets certain fields of the context #89526

Closed
opened 2021-06-29 11:56:06 +02:00 by Sybren A. Stüvel · 7 comments

System Information
Operating system: Linux-5.4.0-74-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.80

Blender Version
Broken: version: 2.93, anything after b787581c9c
Worked: verson 2.92 and master before b787581c9c.

Short description of error
Calling bpy.ops.screen.screen_full_area() resets certain fields of the context, most notably area and space_data. This makes it impossible to register a draw handler or even call bpy.ops.screen.screen_full_area() again to restore the area.

Exact steps for others to reproduce the error

  1. Run the code below
  2. In the 3D Viewport press F3, search for "demo".
  3. Run the "Toggle Fullscreen Demo" operator.
  4. It should make the area go full-screen and back again, without any errors. Instead, it shows Space data is None.

The code and these steps are already set up in fullscreen_demo.blend

import bpy


class DEMO_OT_fullscreen_toggle(bpy.types.Operator):
    bl_idname = "demo.fullscreen_toggle"
    bl_label = "Toggle Fullscreen Demo"
    bl_description = "Demo for issue with b787581c9cda"

    def execute(self, context):
        # Going full-screen shouldn't break the context.
        bpy.ops.screen.screen_full_area()

        # Space data should remain available after full-screening.
        assert context.space_data is not None, 'Space data is None'

        # Un-full-screening should work.
        bpy.ops.screen.screen_full_area()


bpy.utils.register_class(DEMO_OT_fullscreen_toggle)
**System Information** Operating system: Linux-5.4.0-74-generic-x86_64-with-glibc2.31 64 Bits Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.80 **Blender Version** Broken: version: 2.93, anything after b787581c9c Worked: verson 2.92 and master before b787581c9c. **Short description of error** Calling `bpy.ops.screen.screen_full_area()` resets certain fields of the context, most notably `area` and `space_data`. This makes it impossible to register a draw handler or even call `bpy.ops.screen.screen_full_area()` again to restore the area. **Exact steps for others to reproduce the error** 1. Run the code below 2. In the 3D Viewport press F3, search for "demo". 3. Run the "Toggle Fullscreen Demo" operator. 4. It should make the area go full-screen and back again, without any errors. Instead, it shows `Space data is None`. The code and these steps are already set up in [fullscreen_demo.blend](https://archive.blender.org/developer/F10205434/fullscreen_demo.blend) ``` import bpy class DEMO_OT_fullscreen_toggle(bpy.types.Operator): bl_idname = "demo.fullscreen_toggle" bl_label = "Toggle Fullscreen Demo" bl_description = "Demo for issue with b787581c9cda" def execute(self, context): # Going full-screen shouldn't break the context. bpy.ops.screen.screen_full_area() # Space data should remain available after full-screening. assert context.space_data is not None, 'Space data is None' # Un-full-screening should work. bpy.ops.screen.screen_full_area() bpy.utils.register_class(DEMO_OT_fullscreen_toggle) ```
Author
Member

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

blender/blender-addons#89495 was marked as duplicate of this issue

blender/blender-addons#89495 was marked as duplicate of this issue
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @railla

Added subscriber: @railla

This issue was referenced by cf9cacd091

This issue was referenced by cf9cacd091e8cbabf9bfc91b0949bfea785968d4

This issue was referenced by 8f6a9c5176

This issue was referenced by 8f6a9c5176453c83187f90eba3a53a01a9c526d2

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-06-29 13:10:01 +02:00
Thomas Dinges added this to the 3.0 milestone 2023-02-08 15:59:10 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#89526
No description provided.