Add a LatentFlip node.
This commit is contained in:
parent
69df7eba94
commit
3fa009f4cc
23
nodes.py
23
nodes.py
|
@ -210,7 +210,6 @@ class LatentRotate:
|
|||
CATEGORY = "latent"
|
||||
|
||||
def rotate(self, samples, rotation):
|
||||
s = samples.clone()
|
||||
rotate_by = 0
|
||||
if rotation.startswith("90"):
|
||||
rotate_by = 1
|
||||
|
@ -221,6 +220,27 @@ class LatentRotate:
|
|||
|
||||
s = torch.rot90(samples, k=rotate_by, dims=[3, 2])
|
||||
return (s,)
|
||||
|
||||
class LatentFlip:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "samples": ("LATENT",),
|
||||
"flip_method": (["x-axis: vertically", "y-axis: horizontally"],),
|
||||
}}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "flip"
|
||||
|
||||
CATEGORY = "latent"
|
||||
|
||||
def flip(self, samples, flip_method):
|
||||
if flip_method.startswith("x"):
|
||||
s = torch.flip(samples, dims=[2])
|
||||
elif flip_method.startswith("y"):
|
||||
s = torch.flip(samples, dims=[3])
|
||||
else:
|
||||
s = samples
|
||||
|
||||
return (s,)
|
||||
def common_ksampler(device, model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=1.0, disable_noise=False, start_step=None, last_step=None, force_full_denoise=False):
|
||||
if disable_noise:
|
||||
noise = torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
|
||||
|
@ -409,6 +429,7 @@ NODE_CLASS_MAPPINGS = {
|
|||
"ConditioningSetArea": ConditioningSetArea,
|
||||
"KSamplerAdvanced": KSamplerAdvanced,
|
||||
"LatentRotate": LatentRotate,
|
||||
"LatentFlip": LatentFlip,
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue