forked from LeenkxTeam/LNXSDK
31 lines
1016 B
Python
31 lines
1016 B
Python
|
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
|
||
|
|
class GetKeyboardNode(LnxLogicTreeNode):
|
||
|
|
bl_idname = 'LNGetKeyboardNode'
|
||
|
|
bl_label = 'Get Keyboard'
|
||
|
|
lnx_section = 'keyboard'
|
||
|
|
lnx_version = 1
|
||
|
|
|
||
|
|
def update(self):
|
||
|
|
self.label = f'{self.bl_label}: {self.property0}'
|
||
|
|
|
||
|
|
def upd(self, context):
|
||
|
|
self.label = f'{self.bl_label}: {self.property0}'
|
||
|
|
|
||
|
|
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='started', update=upd)
|
||
|
|
|
||
|
|
def lnx_init(self, context):
|
||
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
||
|
|
self.add_output('LnxStringSocket', 'Key')
|
||
|
|
|
||
|
|
def draw_buttons(self, context, layout):
|
||
|
|
layout.prop(self, 'property0')
|
||
|
|
|
||
|
|
def draw_label(self) -> str:
|
||
|
|
return f'{self.bl_label}: {self.property0}'
|