LNXSDK/leenkx/blender/lnx/logicnode/logic/LN_output_sequence.py

35 lines
1.2 KiB
Python
Raw Normal View History

2025-01-22 16:18:30 +01:00
from lnx.logicnode.lnx_nodes import *
class SequenceNode(LnxLogicTreeNode):
"""Activates the outputs one by one sequentially and repeatedly."""
bl_idname = 'LNSequenceNode'
bl_label = 'Output Sequence'
lnx_section = 'flow'
lnx_version = 2
min_outputs = 0
def __init__(self):
super(SequenceNode, self).__init__()
array_nodes[self.get_id_str()] = self
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
def draw_buttons(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_output', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxNodeSocketAction'
column = row.column(align=True)
op = column.operator('lnx.node_remove_output', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.outputs) == self.min_outputs:
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)