2017-04-04 23:11:31 +02:00
|
|
|
import bpy
|
|
|
|
from bpy.props import *
|
|
|
|
from bpy.types import Node, NodeSocket
|
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class ArrayAddNode(ArmLogicTreeNode):
|
2017-04-04 23:11:31 +02:00
|
|
|
'''Array add node'''
|
|
|
|
bl_idname = 'LNArrayAddNode'
|
|
|
|
bl_label = 'Array Add'
|
2020-08-07 19:00:46 +02:00
|
|
|
bl_icon = 'NONE'
|
2017-04-04 23:11:31 +02:00
|
|
|
|
2018-06-12 23:48:01 +02:00
|
|
|
def __init__(self):
|
|
|
|
array_nodes[str(id(self))] = self
|
|
|
|
|
2017-04-04 23:11:31 +02:00
|
|
|
def init(self, context):
|
2017-04-08 20:05:35 +02:00
|
|
|
self.inputs.new('ArmNodeSocketAction', 'In')
|
2018-06-12 23:16:28 +02:00
|
|
|
self.inputs.new('ArmNodeSocketArray', 'Array')
|
2020-04-12 17:33:27 +02:00
|
|
|
self.inputs.new('NodeSocketBool', 'Unique Values')
|
|
|
|
self.inputs.new('NodeSocketBool', 'Modify Original').default_value = True
|
2017-04-08 00:34:45 +02:00
|
|
|
self.inputs.new('NodeSocketShader', 'Value')
|
2017-04-08 20:05:35 +02:00
|
|
|
self.outputs.new('ArmNodeSocketAction', 'Out')
|
2020-04-12 17:33:27 +02:00
|
|
|
self.outputs.new('ArmNodeSocketArray', 'Array')
|
2017-04-04 23:11:31 +02:00
|
|
|
|
2018-06-12 23:48:01 +02:00
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
2020-04-12 17:33:27 +02:00
|
|
|
op = row.operator('arm.node_add_input_value', text='Add Input', icon='PLUS', emboss=True)
|
2018-06-12 23:48:01 +02:00
|
|
|
op.node_index = str(id(self))
|
|
|
|
op.socket_type = 'NodeSocketShader'
|
|
|
|
op2 = row.operator('arm.node_remove_input_value', text='', icon='X', emboss=True)
|
|
|
|
op2.node_index = str(id(self))
|
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
add_node(ArrayAddNode, category=MODULE_AS_CATEGORY)
|