This commit is contained in:
lilly
2023-03-28 21:21:32 +09:00
parent f4d889bc74
commit 98ae062bc0
4 changed files with 34 additions and 27 deletions
+2 -1
View File
@@ -3,12 +3,13 @@ import comfy.sd
from nodes import *
import folder_paths
import random
from .check_name import *
import os
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
from ConsoleColor import print, console
from mypath import *
else:
from .ConsoleColor import print, console
from .mypath import *
#print(__file__)
#print(os.path.basename(__file__))
+6 -1
View File
@@ -3,7 +3,12 @@ import comfy.sd
from nodes import *
import folder_paths
import random
from .check_name import *
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
from ConsoleColor import print, console
from mypath import *
else:
from .ConsoleColor import print, console
from .mypath import *
class LoraLoaderTextRandom:
@classmethod
-25
View File
@@ -1,25 +0,0 @@
import os
from folder_paths import supported_ckpt_extensions,supported_pt_extensions
import folder_paths
import random
def check_name(kind,name,supported_extensions):
for ext in supported_extensions:
if name.lower().endswith(ext):
path = folder_paths.get_full_path(kind, name)
if path is not None:
return path
for ext in supported_extensions:
path = folder_paths.get_full_path(kind, name+ext)
if path is not None:
return path
def check_name_ckpt(name):
return check_name("checkpoints",name,supported_ckpt_extensions)
def check_name_pt(kind,name):
return check_name(kind,name,supported_pt_extensions)
def name_split_choice(name):
return random.choice(name.split('|'))
+26
View File
@@ -2,6 +2,9 @@ import sys
import json
import ast
import os
from folder_paths import supported_ckpt_extensions,supported_pt_extensions
import folder_paths
import random
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
from ConsoleColor import print, console
else:
@@ -45,3 +48,26 @@ mainFile = os.path.abspath(sys.modules['__main__'].__file__)
print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN")
mainfolder = os.path.dirname(mainFile)
print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN")
def check_name(kind,name,supported_extensions):
for ext in supported_extensions:
if name.lower().endswith(ext):
path = folder_paths.get_full_path(kind, name)
if path is not None:
return path
for ext in supported_extensions:
path = folder_paths.get_full_path(kind, name+ext)
if path is not None:
return path
def check_name_ckpt(name):
return check_name("checkpoints",name,supported_ckpt_extensions)
def check_name_pt(kind,name):
return check_name(kind,name,supported_pt_extensions)
def name_split_choice(name):
return random.choice(name.split('|'))