from lnx.logicnode.lnx_nodes import * class ConcatenateStringNode(LnxLogicTreeNode): """Concatenates the given string.""" bl_idname = 'LNConcatenateStringNode' bl_label = 'Concatenate String' lnx_version = 2 min_inputs = 1 def __init__(self): super(ConcatenateStringNode, self).__init__() array_nodes[str(id(self))] = self def lnx_init(self, context): self.add_input('LnxStringSocket', 'Input 0') self.add_output('LnxStringSocket', 'String') def draw_buttons(self, context, layout): row = layout.row(align=True) op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True) op.node_index = str(id(self)) op.socket_type = 'LnxStringSocket' column = row.column(align=True) op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True) op.node_index = str(id(self)) if len(self.inputs) == self.min_inputs: column.enabled = False def get_replacement_node(self, node_tree: bpy.types.NodeTree): if self.lnx_version not in (0, 1): raise LookupError() return NodeReplacement.Identity(self)