Figured out Switch situation
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run

This commit is contained in:
Jedrzej Kosinski 2025-12-16 21:55:20 -08:00
parent 85a97cc5c8
commit 6630cd8135
2 changed files with 9 additions and 8 deletions

View File

@ -1838,7 +1838,7 @@ class NodeOutput(_NodeOutputInternal):
return self.args if len(self.args) > 0 else None return self.args if len(self.args) > 0 else None
@classmethod @classmethod
def from_dict(cls, data: dict[str, Any]) -> "NodeOutput": def from_dict(cls, data: dict[str, Any]) -> NodeOutput:
args = () args = ()
ui = None ui = None
expand = None expand = None

View File

@ -7,13 +7,13 @@ from comfy_api.latest import _io
MISSING = object() MISSING = object()
class SwitchNode(io.ComfyNode): class SoftSwitchNode(io.ComfyNode):
@classmethod @classmethod
def define_schema(cls): def define_schema(cls):
template = io.MatchType.Template("switch") template = io.MatchType.Template("switch")
return io.Schema( return io.Schema(
node_id="ComfySwitchNode", node_id="ComfySoftSwitchNode",
display_name="Switch", display_name="Soft Switch",
category="logic", category="logic",
is_experimental=True, is_experimental=True,
inputs=[ inputs=[
@ -58,14 +58,15 @@ class SwitchNode(io.ComfyNode):
return io.NodeOutput(on_true) return io.NodeOutput(on_true)
return io.NodeOutput(on_true if switch else on_false) return io.NodeOutput(on_true if switch else on_false)
class SwitchNode2(io.ComfyNode): class SwitchNode(io.ComfyNode):
@classmethod @classmethod
def define_schema(cls): def define_schema(cls):
template = io.MatchType.Template("switch") template = io.MatchType.Template("switch")
return io.Schema( return io.Schema(
node_id="ComfySwitchNode2", node_id="ComfySwitchNode",
display_name="Switch2", display_name="Switch",
category="logic", category="logic",
is_experimental=True,
inputs=[ inputs=[
io.Boolean.Input("switch"), io.Boolean.Input("switch"),
io.MatchType.Input("on_false", template=template, lazy=True), io.MatchType.Input("on_false", template=template, lazy=True),
@ -214,7 +215,7 @@ class LogicExtension(ComfyExtension):
async def get_node_list(self) -> list[type[io.ComfyNode]]: async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [ return [
SwitchNode, SwitchNode,
SwitchNode2, SoftSwitchNode,
CustomComboNode, CustomComboNode,
DCTestNode, DCTestNode,
AutogrowNamesTestNode, AutogrowNamesTestNode,