From 02d747919396e9a566f27f455498727e6808ab55 Mon Sep 17 00:00:00 2001 From: WAS Date: Mon, 2 Oct 2023 14:30:11 -0700 Subject: [PATCH] Add MODULE_NODE_MAPPINGS dictionary MODULE_NODE_MAPPINGS contains a module to node mapping of all nodes within the instance of ComfyUI. This sorted information is beneficial for third party development and potentially future ComfyUI features. --- nodes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nodes.py b/nodes.py index 1232373be..146c5083d 100644 --- a/nodes.py +++ b/nodes.py @@ -1715,6 +1715,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { } EXTENSION_WEB_DIRS = {} +MODULE_NODE_MAPPINGS = {os.path.abspath(__file__): dict(NODE_CLASS_MAPPINGS)} def load_custom_node(module_path, ignore=set()): module_name = os.path.basename(module_path) @@ -1739,11 +1740,14 @@ def load_custom_node(module_path, ignore=set()): EXTENSION_WEB_DIRS[module_name] = web_dir if hasattr(module, "NODE_CLASS_MAPPINGS") and getattr(module, "NODE_CLASS_MAPPINGS") is not None: + module_node_mappings = {} for name in module.NODE_CLASS_MAPPINGS: if name not in ignore: NODE_CLASS_MAPPINGS[name] = module.NODE_CLASS_MAPPINGS[name] + module_node_mappings[name] = module.NODE_CLASS_MAPPINGS[name] if hasattr(module, "NODE_DISPLAY_NAME_MAPPINGS") and getattr(module, "NODE_DISPLAY_NAME_MAPPINGS") is not None: NODE_DISPLAY_NAME_MAPPINGS.update(module.NODE_DISPLAY_NAME_MAPPINGS) + MODULE_NODE_MAPPINGS[os.path.abspath(module_path)] = module_node_mappings return True else: print(f"Skip {module_path} module for custom nodes due to the lack of NODE_CLASS_MAPPINGS.")