mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-27 16:26:39 +00:00
restore nodes order as it in the V1 version for smaller git diff (4)
This commit is contained in:
parent
de54491deb
commit
31b1bc20cc
@ -54,7 +54,7 @@ class T5TokenizerOptions(io.ComfyNode):
|
|||||||
return io.NodeOutput(clip)
|
return io.NodeOutput(clip)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
CLIPTextEncodeControlnet,
|
CLIPTextEncodeControlnet,
|
||||||
T5TokenizerOptions,
|
T5TokenizerOptions,
|
||||||
]
|
]
|
||||||
|
@ -45,6 +45,6 @@ class DifferentialDiffusion(io.ComfyNode):
|
|||||||
return (denoise_mask >= threshold).to(denoise_mask.dtype)
|
return (denoise_mask >= threshold).to(denoise_mask.dtype)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
DifferentialDiffusion,
|
DifferentialDiffusion,
|
||||||
]
|
]
|
||||||
|
@ -29,6 +29,6 @@ class ReferenceLatent(io.ComfyNode):
|
|||||||
return io.NodeOutput(conditioning)
|
return io.NodeOutput(conditioning)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
ReferenceLatent,
|
ReferenceLatent,
|
||||||
]
|
]
|
||||||
|
@ -105,6 +105,6 @@ class FreSca(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
FreSca,
|
FreSca,
|
||||||
]
|
]
|
||||||
|
@ -371,6 +371,6 @@ class GITSScheduler(io.ComfyNode):
|
|||||||
return io.NodeOutput(torch.FloatTensor(sigmas))
|
return io.NodeOutput(torch.FloatTensor(sigmas))
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
GITSScheduler,
|
GITSScheduler,
|
||||||
]
|
]
|
||||||
|
@ -131,6 +131,6 @@ class HypernetworkLoader(io.ComfyNode):
|
|||||||
return io.NodeOutput(model_hypernetwork)
|
return io.NodeOutput(model_hypernetwork)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
HypernetworkLoader,
|
HypernetworkLoader,
|
||||||
]
|
]
|
||||||
|
@ -90,6 +90,6 @@ class HyperTile(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
HyperTile,
|
HyperTile,
|
||||||
]
|
]
|
||||||
|
@ -51,6 +51,6 @@ class InstructPixToPixConditioning(io.ComfyNode):
|
|||||||
return io.NodeOutput(out[0], out[1], out_latent)
|
return io.NodeOutput(out[0], out[1], out_latent)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
InstructPixToPixConditioning,
|
InstructPixToPixConditioning,
|
||||||
]
|
]
|
||||||
|
@ -133,6 +133,6 @@ class LoraSave(io.ComfyNode):
|
|||||||
return io.NodeOutput()
|
return io.NodeOutput()
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
LoraSave,
|
LoraSave,
|
||||||
]
|
]
|
||||||
|
@ -29,6 +29,6 @@ class LotusConditioning(io.ComfyNode):
|
|||||||
return io.NodeOutput(cond)
|
return io.NodeOutput(cond)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
LotusConditioning,
|
LotusConditioning,
|
||||||
]
|
]
|
||||||
|
@ -46,6 +46,6 @@ class Mahiro(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
Mahiro,
|
Mahiro,
|
||||||
]
|
]
|
||||||
|
@ -33,6 +33,6 @@ class EmptyMochiLatentVideo(io.ComfyNode):
|
|||||||
return io.NodeOutput({"samples": latent})
|
return io.NodeOutput({"samples": latent})
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
EmptyMochiLatentVideo,
|
EmptyMochiLatentVideo,
|
||||||
]
|
]
|
||||||
|
@ -63,6 +63,6 @@ class PatchModelAddDownscale(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
PatchModelAddDownscale,
|
PatchModelAddDownscale,
|
||||||
]
|
]
|
||||||
|
@ -59,6 +59,6 @@ class OptimalStepsScheduler(io.ComfyNode):
|
|||||||
return io.NodeOutput(torch.FloatTensor(sigmas))
|
return io.NodeOutput(torch.FloatTensor(sigmas))
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
OptimalStepsScheduler,
|
OptimalStepsScheduler,
|
||||||
]
|
]
|
||||||
|
@ -57,6 +57,6 @@ class PerturbedAttentionGuidance(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
PerturbedAttentionGuidance,
|
PerturbedAttentionGuidance,
|
||||||
]
|
]
|
||||||
|
@ -109,6 +109,6 @@ class PerpNegGuider(io.ComfyNode):
|
|||||||
return io.NodeOutput(guider)
|
return io.NodeOutput(guider)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
PerpNegGuider,
|
PerpNegGuider,
|
||||||
]
|
]
|
||||||
|
@ -28,6 +28,6 @@ class CLIPTextEncodePixArtAlpha(io.ComfyNode):
|
|||||||
return io.NodeOutput(clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}))
|
return io.NodeOutput(clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}))
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
CLIPTextEncodePixArtAlpha,
|
CLIPTextEncodePixArtAlpha,
|
||||||
]
|
]
|
||||||
|
@ -186,4 +186,6 @@ class SelfAttentionGuidance(io.ComfyNode):
|
|||||||
|
|
||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
NODES_LIST = [SelfAttentionGuidance]
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
|
SelfAttentionGuidance,
|
||||||
|
]
|
||||||
|
@ -53,4 +53,6 @@ class SD_4XUpscale_Conditioning(io.ComfyNode):
|
|||||||
latent = torch.zeros([images.shape[0], 4, height // 4, width // 4])
|
latent = torch.zeros([images.shape[0], 4, height // 4, width // 4])
|
||||||
return io.NodeOutput(out_cp, out_cn, {"samples":latent})
|
return io.NodeOutput(out_cp, out_cn, {"samples":latent})
|
||||||
|
|
||||||
NODES_LIST = [SD_4XUpscale_Conditioning]
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
|
SD_4XUpscale_Conditioning,
|
||||||
|
]
|
||||||
|
@ -5,6 +5,70 @@ import re
|
|||||||
from comfy_api.latest import io
|
from comfy_api.latest import io
|
||||||
|
|
||||||
|
|
||||||
|
class StringConcatenate(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringConcatenate_V3",
|
||||||
|
display_name="Concatenate _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string_a", multiline=True),
|
||||||
|
io.String.Input("string_b", multiline=True),
|
||||||
|
io.String.Input("delimiter", multiline=False, default="")
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.String.Output()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string_a, string_b, delimiter):
|
||||||
|
return io.NodeOutput(delimiter.join((string_a, string_b)))
|
||||||
|
|
||||||
|
|
||||||
|
class StringSubstring(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringSubstring_V3",
|
||||||
|
display_name="Substring _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True),
|
||||||
|
io.Int.Input("start"),
|
||||||
|
io.Int.Input("end")
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.String.Output()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string, start, end):
|
||||||
|
return io.NodeOutput(string[start:end])
|
||||||
|
|
||||||
|
|
||||||
|
class StringLength(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringLength_V3",
|
||||||
|
display_name="Length _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True)
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Int.Output(display_name="length")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string):
|
||||||
|
return io.NodeOutput(len(string))
|
||||||
|
|
||||||
|
|
||||||
class CaseConverter(io.ComfyNode):
|
class CaseConverter(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -37,6 +101,160 @@ class CaseConverter(io.ComfyNode):
|
|||||||
return io.NodeOutput(result)
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
|
class StringTrim(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringTrim_V3",
|
||||||
|
display_name="Trim _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True),
|
||||||
|
io.Combo.Input("mode", options=["Both", "Left", "Right"])
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.String.Output()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string, mode):
|
||||||
|
if mode == "Both":
|
||||||
|
result = string.strip()
|
||||||
|
elif mode == "Left":
|
||||||
|
result = string.lstrip()
|
||||||
|
elif mode == "Right":
|
||||||
|
result = string.rstrip()
|
||||||
|
else:
|
||||||
|
result = string
|
||||||
|
|
||||||
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
|
class StringReplace(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringReplace_V3",
|
||||||
|
display_name="Replace _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True),
|
||||||
|
io.String.Input("find", multiline=True),
|
||||||
|
io.String.Input("replace", multiline=True)
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.String.Output()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string, find, replace):
|
||||||
|
return io.NodeOutput(string.replace(find, replace))
|
||||||
|
|
||||||
|
|
||||||
|
class StringContains(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringContains_V3",
|
||||||
|
display_name="Contains _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True),
|
||||||
|
io.String.Input("substring", multiline=True),
|
||||||
|
io.Boolean.Input("case_sensitive", default=True)
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Boolean.Output(display_name="contains")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string, substring, case_sensitive):
|
||||||
|
if case_sensitive:
|
||||||
|
contains = substring in string
|
||||||
|
else:
|
||||||
|
contains = substring.lower() in string.lower()
|
||||||
|
|
||||||
|
return io.NodeOutput(contains)
|
||||||
|
|
||||||
|
|
||||||
|
class StringCompare(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StringCompare_V3",
|
||||||
|
display_name="Compare _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string_a", multiline=True),
|
||||||
|
io.String.Input("string_b", multiline=True),
|
||||||
|
io.Combo.Input("mode", options=["Starts With", "Ends With", "Equal"]),
|
||||||
|
io.Boolean.Input("case_sensitive", default=True)
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Boolean.Output()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string_a, string_b, mode, case_sensitive):
|
||||||
|
if case_sensitive:
|
||||||
|
a = string_a
|
||||||
|
b = string_b
|
||||||
|
else:
|
||||||
|
a = string_a.lower()
|
||||||
|
b = string_b.lower()
|
||||||
|
|
||||||
|
if mode == "Equal":
|
||||||
|
return io.NodeOutput(a == b)
|
||||||
|
elif mode == "Starts With":
|
||||||
|
return io.NodeOutput(a.startswith(b))
|
||||||
|
elif mode == "Ends With":
|
||||||
|
return io.NodeOutput(a.endswith(b))
|
||||||
|
|
||||||
|
|
||||||
|
class RegexMatch(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="RegexMatch_V3",
|
||||||
|
display_name="Regex Match _V3",
|
||||||
|
category="utils/string",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("string", multiline=True),
|
||||||
|
io.String.Input("regex_pattern", multiline=True),
|
||||||
|
io.Boolean.Input("case_insensitive", default=True),
|
||||||
|
io.Boolean.Input("multiline", default=False),
|
||||||
|
io.Boolean.Input("dotall", default=False)
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Boolean.Output(display_name="matches")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, string, regex_pattern, case_insensitive, multiline, dotall):
|
||||||
|
flags = 0
|
||||||
|
|
||||||
|
if case_insensitive:
|
||||||
|
flags |= re.IGNORECASE
|
||||||
|
if multiline:
|
||||||
|
flags |= re.MULTILINE
|
||||||
|
if dotall:
|
||||||
|
flags |= re.DOTALL
|
||||||
|
|
||||||
|
try:
|
||||||
|
match = re.search(regex_pattern, string, flags)
|
||||||
|
result = match is not None
|
||||||
|
|
||||||
|
except re.error:
|
||||||
|
result = False
|
||||||
|
|
||||||
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
class RegexExtract(io.ComfyNode):
|
class RegexExtract(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -111,46 +329,6 @@ class RegexExtract(io.ComfyNode):
|
|||||||
return io.NodeOutput(result)
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
class RegexMatch(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="RegexMatch_V3",
|
|
||||||
display_name="Regex Match _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True),
|
|
||||||
io.String.Input("regex_pattern", multiline=True),
|
|
||||||
io.Boolean.Input("case_insensitive", default=True),
|
|
||||||
io.Boolean.Input("multiline", default=False),
|
|
||||||
io.Boolean.Input("dotall", default=False)
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.Boolean.Output(display_name="matches")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string, regex_pattern, case_insensitive, multiline, dotall):
|
|
||||||
flags = 0
|
|
||||||
|
|
||||||
if case_insensitive:
|
|
||||||
flags |= re.IGNORECASE
|
|
||||||
if multiline:
|
|
||||||
flags |= re.MULTILINE
|
|
||||||
if dotall:
|
|
||||||
flags |= re.DOTALL
|
|
||||||
|
|
||||||
try:
|
|
||||||
match = re.search(regex_pattern, string, flags)
|
|
||||||
result = match is not None
|
|
||||||
|
|
||||||
except re.error:
|
|
||||||
result = False
|
|
||||||
|
|
||||||
return io.NodeOutput(result)
|
|
||||||
|
|
||||||
|
|
||||||
class RegexReplace(io.ComfyNode):
|
class RegexReplace(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -187,185 +365,7 @@ class RegexReplace(io.ComfyNode):
|
|||||||
return io.NodeOutput(result)
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
class StringCompare(io.ComfyNode):
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringCompare_V3",
|
|
||||||
display_name="Compare _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string_a", multiline=True),
|
|
||||||
io.String.Input("string_b", multiline=True),
|
|
||||||
io.Combo.Input("mode", options=["Starts With", "Ends With", "Equal"]),
|
|
||||||
io.Boolean.Input("case_sensitive", default=True)
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.Boolean.Output()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string_a, string_b, mode, case_sensitive):
|
|
||||||
if case_sensitive:
|
|
||||||
a = string_a
|
|
||||||
b = string_b
|
|
||||||
else:
|
|
||||||
a = string_a.lower()
|
|
||||||
b = string_b.lower()
|
|
||||||
|
|
||||||
if mode == "Equal":
|
|
||||||
return io.NodeOutput(a == b)
|
|
||||||
elif mode == "Starts With":
|
|
||||||
return io.NodeOutput(a.startswith(b))
|
|
||||||
elif mode == "Ends With":
|
|
||||||
return io.NodeOutput(a.endswith(b))
|
|
||||||
|
|
||||||
|
|
||||||
class StringConcatenate(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringConcatenate_V3",
|
|
||||||
display_name="Concatenate _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string_a", multiline=True),
|
|
||||||
io.String.Input("string_b", multiline=True),
|
|
||||||
io.String.Input("delimiter", multiline=False, default="")
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.String.Output()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string_a, string_b, delimiter):
|
|
||||||
return io.NodeOutput(delimiter.join((string_a, string_b)))
|
|
||||||
|
|
||||||
|
|
||||||
class StringContains(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringContains_V3",
|
|
||||||
display_name="Contains _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True),
|
|
||||||
io.String.Input("substring", multiline=True),
|
|
||||||
io.Boolean.Input("case_sensitive", default=True)
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.Boolean.Output(display_name="contains")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string, substring, case_sensitive):
|
|
||||||
if case_sensitive:
|
|
||||||
contains = substring in string
|
|
||||||
else:
|
|
||||||
contains = substring.lower() in string.lower()
|
|
||||||
|
|
||||||
return io.NodeOutput(contains)
|
|
||||||
|
|
||||||
|
|
||||||
class StringLength(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringLength_V3",
|
|
||||||
display_name="Length _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True)
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.Int.Output(display_name="length")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string):
|
|
||||||
return io.NodeOutput(len(string))
|
|
||||||
|
|
||||||
|
|
||||||
class StringReplace(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringReplace_V3",
|
|
||||||
display_name="Replace _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True),
|
|
||||||
io.String.Input("find", multiline=True),
|
|
||||||
io.String.Input("replace", multiline=True)
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.String.Output()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string, find, replace):
|
|
||||||
return io.NodeOutput(string.replace(find, replace))
|
|
||||||
|
|
||||||
|
|
||||||
class StringSubstring(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringSubstring_V3",
|
|
||||||
display_name="Substring _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True),
|
|
||||||
io.Int.Input("start"),
|
|
||||||
io.Int.Input("end")
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.String.Output()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string, start, end):
|
|
||||||
return io.NodeOutput(string[start:end])
|
|
||||||
|
|
||||||
|
|
||||||
class StringTrim(io.ComfyNode):
|
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="StringTrim_V3",
|
|
||||||
display_name="Trim _V3",
|
|
||||||
category="utils/string",
|
|
||||||
inputs=[
|
|
||||||
io.String.Input("string", multiline=True),
|
|
||||||
io.Combo.Input("mode", options=["Both", "Left", "Right"])
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.String.Output()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, string, mode):
|
|
||||||
if mode == "Both":
|
|
||||||
result = string.strip()
|
|
||||||
elif mode == "Left":
|
|
||||||
result = string.lstrip()
|
|
||||||
elif mode == "Right":
|
|
||||||
result = string.rstrip()
|
|
||||||
else:
|
|
||||||
result = string
|
|
||||||
|
|
||||||
return io.NodeOutput(result)
|
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
|
||||||
CaseConverter,
|
CaseConverter,
|
||||||
RegexExtract,
|
RegexExtract,
|
||||||
RegexMatch,
|
RegexMatch,
|
||||||
|
@ -65,6 +65,6 @@ class TCFG(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
TCFG,
|
TCFG,
|
||||||
]
|
]
|
||||||
|
@ -185,6 +185,6 @@ class TomePatchModel(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
TomePatchModel,
|
TomePatchModel,
|
||||||
]
|
]
|
||||||
|
@ -27,6 +27,6 @@ class TorchCompileModel(io.ComfyNode):
|
|||||||
return io.NodeOutput(m)
|
return io.NodeOutput(m)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
TorchCompileModel,
|
TorchCompileModel,
|
||||||
]
|
]
|
||||||
|
@ -19,6 +19,35 @@ except Exception:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class UpscaleModelLoader(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="UpscaleModelLoader_V3",
|
||||||
|
display_name="Load Upscale Model _V3",
|
||||||
|
category="loaders",
|
||||||
|
inputs=[
|
||||||
|
io.Combo.Input("model_name", options=folder_paths.get_filename_list("upscale_models")),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.UpscaleModel.Output(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, model_name):
|
||||||
|
model_path = folder_paths.get_full_path_or_raise("upscale_models", model_name)
|
||||||
|
sd = comfy.utils.load_torch_file(model_path, safe_load=True)
|
||||||
|
if "module.layers.0.residual_group.blocks.0.norm1.weight" in sd:
|
||||||
|
sd = comfy.utils.state_dict_prefix_replace(sd, {"module.":""})
|
||||||
|
out = ModelLoader().load_from_state_dict(sd).eval()
|
||||||
|
|
||||||
|
if not isinstance(out, ImageModelDescriptor):
|
||||||
|
raise Exception("Upscale model must be a single-image model.")
|
||||||
|
|
||||||
|
return io.NodeOutput(out)
|
||||||
|
|
||||||
|
|
||||||
class ImageUpscaleWithModel(io.ComfyNode):
|
class ImageUpscaleWithModel(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -71,36 +100,7 @@ class ImageUpscaleWithModel(io.ComfyNode):
|
|||||||
return io.NodeOutput(s)
|
return io.NodeOutput(s)
|
||||||
|
|
||||||
|
|
||||||
class UpscaleModelLoader(io.ComfyNode):
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
@classmethod
|
|
||||||
def define_schema(cls):
|
|
||||||
return io.Schema(
|
|
||||||
node_id="UpscaleModelLoader_V3",
|
|
||||||
display_name="Load Upscale Model _V3",
|
|
||||||
category="loaders",
|
|
||||||
inputs=[
|
|
||||||
io.Combo.Input("model_name", options=folder_paths.get_filename_list("upscale_models")),
|
|
||||||
],
|
|
||||||
outputs=[
|
|
||||||
io.UpscaleModel.Output(),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def execute(cls, model_name):
|
|
||||||
model_path = folder_paths.get_full_path_or_raise("upscale_models", model_name)
|
|
||||||
sd = comfy.utils.load_torch_file(model_path, safe_load=True)
|
|
||||||
if "module.layers.0.residual_group.blocks.0.norm1.weight" in sd:
|
|
||||||
sd = comfy.utils.state_dict_prefix_replace(sd, {"module.":""})
|
|
||||||
out = ModelLoader().load_from_state_dict(sd).eval()
|
|
||||||
|
|
||||||
if not isinstance(out, ImageModelDescriptor):
|
|
||||||
raise Exception("Upscale model must be a single-image model.")
|
|
||||||
|
|
||||||
return io.NodeOutput(out)
|
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
|
||||||
ImageUpscaleWithModel,
|
ImageUpscaleWithModel,
|
||||||
UpscaleModelLoader,
|
UpscaleModelLoader,
|
||||||
]
|
]
|
||||||
|
@ -425,7 +425,7 @@ class WanVaceToVideo(io.ComfyNode):
|
|||||||
return io.NodeOutput(positive, negative, out_latent, trim_latent)
|
return io.NodeOutput(positive, negative, out_latent, trim_latent)
|
||||||
|
|
||||||
|
|
||||||
NODES_LIST = [
|
NODES_LIST: list[type[io.ComfyNode]] = [
|
||||||
TrimVideoLatent,
|
TrimVideoLatent,
|
||||||
WanCameraImageToVideo,
|
WanCameraImageToVideo,
|
||||||
WanFirstLastFrameToVideo,
|
WanFirstLastFrameToVideo,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user