From 5b9f8e7f4d46f654bc6f7793cfef80d8c8a3c7ee Mon Sep 17 00:00:00 2001 From: Creepybits Date: Wed, 9 Apr 2025 00:03:09 +0200 Subject: [PATCH] Update __init__.py Restructure node pack --- __init__.py | 90 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 11 deletions(-) diff --git a/__init__.py b/__init__.py index d546425..d098d76 100644 --- a/__init__.py +++ b/__init__.py @@ -1,15 +1,83 @@ -"""Top-level package for Creepy_nodes.""" +import os +import sys -__all__ = [ - "NODE_CLASS_MAPPINGS", - "NODE_DISPLAY_NAME_MAPPINGS", - "WEB_DIRECTORY", -] +# Add the path to your custom nodes directory to the Python path +# If this isn't done, Python won't be able to find your custom node modules +custom_nodes_path = os.path.dirname(os.path.abspath(__file__)) +assets_nodes_path = os.path.join(custom_nodes_path, "assets", "nodes") #New +sys.path.append(assets_nodes_path) #New -__author__ = "Creepybits" -__email__ = "work@zanno.se" -__version__ = "0.0.1" +from .assets.nodes.Modelswitch import NODE_CLASS_MAPPINGS as Modelswitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as Modelswitch_NODE_DISPLAY_NAMES +from .assets.nodes.VAESwitch import NODE_CLASS_MAPPINGS as VAESwitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as VAESwitch_NODE_DISPLAY_NAMES +from .assets.nodes.CLIPSwitch import NODE_CLASS_MAPPINGS as CLIPSwitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as CLIPSwitch_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicModelswitch import NODE_CLASS_MAPPINGS as DynamicModelswitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicModelswitch_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicClipswitch import NODE_CLASS_MAPPINGS as DynamicClipswitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicClipswitch_NODE_DISPLAY_NAMES +from .assets.nodes.Textswitch import NODE_CLASS_MAPPINGS as Textswitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as Textswitch_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicConditioning import NODE_CLASS_MAPPINGS as DynamicConditioning_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicConditioning_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicLatentSwitch import NODE_CLASS_MAPPINGS as DynamicLatentSwitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicLatentSwitch_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicVAESwitch import NODE_CLASS_MAPPINGS as DynamicVAESwitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicVAESwitch_NODE_DISPLAY_NAMES +from .assets.nodes.SystemPromp import NODE_CLASS_MAPPINGS as SystemPromp_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as SystemPromp_NODE_DISPLAY_NAMES +from .assets.nodes.DelayNode import NODE_CLASS_MAPPINGS as DelayNode_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DelayNode_NODE_DISPLAY_NAMES +from .assets.nodes.DelayTextNode import NODE_CLASS_MAPPINGS as DelayTextNode_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DelayTextNode_NODE_DISPLAY_NAMES +from .assets.nodes.SanitizeFilename import NODE_CLASS_MAPPINGS as SanitizeFilename_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as SanitizeFilename_NODE_DISPLAY_NAMES +from .assets.nodes.DynamicImageSwitch import NODE_CLASS_MAPPINGS as DynamicImageSwitch_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as DynamicImageSwitch_NODE_DISPLAY_NAMES +from .assets.nodes.EvaluaterNode import NODE_CLASS_MAPPINGS as EvaluaterNode_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as EvaluaterNode_NODE_DISPLAY_NAMES +from .assets.nodes.PeopleEvaluationNode import NODE_CLASS_MAPPINGS as PeopleEvaluationNode_NODE_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as PeopleEvaluationNode_NODE_DISPLAY_NAMES -from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS +import comfy.sd +import comfy.utils +import time +import re +import json -WEB_DIRECTORY = "./web" # Or the correct path to your web directory +# Try to import folder_paths from ComfyUI +try: + import folder_paths +except ImportError: + print("Warning: Could not import folder_paths from ComfyUI") + folder_paths = None + +NODE_CLASS_MAPPINGS = { + **Modelswitch_NODE_MAPPINGS, + **VAESwitch_NODE_MAPPINGS, + **CLIPSwitch_NODE_MAPPINGS, + **DynamicModelswitch_NODE_MAPPINGS, + **DynamicClipswitch_NODE_MAPPINGS, + **Textswitch_NODE_MAPPINGS, + **DynamicConditioning_NODE_MAPPINGS, + **DynamicLatentSwitch_NODE_MAPPINGS, + **DynamicVAESwitch_NODE_MAPPINGS, + **SystemPromp_NODE_MAPPINGS, + **DelayNode_NODE_MAPPINGS, + **DelayTextNode_NODE_MAPPINGS, + **SanitizeFilename_NODE_MAPPINGS, + **DynamicImageSwitch_NODE_MAPPINGS, + **EvaluaterNode_NODE_MAPPINGS, + **PeopleEvaluationNode_NODE_MAPPINGS, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + **Modelswitch_NODE_DISPLAY_NAMES, + **VAESwitch_NODE_DISPLAY_NAMES, + **CLIPSwitch_NODE_DISPLAY_NAMES, + **DynamicModelswitch_NODE_DISPLAY_NAMES, + **DynamicClipswitch_NODE_DISPLAY_NAMES, + **Textswitch_NODE_DISPLAY_NAMES, + **DynamicConditioning_NODE_DISPLAY_NAMES, + **DynamicLatentSwitch_NODE_DISPLAY_NAMES, + **DynamicVAESwitch_NODE_DISPLAY_NAMES, + **SystemPromp_NODE_DISPLAY_NAMES, + **DelayNode_NODE_DISPLAY_NAMES, + **DelayTextNode_NODE_DISPLAY_NAMES, + **SanitizeFilename_NODE_DISPLAY_NAMES, + **DynamicImageSwitch_NODE_DISPLAY_NAMES, + **EvaluaterNode_NODE_DISPLAY_NAMES, + **PeopleEvaluationNode_NODE_DISPLAY_NAMES, +} + +__version__ = "1.1.2" + +# Define the web directory for ComfyUI to find our JavaScript files +WEB_DIRECTORY = "./web" + +__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY']