Nodetree update optimization from Blender 3.1+ breaks my Addon #101378
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#101378
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: -
Graphics card: -
Blender Version
Broken: 3.1+
Worked: 3.0.1
I'm the creator of Material Wizard Addon (https://wp.h0bb1t.de/index.php/about-material-wizard/) and have to admit, that I haven't touched it quite a long time. I now have planned to update it and stumbled across the fact, that it doesn't work as expected starting with Blender 3.1+. After some debugging, I figured out where the problem comes from and assume it is related to the Nodetree update optimization started in 3.1.
Material Wizard has its own Node Tree and reflects any changes to it in different Shader Node Trees. It does it by creating hidden NodeGroups and instanciate them in the respective material and links sockets according the settings in my own node space. Long story short, the problem arises when adding a node group to the shader node tree and try to loop over the inputs of this node group. It seems in Blender 3.1+, the inputs do not reflect the inputs of the node tree embedded to the group:
In the highlighted area in the lower left corner, len(node.inputs) is 0, while len(node.node_tree.inputs) is 8. In Blender pre 3.1, the first one was also 8, which is what I need. After my script has run, I get the correct node groups in my target material trees, but they don't have inputs or outputs. Subsequent calls to [Node.update()] in Blenders Python console fixes the problem.
I assume I need to force an update on the Shader Node Tree from my script, but havn't found any information how to do this. Calling update() on the node in my script (rectangular highlighted area in the code above) doesn't seem to help.
Please help me.
Thanks,
Thomas
Added subscriber: @h0bB1T
Added subscriber: @JacquesLucke
Changed status from 'Needs Triage' to: 'Needs User Info'
Please try to reproduce the issue outside of your addon to make it easier to investigate for us.
Ok, I've quickly hacked a script based on the custom nodes template that shows the problem. Tested with Blender 3.0 & 3.2, 3.2 is affected (but I assume 3.1+).
In the default scene:
Adding the group to TestMasterial Shift-A/Group/TestNode fixes the problem.
Running create_node_group() + add_node_group() from script directly works as expected.
I hope this helps.
Hello Jacques,
in D16070 you mention there would be better ways to do this. I'm always open to better ways. As it is just a call to rebuild_tree, it's relatively fast to test different ways. What is the preferred way to let the Shader Node Tree stay in sync with my custom tree?
And, in case of your mentioned timer based solution, would it be ok (incrementally) sync tree layout on an e.g. 100ms timed cycle?
It's not perfect but you could set some flag to true in the update function and then just check that flag in a timer so that it only syncs the tree when necessary. I'm not sure if there is a perfect solution for this scenario currently.
Thanks, will try this :)
Added subscriber: @ThomasDinges
Any update here? Did you find a solution @h0bB1T ?
Hi. Yes. I followed the idea of Jaques to use a dirty flag and a timer based update and it works nicely. At the end, it seems the better solution. So at least to my needs, it is not necessary to fix it (and the new solution works in older Blender versions too).
Changed status from 'Needs User Info' to: 'Archived'
Great, thanks for your quick response. I am closing this then. :)