2020-04-11 18:33:53 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class OnCanvasElementNode(ArmLogicTreeNode):
|
2020-10-05 19:55:56 +02:00
|
|
|
"""Activates the output whether an action over the given UI element is done."""
|
2020-04-11 18:33:53 +02:00
|
|
|
bl_idname = 'LNOnCanvasElementNode'
|
|
|
|
bl_label = 'On Canvas Element'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2020-05-14 17:34:39 +02:00
|
|
|
|
2020-04-11 18:33:53 +02:00
|
|
|
property0: EnumProperty(
|
2020-05-14 17:34:39 +02:00
|
|
|
items=[('click', 'Click', 'Listen to mouse clicks'),
|
|
|
|
('hover', 'Hover', 'Listen to mouse hover')],
|
|
|
|
name='Listen to', default='click')
|
2020-04-11 18:33:53 +02:00
|
|
|
property1: EnumProperty(
|
2020-05-14 17:34:39 +02:00
|
|
|
items=[('down', 'Down', 'Down'),
|
|
|
|
('started', 'Started', 'Started'),
|
|
|
|
('released', 'Released', 'Released')],
|
|
|
|
name='Status', default='down')
|
|
|
|
property2: EnumProperty(
|
|
|
|
items=[('left', 'Left', 'Left Button'),
|
|
|
|
('right', 'Right', 'Right Button'),
|
|
|
|
('middle', 'Middle', 'Middle Button')],
|
|
|
|
name='Mouse Button', default='left')
|
|
|
|
|
2020-04-11 18:33:53 +02:00
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(OnCanvasElementNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('NodeSocketString', 'Element')
|
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
2020-04-11 18:33:53 +02:00
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop(self, 'property0')
|
2020-05-14 17:34:39 +02:00
|
|
|
|
|
|
|
if self.property0 == "click":
|
|
|
|
layout.prop(self, 'property1')
|
|
|
|
layout.prop(self, 'property2')
|
2020-04-11 18:33:53 +02:00
|
|
|
|
2020-09-09 20:48:35 +02:00
|
|
|
add_node(OnCanvasElementNode, category=PKG_AS_CATEGORY)
|