-
Notifications
You must be signed in to change notification settings - Fork 4
/
__init__.py
49 lines (41 loc) · 1.72 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from .nodes import CLIPTextEncodeWithStats, SaveImgAdv, OpenPoseEditorAdv, SolidMaskAdv
import shutil
import folder_paths
import os
class colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
CYAN = '\033[96m'
GREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
comfy_path = os.path.dirname(folder_paths.__file__)
def setup_js():
ultools_path = os.path.dirname(__file__)
js_dest_path = os.path.join(comfy_path, "web", "extensions", "ultools")
legacy_js_dest_path = os.path.join(comfy_path, "web", "extensions", "imginfo")
js_files = ["ultools.js", "exif-reader.js", "openposeadv.js", "fabric.min.js"]
# check presence of legacy folder, print hint it can be removed
if os.path.isdir(legacy_js_dest_path):
print(f"{colors.BLUE}ULTools: {colors.WARNING}Found legacy SaveImgAdv path at {legacy_js_dest_path}, this folder and its content can be removed.{colors.ENDC}")
## Creating folder if it's not present, then Copy.
if not os.path.isdir(js_dest_path):
os.mkdir(js_dest_path)
logged = False
for js in js_files:
if not os.path.isfile(f"{js_dest_path}/{js}"):
if logged == False:
print(f"{colors.BLUE}ULTools:{colors.ENDC} Copying JS files")
logged = True
shutil.copy(os.path.join(ultools_path, "js", js), js_dest_path)
print(f"{colors.BLUE}ULTools: {colors.GREEN}Loaded{colors.ENDC}")
setup_js()
NODE_CLASS_MAPPINGS = {
"SaveImgAdv": SaveImgAdv.SaveImgAdv,
"CLIPTextEncodeWithStats": CLIPTextEncodeWithStats.CLIPTextEncodeWithStats,
"OpenPoseEditorAdv": OpenPoseEditorAdv.OpenPoseEditorAdv,
"SolidMaskAdv": SolidMaskAdv.SolidMaskAdv
}