depsgraph_update_pre is not triggered on manual depsgraph update #113930
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
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113930
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?
Blender 3.6.4
Typically
bpy.context.view_layer.update()
is used to update depsgraph manually but it doesn't seem to triggerdepsgraph_update_pre
handler. I also tried multiple other ways to update depsgraph and none of them trigger the handler too.The workaround is to call some other operator, it will trigger the handler. But need to make sure to change
hide_render
,hide_select
,hide_viewport
of some object, otherwise it wouldn't work.What expected - manual depsgraph update to trigger the callbacks added to
depsgraph_update_pre
handlerThe use case was trying to make automated tests for blender addon and was trying to make a way to trigger
depsgraph_update_pre
when Blender is running in background mode.despgraph_pre_handler
will triggered afterempty_operator
call.if True
toif False
-despgraph_pre_handler
won't be triggered even afterempty_operator
call.Code output:
Code from
4b06d0bf51
only triggers the callbacks if any ID actually changed, see https://projects.blender.org/blender/blender/src/branch/main/source/blender/blenkernel/intern/scene.cc#L2550See also discussion in https://archive.blender.org/developer/D3977
So this looks like it is actually working as expected.
Maybe you could elaborate why having the callbacks only fire if an ID changed is problematic for your usecase?
Didn't realised it's any ID change - have seen somewhere mention that it's somehow tied only to objects being hidden/displayed. Any ID change will totally work for me.
And I think I've focused on second operator call and overlooked the
view_layer.update()
andcontext.evaluated_depsgraph_get().update()
triggeringdepsgraph_update_pre
too if some ID was changed. So I'll probably stick to something likescene.show_subframe = scene.show_subframe; context.view_layer.update()
to trigger depsgraph callback from background mode. Thank you.If someone will be looking for a working example:
@lichtwerk
Oh, actually, there is a bit more to it. The initial problem I've run into is that despgraph update wasn't triggered when I changed property from some ID's propertygroup. Doesn't it considered to be ID change too?
Changing this property from UI is triggerring depsgraph update but not when it's changed from code/background mode.
Example code:
Need to check again