more expor
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"""
|
||||
|
||||
from .nodes.any import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS, AnyNode
|
||||
from .nodes.export import AnyNodeExport
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
|
||||
|
||||
+34
-8
@@ -1,5 +1,22 @@
|
||||
"""
|
||||
AnyNode Export Module
|
||||
---
|
||||
The idea is to refactor the AnyNode function into a node package
|
||||
"""
|
||||
|
||||
# Used to generate the full class code with integrated AnyNode function
|
||||
EXPORT_SYSTEM_CLASS = """
|
||||
# Creating a ComfyUI Node Class
|
||||
[[CONTROLINFO]]
|
||||
"""
|
||||
|
||||
# Used to rewrite the system maps in the main nodes.py file
|
||||
EXPORT_SYSTEM_MAPS = """
|
||||
# Register the Node in the Package
|
||||
"""
|
||||
|
||||
class AnyNodeExport:
|
||||
"""Exports your AnyNode so it can be a real boy!"""
|
||||
"""Exports your AnyNode so it can be a "real boy"!"""
|
||||
"""
|
||||
Needs the system prompt for exporting.
|
||||
Copy:
|
||||
@@ -15,9 +32,9 @@ class AnyNodeExport:
|
||||
return {
|
||||
"required": {
|
||||
"control": ("CTRL", {"forceInput": True}),
|
||||
"package": ("STRING", {"default": "DefaultPack"}),
|
||||
"name": ("STRING", {}),
|
||||
"save_node": ("BOOLEAN", {"default": True}),
|
||||
"package": ("STRING", {"default": "TestPack"}),
|
||||
"name": ("STRING", {"default": "TestNode"}),
|
||||
"save_node": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"comment": ("STRING", {
|
||||
@@ -32,14 +49,23 @@ class AnyNodeExport:
|
||||
},
|
||||
}
|
||||
|
||||
#INPUT_IS_LIST = True
|
||||
RETURN_TYPES = ("CTRL",)
|
||||
RETURN_NAMES = ("control",)
|
||||
FUNCTION = "export"
|
||||
OUTPUT_NODE = True
|
||||
#OUTPUT_IS_LIST = (True,)
|
||||
|
||||
CATEGORY = "utils"
|
||||
|
||||
def export(self, control, text=None, unique_id=None, extra_pnginfo=None):
|
||||
|
||||
def copy_core_files(self):
|
||||
pass
|
||||
|
||||
def package_init(self, control, package_path, name, comment=None):
|
||||
self.copy_core_files()
|
||||
|
||||
def export(self, control, package=None, name=None, comment=None, save_node=False, prompt=None, unique_id=None, extra_pnginfo=None):
|
||||
"""Perform export if save_node is activated"""
|
||||
if save_node:
|
||||
package_path = f"custom_nodes/{package}/"
|
||||
self.package_init(control, package_path, name, comment=comment)
|
||||
|
||||
return (control, )
|
||||
|
||||
Reference in New Issue
Block a user