Document how to use group nodes in custom node trees #80827

Open
opened 2020-09-16 10:00:46 +02:00 by Jacques Lucke · 8 comments
Member

Maybe I'm missing something, but I could not find documentation on how to use group nodes in custom node trees. The simplest solution is probably to provide an example in the Python docs on the bpy.types.NodeCustomGroup site. Without documenting how this is supposed to be done, we'll likely get more reports like blender/blender#76591.

@randum provided an initial script that can be used. It needs to be refined a bit more though.

node_group.py

Maybe I'm missing something, but I could not find documentation on how to use group nodes in custom node trees. The simplest solution is probably to provide an example in the Python docs on the `bpy.types.NodeCustomGroup` site. Without documenting how this is supposed to be done, we'll likely get more reports like blender/blender#76591. @randum provided an initial script that can be used. It needs to be refined a bit more though. [node_group.py](https://archive.blender.org/developer/F8888411/node_group.py)
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscribers: @randum, @JacquesLucke

Added subscribers: @randum, @JacquesLucke
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker

I have started implementing group nodes in Sverchok and I have got some new information which can be added into documentation.

Any addon which uses custom sockets should implement NodeSocketInterface classes for each custom socket. Socket interface has bl_socket_idname attribute which should keep bl_idname of normal socket. Unlike normal sockets interface sockets should be added into tree.inputs or tree.outputs collections. When a socket is plugged to virtual socket of group node the node searches appropriate socket interface by their bl_socket_idname attribute and adds it into tree.inputs or outputs collection. The interface socket can have and draw its properties in node interface panel. According its properties sockets in group node can change their behaviour.

95289546-081cbc80-087c-11eb-9a2b-1eb4b17f7c7e.gif

In documentation I have found some methods (register_properties, init_socket, from_socket) which actual interface sockets does not have. Probably documentation is outdated?

>>> D.node_groups- [x].inputs[0]

bpy.data.node_groups['Sverchok group'].inputs[0]

>>> D.node_groups- [x].inputs- [x].bl_rna

<bpy_struct, Struct("SvStringsSocketInterface")>

>>> D.node_groups- [x].inputs- [x].init_socket

Traceback (most recent call last):

File "<blender_console>", line 1, in

AttributeError: 'SvStringsSocketInterface' object has no attribute 'init_socket'

https://docs.blender.org/api/current/bpy.types.NodeSocketInterface.html#bpy.types.NodeSocketInterface.init_socket

Also there is PR on Github dedicated creating UI for node groups. Probably link also can be useful.
https://github.com/nortikin/sverchok/pull/3624

I have started implementing group nodes in Sverchok and I have got some new information which can be added into documentation. Any addon which uses custom sockets should implement `NodeSocketInterface` classes for each custom socket. Socket interface has `bl_socket_idname` attribute which should keep `bl_idname` of normal socket. Unlike normal sockets interface sockets should be added into `tree.inputs` or `tree.outputs` collections. When a socket is plugged to virtual socket of group node the node searches appropriate socket interface by their `bl_socket_idname` attribute and adds it into `tree.inputs or outputs` collection. The interface socket can have and draw its properties in node interface panel. According its properties sockets in group node can change their behaviour. ![95289546-081cbc80-087c-11eb-9a2b-1eb4b17f7c7e.gif](https://archive.blender.org/developer/F8981931/95289546-081cbc80-087c-11eb-9a2b-1eb4b17f7c7e.gif) In documentation I have found some methods (`register_properties`, `init_socket`, `from_socket`) which actual interface sockets does not have. Probably documentation is outdated? ```Text >>> D.node_groups- [x].inputs[0] bpy.data.node_groups['Sverchok group'].inputs[0] >>> D.node_groups- [x].inputs- [x].bl_rna <bpy_struct, Struct("SvStringsSocketInterface")> >>> D.node_groups- [x].inputs- [x].init_socket Traceback (most recent call last): ``` File "<blender_console>", line 1, in <module> ``` AttributeError: 'SvStringsSocketInterface' object has no attribute 'init_socket' ``` https://docs.blender.org/api/current/bpy.types.NodeSocketInterface.html#bpy.types.NodeSocketInterface.init_socket Also there is PR on Github dedicated creating UI for node groups. Probably link also can be useful. https://github.com/nortikin/sverchok/pull/3624

Added subscriber: @AquaticNightmare

Added subscriber: @AquaticNightmare
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk

Added subscriber: @Zeastin

Added subscriber: @Zeastin

Added subscriber: @timodriaan

Added subscriber: @timodriaan
Aaron Carlisle removed the
Module
Python API
label 2023-02-08 05:03:24 +01:00
Aaron Carlisle added the
Module
Python API
label 2023-08-13 15:30:49 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-manual#80827
No description provided.