-
Notifications
You must be signed in to change notification settings - Fork 60
/
HelperNodes.py
59 lines (50 loc) · 1.79 KB
/
HelperNodes.py
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
class CalculateFrameOffset:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"current_frame": ("INT", {"default": 0, "min": 0}),
"max_frames": ("INT", {"default": 18, "min": 0}),
"num_latent_inputs": ("INT", {"default": 4, "min": 0}),
"index": ("INT", {"default": 4, "min": 0}),
}
}
RETURN_TYPES = ("INT", )
FUNCTION = "assignFrameNum"
CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes"
def assignFrameNum(self, current_frame, max_frames, num_latent_inputs, index):
if current_frame == 0:
return (index,)
else:
start_frame = (current_frame - 1) * (num_latent_inputs - 1) + (num_latent_inputs-1)
return ((start_frame + index) % max_frames,)
class ConcatStringSingle:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"string_a": ("STRING", {"forceInput":True,"default":"","multiline": True}),
"string_b": ("STRING", {"forceInput":True,"default":"","multiline": True}),
}
}
RETURN_TYPES = ("STRING", )
FUNCTION = "concat"
CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes"
def concat(self, string_a, string_b):
c = string_a + string_b
return (c,)
class convertKeyframeKeysToBatchKeys:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"input": ("INT", {"forceInput": True, "default": 0}),
"num_latents": ("INT", {"default": 16}),
}
}
RETURN_TYPES = ("INT",)
FUNCTION = "concat"
CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes"
def concat(self, input, num_latents):
c = input * num_latents -1
return (c,)