armory/blender/arm/logicnode/input/LN_keyboard.py

82 lines
2.8 KiB
Python
Raw Normal View History

2017-04-10 21:17:17 +02:00
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class KeyboardNode(ArmLogicTreeNode):
2017-04-10 21:17:17 +02:00
'''Keyboard node'''
bl_idname = 'LNMergedKeyboardNode'
bl_label = 'Keyboard'
2020-08-07 19:00:46 +02:00
bl_icon = 'NONE'
2019-11-04 21:35:18 +01:00
2018-12-18 23:48:38 +01:00
property0: EnumProperty(
2017-04-10 21:17:17 +02:00
items = [('Down', 'Down', 'Down'),
('Started', 'Started', 'Started'),
('Released', 'Released', 'Released')],
name='', default='Started')
2019-11-04 21:35:18 +01:00
2018-12-18 23:48:38 +01:00
property1: EnumProperty(
2017-04-10 21:17:17 +02:00
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'),
2019-11-04 21:35:18 +01:00
('.', 'period', 'period'),
(',', 'comma', 'comma'),
2017-04-10 21:17:17 +02:00
('space', 'space', 'space'),
('backspace', 'backspace', 'backspace'),
('tab', 'tab', 'tab'),
2019-06-27 17:17:11 +02:00
('enter', 'enter', 'enter'),
2017-04-10 21:17:17 +02:00
('shift', 'shift', 'shift'),
2017-06-08 02:10:40 +02:00
('control', 'control', 'control'),
2017-04-10 21:17:17 +02:00
('alt', 'alt', 'alt'),
2017-06-08 02:10:40 +02:00
('escape', 'escape', 'escape'),
('delete', 'delete', 'delete'),
2017-04-10 21:17:17 +02:00
('back', 'back', 'back'),
('up', 'up', 'up'),
('right', 'right', 'right'),
('left', 'left', 'left'),
('down', 'down', 'down'),],
name='', default='space')
def init(self, context):
self.outputs.new('ArmNodeSocketAction', 'Out')
2017-04-10 21:17:17 +02:00
self.outputs.new('NodeSocketBool', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
layout.prop(self, 'property1')
add_node(KeyboardNode, category=MODULE_AS_CATEGORY, section='keyboard')