Skip to content

Commit 322e3d0

Browse files
committed
Add (and leave commented out) some potential logic nodes
1 parent 37e94ed commit 322e3d0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

comfy_extras/nodes_logic.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ def define_schema(cls):
129129
outputs=[io.String.Output()]
130130
)
131131

132+
@classmethod
133+
def validate_inputs(cls, choice: io.Combo.Type) -> bool:
134+
return True
135+
132136
@classmethod
133137
def execute(cls, choice: io.Combo.Type) -> io.NodeOutput:
134138
return io.NodeOutput(choice)
@@ -234,6 +238,21 @@ def define_schema(cls):
234238
def execute(cls, combo: io.Combo.Type, combo2: io.Combo.Type) -> io.NodeOutput:
235239
return io.NodeOutput(combo, combo2)
236240

241+
class ConvertStringToComboNode(io.ComfyNode):
242+
@classmethod
243+
def define_schema(cls):
244+
return io.Schema(
245+
node_id="ConvertStringToComboNode",
246+
display_name="Convert String to Combo",
247+
category="logic",
248+
inputs=[io.String.Input("string")],
249+
outputs=[io.Combo.Output()],
250+
)
251+
252+
@classmethod
253+
def execute(cls, string: str) -> io.NodeOutput:
254+
return io.NodeOutput(string)
255+
237256
class AnyTypeTestNode(io.ComfyNode):
238257
@classmethod
239258
def define_schema(cls):
@@ -249,17 +268,34 @@ def define_schema(cls):
249268
def execute(cls, any: io.AnyType.Type) -> io.NodeOutput:
250269
return io.NodeOutput(any)
251270

271+
class InvertBooleanNode(io.ComfyNode):
272+
@classmethod
273+
def define_schema(cls):
274+
return io.Schema(
275+
node_id="InvertBooleanNode",
276+
display_name="Invert Boolean",
277+
category="logic",
278+
inputs=[io.Boolean.Input("boolean")],
279+
outputs=[io.Boolean.Output()],
280+
)
281+
282+
@classmethod
283+
def execute(cls, boolean: bool) -> io.NodeOutput:
284+
return io.NodeOutput(not boolean)
285+
252286
class LogicExtension(ComfyExtension):
253287
@override
254288
async def get_node_list(self) -> list[type[io.ComfyNode]]:
255289
return [
256290
SwitchNode,
257291
# SoftSwitchNode,
258292
# CustomComboNode,
293+
# ConvertStringToComboNode,
259294
# DCTestNode,
260295
# AutogrowNamesTestNode,
261296
# AutogrowPrefixTestNode,
262297
# ComboOutputTestNode,
298+
# InvertBooleanNode,
263299
# MatchTypeTestNode,
264300
# AnyTypeTestNode,
265301
]

0 commit comments

Comments
 (0)