| |
| |
| |
| |
| |
|
|
| class LTXDurationToFrames: |
| @classmethod |
| def INPUT_TYPES(cls): |
| return { |
| "required": { |
| "duration_seconds": ("FLOAT", {"default": 10.0, "min": 0.5, "max": 120.0, "step": 0.1}), |
| "fps": ("INT", {"default": 25, "min": 1, "max": 60}), |
| } |
| } |
|
|
| RETURN_TYPES = ("INT", "INT", "FLOAT", "FLOAT") |
| RETURN_NAMES = ("frames", "fps_int", "fps_float", "actual_seconds") |
| FUNCTION = "calc" |
| CATEGORY = "LTX" |
|
|
| def calc(self, duration_seconds, fps): |
| raw = duration_seconds * fps |
| n = round((raw - 1) / 8.0) |
| frames = int(8 * n + 1) |
| if frames < 9: |
| frames = 9 |
| actual = frames / float(fps) |
| print("[LTXDurationToFrames] %.1fs @ %dfps -> %d frames (%.2fs actual)" |
| % (duration_seconds, fps, frames, actual)) |
| return (frames, int(fps), float(fps), actual) |
|
|
|
|
| NODE_CLASS_MAPPINGS = {"LTXDurationToFrames": LTXDurationToFrames} |
| NODE_DISPLAY_NAME_MAPPINGS = {"LTXDurationToFrames": "LTX Duration to Frames (seconds)"} |
|
|