added pipe for parameters
This commit is contained in:
+4
-1
@@ -1,8 +1,11 @@
|
||||
from .nodes.nodes import *
|
||||
from .nodes.pipe import *
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Text Switch 2 Way": TextSwitch2Way,
|
||||
"Prompt Tidy": PromptTidy
|
||||
"Prompt Tidy": PromptTidy,
|
||||
"Pipe To Parameters": SoCPipeToParamters,
|
||||
"Pipe From Parameters": SoCPipeFromParamters
|
||||
}
|
||||
|
||||
print("\033[34mComfyUI Simple of Complex Nodes: \033[92mLoaded\033[0m")
|
||||
+11
-7
@@ -1,3 +1,5 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
class TextSwitch2Way:
|
||||
|
||||
@classmethod
|
||||
@@ -10,11 +12,11 @@ class TextSwitch2Way:
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "text_switch2way"
|
||||
FUNCTION = "execute"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "SimpleOfComplex"
|
||||
CATEGORY = "SimpleOfComplex/Switch"
|
||||
|
||||
def text_switch2way(self, text1,text2):
|
||||
def execute(self, text1,text2):
|
||||
|
||||
if text1 is None or text1 == "":
|
||||
if text2 is None or text2 == "":
|
||||
@@ -23,7 +25,9 @@ class TextSwitch2Way:
|
||||
return (text2,)
|
||||
else:
|
||||
return (text1,)
|
||||
|
||||
|
||||
|
||||
|
||||
class PromptTidy:
|
||||
|
||||
@classmethod
|
||||
@@ -35,11 +39,11 @@ class PromptTidy:
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "prompt_tidy"
|
||||
FUNCTION = "execute"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "SimpleOfComplex"
|
||||
CATEGORY = "SimpleOfComplex/Prompt"
|
||||
|
||||
def prompt_tidy(self, prompt):
|
||||
def execute(self, prompt):
|
||||
|
||||
prompt1=""
|
||||
while not (prompt1 == prompt):
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
class SoCPipeToParamters:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
return {"optional": {
|
||||
"SoCPipeToParamters": ("SoCPipeToParamters",),
|
||||
"model_name": ("STRING", {"multiline": False, "default": ""}),
|
||||
"path_name": ("STRING", {"multiline": False, "default": ""}),
|
||||
"sampler_name": ("STRING", {"multiline": False, "default": ""}),
|
||||
"scheduler_name": ("STRING", {"multiline": False, "default": ""}),
|
||||
"postive_prompt": ("STRING", {"multiline": False, "default": ""}),
|
||||
"negative_prompt": ("STRING", {"multiline": False, "default": ""}),
|
||||
"seed": int,
|
||||
"batch_count": int,
|
||||
"steps": int,
|
||||
"CFG": float,
|
||||
"image_width": int,
|
||||
"image_height": int,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = "SimpleOfComplex/Pipe"
|
||||
RETURN_TYPES = ("SoCPipeToParamters",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, SoCPipeParameters=None, model_name=None, path_name=None, sampler_name=None, scheduler_name=None, postive_prompt=None, negative_prompt=None, seed=None, batch_count=None, steps=None, CFG=None, image_width=None, image_height=None):
|
||||
model_name_original = None
|
||||
path_name_original = None
|
||||
sampler_name_original = None
|
||||
scheduler_name_original = None
|
||||
postive_prompt_original = None
|
||||
negative_prompt_original = None
|
||||
seed_original = None
|
||||
batch_count_original = None
|
||||
steps_original = None
|
||||
CFG_original = None
|
||||
image_width_original = None
|
||||
image_height_original = None
|
||||
|
||||
|
||||
|
||||
|
||||
if SoCPipeParameters != None:
|
||||
model_name_original, path_name_original, sampler_name_original, scheduler_name_original, postive_prompt_original, negative_prompt_original,seed_original,batch_count_original,steps_original,CFG_original,image_width_original, image_height_original = SoCPipeParameters
|
||||
|
||||
SoCPipeParametersMod = []
|
||||
|
||||
SoCPipeParametersMod.append(model_name if model_name is not None else model_name_original)
|
||||
SoCPipeParametersMod.append(path_name if path_name is not None else path_name_original)
|
||||
SoCPipeParametersMod.append(sampler_name if sampler_name is not None else sampler_name_original)
|
||||
SoCPipeParametersMod.append(scheduler_name if scheduler_name is not None else scheduler_name_original)
|
||||
SoCPipeParametersMod.append(postive_prompt if postive_prompt is not None else postive_prompt_original)
|
||||
SoCPipeParametersMod.append(negative_prompt if negative_prompt is not None else negative_prompt_original)
|
||||
SoCPipeParametersMod.append(seed if seed is not None else seed_original)
|
||||
SoCPipeParametersMod.append(batch_count if batch_count is not None else batch_count_original)
|
||||
SoCPipeParametersMod.append(steps if steps is not None else steps_original)
|
||||
SoCPipeParametersMod.append(CFG if CFG is not None else CFG_original)
|
||||
SoCPipeParametersMod.append(image_width if image_width is not None else image_width_original)
|
||||
SoCPipeParametersMod.append(image_height if image_height is not None else image_height_original)
|
||||
|
||||
return (SoCPipeParametersMod,)
|
||||
|
||||
|
||||
class SoCPipeFromParamters:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"SoCPipeToParamters": ("SoCPipeToParamters",),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = "SimpleOfComplex/Pipe"
|
||||
RETURN_TYPES = ("SoCPipeToParamters", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", int, int, int, float, int, int,)
|
||||
RETURN_NAMES = ("SoCPipeToParamters", "model_name", "path_name", "sampler_name", "scheduler_name", "postive_prompt", "negative_prompt", "seed", "batch_count", "steps", "CFG", "image_height", "image_width")
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, SoCPipeParameters=None, ):
|
||||
model_name_original, path_name_original, sampler_name_original, scheduler_name_original, postive_prompt_original, negative_prompt_original,seed_original,batch_count_original,steps_original,CFG_original,image_width_original, image_height_original = SoCPipeParameters
|
||||
return SoCPipeParameters, model_name_original, path_name_original, sampler_name_original, scheduler_name_original, postive_prompt_original, negative_prompt_original,seed_original,batch_count_original,steps_original,CFG_original,image_width_original, image_height_original
|
||||
@@ -0,0 +1,52 @@
|
||||
#class PromptModify:
|
||||
|
||||
#
|
||||
# <<QUALITY>><<QUALITY>
|
||||
# <PROMPT>
|
||||
# <POSITIVE>
|
||||
# <QUALITY add="source_9,source_8_up" remove=""/>
|
||||
# </POSITIVE>
|
||||
# <NEGATIVE>
|
||||
# <QUALITY> add="" remove=""/>
|
||||
# </NEGATIVE>
|
||||
# </PROMPT>
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
return {"required": {
|
||||
"postive": ("STRING", {"multiline": False, "default": ""}),
|
||||
"negative": ("STRING", {"multiline": False, "default": ""}),
|
||||
"element": ("STRING", {"multiline": False, "default": ""}),
|
||||
"modifers": ("STRING", {"multiline": False, "default": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "execute"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "SimpleOfComplex/Prompt"
|
||||
|
||||
def execute(self, positive,negative,element,modifers):
|
||||
|
||||
modifier_array = modifers.split("|")
|
||||
postive_seg_array = positive.split("<<{element}>>") # part1,quality_part,part2
|
||||
negative_seg_array = negative.split("<<{element}>>") # part1,quality_part,part2
|
||||
for modifier_item in modifier_array:
|
||||
if modifier_item.startswith("<<POSITIVE:"):
|
||||
a_item = modifier_item.replace("<<POSITIVE:","").replace(">>","")
|
||||
#source_9,source_8_up
|
||||
b_items = a_item.split(",")
|
||||
for c_item in b_items:
|
||||
|
||||
|
||||
if modifier_item.startswith("<<NEGATIVE:"):
|
||||
a_item = modifier_item.replace("<<NEGATIVE:","").replace(">>","")
|
||||
#-source_cartoon,source_furry
|
||||
|
||||
# <<POSTIVE:source_9,source_8_up>>|<<NEGATIVE:-source_cartoon,source_furry>>
|
||||
return("",)
|
||||
Reference in New Issue
Block a user