LNXSDK/leenkx/blender/lnx/logicnode/random/LN_random_output.py
2025-01-22 16:18:30 +01:00

26 lines
794 B
Python

from lnx.logicnode.lnx_nodes import *
class RandomOutputNode(LnxLogicTreeNode):
"""Activate a random output when the input is activated."""
bl_idname = 'LNRandomOutputNode'
bl_label = 'Random Output'
lnx_section = 'logic'
lnx_version = 1
def __init__(self):
array_nodes[str(id(self))] = 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 = str(id(self))
op.socket_type = 'LnxNodeSocketAction'
op2 = row.operator('lnx.node_remove_output', text='', icon='X', emboss=True)
op2.node_index = str(id(self))