File size: 1,191 Bytes
d566315 | 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 | import math
class Calculate_Framewindow:
"""
Computes: floor((length * float(framerate)) + 1)
"""
@classmethod
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"
}
|