Depsgraph not updating properly for frame_change_pre
handler #77126
Labels
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
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#77126
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?
System Information
Operating system: Windows 10
Graphics card:
Blender Version
Broken: 2.83
Worked: Never
Short description of error
Depsgraph access in the
frame_update_pre
handler differs from viewport animation to render animation. It seems the global depsgraph does not update during render animation. I believe a simple solution would be to provide a depsgraph argument in theframe_update_pre
handler (similar to theframe_change_post
handler).Exact steps for others to reproduce the error
Based on the default startup:
Added subscriber: @bblanimation
Added subscriber: @mano-wii
Changed status from 'Needs Triage' to: 'Confirmed'
Looks well related to #71908 if not the same problem.
Added subscriber: @dr.sybren
This is not the same as #71908.
The difference between viewport & render animation is as follows. In the viewport the depsgraph is "active", and thus the updates by the animation system are written back to the original datablocks. For rendering a new depsgraph is made (because all kinds of things have to be evaluated differently), which as a result is not marked as "active", and thus animation updates are not written back to the original datablocks. The problem here is that
bpy.context
will give you the viewport depsgraph, and not the render depsgraph. It'll thus always return the values as are currently seen in the viewport.As can be seen in
BKE_scene_graph_update_for_newframe()
(inscene.c
), updating the scene for a new frame happens as follows:BKE_scene_graph_update_for_newframe()
, the scene's current frame is updated to the new frame.frame_change_pre()
callback is called.frame_change_post()
callback is called.If that callback changed any data, the depsgraph is re-evaluated.
As you can see, in the pre-handler the depsgraph hasn't been updated for the new frame yet (hence the 'pre'). This can be used to change things around before the depsgraph is evaluated.
I agree that it is a good idea to explicitly pass the depsgraph here (also see #77086).
Added subscriber: @Sergey
Discussed with @Sergey, and this is not possible. The handler is not to be used as a "before the frame changes" handler, but as a "before the depsgraph updates". This means it can be used for adjusting the data & relations for the new frame. The depsgraph itself is intentionally not available, as it's out of date (i.e. it's not in sync with either the previous or the current frame).
I'll see this as a documentation task, as the code is working as intended.
This issue was referenced by
cdf0d95a50
Changed status from 'Confirmed' to: 'Resolved'
Added subscriber: @barakooda
This comment was removed by @barakooda