Add files via upload
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from typing import Tuple
|
||||
|
||||
class PainterFrameMath:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"frame_number": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1, "forceInput": True}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT",)
|
||||
RETURN_NAMES = ("aligned_frame",)
|
||||
FUNCTION = "align_frame"
|
||||
CATEGORY = "Prince"
|
||||
|
||||
def align_frame(self, frame_number: int) -> Tuple[int]:
|
||||
# Calculate remainder when (frame_number - 1) is divided by 4
|
||||
remainder = (frame_number - 1) % 4
|
||||
|
||||
# If remainder is 0, frame_number is already in 4N+1 format
|
||||
# Otherwise, add the difference to reach next 4N+1 number
|
||||
if remainder == 0:
|
||||
aligned = frame_number
|
||||
else:
|
||||
aligned = frame_number + (4 - remainder)
|
||||
|
||||
return (aligned,)
|
||||
@@ -0,0 +1,9 @@
|
||||
from .PainterFrameMath import PainterFrameMath
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"PainterFrameMath": PainterFrameMath,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"PainterFrameMath": "PainterFrameMath",
|
||||
}
|
||||
Reference in New Issue
Block a user