Files
LNXSDK/leenkx/blender/lnx/logicnode/krom/LN_webview_set_property.py
2026-07-13 15:44:52 -07:00

40 lines
1.4 KiB
Python

from lnx.logicnode.lnx_nodes import *
class WebviewSetPropertyNode(LnxLogicTreeNode):
"""Sets a property of the given WebView"""
bl_idname = 'LNWebviewSetPropertyNode'
bl_label = 'Webview Set Property'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def update_sockets(self, context):
remove_list = []
for i in range(2, len(self.inputs)):
remove_list.append(self.inputs[i])
for i in remove_list:
self.inputs.remove(i)
if self.property0 == 'title':
self.add_input('LnxStringSocket', 'Title', default_value='WebView')
else:
self.add_input('LnxBoolSocket', 'Value', default_value=True)
property0: HaxeEnumProperty(
'property0',
items=[('transparent', 'Transparent', 'Set background transparency'),
('click_through', 'Click Through', 'Set click-through mode'),
('title', 'Title', 'Set window title')],
name='Property', default='transparent', update=update_sockets)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxBoolSocket', 'Value', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')