context.scene not updating correctly #23135
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#23135
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%Consider this code:
bpy.context.screen.scene = bpy.data.scenes.new("My Scene")
print("Active scene is",bpy.context.scene)
When this is executed line-by-line from the console, the UI shows the new scene and context.scene becomes the scene we just created.
When it is executed from a script, the UI shows the new scene but context.scene does not change from its original value.
This is in r30581, and the problem has been reported as far back as 27070.%%%
Changed status to: 'Open'
%%%At the moment setting the current scene (or screen) is delayed until the next event loop, after everything has been handled. It would be useful if changing scenes was possible, but not sure if this should be considered a bug or current design limitation.%%%
%%%Is there any way to have a script wait until the next event loop, or to force one to occur?%%%
%%%Tom: one of the next todos for Py API is to make scripts proper part of our event handling system, or with timers, or to attach to redraws. It's a known issue and will be resolved asap.%%%
Changed status from 'Open' to: 'Archived'
Added subscriber: @solarlune
Hello. No idea if this'll be heard, but I've been looking around for an answer and not getting anywhere.
I'm basically trying to do the same thing as Tom was - setting a scene, but bpy.context.scene doesn't update immediately. Is there a known way now to force another event loop or wait or something? Something to make bpy.context.scene update immediately?
Wow, a bug report from seven years ago! Since then I've discovered how to wait for the next event loop:
Hmm, I don't think that'll work for my purposes - I'm doing something in a function that needs to execute immediately, so I dunno if I can wait over the course of a script execution...
Thanks for the answer, though! I'll see if I can make any headway. I'll let this stay dead, haha.