Webview for RunT/Krom
This commit is contained in:
37
leenkx/blender/lnx/logicnode/krom/LN_webview_load.py
Normal file
37
leenkx/blender/lnx/logicnode/krom/LN_webview_load.py
Normal file
@ -0,0 +1,37 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class WebviewLoadNode(LnxLogicTreeNode):
|
||||
"""Loads HTML content or a URL into the given WebView"""
|
||||
bl_idname = 'LNWebviewLoadNode'
|
||||
bl_label = 'Webview Load'
|
||||
lnx_category = 'Krom Runtime'
|
||||
lnx_section = 'webview'
|
||||
lnx_version = 1
|
||||
|
||||
def update_sockets(self, context):
|
||||
for i in self.inputs:
|
||||
self.inputs.remove(i)
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxIntSocket', 'ID')
|
||||
if self.property0 == 'html':
|
||||
self.add_input('LnxStringSocket', 'HTML')
|
||||
else:
|
||||
self.add_input('LnxStringSocket', 'URL')
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items=[('html', 'HTML', 'Load HTML content'),
|
||||
('url', 'URL', 'Load a URL')],
|
||||
name='Load Type', default='url', update=update_sockets)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxIntSocket', 'ID')
|
||||
self.add_input('LnxStringSocket', 'URL')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
Reference in New Issue
Block a user