Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class ArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores the given array as a variable."""
bl_idname = 'LNArrayNode'
bl_label = 'Array Dynamic'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxDynamicSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxDynamicSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,46 @@
from lnx.logicnode.lnx_nodes import *
class ArrayAddNode(LnxLogicTreeNode):
"""Adds the given value to the given array.
@input Array: the array to manipulate.
@input Modify Original: if `false`, the input array is copied before adding the value.
@input Unique Values: if `true`, values may occur only once in that array (only primitive data types are supported).
"""
bl_idname = 'LNArrayAddNode'
bl_label = 'Array Add'
lnx_version = 5
min_inputs = 6
def __init__(self):
super(ArrayAddNode, self).__init__()
array_nodes[self.get_id_str()] = self
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxBoolSocket', 'Modify Original', default_value=True)
self.add_input('LnxBoolSocket', 'Unique Values')
self.add_input('LnxBoolSocket', 'Add First')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketArray', 'Array')
def draw_buttons(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input_value', text='Add Input', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxDynamicSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
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, 4):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class BooleanArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of boolean elements as a variable."""
bl_idname = 'LNArrayBooleanNode'
bl_label = 'Array Boolean'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(BooleanArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxBoolSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxBoolSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class ColorArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of color elements as a variable."""
bl_idname = 'LNArrayColorNode'
bl_label = 'Array Color'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(ColorArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxColorSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxColorSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class ArrayCompareNode(LnxLogicTreeNode):
"""Compare arrays."""
bl_idname = 'LNArrayCompareNode'
bl_label = 'Array Compare'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxBoolSocket', 'Compare')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class ArrayConcatNode(LnxLogicTreeNode):
"""Join arrays."""
bl_idname = 'LNArrayConcatNode'
bl_label = 'Array Concat'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketArray', 'Array')
self.add_output('LnxIntSocket', 'Length')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayContainsNode(LnxLogicTreeNode):
"""Returns whether the given array contains the given value."""
bl_idname = 'LNArrayInArrayNode'
bl_label = 'Array Contains'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxBoolSocket', 'Contains')

View File

@ -0,0 +1,12 @@
from lnx.logicnode.lnx_nodes import *
class ArrayCountNode(LnxLogicTreeNode):
"""Returns an array with the item counts of the given array."""
bl_idname = 'LNArrayCountNode'
bl_label = 'Array Count'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketArray', 'Count')

View File

@ -0,0 +1,31 @@
from lnx.logicnode.lnx_nodes import *
class ArrayDisplayNode(LnxLogicTreeNode):
"""Returns the display of the given array."""
bl_idname = 'LNArrayDisplayNode'
bl_label = 'Array Display'
lnx_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('LnxStringSocket', 'Item Field')
if self.property0 == 'Item Property':
self.add_input('LnxStringSocket', '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 lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxStringSocket', 'Separator')
self.add_output('LnxStringSocket', 'Items')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayDistinctNode(LnxLogicTreeNode):
"""Returns the Distinct and Duplicated items of the given array."""
bl_idname = 'LNArrayDistinctNode'
bl_label = 'Array Distinct'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketArray', 'Distinct')
self.add_output('LnxNodeSocketArray', 'Duplicated')

View File

@ -0,0 +1,49 @@
from lnx.logicnode.lnx_nodes import *
class ArrayFilterNode(LnxLogicTreeNode):
"""Returns an array with the filtered items of the given array."""
bl_idname = 'LNArrayFilterNode'
bl_label = 'Array Filter'
lnx_version = 1
def remove_extra_inputs(self, context):
while len(self.inputs) > 1:
self.inputs.remove(self.inputs[-1])
if self.property0 == 'Item Field':
self.add_input('LnxStringSocket', 'Item Field')
if self.property0 == 'Item Property':
self.add_input('LnxStringSocket', 'Item Property')
self.add_input('LnxDynamicSocket', 'Value')
if self.property1 == 'Between':
self.add_input('LnxDynamicSocket', 'Value')
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)
property1: HaxeEnumProperty(
'property1',
items = [('Equal', 'Equal', 'Equal'),
('Not Equal', 'Not Equal', 'Not Equal'),
('Greater', 'Greater', 'Greater'),
('Greater Equal', 'Greater Equal', 'Greater Equal'),
('Less', 'Less', 'Less'),
('Less Equal', 'Less Equal', 'Less Equal'),
('Between', 'Between', 'Input 1 Between Input 2 and Input 3 inclusive'),
('Contains', 'Contains', 'Contains'),
('Starts With', 'Starts With', 'Starts With'),
('Ends With', 'Ends With', 'Ends With')],
name='', default='Equal', update=remove_extra_inputs)
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketArray', 'Array')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')

View File

@ -0,0 +1,61 @@
from lnx.logicnode.lnx_nodes import *
class FloatArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of float elements as a variable."""
bl_idname = 'LNArrayFloatNode'
bl_label = 'Array Float'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(FloatArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxFloatSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxFloatSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version < 0 or self.lnx_version > 2:
raise LookupError()
newnode = node_tree.nodes.new(FloatArrayNode.bl_idname)
for inp_old in self.inputs:
inp_new = newnode.add_input('LnxFloatSocket', inp_old.name)
inp_new.hide = self.lnx_logic_id != ''
inp_new.enabled = self.lnx_logic_id != ''
inp_new.default_value_raw = inp_old.get_default_value()
NodeReplacement.replace_input_socket(node_tree, inp_old, inp_new)
NodeReplacement.replace_output_socket(node_tree, self.outputs[0], newnode.outputs[0])
NodeReplacement.replace_output_socket(node_tree, self.outputs[1], newnode.outputs[1])
return newnode

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayGetNode(LnxLogicTreeNode):
"""Returns the value of the given array at the given index."""
bl_idname = 'LNArrayGetNode'
bl_label = 'Array Get'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayGetPreviousNextNode(LnxLogicTreeNode):
"""Returns the previous or next value to be retrieve by looping the array according to the boolean condition."""
bl_idname = 'LNArrayGetPreviousNextNode'
bl_label = 'Array Get Previous/Next'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxBoolSocket', 'Previous: 0 / Next: 1')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,12 @@
from lnx.logicnode.lnx_nodes import *
class ArrayGetNextNode(LnxLogicTreeNode):
"""Returns the next value to be retrieve by looping the array."""
bl_idname = 'LNArrayGetNextNode'
bl_label = 'Array Get Next'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,20 @@
from lnx.logicnode.lnx_nodes import *
class ArrayIndexNode(LnxLogicTreeNode):
"""Returns the array index of the given value."""
bl_idname = 'LNArrayIndexNode'
bl_label = 'Array Index'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxDynamicSocket', 'Value')
self.add_input('LnxIntSocket', 'From')
self.add_output('LnxIntSocket', 'Index')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class ArrayInsertNode(LnxLogicTreeNode):
"""Inserts the value of the given array at the given index and increases the length of the array."""
bl_idname = 'LNArrayInsertNode'
bl_label = 'Array Insert'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class IntegerArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of integer elements as a variable."""
bl_idname = 'LNArrayIntegerNode'
bl_label = 'Array Integer'
lnx_version = 4
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(IntegerArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxIntSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxIntSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 3):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,12 @@
from lnx.logicnode.lnx_nodes import *
class ArrayLengthNode(LnxLogicTreeNode):
"""Returns the length of the given array."""
bl_idname = 'LNArrayLengthNode'
bl_label = 'Array Length'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxIntSocket', 'Length')

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class ArrayLoopNode(LnxLogicTreeNode):
"""Loops through each item of the given array."""
bl_idname = 'LNArrayLoopNode'
bl_label = 'Array Loop'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketAction', 'Loop')
self.add_output('LnxDynamicSocket', 'Value')
self.add_output('LnxIntSocket', 'Index')
self.add_output('LnxNodeSocketAction', 'Done')

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class ObjectArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of object elements as a variable."""
bl_idname = 'LNArrayObjectNode'
bl_label = 'Array Object'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(ObjectArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxNodeSocketObject'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxNodeSocketObject', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].default_value_raw
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class ArrayPopNode(LnxLogicTreeNode):
"""Removes the last element of the given array.
@see [Haxe API](https://api.haxe.org/Array.html#pop)"""
bl_idname = 'LNArrayPopNode'
bl_label = 'Array Pop'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class ArrayRemoveIndexNode(LnxLogicTreeNode):
"""Removes the element from the given array by its index.
@seeNode Array Remove by Value"""
bl_idname = 'LNArrayRemoveNode'
bl_label = 'Array Remove by Index'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,29 @@
from lnx.logicnode.lnx_nodes import *
class ArrayRemoveValueNode(LnxLogicTreeNode):
"""Removes the element from the given array by its value.
@seeNode Array Remove by Index"""
bl_idname = 'LNArrayRemoveValueNode'
bl_label = 'Array Remove by Value'
lnx_version = 1
# def __init__(self):
# array_nodes[str(id(self))] = self
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxDynamicSocket', 'Value')
# def draw_buttons(self, context, layout):
# row = layout.row(align=True)
# op = row.operator('lnx.node_add_input_value', text='New', icon='PLUS', emboss=True)
# op.node_index = str(id(self))
# op.socket_type = 'LnxDynamicSocket'
# op2 = row.operator('lnx.node_remove_input_value', text='', icon='X', emboss=True)
# op2.node_index = str(id(self))

View File

@ -0,0 +1,18 @@
from lnx.logicnode.lnx_nodes import *
class ArrayResizeNode(LnxLogicTreeNode):
"""Resize the array to the given length. For more details, please
take a look at the documentation of `Array.resize()` in the
[Haxe API](https://api.haxe.org/Array.html#resize).
"""
bl_idname = 'LNArrayResizeNode'
bl_label = 'Array Resize'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Length')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayReverseNode(LnxLogicTreeNode):
"""Reverse the items order of the array."""
bl_idname = 'LNArrayReverseNode'
bl_label = 'Array Reverse'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class ArraySampleNode(LnxLogicTreeNode):
"""Take a sample of n items from an array (boolean option to remove those items from original array)
"""
bl_idname = 'LNArraySampleNode'
bl_label = 'Array Sample'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Sample')
self.add_input('LnxBoolSocket', 'Remove')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class ArraySetNode(LnxLogicTreeNode):
"""Sets the value of the given array at the given index."""
bl_idname = 'LNArraySetNode'
bl_label = 'Array Set'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class ArrayShiftNode(LnxLogicTreeNode):
"""Removes the first element of the given array.
@see [Haxe API](https://api.haxe.org/Array.html#shift)"""
bl_idname = 'LNArrayShiftNode'
bl_label = 'Array Shift'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxDynamicSocket', 'Value')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayShuffleNode(LnxLogicTreeNode):
"""Shuffle the items in the array and return a new array
"""
bl_idname = 'LNArrayShuffleNode'
bl_label = 'Array Shuffle'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class ArraySliceNode(LnxLogicTreeNode):
"""Creates a shallow copy of the given array in the specified range.
@see [Haxe API](https://api.haxe.org/Array.html#slice)"""
bl_idname = 'LNArraySliceNode'
bl_label = 'Array Slice'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_input('LnxIntSocket', 'End')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class ArraySortNode(LnxLogicTreeNode):
"""Sort the items order of the array by ascending or descending."""
bl_idname = 'LNArraySortNode'
bl_label = 'Array Sort'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxBoolSocket', 'Descending', default_value=False)
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,18 @@
from lnx.logicnode.lnx_nodes import *
class ArraySpliceNode(LnxLogicTreeNode):
"""Removes the given amount of elements from the given array and returns it.
@see [Haxe API](https://api.haxe.org/Array.html#splice)"""
bl_idname = 'LNArraySpliceNode'
bl_label = 'Array Splice'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxIntSocket', 'Index')
self.add_input('LnxIntSocket', 'Length')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class StringArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of string elements as a variable."""
bl_idname = 'LNArrayStringNode'
bl_label = 'Array String'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(StringArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxStringSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxStringSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,50 @@
from lnx.logicnode.lnx_nodes import *
class VectorArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores an array of vector elements as a variable."""
bl_idname = 'LNArrayVectorNode'
bl_label = 'Array Vector'
lnx_version = 3
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(VectorArrayNode, self).__init__()
self.register_id()
def lnx_init(self, context):
self.add_output('LnxNodeSocketArray', 'Array', is_var=True)
self.add_output('LnxIntSocket', 'Length')
def draw_content(self, context, layout):
row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
op.node_index = self.get_id_str()
op.socket_type = 'LnxVectorSocket'
column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = self.get_id_str()
if len(self.inputs) == self.min_inputs:
column.enabled = False
def draw_label(self) -> str:
if len(self.inputs) == self.min_inputs:
return super().draw_label()
return f'{super().draw_label()} [{len(self.inputs)}]'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs.clear()
for i in range(len(master_node.inputs)):
inp = self.add_input('LnxVectorSocket', master_node.inputs[i].name)
inp.hide = self.lnx_logic_id != ''
inp.enabled = self.lnx_logic_id == ''
inp.default_value_raw = master_node.inputs[i].get_default_value()
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 2):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,4 @@
from lnx.logicnode.lnx_nodes import add_node_section
add_node_section(name='variable', category='Array')
add_node_section(name='default', category='Array')