forked from LeenkxTeam/LNXSDK
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
|
|
class WebviewDOMNode(LnxLogicTreeNode):
|
|
"""Sets or gets the active DOM WebView"""
|
|
bl_idname = 'LNWebviewDOMNode'
|
|
bl_label = 'Webview DOM'
|
|
lnx_category = 'Krom Runtime'
|
|
lnx_section = 'webview'
|
|
lnx_version = 1
|
|
|
|
def update_sockets(self, context):
|
|
for i in self.inputs:
|
|
self.inputs.remove(i)
|
|
for o in self.outputs:
|
|
self.outputs.remove(o)
|
|
|
|
if self.property0 == 'set':
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
|
self.add_input('LnxIntSocket', 'ID')
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
else:
|
|
self.add_output('LnxIntSocket', 'ID')
|
|
|
|
property0: HaxeEnumProperty(
|
|
'property0',
|
|
items=[('set', 'Set Active', 'Set the active DOM WebView'),
|
|
('get', 'Get Active', 'Get the active DOM WebView ID')],
|
|
name='Mode', default='set', update=update_sockets)
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
|
self.add_input('LnxIntSocket', 'ID')
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop(self, 'property0')
|