NodeCustomGroup class

I’m getting crazy trying to build a custom NodeCustom group
basically
I want to build B like A
image
but inheriting from NodeCustomGroup

`
class TestCustomNode(NodeCustomGroup,ShaderNodeTree):
bl_idname = ‘TestCustomNodeType’
bl_label = “TEST Custom Node”
bl_icon = ‘SOUND’

def init(self, context):

    self.node_tree = bpy.data.node_groups.new('testGroup', 'ShaderNodeTree')
    group_inputs = self.node_tree.nodes.new('NodeGroupInput')
    group_inputs.location = (-350,0)
    self.node_tree.inputs.new('NodeSocketFloat','in_to_greater')
    self.node_tree.inputs.new('NodeSocketFloat','in_to_less')

    # create group outputs
    group_outputs = self.node_tree.nodes.new('NodeGroupOutput')
    group_outputs.location = (300,0)
    self.node_tree.outputs.new('NodeSocketFloat','out_result')

    # create three math nodes in a group
    node_add = self.node_tree.nodes.new('ShaderNodeMath')
    node_add.operation = 'ADD'
    node_add.location = (100,0)

    node_greater = self.node_tree.nodes.new('ShaderNodeMath')
    node_greater.operation = 'GREATER_THAN'
    node_greater.label = 'greater'
    node_greater.location = (-100,100)

    node_less = self.node_tree.nodes.new('ShaderNodeMath')
    node_less.operation = 'LESS_THAN'
    node_less.label = 'less'
    node_less.location = (-100,-100)

    # link nodes together
    self.node_tree.links.new(node_add.inputs[0], node_greater.outputs[0])
    self.node_tree.links.new(node_add.inputs[1], node_less.outputs[0])

    # link inputs
    self.node_tree.links.new(group_inputs.outputs['in_to_greater'], node_greater.inputs[0])
    self.node_tree.links.new(group_inputs.outputs['in_to_less'], node_less.inputs[0])

`

How can I build a custom NodeCustomGroup using the proper class?

You’d have to inherit from a more specialized class, like ShaderNodeCustomGroup.

you can cheat off some example nodes i have github

that’s nice thanks
How did you build something like the ShaderNodebonus_hexagon… there are many links and nodes
is it possible to visually see the nodes in some way?
or you simply create a group manually in Blender and after you code it?

Bricktricks used an early version of oslpy that compiled into addons rather than dynamically at runtime, you can find the original osl shader code for that one (and all others in bricktricks) in the examples folder.