Regression: Missing update in custom Nodetree #96394

Closed
opened 2022-03-13 11:17:06 +01:00 by Gregory · 11 comments

System Information
Operating system: Windows-10-10.0.19042-SP0 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40

Blender Version
Broken: version: 3.1.0, current master
Affected by 7e712b2d6a

Short description of error
If create custom node tree with name "CustomNodeTree" and try update node tree by script: bpy.data.node_groups["CustomNodeTree"].interface_update(bpy.context) - tree not updated. In version Blender 3.0 function works good

Exact steps for others to reproduce the error

  1. Download archive batch_render_nodes.zip

  2. Install zip-archive add-on in Blender 3.0 and Blender 3.1

  3. Download test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend

  4. Open test file in Blender 3.0

  5. Try change sockets values

  6. Sockets output values updated

  7. Open same test file in Blender 3.1

  8. Try change sockets values

  9. Sockets output values not updated

For update sockets and all node tree i used function https://docs.blender.org/api/current/bpy.types.NodeTree.html#bpy.types.NodeTree.interface_update
batch_render_nodes.zip
Batch_Render_Nodes_UPDATE_TREE_TEST.blend

3.0.0 3.1.0
Video_Blender_3_0.mp4 Video_Blender_3_1.mp4
**System Information** Operating system: Windows-10-10.0.19042-SP0 64 Bits Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40 **Blender Version** Broken: version: 3.1.0, current master Affected by 7e712b2d6a **Short description of error** If create custom node tree with name "CustomNodeTree" and try update node tree by script: `bpy.data.node_groups["CustomNodeTree"].interface_update(bpy.context)` - tree not updated. In version Blender 3.0 function works good **Exact steps for others to reproduce the error** 1. Download archive `batch_render_nodes.zip` 2. Install zip-archive add-on in Blender 3.0 and Blender 3.1 3. Download test file `Batch_Render_Nodes_UPDATE_TREE_TEST.blend` 4. Open test file in Blender 3.0 5. Try change sockets values 6. Sockets output values updated 7. Open same test file in Blender 3.1 8. Try change sockets values 9. Sockets output values not updated For update sockets and all node tree i used function https://docs.blender.org/api/current/bpy.types.NodeTree.html#bpy.types.NodeTree.interface_update [batch_render_nodes.zip](https://archive.blender.org/developer/F12941658/batch_render_nodes.zip) [Batch_Render_Nodes_UPDATE_TREE_TEST.blend](https://archive.blender.org/developer/F12941677/Batch_Render_Nodes_UPDATE_TREE_TEST.blend) | 3.0.0 | 3.1.0 | | -- | -- | | [Video_Blender_3_0.mp4](https://archive.blender.org/developer/F12941688/Video_Blender_3_0.mp4) | [Video_Blender_3_1.mp4](https://archive.blender.org/developer/F12941690/Video_Blender_3_1.mp4) |
Author

Added subscriber: @GregoryS

Added subscriber: @GregoryS
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Create custom node tree by python

Hi, thanks for the report. You mean using default python template?

I don't think I understand steps for reproducing the problem. Are you using custom script? Can you attach that?
Also, please test again on latest 3.2 build: https://builder.blender.org/download/daily/
Similar reports I have seen where responsible commit was 7e712b2d6a

> Create custom node tree by python Hi, thanks for the report. You mean using default python template? I don't think I understand steps for reproducing the problem. Are you using custom script? Can you attach that? Also, please test again on latest 3.2 build: https://builder.blender.org/download/daily/ Similar reports I have seen where responsible commit was 7e712b2d6a
Author

In #96394#1326520, @PratikPB2123 wrote:

Create custom node tree by python

Hi, thanks for the report. You mean using default python template?

I don't think I understand steps for reproducing the problem. Are you using custom script? Can you attach that?
Also, please test again on latest 3.2 build: https://builder.blender.org/download/daily/
Similar reports I have seen where responsible commit was 7e712b2d6a

Thanks!

I codding add-on for batch rendering using node trees.
Steps:

  1. Download archive batch_render_nodes.zip batch_render_nodes.zip

  2. Install zip-archive add-on in Blender 3.0 and Blender 3.1
    3.Download test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend Batch_Render_Nodes_UPDATE_TREE_TEST.blend

  3. Open test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend in Blender 3.0

  4. Try change sockets values

  5. Sockets output values updated

  6. Open test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend in Blender 3.1

  7. Try change sockets values

  8. Sockets output values not updated

I try Blender 3.2. Sockets output information also not updated

For update sockets and all node tree i used function https://docs.blender.org/api/current/bpy.types.NodeTree.html#bpy.types.NodeTree.interface_update

Also i upload screen videocapture
Video_Blender_3_0.mp4
Video_Blender_3_1.mp4

> In #96394#1326520, @PratikPB2123 wrote: >> Create custom node tree by python > Hi, thanks for the report. You mean using default python template? > > I don't think I understand steps for reproducing the problem. Are you using custom script? Can you attach that? > Also, please test again on latest 3.2 build: https://builder.blender.org/download/daily/ > Similar reports I have seen where responsible commit was 7e712b2d6a Thanks! I codding add-on for batch rendering using node trees. Steps: 1. Download archive batch_render_nodes.zip [batch_render_nodes.zip](https://archive.blender.org/developer/F12941658/batch_render_nodes.zip) 2. Install zip-archive add-on in Blender 3.0 and Blender 3.1 3.Download test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend [Batch_Render_Nodes_UPDATE_TREE_TEST.blend](https://archive.blender.org/developer/F12941677/Batch_Render_Nodes_UPDATE_TREE_TEST.blend) 4. Open test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend in Blender 3.0 5. Try change sockets values 6. Sockets output values updated 7. Open test file Batch_Render_Nodes_UPDATE_TREE_TEST.blend in Blender 3.1 8. Try change sockets values 9. Sockets output values not updated I try Blender 3.2. Sockets output information also not updated For update sockets and all node tree i used function https://docs.blender.org/api/current/bpy.types.NodeTree.html#bpy.types.NodeTree.interface_update Also i upload screen videocapture [Video_Blender_3_0.mp4](https://archive.blender.org/developer/F12941688/Video_Blender_3_0.mp4) [Video_Blender_3_1.mp4](https://archive.blender.org/developer/F12941690/Video_Blender_3_1.mp4)
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Thank you for the information :)
I can confirm now. This is got affected after the same commit. This one- 7e712b2d6a
@JacquesLucke ^

Thank you for the information :) I can confirm now. This is got affected after the same commit. This one- 7e712b2d6a @JacquesLucke ^
Pratik Borhade changed title from Function - interface_update(context) - from class NodeTree not work in Blender 3.1 to Regression: Missing update in custom Nodetree 2022-03-24 03:44:49 +01:00
Member

I'm not 100%, but right now this does not feel like a bug in Blender to me.

It seems like you expect Blender to call the update method on every node when you call interface_update. However, there is no reason why it should do that. interface_update is a method that was supposed to be called to force an update when the inputs or outputs of a node group changed. However, Blender never calls this function itself anymore, so maybe it should even be removed.

From what I can tell, the current update-logic in the addon is very brittle. This is also shown by the fact that you always call interface_update three times, so that data can propagate for three nodes. This might give the illusion that it works, but is still unreliable when there are longer chains of nodes.

A short term fix would be to just call node.update() for all the nodes manually.

@persistent
def updateNodeTreeTimerThread():

        for tree in bpy.data.node_groups:
            if tree.bl_idname == 'BatchNodesTree':
                for _ in range(3):
                    for node in tree.nodes:
                        node.update()

In addition you might have to loop over the different area/regions in the Blender UI and call tag_redraw on them.
For a more complete example see P2851.

I highly recommend you to implement a system that gives you control over when and in what order nodes are executed.

I'm not 100%, but right now this does not feel like a bug in Blender to me. It seems like you expect Blender to call the `update` method on every node when you call `interface_update`. However, there is no reason why it should do that. `interface_update` is a method that was supposed to be called to force an update when the inputs or outputs of a node group changed. However, Blender never calls this function itself anymore, so maybe it should even be removed. From what I can tell, the current update-logic in the addon is very brittle. This is also shown by the fact that you always call `interface_update` three times, so that data can propagate for three nodes. This might give the illusion that it works, but is still unreliable when there are longer chains of nodes. A short term fix would be to just call `node.update()` for all the nodes manually. ``` @persistent def updateNodeTreeTimerThread(): for tree in bpy.data.node_groups: if tree.bl_idname == 'BatchNodesTree': for _ in range(3): for node in tree.nodes: node.update() ``` In addition you might have to loop over the different area/regions in the Blender UI and call `tag_redraw` on them. For a more complete example see [P2851](https://archive.blender.org/developer/P2851.txt). I highly recommend you to implement a system that gives you control over when and in what order nodes are executed.
Author

In #96394#1329178, @JacquesLucke wrote:
I'm not 100%, but right now this does not feel like a bug in Blender to me.

It seems like you expect Blender to call the update method on every node when you call interface_update. However, there is no reason why it should do that. interface_update is a method that was supposed to be called to force an update when the inputs or outputs of a node group changed. However, Blender never calls this function itself anymore, so maybe it should even be removed.

From what I can tell, the current update-logic in the addon is very brittle. This is also shown by the fact that you always call interface_update three times, so that data can propagate for three nodes. This might give the illusion that it works, but is still unreliable when there are longer chains of nodes.

A short term fix would be to just call node.update() for all the nodes manually.

@persistent
def updateNodeTreeTimerThread():

        for tree in bpy.data.node_groups:
            if tree.bl_idname == 'BatchNodesTree':
                for _ in range(3):
                    for node in tree.nodes:
                        node.update()

In addition you might have to loop over the different area/regions in the Blender UI and call tag_redraw on them.
For a more complete example see P2851.

I highly recommend you to implement a system that gives you control over when and in what order nodes are executed.

Thanks !I have updated the code, thanks to your advice. Update nodes works

> In #96394#1329178, @JacquesLucke wrote: > I'm not 100%, but right now this does not feel like a bug in Blender to me. > > It seems like you expect Blender to call the `update` method on every node when you call `interface_update`. However, there is no reason why it should do that. `interface_update` is a method that was supposed to be called to force an update when the inputs or outputs of a node group changed. However, Blender never calls this function itself anymore, so maybe it should even be removed. > > From what I can tell, the current update-logic in the addon is very brittle. This is also shown by the fact that you always call `interface_update` three times, so that data can propagate for three nodes. This might give the illusion that it works, but is still unreliable when there are longer chains of nodes. > > A short term fix would be to just call `node.update()` for all the nodes manually. > ``` > @persistent > def updateNodeTreeTimerThread(): > > for tree in bpy.data.node_groups: > if tree.bl_idname == 'BatchNodesTree': > for _ in range(3): > for node in tree.nodes: > node.update() > ``` > > In addition you might have to loop over the different area/regions in the Blender UI and call `tag_redraw` on them. > For a more complete example see [P2851](https://archive.blender.org/developer/P2851.txt). > > I highly recommend you to implement a system that gives you control over when and in what order nodes are executed. Thanks !I have updated the code, thanks to your advice. Update nodes works
Member

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
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
3 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#96394
No description provided.