3
$\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$
  • $\begingroup$ No, as far as I know this is not supported yet, unfortunally. $\endgroup$ – Jacques Lucke Jun 26 '15 at 7:02
  • $\begingroup$ sverchok has a node group blender.stackexchange.com/questions/29226/… $\endgroup$ – Chebhou Jun 26 '15 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$ – tiredNconfused Jun 27 '15 at 19:03
3
$\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

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.