/
LN_array_display.py
31 lines (25 loc) · 1.16 KB
/
LN_array_display.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
from arm.logicnode.arm_nodes import *
class ArrayDisplayNode(ArmLogicTreeNode):
"""Returns the length of the given array."""
bl_idname = 'LNArrayDisplayNode'
bl_label = 'Array Display'
arm_version = 1
def remove_extra_inputs(self, context):
while len(self.inputs) > 2:
self.inputs.remove(self.inputs[-1])
if self.property0 == 'Item Field':
self.add_input('ArmStringSocket', 'Item Field')
if self.property0 == 'Item Property':
self.add_input('ArmStringSocket', 'Item Property')
property0: HaxeEnumProperty(
'property0',
items = [('Item', 'Item', 'Array Item'),
('Item Field', 'Item Field', 'Object Item Field, ie: name, uid, visible, parent, length, etc.'),
('Item Property', 'Item Property', 'Object Item Property')],
name='', default='Item', update=remove_extra_inputs)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmStringSocket', 'Separator')
self.add_output('ArmStringSocket', 'Items')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')