-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathotonx_nodes.py
323 lines (263 loc) · 9.32 KB
/
otonx_nodes.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# wildcard trick is taken from pythongossss's
# I found it in Impact Pack's nodes
class AnyType(str):
def __ne__(self, __value: object) -> bool:
return False
any_type = AnyType("*")
class OTX_IntegerMultipleInputs_4:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"int_1": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_2": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_3": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_4": ("INT", {"default": 0, "min": 0, "max": 10000}),
},
}
RETURN_TYPES = ("INT","INT","INT","INT",)
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, int_1, int_2, int_3, int_4):
return int_1, int_2, int_3, int_4
class OTX_IntegerMultipleInputs_5:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"int_1": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_2": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_3": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_4": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_5": ("INT", {"default": 0, "min": 0, "max": 10000}),
},
}
RETURN_TYPES = ("INT","INT","INT","INT","INT",)
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, int_1, int_2, int_3, int_4, int_5):
return int_1, int_2, int_3, int_4, int_5
class OTX_IntegerMultipleInputs_6:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"int_1": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_2": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_3": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_4": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_5": ("INT", {"default": 0, "min": 0, "max": 10000}),
"int_6": ("INT", {"default": 0, "min": 0, "max": 10000}),
},
}
RETURN_TYPES = ("INT","INT","INT","INT","INT","INT",)
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, int_1, int_2, int_3, int_4, int_5, int_6):
return int_1, int_2, int_3, int_4, int_5, int_6
class OTX_VersatileMultipleInputs_4:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value_1": ("STRING", {"default": "", "multiline": True}),
"valuetype_1": (list(('int', 'float', 'string')),),
"value_2": ("STRING", {"default": "", "multiline": True}),
"valuetype_2": (list(('int', 'float', 'string')),),
"value_3": ("STRING", {"default": "", "multiline": True}),
"valuetype_3": (list(('int', 'float', 'string')),),
"value_4": ("STRING", {"default": "", "multiline": True}),
"valuetype_4": (list(('int', 'float', 'string')),),
},
}
RETURN_TYPES = (any_type, any_type, any_type, any_type,)
RETURN_NAMES = ("value_1", "value_2", "value_3", "value_4")
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, value_1, value_2, value_3, value_4, valuetype_1, valuetype_2, valuetype_3, valuetype_4):
# Convert value_1 based on valuetype_1
if valuetype_1 == "INT":
value_1 = int(value_1)
elif valuetype_1 == "FLOAT":
value_1 = float(value_1)
elif valuetype_1 == "STRING":
value_1 = str(value_1)
# Convert value_2 based on valuetype_2
if valuetype_2 == "INT":
value_2 = int(value_2)
elif valuetype_2 == "FLOAT":
value_2 = float(value_2)
elif valuetype_2 == "STRING":
value_2 = str(value_2)
# Convert value_3 based on valuetype_3
if valuetype_3 == "INT":
value_3 = int(value_3)
elif valuetype_3 == "FLOAT":
value_3 = float(value_3)
elif valuetype_3 == "STRING":
value_3 = str(value_3)
# Convert value_4 based on valuetype_4
if valuetype_4 == "INT":
value_4 = int(value_4)
elif valuetype_4 == "FLOAT":
value_4 = float(value_4)
elif valuetype_4 == "STRING":
value_4 = str(value_4)
return value_1, value_2, value_3, value_4
class OTX_VersatileMultipleInputs_5:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value_1": ("STRING", {"default": "", "multiline": True}),
"valuetype_1": (list(('int', 'float', 'string')),),
"value_2": ("STRING", {"default": "", "multiline": True}),
"valuetype_2": (list(('int', 'float', 'string')),),
"value_3": ("STRING", {"default": "", "multiline": True}),
"valuetype_3": (list(('int', 'float', 'string')),),
"value_4": ("STRING", {"default": "", "multiline": True}),
"valuetype_4": (list(('int', 'float', 'string')),),
"value_5": ("STRING", {"default": "", "multiline": True}),
"valuetype_5": (list(('int', 'float', 'string')),),
},
}
RETURN_TYPES = (any_type, any_type, any_type, any_type, any_type,)
RETURN_NAMES = ("value_1", "value_2", "value_3", "value_4", "value_5")
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, value_1, value_2, value_3, value_4, value_5, valuetype_1, valuetype_2, valuetype_3, valuetype_4, valuetype_5):
# Convert value_1 based on valuetype_1
if valuetype_1 == "INT":
value_1 = int(value_1)
elif valuetype_1 == "FLOAT":
value_1 = float(value_1)
elif valuetype_1 == "STRING":
value_1 = str(value_1)
# Convert value_2 based on valuetype_2
if valuetype_2 == "INT":
value_2 = int(value_2)
elif valuetype_2 == "FLOAT":
value_2 = float(value_2)
elif valuetype_2 == "STRING":
value_2 = str(value_2)
# Convert value_3 based on valuetype_3
if valuetype_3 == "INT":
value_3 = int(value_3)
elif valuetype_3 == "FLOAT":
value_3 = float(value_3)
elif valuetype_3 == "STRING":
value_3 = str(value_3)
# Convert value_4 based on valuetype_4
if valuetype_4 == "INT":
value_4 = int(value_4)
elif valuetype_4 == "FLOAT":
value_4 = float(value_4)
elif valuetype_4 == "STRING":
value_4 = str(value_4)
# Convert value_5 based on valuetype_5
if valuetype_5 == "INT":
value_5 = int(value_5)
elif valuetype_5 == "FLOAT":
value_5 = float(value_5)
elif valuetype_5 == "STRING":
value_5 = str(value_5)
return value_1, value_2, value_3, value_4, value_5
class OTX_VersatileMultipleInputs_6:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value_1": ("STRING", {"default": "", "multiline": True}),
"valuetype_1": (list(('int', 'float', 'string')),),
"value_2": ("STRING", {"default": "", "multiline": True}),
"valuetype_2": (list(('int', 'float', 'string')),),
"value_3": ("STRING", {"default": "", "multiline": True}),
"valuetype_3": (list(('int', 'float', 'string')),),
"value_4": ("STRING", {"default": "", "multiline": True}),
"valuetype_4": (list(('int', 'float', 'string')),),
"value_5": ("STRING", {"default": "", "multiline": True}),
"valuetype_5": (list(('int', 'float', 'string')),),
"value_6": ("STRING", {"default": "", "multiline": True}),
"valuetype_6": (list(('int', 'float', 'string')),),
},
}
RETURN_TYPES = (any_type, any_type, any_type, any_type, any_type, any_type,)
RETURN_NAMES = ("value_1", "value_2", "value_3", "value_4", "value_5", "value_6")
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, value_1, value_2, value_3, value_4, value_5, value_6, valuetype_1, valuetype_2, valuetype_3, valuetype_4, valuetype_5, valuetype_6):
# Convert value_1 based on valuetype_1
if valuetype_1 == "INT":
value_1 = int(value_1)
elif valuetype_1 == "FLOAT":
value_1 = float(value_1)
elif valuetype_1 == "STRING":
value_1 = str(value_1)
# Convert value_2 based on valuetype_2
if valuetype_2 == "INT":
value_2 = int(value_2)
elif valuetype_2 == "FLOAT":
value_2 = float(value_2)
elif valuetype_2 == "STRING":
value_2 = str(value_2)
# Convert value_3 based on valuetype_3
if valuetype_3 == "INT":
value_3 = int(value_3)
elif valuetype_3 == "FLOAT":
value_3 = float(value_3)
elif valuetype_3 == "STRING":
value_3 = str(value_3)
# Convert value_4 based on valuetype_4
if valuetype_4 == "INT":
value_4 = int(value_4)
elif valuetype_4 == "FLOAT":
value_4 = float(value_4)
elif valuetype_4 == "STRING":
value_4 = str(value_4)
# Convert value_5 based on valuetype_5
if valuetype_5 == "INT":
value_5 = int(value_5)
elif valuetype_5 == "FLOAT":
value_5 = float(value_5)
elif valuetype_5 == "STRING":
value_5 = str(value_5)
# Convert value_6 based on valuetype_6
if valuetype_6 == "INT":
value_6 = int(value_6)
elif valuetype_6 == "FLOAT":
value_6 = float(value_6)
elif valuetype_6 == "STRING":
value_6 = str(value_6)
return value_1, value_2, value_3, value_4, value_5, value_6
class OTX_KSampler_Feeder:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0}),
"base_steps_portion": ("FLOAT", {"default": 0.8, "min": 0.0, "max": 1.0, "step": 0.1, "display": "number"}),
},
}
RETURN_TYPES = ("INT","INT","FLOAT","INT",)
RETURN_NAMES = ("noise_seed", "steps", "cfg", "base_end_at_step",)
FUNCTION = "pass_parameters"
CATEGORY = "OtonxPack"
def pass_parameters(self, base_steps_portion, noise_seed, steps, cfg):
base_end_at_step = int(steps * base_steps_portion)
return noise_seed, steps, cfg, base_end_at_step