4
$\begingroup$

Is there a way to make node groups with a custom node tree? The option is grayed out in the node menu. I checked Sverchok's implementation, but it also seems like they don't support node groups.

$\endgroup$
4
  • $\begingroup$ No, as far as I know this is not supported yet, unfortunally. $\endgroup$ Commented Jun 26, 2015 at 7:02
  • $\begingroup$ sverchok has a node group blender.stackexchange.com/questions/29226/… $\endgroup$
    – Chebhou
    Commented Jun 26, 2015 at 10:39
  • $\begingroup$ I can't figure out how to add sockets to the group inputs/outputs node in sverchok. The link didn't provide any instructions on how to use the node group after you create it. Anyway, I think I have an idea of how to implement node groups in custom node trees now. I'm going to try using node frames (bpy.ops.nodes.join) with custom operators that allow you to toggle between the frame view and collapsed view. Also, when creating the node frame, add an input and output node that can control the socket layout of the collapsed view. $\endgroup$ Commented Jun 27, 2015 at 19:03
  • $\begingroup$ Is this STILL not supported? I can't see a way to do it in v2.83.. There just doesn't seem to be a way for a custom tree to create a group? $\endgroup$
    – hekete
    Commented Jul 20, 2020 at 7:56

1 Answer 1

4
$\begingroup$

There's a reference implementation for a custom Node Group for CustomNodeTrees, used in Lukas Toenne's object_nodes branch. While part of it is compiled, the UI is implemented using bpy's PyNodes ( A CustomNodeTree, same as Sverchok / AnimationNodes ).

If you are comfortable with Python then having a reference implementation may be enough, the whole concept is a little complex to try to convey as a single answer because it involves describing many sub problems. In short, it is possible, but it's not trivial. you'll have to deal implement a few things:

  • How does a node Group behave when copied/duplicated
  • Implement the code to generate a node Group from the selected nodes
  • Creating a NodeSocketInterface (What's that?!)

Most of these can be copied almost verbatim from the reference implementation but others will likely need some modifications to fit with your own CustomNodetree type.


Alternate implementation

In Sverchok we recently pushed a new group node implementation (codename Monads): see anything imported by /nodes/basic_data/monad.py. Warning, expect some complex dynamic programming.

It takes a slightly different approach, it is not final but includes a lot of the same functional Operators / UI behaviour:

  • socket recast
  • delete socket
  • rename socket
  • make nodegroup from selected.

I don't consider this a reference implementation, but it may be of some interest.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .