forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
14
leenkx/blender/lnx/logicnode/map/LN_clear_map.py
Normal file
14
leenkx/blender/lnx/logicnode/map/LN_clear_map.py
Normal file
@ -0,0 +1,14 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class ClearMapNode(LnxLogicTreeNode):
|
||||
"""Clear Map"""
|
||||
bl_idname = 'LNClearMapNode'
|
||||
bl_label = 'Clear Map'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
38
leenkx/blender/lnx/logicnode/map/LN_create_map.py
Normal file
38
leenkx/blender/lnx/logicnode/map/LN_create_map.py
Normal file
@ -0,0 +1,38 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class CreateMapNode(LnxLogicTreeNode):
|
||||
"""Create Map"""
|
||||
bl_idname = 'LNCreateMapNode'
|
||||
bl_label = 'Create Map'
|
||||
lnx_version = 1
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items = [('string', 'String', 'String Map Key Type'),
|
||||
('int', 'Int', 'Int Map key type'),
|
||||
('enumvalue', 'EnumValue', 'EnumValue Map key type'),
|
||||
('object', 'Object', 'Object Map key type')],
|
||||
name='Key',
|
||||
default='string')
|
||||
|
||||
property1: HaxeEnumProperty(
|
||||
'property1',
|
||||
items = [('string', 'String', 'String Map Value Type'),
|
||||
('vector', 'Vector', 'Vector Map Value Type'),
|
||||
('float', 'Float', 'Float Map Value Type'),
|
||||
('integer', 'Integer', 'Integer Map Value Type'),
|
||||
('boolean', 'Boolean', 'Boolean Map Value Type'),
|
||||
('dynamic', 'Dynamic', 'Dynamic Map Value Type')],
|
||||
name='Value',
|
||||
default='string')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
layout.prop(self, 'property1')
|
||||
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxDynamicSocket', 'Map')
|
14
leenkx/blender/lnx/logicnode/map/LN_get_map_value.py
Normal file
14
leenkx/blender/lnx/logicnode/map/LN_get_map_value.py
Normal file
@ -0,0 +1,14 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class GetMapValueNode(LnxLogicTreeNode):
|
||||
"""Get Map Value"""
|
||||
bl_idname = 'LNGetMapValueNode'
|
||||
bl_label = 'Get Map Value'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
self.add_input('LnxDynamicSocket', 'Key')
|
||||
|
||||
self.add_output('LnxDynamicSocket', 'Value')
|
18
leenkx/blender/lnx/logicnode/map/LN_json_parse.py
Normal file
18
leenkx/blender/lnx/logicnode/map/LN_json_parse.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class ParseJsonNode(LnxLogicTreeNode):
|
||||
"""Parse a JSON String to Haxe object.
|
||||
|
||||
@input JSON: JSON string.
|
||||
|
||||
@output Value: Parsed value.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNParseJsonNode'
|
||||
bl_label = 'Parse JSON'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxStringSocket', 'JSON')
|
||||
self.add_output('LnxDynamicSocket', 'Value')
|
18
leenkx/blender/lnx/logicnode/map/LN_json_stringify.py
Normal file
18
leenkx/blender/lnx/logicnode/map/LN_json_stringify.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class JsonStringifyNode(LnxLogicTreeNode):
|
||||
"""Convert a Haxe object to JSON String.
|
||||
|
||||
@input Value: Value to convert.
|
||||
|
||||
@output String: JSON String.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNJsonStringifyNode'
|
||||
bl_label = 'JSON Stringify'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxDynamicSocket', 'Value')
|
||||
self.add_output('LnxStringSocket', 'JSON')
|
16
leenkx/blender/lnx/logicnode/map/LN_map_key_exists.py
Normal file
16
leenkx/blender/lnx/logicnode/map/LN_map_key_exists.py
Normal file
@ -0,0 +1,16 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class MapKeyExistsNode(LnxLogicTreeNode):
|
||||
"""Map Key Exists"""
|
||||
bl_idname = 'LNMapKeyExistsNode'
|
||||
bl_label = 'Map Key Exists'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
self.add_input('LnxDynamicSocket', 'Key')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'True')
|
||||
self.add_output('LnxNodeSocketAction', 'False')
|
18
leenkx/blender/lnx/logicnode/map/LN_map_loop.py
Normal file
18
leenkx/blender/lnx/logicnode/map/LN_map_loop.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class MapLoopNode(LnxLogicTreeNode):
|
||||
"""Map Loop"""
|
||||
bl_idname = 'LNMapLoopNode'
|
||||
bl_label = 'Map Loop'
|
||||
lnx_version = 1
|
||||
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Loop')
|
||||
self.add_output('LnxDynamicSocket', 'Key')
|
||||
self.add_output('LnxDynamicSocket', 'Value')
|
||||
self.add_output('LnxNodeSocketAction', 'Done')
|
15
leenkx/blender/lnx/logicnode/map/LN_remove_map_key.py
Normal file
15
leenkx/blender/lnx/logicnode/map/LN_remove_map_key.py
Normal file
@ -0,0 +1,15 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class RemoveMapKeyNode(LnxLogicTreeNode):
|
||||
"""Remove Map Key"""
|
||||
bl_idname = 'LNRemoveMapKeyNode'
|
||||
bl_label = 'Remove Map Key'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
self.add_input('LnxDynamicSocket', 'Key')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
26
leenkx/blender/lnx/logicnode/map/LN_set_map_from_array.py
Normal file
26
leenkx/blender/lnx/logicnode/map/LN_set_map_from_array.py
Normal file
@ -0,0 +1,26 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class SetMapFromArrayNode(LnxLogicTreeNode):
|
||||
"""Set Map From Arrays.
|
||||
|
||||
@input In: Set the map.
|
||||
|
||||
@input Map: Map to set values.
|
||||
|
||||
@input Key: Array of keys to be set.
|
||||
|
||||
@input Value: Array of corresponding values for the keys.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNSetMapFromArrayNode'
|
||||
bl_label = 'Set Map From Array'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
self.add_input('LnxNodeSocketArray', 'Keys')
|
||||
self.add_input('LnxNodeSocketArray', 'Values')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
26
leenkx/blender/lnx/logicnode/map/LN_set_map_value.py
Normal file
26
leenkx/blender/lnx/logicnode/map/LN_set_map_value.py
Normal file
@ -0,0 +1,26 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class SetMapValueNode(LnxLogicTreeNode):
|
||||
"""Set Map Value.
|
||||
|
||||
@input In: Set the map.
|
||||
|
||||
@input Map: Map to set values.
|
||||
|
||||
@input Key: Key to be set.
|
||||
|
||||
@input Value: Value for the key.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNSetMapValueNode'
|
||||
bl_label = 'Set Map Value'
|
||||
lnx_version = 1
|
||||
|
||||
def init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Map')
|
||||
self.add_input('LnxDynamicSocket', 'Key')
|
||||
self.add_input('LnxDynamicSocket', 'Value')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
55
leenkx/blender/lnx/logicnode/map/LN_string_map.py
Normal file
55
leenkx/blender/lnx/logicnode/map/LN_string_map.py
Normal file
@ -0,0 +1,55 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class StringMapNode(LnxLogicTreeNode):
|
||||
"""Create String Map.
|
||||
|
||||
@input In: Create a map using given keys and values.
|
||||
|
||||
@input Key: Key.
|
||||
|
||||
@input Value: Value.
|
||||
|
||||
@output Out: Run after map is created.
|
||||
|
||||
@output Map: The created map.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNStringMapNode'
|
||||
bl_label = 'String Map'
|
||||
lnx_version = 1
|
||||
|
||||
min_inputs = 1
|
||||
property0: HaxeIntProperty('property0', name='Number of keys', default=0)
|
||||
|
||||
def __init__(self):
|
||||
super(StringMapNode, self).__init__()
|
||||
self.register_id()
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxDynamicSocket', 'Map')
|
||||
|
||||
def add_sockets(self):
|
||||
self.add_input('LnxStringSocket', f'Key [{self.property0}]')
|
||||
self.add_input('LnxStringSocket', f'Value [{self.property0}]')
|
||||
self.property0 += 1
|
||||
|
||||
def remove_sockets(self):
|
||||
if self.property0 > 0:
|
||||
self.inputs.remove(self.inputs.values()[-1])
|
||||
self.inputs.remove(self.inputs.values()[-1])
|
||||
self.property0 -= 1
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
row = layout.row(align=True)
|
||||
|
||||
op = row.operator('lnx.node_call_func', text='New', icon='PLUS', emboss=True)
|
||||
op.node_index = self.get_id_str()
|
||||
op.callback_name = 'add_sockets'
|
||||
column = row.column(align=True)
|
||||
op = column.operator('lnx.node_call_func', text='', icon='X', emboss=True)
|
||||
op.node_index = self.get_id_str()
|
||||
op.callback_name = 'remove_sockets'
|
||||
if len(self.inputs) == self.min_inputs:
|
||||
column.enabled = False
|
1
leenkx/blender/lnx/logicnode/map/__init__.py
Normal file
1
leenkx/blender/lnx/logicnode/map/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user