Webview for RunT/Krom

This commit is contained in:
Gorochu
2026-07-13 15:44:52 -07:00
parent 7b2f21c499
commit 31a6a9d7ec
75 changed files with 1488 additions and 46 deletions

View File

@ -33,8 +33,10 @@ def init_categories():
lnx_nodes.add_category('Input', icon='GREASEPENCIL', section="basic")
lnx_nodes.add_category('Native', icon='MEMORY', section="basic",
description="The Native category contains nodes which interact with the system (Input/Output functionality, etc.) or Haxe.")
lnx_nodes.add_category('Browser', icon='URL', section="basic")
lnx_nodes.add_category('Krom Runtime', icon='WINDOW', section="basic",
description="Krom specific nodes for WebView, Networking, Window, Display, File and System operations etc.")
lnx_nodes.add_category('Camera', icon='OUTLINER_OB_CAMERA', section="data")
lnx_nodes.add_category('Material', icon='MATERIAL', section="data")
lnx_nodes.add_category('Light', icon='LIGHT', section="data")

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class KromCopyToClipboardNode(LnxLogicTreeNode):
"""Copies the given text to the system clipboard"""
bl_idname = 'LNKromCopyToClipboardNode'
bl_label = 'Copy To Clipboard'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Text')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class KromDelayIdleSleepNode(LnxLogicTreeNode):
"""Delays idle sleep on mobile platforms to keep the runtime active"""
bl_idname = 'LNKromDelayIdleSleepNode'
bl_label = 'Delay Idle Sleep'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class KromDeleteFileNode(LnxLogicTreeNode):
"""Deletes the file at the given path."""
bl_idname = 'LNKromDeleteFileNode'
bl_label = 'Delete File'
lnx_category = 'Krom Runtime'
lnx_section = 'file'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Path')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class KromFileExistsNode(LnxLogicTreeNode):
"""Checks whether a file exists at the given path"""
bl_idname = 'LNKromFileExistsNode'
bl_label = 'File Exists'
lnx_category = 'Krom Runtime'
lnx_section = 'file'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxStringSocket', 'Path')
self.add_output('LnxBoolSocket', 'Exists')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class KromGetArgNode(LnxLogicTreeNode):
"""Returns the command-line argument at the given index"""
bl_idname = 'LNKromGetArgNode'
bl_label = 'Get Arg'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'Index')
self.add_output('LnxStringSocket', 'Arg')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class KromGetArgCountNode(LnxLogicTreeNode):
"""Returns the number of command line arguments passed to the application"""
bl_idname = 'LNKromGetArgCountNode'
bl_label = 'Get Arg Count'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxIntSocket', 'Count')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class KromGetFilesLocationNode(LnxLogicTreeNode):
"""Returns the files location path for the application"""
bl_idname = 'LNKromGetFilesLocationNode'
bl_label = 'Get Files Location'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxStringSocket', 'Path')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class KromSavePathNode(LnxLogicTreeNode):
"""Returns the save path for the application."""
bl_idname = 'LNKromSavePathNode'
bl_label = 'Save Path'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxStringSocket', 'Path')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class KromSetApplicationNameNode(LnxLogicTreeNode):
"""Sets the application name used for save paths"""
bl_idname = 'LNKromSetApplicationNameNode'
bl_label = 'Set Application Name'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Name')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class KromShowKeyboardNode(LnxLogicTreeNode):
"""Shows or hides the onscreen keyboard for mobile platforms"""
bl_idname = 'LNKromShowKeyboardNode'
bl_label = 'Show Keyboard'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxBoolSocket', 'Show', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,18 @@
from lnx.logicnode.lnx_nodes import *
class KromSysCommandNode(LnxLogicTreeNode):
"""Executes a system command and returns the exit code"""
bl_idname = 'LNKromSysCommandNode'
bl_label = 'System Command'
lnx_category = 'Krom Runtime'
lnx_section = 'system'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Command')
self.add_input('LnxDynamicSocket', 'Args')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxIntSocket', 'Exit Code')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class WebviewCountNode(LnxLogicTreeNode):
"""Returns the number of active WebViews"""
bl_idname = 'LNWebviewCountNode'
bl_label = 'Webview Count'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxIntSocket', 'Count')

View File

@ -0,0 +1,34 @@
from lnx.logicnode.lnx_nodes import *
class WebviewCreateNode(LnxLogicTreeNode):
"""Creates a WebView window and returns its ID"""
bl_idname = 'LNWebviewCreateNode'
bl_label = 'Webview Create'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('embedded', 'Embedded', 'Embed webview in the engine window'),
('external', 'External', 'Detached OS window')],
name='Window Mode', default='external')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'X', default_value=0)
self.add_input('LnxIntSocket', 'Y', default_value=0)
self.add_input('LnxIntSocket', 'Width', default_value=800)
self.add_input('LnxIntSocket', 'Height', default_value=600)
self.add_input('LnxBoolSocket', 'Transparent', default_value=True)
self.add_input('LnxStringSocket', 'Title', default_value='WebView')
self.add_input('LnxStringSocket', 'HTML')
self.add_input('LnxStringSocket', 'URL')
self.add_input('LnxBoolSocket', 'Show', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxIntSocket', 'ID')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class WebviewDestroyNode(LnxLogicTreeNode):
"""Destroys the given WebView and frees its resources"""
bl_idname = 'LNWebviewDestroyNode'
bl_label = 'Webview Destroy'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class WebviewDevSettingsNode(LnxLogicTreeNode):
"""Enables or disables developer settings for the given WebView"""
bl_idname = 'LNWebviewDevSettingsNode'
bl_label = 'Webview Dev Settings'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('devtools', 'DevTools', 'Enable/disable developer tools'),
('context_menu', 'Context Menu', 'Enable/disable right-click context menu')],
name='Setting', default='devtools')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxBoolSocket', 'Enabled', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,37 @@
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')

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class WebviewEvalJSNode(LnxLogicTreeNode):
"""Evaluates JavaScript code in the given WebView"""
bl_idname = 'LNWebviewEvalJSNode'
bl_label = 'Webview Eval JS'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxStringSocket', 'JS')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,40 @@
from lnx.logicnode.lnx_nodes import *
class WebviewFullscreenNode(LnxLogicTreeNode):
"""Sets or gets the fullscreen state of the given WebView's detached window"""
bl_idname = 'LNWebviewFullscreenNode'
bl_label = 'Webview Fullscreen'
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_input('LnxBoolSocket', 'Fullscreen', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
else:
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxBoolSocket', 'Is Fullscreen')
property0: HaxeEnumProperty(
'property0',
items=[('set', 'Set', 'Set fullscreen state'),
('get', 'Get', 'Get fullscreen state')],
name='Mode', default='set', update=update_sockets)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxBoolSocket', 'Fullscreen', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,36 @@
from lnx.logicnode.lnx_nodes import *
class WebviewGetDimensionsNode(LnxLogicTreeNode):
"""Gets the position or size of the given WebView"""
bl_idname = 'LNWebviewGetDimensionsNode'
bl_label = 'Webview Get Dimensions'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def update_sockets(self, context):
for o in self.outputs:
self.outputs.remove(o)
if self.property0 == 'position':
self.add_output('LnxIntSocket', 'X')
self.add_output('LnxIntSocket', 'Y')
else:
self.add_output('LnxIntSocket', 'Width')
self.add_output('LnxIntSocket', 'Height')
property0: HaxeEnumProperty(
'property0',
items=[('position', 'Position', 'Get X and Y position'),
('size', 'Size', 'Get width and height')],
name='Mode', default='position', update=update_sockets)
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxIntSocket', 'X')
self.add_output('LnxIntSocket', 'Y')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class WebviewIsValidNode(LnxLogicTreeNode):
"""Checks whether the given WebView ID is valid"""
bl_idname = 'LNWebviewIsValidNode'
bl_label = 'Webview Is Valid'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxBoolSocket', 'Valid')

View 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')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class WebviewNavigationNode(LnxLogicTreeNode):
"""Performs a navigation action on the given WebView"""
bl_idname = 'LNWebviewNavigationNode'
bl_label = 'Webview Navigation'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('go_back', 'Go Back', 'Navigate back in history'),
('go_forward', 'Go Forward', 'Navigate forward in history'),
('reload', 'Reload', 'Reload the current page')],
name='Action', default='reload')
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')

View File

@ -0,0 +1,24 @@
from lnx.logicnode.lnx_nodes import *
class WebviewNavigationStateNode(LnxLogicTreeNode):
"""Checks the navigation state of the given WebView"""
bl_idname = 'LNWebviewNavigationStateNode'
bl_label = 'Webview Navigation State'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('can_go_back', 'Can Go Back', 'Check if can navigate back'),
('can_go_forward', 'Can Go Forward', 'Check if can navigate forward')],
name='Check', default='can_go_back')
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxBoolSocket', 'State')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View 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')

View File

@ -0,0 +1,24 @@
from lnx.logicnode.lnx_nodes import *
class WebviewPageInfoNode(LnxLogicTreeNode):
"""Gets the current URL or page title of the given WebView"""
bl_idname = 'LNWebviewPageInfoNode'
bl_label = 'Webview Page Info'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('url', 'URL', 'Get the current URL'),
('title', 'Title', 'Get the page title')],
name='Info', default='url')
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'ID')
self.add_output('LnxStringSocket', 'Value')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class WebviewSendNode(LnxLogicTreeNode):
"""Sends a message to the given WebView received via window.onMessage"""
bl_idname = 'LNWebviewSendNode'
bl_label = 'Webview Send'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxStringSocket', 'Message')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,47 @@
from lnx.logicnode.lnx_nodes import *
class WebviewSetDimensionsNode(LnxLogicTreeNode):
"""Sets dimensions of the given WebView for resize, move, or setting bounds"""
bl_idname = 'LNWebviewSetDimensionsNode'
bl_label = 'Webview Set Dimensions'
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 == 'resize':
self.add_input('LnxIntSocket', 'Width', default_value=800)
self.add_input('LnxIntSocket', 'Height', default_value=600)
elif self.property0 == 'move':
self.add_input('LnxIntSocket', 'X', default_value=0)
self.add_input('LnxIntSocket', 'Y', default_value=0)
else:
self.add_input('LnxIntSocket', 'X', default_value=0)
self.add_input('LnxIntSocket', 'Y', default_value=0)
self.add_input('LnxIntSocket', 'Width', default_value=800)
self.add_input('LnxIntSocket', 'Height', default_value=600)
property0: HaxeEnumProperty(
'property0',
items=[('resize', 'Resize', 'Set width and height'),
('move', 'Move', 'Set X and Y position'),
('set_bounds', 'Set Bounds', 'Set X, Y, width and height')],
name='Mode', default='resize', update=update_sockets)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxIntSocket', 'ID')
self.add_input('LnxIntSocket', 'Width', default_value=800)
self.add_input('LnxIntSocket', 'Height', default_value=600)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,39 @@
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')

View File

@ -0,0 +1,25 @@
from lnx.logicnode.lnx_nodes import *
class WebviewVisibilityNode(LnxLogicTreeNode):
"""Shows or hides the given WebView"""
bl_idname = 'LNWebviewVisibilityNode'
bl_label = 'Webview Visibility'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('show', 'Show', 'Show the WebView'),
('hide', 'Hide', 'Hide the WebView')],
name='Action', default='show')
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')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class WebviewWindowActionsNode(LnxLogicTreeNode):
"""Performs a window action on the given WebView's detached window"""
bl_idname = 'LNWebviewWindowActionsNode'
bl_label = 'Webview Window Actions'
lnx_category = 'Krom Runtime'
lnx_section = 'webview'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
items=[('minimize', 'Minimize', 'Minimize the window'),
('maximize', 'Maximize', 'Maximize the window'),
('restore', 'Restore', 'Restore the window')],
name='Action', default='restore')
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')

View File

@ -364,6 +364,7 @@ def init_properties():
bpy.types.World.lnx_dce = BoolProperty(name="DCE", description="Enable dead code elimination for publish builds", default=True, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_asset_compression = BoolProperty(name="Asset Compression", description="Enable scene data compression with LZ4 when publishing. Warning: This will slow down export!", default=False, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_single_data_file = BoolProperty(name="Single Data File", description="Pack exported meshes and materials into single file", default=False, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_webview = BoolProperty(name="Enable Webview", description="Create a default embedded webview for DOM interaction", default=False, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_write_config = BoolProperty(name="Write Config", description="Allow this project to be configured at runtime via a JSON file", default=False, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_compiler_inline = BoolProperty(name="Compiler Inline", description="Favor speed over size", default=True, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_winmode = EnumProperty(

View File

@ -1201,6 +1201,7 @@ class LNX_PT_ProjectFlagsPanel(bpy.types.Panel):
col.prop(wrd, 'lnx_live_patch')
col.prop(wrd, 'lnx_stream_scene')
col.prop(wrd, 'lnx_loadscreen')
col.prop(wrd, 'lnx_webview')
col.prop(wrd, 'lnx_write_config')
col = column_with_heading(layout, 'Renderer', align=True)

View File

@ -509,6 +509,9 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
if lnx.utils.get_viewport_controls() == 'azerty':
assets.add_khafile_def('lnx_azerty')
if wrd.lnx_webview:
assets.add_khafile_def('lnx_webview')
if os.path.exists(project_path + '/Bundled/config.lnx'):
assets.add_khafile_def('lnx_config')