-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodes.py
101 lines (71 loc) · 2.06 KB
/
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
class AlwaysEqualProxy(str):
def __eq__(self, _):
return True
def __ne__(self, _):
return False
class IfElse:
"""
this node does nothing but it is required for Gyre if else (e.g. Inpainting)
"""
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"true": (AlwaysEqualProxy("*"),),
"false": (AlwaysEqualProxy("*"),),
"route": ("BOOLEAN", {"default": False}),
},
}
RETURN_TYPES = (AlwaysEqualProxy("*"),)
RETURN_NAMES = ("ANY",)
FUNCTION = "live_route"
CATEGORY = "Gyre"
def live_route(self, true,false,route ):
return (true if route else false,)
class LoopStart:
"""
this node does nothing but it is required for Gyre loops (e.g. ControlNet list)
"""
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"ANY": (AlwaysEqualProxy("*"),),
},
}
RETURN_TYPES = (AlwaysEqualProxy("*"),)
RETURN_NAMES = ("ANY",)
FUNCTION = "do_nothing"
CATEGORY = "Gyre"
def do_nothing(self, ANY):
return (ANY,)
class LoopEnd:
"""
this node does nothing but it is required for Gyre loops (e.g. ControlNet list)
"""
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"ANY": (AlwaysEqualProxy("*"),),
},
}
RETURN_TYPES = (AlwaysEqualProxy("*"),)
RETURN_NAMES = ("ANY",)
FUNCTION = "do_nothing"
CATEGORY = "Gyre"
def do_nothing(self, ANY):
return (ANY,)
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"GyreLoopStart": LoopStart,
"GyreLoopEnd": LoopEnd,
"GyreIfElse": IfElse,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"GyreLoopStart": "Loop Start",
"GyreLoopEnd": "Loop End",
"GyreIfElse": "If Else",
}