forked from LeenkxTeam/LNXSDK
		
	
		
			
	
	
		
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								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')
							 |