Spaces:
Running
on
L40S
Running
on
L40S
File size: 2,247 Bytes
4450790 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
#---------------------------------------------------------------------------------------------------------------------#
# CR Animation Nodes by RockOfFire and Akatsuzi https://github.com/Suzie1/CR-Animation-Nodes
# for ComfyUI https://github.com/comfyanonymous/ComfyUI
#---------------------------------------------------------------------------------------------------------------------#
from ..categories import icons
#---------------------------------------------------------------------------------------------------------------------#
class CR_DebatchFrames:
# cloned from ltdrdata Image Batch To Image List node
@classmethod
def INPUT_TYPES(s):
return {"required": { "frames": ("IMAGE",), } }
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("debatched_frames",)
OUTPUT_IS_LIST = (True,)
FUNCTION = "debatch"
CATEGORY = icons.get("Comfyroll/Animation/Utils")
def debatch(self, frames):
images = [frames[i:i + 1, ...] for i in range(frames.shape[0])]
return (images, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_CurrentFrame:
@classmethod
def INPUT_TYPES(s):
return {"required":{
"index": ("INT", {"default": 1, "min": -10000, "max": 10000}),
"print_to_console": (["Yes","No"],),
}
}
RETURN_TYPES = ("INT",)
RETURN_NAMES = ("index",)
FUNCTION = "to_console"
CATEGORY = icons.get("Comfyroll/Animation/Utils")
def to_console(self, index, print_to_console):
if print_to_console == "Yes":
print(f"[Info] CR Current Frame:{index}")
return (index, )
#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
#---------------------------------------------------------------------------------------------------------------------#
# For reference only, actual mappings are in __init__.py
# 8 nodes
'''
NODE_CLASS_MAPPINGS = {
# Utils
"CR Debatch Frames":CR_DebatchFrames,
"CR Current Frame":CR_CurrentFrame,
}
'''
|