From 418eaed42ca2d30d5e0c657f9c27b0b7c62f0b28 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Sat, 12 Apr 2025 20:55:27 +0900 Subject: [PATCH] fixed: Ensure that `comfyui_manager`'s prestartup always runs, even when `--disable-all-custom-nodes` is used. feat: Disable specific custom nodes according to the policy of `comfyui_manager`. --- main.py | 7 +++++-- nodes.py | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7ca04f4b1..ff582ff22 100644 --- a/main.py +++ b/main.py @@ -70,8 +70,6 @@ def execute_prestartup_script(): if args.disable_all_custom_nodes: return - comfyui_manager.prestartup() - node_paths = folder_paths.get_folder_paths("custom_nodes") for custom_node_path in node_paths: possible_modules = os.listdir(custom_node_path) @@ -79,6 +77,10 @@ def execute_prestartup_script(): for possible_module in possible_modules: module_path = os.path.join(custom_node_path, possible_module) + + if comfyui_manager.should_be_disabled(module_path): + continue + if os.path.isfile(module_path) or module_path.endswith(".disabled") or module_path == "__pycache__": continue @@ -98,6 +100,7 @@ def execute_prestartup_script(): logging.info("") apply_custom_paths() +comfyui_manager.prestartup() execute_prestartup_script() diff --git a/nodes.py b/nodes.py index 8c1720c1a..5b8077ab7 100644 --- a/nodes.py +++ b/nodes.py @@ -37,6 +37,7 @@ import importlib import folder_paths import latent_preview import node_helpers +import comfyui_manager def before_node_execution(): comfy.model_management.throw_exception_if_processing_interrupted() @@ -2196,6 +2197,10 @@ def init_external_custom_nodes(): module_path = os.path.join(custom_node_path, possible_module) if os.path.isfile(module_path) and os.path.splitext(module_path)[1] != ".py": continue if module_path.endswith(".disabled"): continue + if comfyui_manager.should_be_disabled(module_path): + logging.info(f"Blocked by policy: {module_path}") + continue + time_before = time.perf_counter() success = load_custom_node(module_path, base_node_names, module_parent="custom_nodes") node_import_times.append((time.perf_counter() - time_before, module_path, success))