Webview for RunT/Krom
This commit is contained in:
35
leenkx/blender/lnx/logicnode/krom/LN_webview_on_event.py
Normal file
35
leenkx/blender/lnx/logicnode/krom/LN_webview_on_event.py
Normal file
@ -0,0 +1,35 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class WebviewOnEventNode(LnxLogicTreeNode):
|
||||
"""Triggers when the given WebView fires an event message, load, error, or close"""
|
||||
bl_idname = 'LNWebviewOnEventNode'
|
||||
bl_label = 'Webview On Event'
|
||||
lnx_category = 'Krom Runtime'
|
||||
lnx_section = 'webview'
|
||||
lnx_version = 1
|
||||
|
||||
def update_sockets(self, context):
|
||||
for o in self.outputs:
|
||||
self.outputs.remove(o)
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
if self.property0 in ('message', 'error'):
|
||||
self.add_output('LnxStringSocket', 'Data')
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items=[('message', 'On Message', 'Triggered when a message is received'),
|
||||
('load', 'On Load', 'Triggered when the page finishes loading'),
|
||||
('error', 'On Error', 'Triggered when a load error occurs'),
|
||||
('close', 'On Close', 'Triggered when the WebView is closed')],
|
||||
name='Event', default='message', update=update_sockets)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxIntSocket', 'ID')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxStringSocket', 'Data')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
Reference in New Issue
Block a user