Add CustomSocket node socket type

This commit is contained in:
Moritz Brückner 2020-06-08 08:49:21 +02:00
parent 3cd6ab1331
commit 1dfc777f2b
2 changed files with 12 additions and 1 deletions

View file

@ -24,6 +24,15 @@ class ArmActionSocket(bpy.types.NodeSocket):
def draw_color(self, context, node):
return (0.8, 0.3, 0.3, 1)
class ArmCustomSocket(bpy.types.NodeSocket):
"""
A custom socket that can be used to define more socket types for
logic node packs. Do not use this type directly (it is not
registered)!
"""
bl_idname = 'ArmCustomSocket'
bl_label = 'Custom Socket'
class ArmArraySocket(bpy.types.NodeSocket):
bl_idname = 'ArmNodeSocketArray'
bl_label = 'Array Socket'

View file

@ -100,7 +100,7 @@ def build_node_tree(node_group):
f.write('}')
node_group.arm_cached = True
def build_node(node, f):
def build_node(node: bpy.types.Node, f):
global parsed_nodes
global parsed_ids
@ -243,6 +243,8 @@ def get_root_nodes(node_group):
def build_default_node(inp):
inp_name = 'new armory.logicnode.NullNode(this)'
if isinstance(inp, arm.logicnode.arm_nodes.ArmCustomSocket):
return inp_name
if inp.bl_idname == 'ArmNodeSocketAction' or inp.bl_idname == 'ArmNodeSocketArray':
return inp_name
if inp.bl_idname == 'ArmNodeSocketObject':