forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
36
leenkx/blender/lnx/logicnode/native/LN_read_json.py
Normal file
36
leenkx/blender/lnx/logicnode/native/LN_read_json.py
Normal file
@ -0,0 +1,36 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class ReadJsonNode(LnxLogicTreeNode):
|
||||
"""Reads the given JSON file and returns its content.
|
||||
|
||||
@input File: the asset name of the file as used by Kha.
|
||||
@input Use cache: if unchecked, re-read the file from disk every
|
||||
time the node is executed. Otherwise, cache the file after the
|
||||
first read and return the cached content.
|
||||
|
||||
@output Loaded: activated after the file has been read.
|
||||
@output Not Loaded: If the file doesn't exist the output is activated.
|
||||
@output Dynamic: the content of the file.
|
||||
|
||||
@seeNode Write JSON
|
||||
"""
|
||||
bl_idname = 'LNReadJsonNode'
|
||||
bl_label = 'Read JSON'
|
||||
lnx_section = 'file'
|
||||
lnx_version = 2
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxStringSocket', 'File')
|
||||
self.add_input('LnxBoolSocket', 'Use cache', default_value=1)
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Loaded')
|
||||
self.add_output('LnxNodeSocketAction', 'Not loaded')
|
||||
self.add_output('LnxDynamicSocket', 'Dynamic')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement.Identity(self)
|
Reference in New Issue
Block a user