mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 03:13:30 +00:00
Add a LatentRotate node.
This commit is contained in:
parent
1daccf3678
commit
f8f165e2c3
24
nodes.py
24
nodes.py
@ -198,6 +198,29 @@ class LatentUpscale:
|
|||||||
s = torch.nn.functional.interpolate(s, size=(height // 8, width // 8), mode=upscale_method)
|
s = torch.nn.functional.interpolate(s, size=(height // 8, width // 8), mode=upscale_method)
|
||||||
return (s,)
|
return (s,)
|
||||||
|
|
||||||
|
class LatentRotate:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": { "samples": ("LATENT",),
|
||||||
|
"rotation": (["none", "90 degrees", "180 degrees", "270 degrees"],),
|
||||||
|
}}
|
||||||
|
RETURN_TYPES = ("LATENT",)
|
||||||
|
FUNCTION = "rotate"
|
||||||
|
|
||||||
|
CATEGORY = "latent"
|
||||||
|
|
||||||
|
def rotate(self, samples, rotation):
|
||||||
|
s = samples.clone()
|
||||||
|
rotate_by = 0
|
||||||
|
if rotation.startswith("90"):
|
||||||
|
rotate_by = 1
|
||||||
|
elif rotation.startswith("180"):
|
||||||
|
rotate_by = 2
|
||||||
|
elif rotation.startswith("270"):
|
||||||
|
rotate_by = 3
|
||||||
|
|
||||||
|
s = torch.rot90(samples, k=rotate_by, dims=[3, 2])
|
||||||
|
return (s,)
|
||||||
class KSampler:
|
class KSampler:
|
||||||
def __init__(self, device="cuda"):
|
def __init__(self, device="cuda"):
|
||||||
self.device = device
|
self.device = device
|
||||||
@ -342,6 +365,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"LoadImage": LoadImage,
|
"LoadImage": LoadImage,
|
||||||
"ConditioningCombine": ConditioningCombine,
|
"ConditioningCombine": ConditioningCombine,
|
||||||
"ConditioningSetArea": ConditioningSetArea,
|
"ConditioningSetArea": ConditioningSetArea,
|
||||||
|
"LatentRotate": LatentRotate,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user