2018-11-04 05:05:52 +01:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class FunctionNode(ArmLogicTreeNode):
|
2020-09-08 17:03:24 +02:00
|
|
|
"""Function node"""
|
2018-11-04 05:05:52 +01:00
|
|
|
bl_idname = 'LNFunctionNode'
|
|
|
|
bl_label = 'Function'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2018-11-04 05:05:52 +01:00
|
|
|
min_outputs = 1
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2018-11-04 05:05:52 +01:00
|
|
|
def __init__(self):
|
|
|
|
array_nodes[str(id(self))] = self
|
|
|
|
|
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(FunctionNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
2018-11-04 05:05:52 +01:00
|
|
|
|
2018-12-18 23:48:38 +01:00
|
|
|
function_name: StringProperty(name="Name")
|
2018-11-04 05:05:52 +01:00
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(self, 'function_name')
|
|
|
|
row = layout.row(align=True)
|
|
|
|
op = row.operator('arm.node_add_output', text='Add Arg', icon='PLUS', emboss=True)
|
|
|
|
op.node_index = str(id(self))
|
|
|
|
op.socket_type = 'NodeSocketShader'
|
|
|
|
op.name_format = "Arg {0}"
|
|
|
|
op.index_name_offset = 0
|
|
|
|
op2 = row.operator('arm.node_remove_output', text='', icon='X', emboss=True)
|
|
|
|
op2.node_index = str(id(self))
|
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2020-09-09 20:48:35 +02:00
|
|
|
add_node(FunctionNode, category=PKG_AS_CATEGORY, section='function')
|