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,37 @@
from lnx.logicnode.lnx_nodes import *
class CursorInRegionNode(LnxLogicTreeNode):
"""Detect cursor in specific region.
@input Center X/Y: The position of the center in pixels.
@input Width: Width of the region in pixels.
@input Height: Height of the region in pixels.
@input Angle: Rotation angle in radians. Rotation is clockwise.
@output On Enter: Activated after the cursor enters the region.
@output On Exit: Activated after the cursor exits the region.
@output Is Inside: True if inside the region. False otherwise.
"""
bl_idname = 'LNCursorInRegionNode'
bl_label = 'Cursor In Region'
lnx_section = 'mouse'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('rectangle', 'Rectangle', 'Rectangular region'),
('ellipse', 'Ellipse', 'Elliptical or Circular region')],
name='', default='rectangle')
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'Center X')
self.add_input('LnxFloatSocket', 'Center Y')
self.add_input('LnxFloatSocket', 'Width')
self.add_input('LnxFloatSocket', 'Height')
self.add_input('LnxFloatSocket', 'Angle')
self.add_output('LnxNodeSocketAction', 'On Enter')
self.add_output('LnxNodeSocketAction', 'On Exit')
self.add_output('LnxBoolSocket', 'Is Inside')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,64 @@
from lnx.logicnode.lnx_nodes import *
class GamepadNode(LnxLogicTreeNode):
"""Activates the output on the given gamepad event.
@seeNode Gamepad Coords
@input Gamepad: the ID of the gamepad.
@option State: the state of the gamepad button to listen to.
@option Button: the gamepad button that should activate the output.
"""
bl_idname = 'LNMergedGamepadNode'
bl_label = 'Gamepad'
lnx_version = 1
lnx_section = 'gamepad'
property0: HaxeEnumProperty(
'property0',
items = [('started', 'Started', 'The gamepad button starts to be pressed'),
('down', 'Down', 'The gamepad button is pressed'),
('released', 'Released', 'The gamepad button stops being pressed')],
# ('Moved Left', 'Moved Left', 'Moved Left'),
# ('Moved Right', 'Moved Right', 'Moved Right'),],
name='', default='down')
property1: HaxeEnumProperty(
'property1',
items = [('cross', 'cross / a', 'cross / a'),
('circle', 'circle / b', 'circle / b'),
('square', 'square / x', 'square / x'),
('triangle', 'triangle / y', 'triangle / y'),
('l1', 'l1 / lb', 'l1 / lb'),
('r1', 'r1 / rb', 'r1 / rb'),
('l2', 'l2 / lt', 'l2 / lt'),
('r2', 'r2 / rt', 'r2 / rt'),
('share', 'share', 'share'),
('options', 'options', 'options'),
('l3', 'l3', 'l3'),
('r3', 'r3', 'r3'),
('up', 'up', 'up'),
('down', 'down', 'down'),
('left', 'left', 'left'),
('right', 'right', 'right'),
('home', 'home', 'home'),
('touchpad', 'touchpad', 'touchpad'),],
name='', default='cross')
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
self.add_input('LnxIntSocket', 'Gamepad')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')
def draw_label(self) -> str:
inp_gamepad = self.inputs['Gamepad']
if inp_gamepad.is_linked:
return f'{self.bl_label}: {self.property1}'
return f'{self.bl_label} {inp_gamepad.default_value_raw}: {self.property1}'

View File

@ -0,0 +1,22 @@
from lnx.logicnode.lnx_nodes import *
class GamepadCoordsNode(LnxLogicTreeNode):
"""Returns the coordinates of the given gamepad.
@seeNode Gamepad
@input Gamepad: the ID of the gamepad."""
bl_idname = 'LNGamepadCoordsNode'
bl_label = 'Gamepad Coords'
lnx_version = 1
lnx_section = 'gamepad'
def lnx_init(self, context):
self.add_output('LnxVectorSocket', 'Left Stick')
self.add_output('LnxVectorSocket', 'Right Stick')
self.add_output('LnxVectorSocket', 'Left Movement')
self.add_output('LnxVectorSocket', 'Right Movement')
self.add_output('LnxFloatSocket', 'Left Trigger')
self.add_output('LnxFloatSocket', 'Right Trigger')
self.add_input('LnxIntSocket', 'Gamepad')

View File

@ -0,0 +1,52 @@
from lnx.logicnode.lnx_nodes import *
class GamepadSticksNode(LnxLogicTreeNode):
"""Activates the output on the given gamepad event.
@seeNode Gamepad Coords
@input Gamepad: the ID of the gamepad.
@option state: the state of the gamepad stick to listen to.
@option stick: the gamepad stick that should activate the output.
@option axis: the gamepad stick axis value
"""
bl_idname = 'LNGamepadSticksNode'
bl_label = 'Gamepad Sticks'
lnx_version = 1
lnx_section = 'gamepad'
property0: HaxeEnumProperty(
'property0',
items = [('Started', 'Started', 'Started'),
('Down', 'Down', 'Down'),
('Released', 'Released', 'Released'),],
name='', default='Down')
property1: HaxeEnumProperty(
'property1',
items = [('LeftStick', 'LeftStick', 'LeftStick'), ('RightStick', 'RightStick', 'RightStick'),],
name='', default='LeftStick')
property2: HaxeEnumProperty(
'property2',
items = [('up', 'up', 'up'),
('down', 'down', 'down'),
('left', 'left', 'left'),
('right', 'right', 'right'),
('up-left', 'up-left', 'up-left'),
('up-right', 'up-right', 'up-right'),
('down-left', 'down-left', 'down-left'),
('down-right', 'down-right', 'down-right'),],
name='', default='up')
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
self.add_input('LnxIntSocket', 'Gamepad')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')
layout.prop(self, 'property2')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class GetCursorLocationNode(LnxLogicTreeNode):
"""Returns the mouse cursor location in screen coordinates (pixels)."""
bl_idname = 'LNGetCursorLocationNode'
bl_label = 'Get Cursor Location'
lnx_section = 'mouse'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxIntSocket', 'X')
self.add_output('LnxIntSocket', 'Y')
self.add_output('LnxIntSocket', 'Inverted X')
self.add_output('LnxIntSocket', 'Inverted Y')

View File

@ -0,0 +1,22 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from lnx.logicnode.lnx_nodes import *
class GetCursorStateNode(LnxLogicTreeNode):
"""Returns the state of the mouse cursor.
@seeNode Set Cursor State
@output Is Hidden Locked: `true` if the mouse cursor is both hidden and locked.
@output Is Hidden: `true` if the mouse cursor is hidden.
@output Is Locked: `true` if the mouse cursor is locked."""
bl_idname = 'LNGetCursorStateNode'
bl_label = 'Get Cursor State'
lnx_section = 'mouse'
lnx_version = 1
def lnx_init(self, context):
self.outputs.new('LnxBoolSocket', 'Is Hidden Locked')
self.outputs.new('LnxBoolSocket', 'Is Hidden')
self.outputs.new('LnxBoolSocket', 'Is Locked')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class GetGamepadStartedNode(LnxLogicTreeNode):
"""."""
bl_idname = 'LNGetGamepadStartedNode'
bl_label = 'Get Gamepad Started'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'Index')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxStringSocket', 'Button')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class GetInputMapKeyNode(LnxLogicTreeNode):
"""Get key data if it exists in the input map."""
bl_idname = 'LNGetInputMapKeyNode'
bl_label = 'Get Input Map Key'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxStringSocket', 'Input Map')
self.add_input('LnxStringSocket', 'Key')
self.add_output('LnxFloatSocket', 'Scale', default_value = 1.0)
self.add_output('LnxFloatSocket', 'Deadzone')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class GetKeyboardStartedNode(LnxLogicTreeNode):
"""."""
bl_idname = 'LNGetKeyboardStartedNode'
bl_label = 'Get Keyboard Started'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxStringSocket', 'Key')

View File

@ -0,0 +1,23 @@
from lnx.logicnode.lnx_nodes import *
class GetMouseMovementNode(LnxLogicTreeNode):
"""Get the movement coordinates of the mouse and the mouse wheel delta.
The multiplied output variants default to -1 to invert the values."""
bl_idname = 'LNGetMouseMovementNode'
bl_label = 'Get Mouse Movement'
lnx_section = 'mouse'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'X Multiplier', default_value=-1.0)
self.add_input('LnxFloatSocket', 'Y Multiplier', default_value=-1.0)
self.add_input('LnxFloatSocket', 'Wheel Delta Multiplier', default_value=-1.0)
self.add_output('LnxFloatSocket', 'X')
self.add_output('LnxFloatSocket', 'Y')
self.add_output('LnxFloatSocket', 'Multiplied X')
self.add_output('LnxFloatSocket', 'Multiplied Y')
self.add_output('LnxIntSocket', 'Wheel Delta')
self.add_output('LnxFloatSocket', 'Multiplied Wheel Delta')

View File

@ -0,0 +1,36 @@
from lnx.logicnode.lnx_nodes import *
class GetMouseStartedNode(LnxLogicTreeNode):
"""."""
bl_idname = 'LNGetMouseStartedNode'
bl_label = 'Get Mouse Started'
lnx_version = 2
property0: HaxeBoolProperty(
'property0',
name='Include Debug Console',
description=(
'If disabled, this node does not react to mouse press events'
' over the debug console area. Enable this option to catch those events'
)
)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxStringSocket', 'Button')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNGetMouseStartedNode', self.lnx_version, 'LNGetMouseStartedNode', 2,
in_socket_mapping={0: 0}, out_socket_mapping={0: 0, 1: 1},
property_defaults={'property0': True}
)

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class GetTouchLocationNode(LnxLogicTreeNode):
"""Returns the location of the last touch event in screen coordinates (pixels)."""
bl_idname = 'LNGetTouchLocationNode'
bl_label = 'Get Touch Location'
lnx_section = 'surface'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxIntSocket', 'X')
self.add_output('LnxIntSocket', 'Y')
self.add_output('LnxIntSocket', 'Inverted X')
self.add_output('LnxIntSocket', 'Inverted Y')

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class GetTouchMovementNode(LnxLogicTreeNode):
"""Returns the movement values of the current touch event."""
bl_idname = 'LNGetTouchMovementNode'
bl_label = 'Get Touch Movement'
lnx_section = 'surface'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'X Multiplier', default_value=-1.0)
self.add_input('LnxFloatSocket', 'Y Multiplier', default_value=-1.0)
self.add_output('LnxFloatSocket', 'X')
self.add_output('LnxFloatSocket', 'Y')
self.add_output('LnxFloatSocket', 'Multiplied X')
self.add_output('LnxFloatSocket', 'Multiplied Y')

View File

@ -0,0 +1,89 @@
from lnx.logicnode.lnx_nodes import *
class KeyboardNode(LnxLogicTreeNode):
"""Activates the output on the given keyboard button event."""
bl_idname = 'LNMergedKeyboardNode'
bl_label = 'Keyboard'
lnx_section = 'keyboard'
lnx_version = 2
property0: HaxeEnumProperty(
'property0',
items = [('started', 'Started', 'The keyboard button starts to be pressed'),
('down', 'Down', 'The keyboard button is pressed'),
('released', 'Released', 'The keyboard button stops being pressed')],
name='', default='down')
property1: HaxeEnumProperty(
'property1',
items = [('a', 'a', 'a'),
('b', 'b', 'b'),
('c', 'c', 'c'),
('d', 'd', 'd'),
('e', 'e', 'e'),
('f', 'f', 'f'),
('g', 'g', 'g'),
('h', 'h', 'h'),
('i', 'i', 'i'),
('j', 'j', 'j'),
('k', 'k', 'k'),
('l', 'l', 'l'),
('m', 'm', 'm'),
('n', 'n', 'n'),
('o', 'o', 'o'),
('p', 'p', 'p'),
('q', 'q', 'q'),
('r', 'r', 'r'),
('s', 's', 's'),
('t', 't', 't'),
('u', 'u', 'u'),
('v', 'v', 'v'),
('w', 'w', 'w'),
('x', 'x', 'x'),
('y', 'y', 'y'),
('z', 'z', 'z'),
('0', '0', '0'),
('1', '1', '1'),
('2', '2', '2'),
('3', '3', '3'),
('4', '4', '4'),
('5', '5', '5'),
('6', '6', '6'),
('7', '7', '7'),
('8', '8', '8'),
('9', '9', '9'),
('.', 'period', 'period'),
(',', 'comma', 'comma'),
('space', 'space', 'space'),
('backspace', 'backspace', 'backspace'),
('tab', 'tab', 'tab'),
('enter', 'enter', 'enter'),
('shift', 'shift', 'shift'),
('control', 'control', 'control'),
('alt', 'alt', 'alt'),
('capslock', 'capslock', 'capslock'),
('escape', 'escape', 'escape'),
('delete', 'delete', 'delete'),
('back', 'back', 'back'),
('up', 'up', 'up'),
('right', 'right', 'right'),
('left', 'left', 'left'),
('down', 'down', 'down'),],
name='', default='space')
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')
def draw_label(self) -> str:
return f'{self.bl_label}: {self.property1}'
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,61 @@
from lnx.logicnode.lnx_nodes import *
class MouseNode(LnxLogicTreeNode):
"""Activates the output on the given mouse event."""
bl_idname = 'LNMergedMouseNode'
bl_label = 'Mouse'
lnx_section = 'mouse'
lnx_version = 3
property0: HaxeEnumProperty(
'property0',
items = [('started', 'Started', 'The mouse button begins to be pressed'),
('down', 'Down', 'The mouse button is pressed'),
('released', 'Released', 'The mouse button stops being pressed'),
('moved', 'Moved', 'Moved')],
name='', default='down')
property1: HaxeEnumProperty(
'property1',
items = [('left', 'Left', 'Left mouse button'),
('middle', 'Middle', 'Middle mouse button'),
('right', 'Right', 'Right mouse button'),
('side1', 'Side 1', 'Side 1 mouse button'),
('side2', 'Side 2', 'Side 2 mouse button')],
name='', default='left')
property2: HaxeBoolProperty(
'property2',
name='Include Debug Console',
description=(
'If disabled, this node does not react to mouse press events'
' over the debug console area. Enable this option to catch those events'
)
)
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
if self.property0 != 'moved':
layout.prop(self, 'property1')
layout.prop(self, 'property2')
def draw_label(self) -> str:
return f'{self.bl_label}: {self.property1}'
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if 0 <= self.lnx_version < 2:
return NodeReplacement.Identity(self)
elif self.lnx_version == 2:
return NodeReplacement(
'LNMergedMouseNode', self.lnx_version, 'LNMergedMouseNode', 3,
in_socket_mapping={}, out_socket_mapping={0: 0, 1: 1},
property_mapping={'property0': 'property0', 'property1': 'property1'},
property_defaults={'property2': True}
)
raise LookupError()

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class OnInputMapNode(LnxLogicTreeNode):
"""Send a signal if any input map key is started or released."""
bl_idname = 'LNOnInputMapNode'
bl_label = 'On Input Map'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxStringSocket', 'Input Map')
self.add_output('LnxNodeSocketAction', 'Started')
self.add_output('LnxNodeSocketAction', 'Released')
self.add_output('LnxFloatSocket', 'Value')
self.add_output('LnxStringSocket', 'Key Pressed')

View File

@ -0,0 +1,98 @@
from lnx.logicnode.lnx_nodes import *
# Custom class for add output parameters (in 4 directions)
class NodeAddOutputButton(bpy.types.Operator):
"""Add 4 States"""
bl_idname = 'lnx.add_output_4_parameters'
bl_label = 'Add 4 States'
bl_options = {'UNDO', 'INTERNAL'}
node_index: StringProperty(name='Node Index', default='')
socket_type: StringProperty(name='Socket Type', default='LnxDynamicSocket')
name_format: StringProperty(name='Name Format', default='Output {0}')
index_name_offset: IntProperty(name='Index Name Offset', default=0)
# Get name State
def get_name_state(self, id, min_outputs):
states = ['UP', 'DOWN', 'LEFT', 'RIGHT', 'UP-LEFT', 'UP-RIGHT', 'DOWN-LEFT', 'DOWN-RIGHT']
if ((id - min_outputs) < len(states)): return states[id - min_outputs]
return ''
def execute(self, context):
global array_nodes
node = array_nodes[self.node_index]
outs = node.outputs
outs.new('LnxBoolSocket', self.get_name_state(len(outs), node.min_outputs))
outs.new('LnxBoolSocket', self.get_name_state(len(outs), node.min_outputs))
outs.new('LnxBoolSocket', self.get_name_state(len(outs), node.min_outputs))
outs.new('LnxBoolSocket', self.get_name_state(len(outs), node.min_outputs))
return{'FINISHED'}
# Custom class for remove output parameters (in 4 directions)
class NodeRemoveOutputButton(bpy.types.Operator):
"""Remove 4 last states"""
bl_idname = 'lnx.remove_output_4_parameters'
bl_label = 'Remove 4 States'
bl_options = {'UNDO', 'INTERNAL'}
node_index: StringProperty(name='Node Index', default='')
def execute(self, context):
global array_nodes
node = array_nodes[self.node_index]
outs = node.outputs
min_outs = 0 if not hasattr(node, 'min_outputs') else node.min_outputs
if len(outs) > min_outs:
for i in range(4):
outs.remove(outs.values()[-1])
return{'FINISHED'}
# Class SwipeNode
class OnSwipeNode(LnxLogicTreeNode):
"""Activates the output on the given swipe event."""
bl_idname = 'LNOnSwipeNode'
bl_label = 'On Swipe'
lnx_version = 1
lnx_section = 'Input'
min_outputs = 4
max_outputs = 12
def __init__(self):
super(OnSwipeNode, self).__init__()
array_nodes[str(id(self))] = self
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'Time', default_value=0.15)
self.add_input('LnxIntSocket', 'Min Length (px)', default_value=100)
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxVectorSocket', 'Direction')
self.add_output('LnxIntSocket', 'Length (px)')
self.add_output('LnxIntSocket', 'Angle (0-360)')
# Draw node buttons
def draw_buttons(self, context, layout):
row = layout.row(align=True)
column = row.column(align=True)
# Button add output
op = column.operator('lnx.add_output_4_parameters', text='Add 4 States', icon='PLUS', emboss=True)
op.node_index = str(id(self))
# Disable/Enabled button
if (len(self.outputs) == self.max_outputs):
column.enabled = False
# Button remove output
column = row.column(align=True)
op2 = column.operator('lnx.remove_output_4_parameters', text='', icon='X', emboss=True)
op2.node_index = str(id(self))
# Disable/Enabled button
if (len(self.outputs) == self.min_outputs):
column.enabled = False
@classmethod
def on_register(cls):
bpy.utils.register_class(NodeAddOutputButton)
bpy.utils.register_class(NodeRemoveOutputButton)
super().on_register()
@classmethod
def on_unregister(cls):
super().on_unregister()
bpy.utils.unregister_class(NodeRemoveOutputButton)
bpy.utils.unregister_class(NodeAddOutputButton)

View File

@ -0,0 +1,30 @@
from lnx.logicnode.lnx_nodes import *
class OnTapScreen(LnxLogicTreeNode):
"""Activates the output on tap screen event.
@input Duration: touching time
@input Interval: interval between taps
@input Repeat: repetitions amount to validate
@output Done: the sequence success
@output Fail: the the sequence failure
@output Tap Number: number of the last tap
@output Coords: the coordinates of the last tap
"""
bl_idname = 'LNOnTapScreen'
bl_label = 'On Tap Screen'
lnx_section = 'Input'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'Duration', default_value=0.3)
self.add_input('LnxFloatSocket', 'Interval', default_value=0.0)
self.add_input('LnxIntSocket', 'Repeat', default_value=2)
self.add_output('LnxNodeSocketAction', 'Done')
self.add_output('LnxNodeSocketAction', 'Fail')
self.add_output('LnxNodeSocketAction', 'Tap')
self.add_output('LnxIntSocket', 'Tap Number')
self.add_output('LnxVectorSocket', 'Coords')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class RemoveInputMapKeyNode(LnxLogicTreeNode):
"""Remove input map key."""
bl_idname = 'LNRemoveInputMapKeyNode'
bl_label = 'Remove Input Map Key'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Input Map')
self.add_input('LnxStringSocket', 'Key')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,28 @@
from lnx.logicnode.lnx_nodes import *
class SensorCoordsNode(LnxLogicTreeNode):
"""Sensor Coords Node: Retrieves and provides real-time information from the device's sensors.
@output Accelerometer Coords: Provides the acceleration data from the device's accelerometer,
including values for the X, Y, and Z axes.
@output Gyroscope Coords: Returns the rotational speed data from the device's gyroscope,
including values for the X, Y, and Z axes.
@output Device Orientation: Offers information about the overall orientation of the device represented in degrees (°).
"""
bl_idname = 'LNSensorCoordsNode'
bl_label = 'Sensor Coords'
lnx_section = 'sensor'
lnx_version = 2
def lnx_init(self, context):
self.add_output('LnxVectorSocket', 'Accelerometer Coords')
self.add_output('LnxVectorSocket', 'Gyroscope Coords')
self.add_output('LnxIntSocket', 'Device Orientation')
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,33 @@
from lnx.logicnode.lnx_nodes import *
class SetCursorStateNode(LnxLogicTreeNode):
"""Sets the state of the mouse cursor.
@seeNode Get Cursor State
@option Hide Locked: hide and lock or unhide and unlock the mouse cursor.
@option Hide: hide/unhide the mouse cursor.
@option Lock: lock/unlock the mouse cursor.
"""
bl_idname = 'LNSetCursorStateNode'
bl_label = 'Set Cursor State'
lnx_section = 'mouse'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('hide locked', 'Hide Locked', 'The mouse cursor is hidden and locked'),
('hide', 'Hide', 'The mouse cursor is hidden'),
('lock', 'Lock', 'The mouse cursor is locked'),
],
name='', default='hide locked')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxBoolSocket', 'State')
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,27 @@
from lnx.logicnode.lnx_nodes import *
class SetInputMapKeyNode(LnxLogicTreeNode):
"""Set input map key."""
bl_idname = 'LNSetInputMapKeyNode'
bl_label = 'Set Input Map Key'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('keyboard', 'Keyboard', 'Keyboard input'),
('mouse', 'Mouse', 'Mouse input'),
('gamepad', 'Gamepad', 'Gamepad input')],
name='', default='keyboard')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Input Map')
self.add_input('LnxStringSocket', 'Key')
self.add_input('LnxFloatSocket', 'Scale', default_value=1.0)
self.add_input('LnxFloatSocket', 'Deadzone')
self.add_input('LnxIntSocket', 'Index')
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class SurfaceNode(LnxLogicTreeNode):
"""Activates the output on the given touch event."""
bl_idname = 'LNMergedSurfaceNode'
bl_label = 'Touch'
lnx_section = 'surface'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('started', 'Started', 'The screen surface starts to be touched'),
('down', 'Down', 'The screen surface is touched'),
('released', 'Released', 'The screen surface stops being touched'),
('moved', 'Moved', 'Moved')],
name='', default='down')
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
def draw_label(self) -> str:
return f'{self.bl_label}: {self.property0}'

View File

@ -0,0 +1,37 @@
from lnx.logicnode.lnx_nodes import *
class TouchInRegionNode(LnxLogicTreeNode):
"""Detect touch in specific region.
@input Center X/Y: The position of the center in pixels.
@input Width: Width of the region in pixels.
@input Height: Height of the region in pixels.
@input Angle: Rotation angle in radians. Rotation is clockwise.
@output On Enter: Activated after the cursor enters the region.
@output On Exit: Activated after the cursor exits the region.
@output Is Inside: True if inside the region. False otherwise.
"""
bl_idname = 'LNTouchInRegionNode'
bl_label = 'Touch In Region'
lnx_section = 'surface'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('rectangle', 'Rectangle', 'Rectangular region'),
('ellipse', 'Ellipse', 'Elliptical or Circular region')],
name='', default='rectangle')
def lnx_init(self, context):
self.add_input('LnxFloatSocket', 'Center X')
self.add_input('LnxFloatSocket', 'Center Y')
self.add_input('LnxFloatSocket', 'Width')
self.add_input('LnxFloatSocket', 'Height')
self.add_input('LnxFloatSocket', 'Angle')
self.add_output('LnxNodeSocketAction', 'On Enter')
self.add_output('LnxNodeSocketAction', 'On Exit')
self.add_output('LnxBoolSocket', 'Is Inside')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,27 @@
from lnx.logicnode.lnx_nodes import *
class VirtualButtonNode(LnxLogicTreeNode):
"""Activates the output on the given virtual button event."""
bl_idname = 'LNMergedVirtualButtonNode'
bl_label = 'Virtual Button'
lnx_section = 'virtual'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('started', 'Started', 'The virtual button starts to be pressed'),
('down', 'Down', 'The virtual button is pressed'),
('released', 'Released', 'The virtual button stops being pressed')],
name='', default='down')
property1: HaxeStringProperty('property1', name='', default='button')
def lnx_init(self, context):
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxBoolSocket', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')
def draw_label(self) -> str:
return f'{self.bl_label}: {self.property1}'

View File

@ -0,0 +1,8 @@
from lnx.logicnode.lnx_nodes import add_node_section
add_node_section(name='keyboard', category='Input')
add_node_section(name='mouse', category='Input')
add_node_section(name='gamepad', category='Input')
add_node_section(name='surface', category='Input')
add_node_section(name='sensor', category='Input')
add_node_section(name='virtual', category='Input')