-
Notifications
You must be signed in to change notification settings - Fork 315
/
LN_output_sequence.py
34 lines (27 loc) · 1.17 KB
/
LN_output_sequence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from arm.logicnode.arm_nodes import *
class SequenceNode(ArmLogicTreeNode):
"""Activates the outputs one by one sequentially and repeatedly."""
bl_idname = 'LNSequenceNode'
bl_label = 'Output Sequence'
arm_section = 'flow'
arm_version = 2
min_outputs = 0
def __init__(self):
super(SequenceNode, self).__init__()
array_nodes[self.get_id_str()] = self
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
def draw_buttons(self, context, layout):
row = layout.row(align=True)
op = row.operator('arm.node_add_output', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'ArmNodeSocketAction'
column = row.column(align=True)
op = column.operator('arm.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.arm_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)