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 GamepadNode(Node, ArmLogicTreeNode):
|
|
|
|
'''Gamepad node'''
|
2019-04-30 17:07:57 +02:00
|
|
|
bl_idname = 'LNMergedGamepadNode'
|
2019-01-30 22:05:55 +01:00
|
|
|
bl_label = 'Gamepad'
|
2017-04-10 21:17:17 +02:00
|
|
|
bl_icon = 'CURVE_PATH'
|
|
|
|
|
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')],
|
|
|
|
# ('Moved Left', 'Moved Left', 'Moved Left'),
|
|
|
|
# ('Moved Right', 'Moved Right', 'Moved Right'),],
|
|
|
|
name='', default='Started')
|
|
|
|
|
2018-12-18 23:48:38 +01:00
|
|
|
property1: EnumProperty(
|
2017-04-10 21:17:17 +02:00
|
|
|
items = [('cross', 'cross / a', 'cross / a'),
|
|
|
|
('circle', 'circle / b', 'circle / b'),
|
|
|
|
('square', 'square / x', 'square / x'),
|
|
|
|
('triangle', 'triangle / y', 'triangle / y'),
|
2019-02-16 17:44:47 +01:00
|
|
|
('l1', 'l1 / lb', 'l1 / lb'),
|
|
|
|
('r1', 'r1 / rb', 'r1 / rb'),
|
|
|
|
('l2', 'l2 / lt', 'l2 / lt'),
|
|
|
|
('r2', 'r2 / rt', 'r2 / rt'),
|
2017-04-10 21:17:17 +02:00
|
|
|
('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 init(self, context):
|
2019-01-30 22:05:55 +01:00
|
|
|
self.outputs.new('ArmNodeSocketAction', 'Out')
|
2019-02-16 17:34:53 +01:00
|
|
|
self.outputs.new('NodeSocketBool', 'State')
|
2017-04-10 21:17:17 +02:00
|
|
|
self.inputs.new('NodeSocketInt', 'Gamepad')
|
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop(self, 'property0')
|
|
|
|
layout.prop(self, 'property1')
|
|
|
|
|
|
|
|
add_node(GamepadNode, category='Input')
|