forked from LeenkxTeam/LNXSDK
Repe [T3DU] and Moises Jpelaez updates
This commit is contained in:
45
leenkx/blender/lnx/logicnode/signal/LN_emit_signal.py
Normal file
45
leenkx/blender/lnx/logicnode/signal/LN_emit_signal.py
Normal file
@ -0,0 +1,45 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class EmitSignalNode(LnxLogicTreeNode):
|
||||
"""Emits a Signal with optional arguments.
|
||||
|
||||
Connect a Signal instance to the Signal input. When this node is activated,
|
||||
it calls emit() on the Signal, passing any connected arguments to all
|
||||
connected OnSignal nodes.
|
||||
|
||||
Use 'Add Arg' to add input sockets for passing data to listeners.
|
||||
|
||||
@seeNode Signal
|
||||
@seeNode On Signal"""
|
||||
|
||||
bl_idname = 'LNEmitSignalNode'
|
||||
bl_label = 'Emit Signal'
|
||||
lnx_version = 1
|
||||
lnx_section = 'signal'
|
||||
min_inputs = 2
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EmitSignalNode, self).__init__(*args, **kwargs)
|
||||
array_nodes[str(id(self))] = self
|
||||
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Signal')
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
row = layout.row(align=True)
|
||||
op = row.operator('lnx.node_add_input', text='Add Arg', icon='PLUS', emboss=True)
|
||||
op.node_index = str(id(self))
|
||||
op.socket_type = 'LnxDynamicSocket'
|
||||
op.name_format = "Arg {0}"
|
||||
op.index_name_offset = -1
|
||||
column = row.column(align=True)
|
||||
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
|
||||
op.node_index = str(id(self))
|
||||
if len(self.inputs) == self.min_inputs:
|
||||
column.enabled = False
|
||||
Reference in New Issue
Block a user