-
-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default nodes when creating a new node tree using new_engine_node_tree #737
Add default nodes when creating a new node tree using new_engine_node_tree #737
Conversation
… the minimum required nodes and synchronize open editors
engine/engine.py
Outdated
node_sd.location = (200, 200) | ||
node_out = node_tree.nodes.new(type="NodeGroupOutput") | ||
node_out.location = (400, 200) | ||
node_tree.links.new(node_sd.outputs['Image'], node_out.inputs['']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this connects the image to the virtual socket on the Group Output. You might need to add an image socket to it first, then link to that socket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small suggestion to simplify the new tree lookup.
engine/engine.py
Outdated
node_sd = node_tree.nodes.new(type="dream_textures.node_stable_diffusion") | ||
node_sd.location = (200, 200) | ||
node_out = node_tree.nodes.new(type="NodeGroupOutput") | ||
node_tree.outputs.new('NodeSocketColor','Image') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this before, outputs
and inputs
were removed in Blender 4. Could you add a check here for the bpy.app.version
, and in Blender 4.0 use the .interface.new_socket(...)
API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to latest iteration but was not able to test yet.
When creating new node trees, usually a functional minimal sample of a node tree is already created (Eevee, Cycles, Geometry Nodes, Compositor Nodes). This is not possible directly when the node tree type is defined via Python but Dream Textures has a secondardy operator new_engine_node_tree that is exposed in the render engine settings. Using this operator, we can simulate the default Blender behavior.
For the default nodes, I have selected Stable Diffusion and Output because they are the bare minimum render properties because that way the user will not run into the error of resolution mismatch between render engine and the stable diffusion output.