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
|
||||
25
leenkx/blender/lnx/logicnode/signal/LN_global_signal.py
Normal file
25
leenkx/blender/lnx/logicnode/signal/LN_global_signal.py
Normal file
@ -0,0 +1,25 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class GlobalSignalNode(LnxLogicTreeNode):
|
||||
"""Gets or creates a global Signal by name.
|
||||
|
||||
Global Signals are stored in a static registry and can be accessed from
|
||||
any logic tree in the scene. Provide a unique name to identify the signal.
|
||||
|
||||
Use this for communication between different objects or logic trees without
|
||||
needing to pass Signal references directly.
|
||||
|
||||
@seeNode Signal
|
||||
@seeNode On Signal
|
||||
@seeNode Emit Signal"""
|
||||
|
||||
bl_idname = 'LNGlobalSignalNode'
|
||||
bl_label = 'Global Signal'
|
||||
lnx_version = 1
|
||||
lnx_section = 'signal'
|
||||
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxStringSocket', 'Property')
|
||||
self.add_output('LnxDynamicSocket', 'Signal')
|
||||
44
leenkx/blender/lnx/logicnode/signal/LN_on_signal.py
Normal file
44
leenkx/blender/lnx/logicnode/signal/LN_on_signal.py
Normal file
@ -0,0 +1,44 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class OnSignalNode(LnxLogicTreeNode):
|
||||
"""Activates the output when the given Signal emits.
|
||||
|
||||
Connect a Signal instance to the input. When that Signal emits,
|
||||
the output is activated and emitted arguments are available on
|
||||
the dynamic output sockets.
|
||||
|
||||
Use 'Add Arg' to add output sockets for receiving emitted data.
|
||||
|
||||
@seeNode Signal
|
||||
@seeNode Emit Signal"""
|
||||
|
||||
bl_idname = 'LNOnSignalNode'
|
||||
bl_label = 'On Signal'
|
||||
lnx_version = 1
|
||||
lnx_section = 'signal'
|
||||
min_outputs = 1
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OnSignalNode, self).__init__(*args, **kwargs)
|
||||
array_nodes[str(id(self))] = self
|
||||
|
||||
|
||||
def lnx_init(self, context):
|
||||
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_output', 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 = 0
|
||||
column = row.column(align=True)
|
||||
op = column.operator('lnx.node_remove_output', text='', icon='X', emboss=True)
|
||||
op.node_index = str(id(self))
|
||||
if len(self.outputs) == self.min_outputs:
|
||||
column.enabled = False
|
||||
27
leenkx/blender/lnx/logicnode/signal/LN_signal.py
Normal file
27
leenkx/blender/lnx/logicnode/signal/LN_signal.py
Normal file
@ -0,0 +1,27 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class SignalNode(LnxLogicTreeNode):
|
||||
"""Creates a new Signal or references an existing Signal from an object's property.
|
||||
|
||||
**Standalone Mode (default):**
|
||||
Creates a new Signal instance that can be connected to OnSignal and EmitSignal nodes.
|
||||
The Signal is stored in the LogicTree and persists for the lifetime of the trait.
|
||||
|
||||
**Reference Mode:**
|
||||
When Object and Property inputs are connected, retrieves an existing Signal
|
||||
from a Haxe trait's property using reflection.
|
||||
|
||||
@seeNode On Signal
|
||||
@seeNode Emit Signal"""
|
||||
|
||||
bl_idname = 'LNSignalNode'
|
||||
bl_label = 'Signal'
|
||||
lnx_version = 1
|
||||
lnx_section = 'signal'
|
||||
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxStringSocket', 'Property')
|
||||
self.add_output('LnxDynamicSocket', 'Signal')
|
||||
3
leenkx/blender/lnx/logicnode/signal/__init__.py
Normal file
3
leenkx/blender/lnx/logicnode/signal/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
from lnx.logicnode.lnx_nodes import add_node_section
|
||||
|
||||
add_node_section(name='signal', category='Signal')
|
||||
Reference in New Issue
Block a user