37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import importlib.util
|
|
import glob
|
|
import os
|
|
import sys
|
|
import __main__
|
|
import shutil
|
|
|
|
NODE_CLASS_MAPPINGS = {}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {}
|
|
python = sys.executable
|
|
|
|
def get_ext_dir(subpath=None, mkdir=False):
|
|
dir = os.path.dirname(__file__)
|
|
if subpath is not None:
|
|
dir = os.path.join(dir, subpath)
|
|
dir = os.path.abspath(dir)
|
|
if mkdir and not os.path.exists(dir):
|
|
os.makedirs(dir)
|
|
return dir
|
|
|
|
py = get_ext_dir("py")
|
|
files = os.listdir(py)
|
|
for file in files:
|
|
if not file.endswith(".py"):
|
|
continue
|
|
name = os.path.splitext(file)[0]
|
|
imported_module = importlib.import_module(".py.{}".format(name), __name__)
|
|
try:
|
|
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **imported_module.NODE_DISPLAY_NAME_MAPPINGS}
|
|
except:
|
|
pass
|
|
|
|
print(f"# 😺 ComfyUI_OmniGen_Wrapper: -> " + '\033[1;32m' + f"Success loaded {len(NODE_CLASS_MAPPINGS)} nodes." + '\033[m')
|
|
|
|
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
|