Update Files
This commit is contained in:
33
leenkx/blender/lnx/logicnode/native/LN_write_json.py
Normal file
33
leenkx/blender/lnx/logicnode/native/LN_write_json.py
Normal file
@ -0,0 +1,33 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class WriteJsonNode(LnxLogicTreeNode):
|
||||
"""Writes the given content to the given JSON file. If the file
|
||||
already exists, the existing content of the file is overwritten.
|
||||
|
||||
> **This node is currently only implemented on Krom**
|
||||
|
||||
@input File: the name of the file, relative to `Krom.getFilesLocation()`,
|
||||
including the file extension.
|
||||
@input Dynamic: the content to write to the file. Can be any type that can
|
||||
be serialized to JSON.
|
||||
|
||||
@seeNode Read JSON
|
||||
"""
|
||||
bl_idname = 'LNWriteJsonNode'
|
||||
bl_label = 'Write 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('LnxDynamicSocket', 'Dynamic')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
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