2018-11-04 05:05:52 +01:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class CallFunctionNode(ArmLogicTreeNode):
|
2020-10-05 19:55:56 +02:00
|
|
|
"""Calls the given function that was created by the [Function](#function) node."""
|
2018-11-04 05:05:52 +01:00
|
|
|
bl_idname = 'LNCallFunctionNode'
|
|
|
|
bl_label = 'Call Function'
|
2020-09-28 15:58:41 +02:00
|
|
|
bl_description = 'Calls a function that was created by the Function node.'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2018-11-04 05:05:52 +01:00
|
|
|
min_inputs = 3
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
array_nodes[str(id(self))] = self
|
|
|
|
|
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(CallFunctionNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('ArmNodeSocketAction', 'In')
|
|
|
|
self.add_input('NodeSocketShader', 'Trait/Any')
|
|
|
|
self.add_input('NodeSocketString', 'Function')
|
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
|
|
|
self.add_output('NodeSocketShader', 'Result')
|
2018-11-04 05:05:52 +01:00
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
row = layout.row(align=True)
|
|
|
|
op = row.operator('arm.node_add_input', 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 = -2
|
|
|
|
op2 = row.operator('arm.node_remove_input', text='', icon='X', emboss=True)
|
|
|
|
op2.node_index = str(id(self))
|
|
|
|
|
2020-09-09 20:48:35 +02:00
|
|
|
add_node(CallFunctionNode, category=PKG_AS_CATEGORY, section='function')
|