mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-04 05:56:59 +08:00
Add get_subgraphs_dir to ComfyExtension and PUBLISHED_SUBGRAPH_DIRS to nodes.py
This commit is contained in:
parent
d8d60b5609
commit
b73e0547ca
@ -83,6 +83,12 @@ class ComfyExtension(ABC):
|
|||||||
This should be used to initialize any global resources neeeded by the extension.
|
This should be used to initialize any global resources neeeded by the extension.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
async def get_subgraphs_dir(self) -> str | None:
|
||||||
|
"""
|
||||||
|
Returns the directory containing the published subgraphs for this extension.
|
||||||
|
"""
|
||||||
|
return None
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
6
nodes.py
6
nodes.py
@ -2081,6 +2081,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EXTENSION_WEB_DIRS = {}
|
EXTENSION_WEB_DIRS = {}
|
||||||
|
PUBLISHED_SUBGRAPH_DIRS = {}
|
||||||
|
|
||||||
# Dictionary of successfully loaded module names and associated directories.
|
# Dictionary of successfully loaded module names and associated directories.
|
||||||
LOADED_MODULE_DIRS = {}
|
LOADED_MODULE_DIRS = {}
|
||||||
@ -2179,6 +2180,11 @@ async def load_custom_node(module_path: str, ignore=set(), module_parent="custom
|
|||||||
if not isinstance(extension, ComfyExtension):
|
if not isinstance(extension, ComfyExtension):
|
||||||
logging.warning(f"comfy_entrypoint in {module_path} did not return a ComfyExtension, skipping.")
|
logging.warning(f"comfy_entrypoint in {module_path} did not return a ComfyExtension, skipping.")
|
||||||
return False
|
return False
|
||||||
|
subgraphs_dir = await extension.get_subgraphs_dir()
|
||||||
|
if subgraphs_dir is not None:
|
||||||
|
subgraphs_dir = os.path.abspath(os.path.join(module_dir, subgraphs_dir))
|
||||||
|
if os.path.isdir(subgraphs_dir):
|
||||||
|
PUBLISHED_SUBGRAPH_DIRS[module_name] = subgraphs_dir
|
||||||
node_list = await extension.get_node_list()
|
node_list = await extension.get_node_list()
|
||||||
if not isinstance(node_list, list):
|
if not isinstance(node_list, list):
|
||||||
logging.warning(f"comfy_entrypoint in {module_path} did not return a list of nodes, skipping.")
|
logging.warning(f"comfy_entrypoint in {module_path} did not return a list of nodes, skipping.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user