Checkboxes in Node Editor

I am trying to make some procedural material. I would sometimes like to have multiple pathways when I group the node-setup to a Node-group. Let me elaborate: Is there a way to create a ‘checkbox’ after creating a Node group, like the Clamp in Math node. The functionality of the checkbox should be that it should take different node paths inside the Nodetree depending on the checkbox status.

Please help me out.

1 Like

There is NodeCustomGroup for that. You can create and register custom nodes in python, define properties for them, draw inputs for the properties right on the node ui, and use property update handlers to tweak inner node tree.

But at the moment, the implementation is broken and copying such nodes will destroy them.
The fix is waiting for review

1 Like

As alternative, you can define custom property group (including some marker property like boolean ‘thisismynodegroup’) and put it on the standard node group.
Then, you can implement operator with dialog, or a panel to display these properties and call operators to adjust node inner tree. Care should be taken to assure that each instance of node has unique copy of nodetree.

I’m going to implement this approach as a reusable snippet in case that bugs won’t get fixed.

1 Like

I am unable to understand what you mean by “defining custom property group” and putting it on a “standard node group”. Can you please elaborate it.

See this example in manual.
I suppose It’s possible to do that with ShaderNodeGroup.