Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Refactor with code from comment of #1588

comfyanonymousec454c771b8c
diff --git a/nodes.py b/nodes.py
index 1232373be..919aac89e 100644
--- a/nodes.py
+++ b/nodes.py
@@ -1781,16 +1781,23 @@ def load_custom_nodes():
print()
def init_custom_nodes():
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_latent.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_hypernetwork.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_upscale_model.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_post_processing.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_mask.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_rebatch.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_model_merging.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_tomesd.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_clip_sdxl.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_canny.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_freelunch.py"))
- load_custom_node(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras"), "nodes_custom_sampler.py"))
+ extras_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_extras")
+ extras_files = [
+ "nodes_latent.py",
+ "nodes_hypernetwork.py",
+ "nodes_upscale_model.py",
+ "nodes_post_processing.py",
+ "nodes_mask.py",
+ "nodes_rebatch.py",
+ "nodes_model_merging.py",
+ "nodes_tomesd.py",
+ "nodes_clip_sdxl.py",
+ "nodes_canny.py",
+ "nodes_freelunch.py",
+ "nodes_custom_sampler.py"
+ ]
+
+ for node_file in extras_files:
+ load_custom_node(os.path.join(extras_dir, node_file))
+
load_custom_nodes()