Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more inputs/outputs to Pass Through #2549

Merged
merged 6 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend/src/api/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ def get_broadcast_type(self, _value: object) -> navi.ExpressionJson | None:
return None

def enforce(self, value: object) -> object:
assert value is not None
joeyballentine marked this conversation as resolved.
Show resolved Hide resolved
return value
12 changes: 12 additions & 0 deletions backend/src/nodes/properties/outputs/generic_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@ def __init__(self, label: str = "Audio Stream"):
label=label,
kind="generic",
)


class AnyOutput(BaseOutput):
def __init__(self, label: str = "Any", output_type: navi.ExpressionJson = "Any"):
super().__init__(
output_type=output_type,
label=label,
kind="generic",
)

def enforce(self, value: object) -> object:
return value
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
"""
Nodes that provide various generic utility
"""

from __future__ import annotations

from nodes.groups import optional_list_group
from nodes.properties.inputs import AnyInput
from nodes.properties.outputs import BaseOutput
from nodes.properties.outputs import AnyOutput

from .. import value_group


@value_group.register(
schema_id="chainner:utility:pass_through",
name="Pass Through",
description="Outputs the input value as is.",
description="Outputs the input value as is. Supports up to 10 inputs.",
icon="MdDoubleArrow",
inputs=[
AnyInput(label="Value").make_fused(),
AnyInput(label="Value 1").make_fused(0),
optional_list_group(
AnyInput(label="Value 2").make_fused(1).make_optional(),
AnyInput(label="Value 3").make_fused(2).make_optional(),
AnyInput(label="Value 4").make_fused(3).make_optional(),
AnyInput(label="Value 5").make_fused(4).make_optional(),
AnyInput(label="Value 6").make_fused(5).make_optional(),
AnyInput(label="Value 7").make_fused(6).make_optional(),
AnyInput(label="Value 8").make_fused(7).make_optional(),
AnyInput(label="Value 9").make_fused(8).make_optional(),
AnyInput(label="Value 10").make_fused(9).make_optional(),
),
],
outputs=[
BaseOutput(output_type="Input0", label="Value"),
AnyOutput(output_type="Input0", label="Value 1"),
AnyOutput(output_type="Input1", label="Value 2"),
AnyOutput(output_type="Input2", label="Value 3"),
AnyOutput(output_type="Input3", label="Value 4"),
AnyOutput(output_type="Input4", label="Value 5"),
AnyOutput(output_type="Input5", label="Value 6"),
AnyOutput(output_type="Input6", label="Value 7"),
AnyOutput(output_type="Input7", label="Value 8"),
AnyOutput(output_type="Input8", label="Value 9"),
AnyOutput(output_type="Input9", label="Value 10"),
],
)
def pass_through_node(value: object) -> object:
return value
def pass_through_node(
value_a: object,
value_b: object | None = None,
value_c: object | None = None,
value_d: object | None = None,
value_e: object | None = None,
value_f: object | None = None,
value_g: object | None = None,
value_h: object | None = None,
value_i: object | None = None,
value_j: object | None = None,
) -> tuple[
object, object, object, object, object, object, object, object, object, object
]:
return (
value_a,
value_b,
value_c,
value_d,
value_e,
value_f,
value_g,
value_h,
value_i,
value_j,
)
Loading