| import math | |
| class Calculate_Framewindow: | |
| """ | |
| Computes: floor((length * float(framerate)) + 1) | |
| """ | |
| def INPUT_TYPES(cls): | |
| return { | |
| "required": { | |
| "length": ("FLOAT", { | |
| "default": 1.0, | |
| "min": 0.0, | |
| "max": 1.0e9, | |
| "step": 0.001, | |
| }), | |
| "framerate": ("INT", { | |
| "default": 24, | |
| "min": 1, | |
| "max": 1000000, | |
| "step": 1, | |
| }), | |
| } | |
| } | |
| RETURN_TYPES = ("INT",) | |
| RETURN_NAMES = ("result",) | |
| FUNCTION = "compute" | |
| CATEGORY = "math" | |
| def compute(self, length: float, framerate: int): | |
| framerate_f = float(framerate) # explicit internal conversion as requested | |
| value = (length * framerate_f) + 1.0 | |
| result = int(math.floor(value)) # round down | |
| return (result,) | |
| NODE_CLASS_MAPPINGS = { | |
| "Calculate_Framewindow": Calculate_Framewindow | |
| } | |
| NODE_DISPLAY_NAME_MAPPINGS = { | |
| "Calculate_Framewindow": "Calculate_Framewindow" | |
| } | |