Update leenkx/blender/lnx/logicnode/custom/LN_call_wasm.py

This commit is contained in:
Onek8 2025-04-03 09:34:57 +00:00
parent d6b4b6eeea
commit 3ab9123000

View File

@ -1,54 +1,54 @@
from lnx.logicnode.lnx_nodes import * from lnx.logicnode.lnx_nodes import *
class CallWASMNode(LnxLogicTreeNode): class CallWASMNode(LnxLogicTreeNode):
"""Call WASM""" """Call WASM"""
bl_idname = 'LNCallWASMNode' bl_idname = 'LNCallWASMNode'
bl_label = 'Call WASM' bl_label = 'Call WASM'
bl_description = 'Call WASM' bl_description = 'Call WASM'
lnx_category = 'HTML' lnx_category = 'HTML'
lnx_version = 1 lnx_version = 1
min_inputs = 3 min_inputs = 3
property1: HaxeBoolProperty( property1: HaxeBoolProperty(
'property1', 'property1',
name="Secure", name="Secure",
description="Assignment", description="Assignment",
default=False, default=False,
) )
def __init__(self): def __init__(self, *args, **kwargs):
super(CallWASMNode, self).__init__() super(CallWASMNode, self).__init__(*args, **kwargs)
array_nodes[str(id(self))] = self array_nodes[str(id(self))] = self
def lnx_init(self, context): def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In') self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxDynamicSocket', 'WASM') self.add_input('LnxDynamicSocket', 'WASM')
self.add_input('LnxStringSocket', 'Call') self.add_input('LnxStringSocket', 'Call')
self.add_output('LnxNodeSocketAction', 'Out') self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxDynamicSocket', 'Result') self.add_output('LnxDynamicSocket', 'Result')
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
#layout.prop(self, 'property1') #layout.prop(self, 'property1')
row = layout.row(align=True) row = layout.row(align=True)
op = row.operator('lnx.node_add_input', text='Add Arg', icon='PLUS', emboss=True) op = row.operator('lnx.node_add_input', text='Add Arg', icon='PLUS', emboss=True)
op.node_index = str(id(self)) op.node_index = str(id(self))
op.socket_type = 'LnxDynamicSocket' op.socket_type = 'LnxDynamicSocket'
op.name_format = "Arg {0}" op.name_format = "Arg {0}"
op.index_name_offset = -2 op.index_name_offset = -2
column = row.column(align=True) column = row.column(align=True)
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True) op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
op.node_index = str(id(self)) op.node_index = str(id(self))
if len(self.inputs) == self.min_inputs: if len(self.inputs) == self.min_inputs:
column.enabled = False column.enabled = False
def get_replacement_node(self, node_tree: bpy.types.NodeTree): def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1): if self.lnx_version not in (0, 1):
raise LookupError() raise LookupError()
return NodeReplacement.Identity(self) return NodeReplacement.Identity(self)
def register(): def register():
add_category('HTML', icon='SEQ_STRIP_META') add_category('HTML', icon='SEQ_STRIP_META')
CallWASMNode.on_register() CallWASMNode.on_register()