ComfyUI-AnyText/__init__.py
FlintyLemming e1911954ed Init
2024-09-25 15:18:31 +08:00

34 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from .AnyText.utils import is_folder_exist
import folder_paths
import os
#加载插件前先检查是否在os.listdir里存在自定义目录没有则自动创建防止加载节点失败官方目录可无视。
fonts_path = os.path.join(folder_paths.models_dir, 'fonts')
translator_path = os.path.join(folder_paths.models_dir, 'prompt_generator')
comfy_temp_dir = folder_paths.get_temp_directory()
if not is_folder_exist(fonts_path):
os.makedirs(fonts_path)
if not is_folder_exist(translator_path):
os.makedirs(translator_path)
if not is_folder_exist(comfy_temp_dir):
os.makedirs(comfy_temp_dir)
# only import if running as a custom node
try:
pass
except ImportError:
pass
else:
NODE_CLASS_MAPPINGS = {}
# AnyText
from .AnyText.nodes import NODE_CLASS_MAPPINGS as AnyText_Nodes
NODE_CLASS_MAPPINGS.update(AnyText_Nodes)
# AnyText_utils
from .AnyText.utils import NODE_CLASS_MAPPINGS as AnyText_loader_Nodes
NODE_CLASS_MAPPINGS.update(AnyText_loader_Nodes)
NODE_DISPLAY_NAME_MAPPINGS = {k:v.TITLE for k,v in NODE_CLASS_MAPPINGS.items()}
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']