40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
|
|
class OnCanvasElementNode(LnxLogicTreeNode):
|
|
"""Activates the output whether an action over the given UI element is done."""
|
|
bl_idname = 'LNOnCanvasElementNode'
|
|
bl_label = 'On Canvas Element'
|
|
lnx_section = 'events'
|
|
lnx_version = 1
|
|
|
|
property0: HaxeEnumProperty(
|
|
'property0',
|
|
items=[('click', 'Click', 'Listen to mouse clicks'),
|
|
('hover', 'Hover', 'Listen to mouse hover')],
|
|
name='Listen to', default='click')
|
|
property1: HaxeEnumProperty(
|
|
'property1',
|
|
items=[('started', 'Started', 'Started'),
|
|
('down', 'Down', 'Down'),
|
|
('released', 'Released', 'Released')],
|
|
name='Status', default='started')
|
|
property2: HaxeEnumProperty(
|
|
'property2',
|
|
items=[('left', 'Left', 'Left mouse button'),
|
|
('middle', 'Middle', 'Middle mouse button'),
|
|
('right', 'Right', 'Right mouse button')],
|
|
name='Mouse Button', default='left')
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxStringSocket', 'Element')
|
|
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop(self, 'property0')
|
|
|
|
if self.property0 == "click":
|
|
layout.prop(self, 'property1')
|
|
layout.prop(self, 'property2')
|