Files
rgthree-rgthree-comfy/py/context_switch_big.py
T

45 lines
1.3 KiB
Python

"""The Context Switch (Big)."""
from .constants import get_category, get_name
from .context_utils import (ALL_CTX_RETURN_TYPES, ALL_CTX_RETURN_NAMES, is_context_empty,
get_context_return_tuple)
class RgthreeContextSwitchBig:
"""The Context Switch Big node."""
NAME = get_name("Context Switch Big")
CATEGORY = get_category()
@classmethod
def INPUT_TYPES(cls): # pylint: disable = invalid-name, missing-function-docstring
return {
"required": {},
"optional": {
"ctx_01": ("RGTHREE_CONTEXT",),
"ctx_02": ("RGTHREE_CONTEXT",),
"ctx_03": ("RGTHREE_CONTEXT",),
"ctx_04": ("RGTHREE_CONTEXT",),
"ctx_05": ("RGTHREE_CONTEXT",),
},
}
RETURN_TYPES = ALL_CTX_RETURN_TYPES
RETURN_NAMES = ALL_CTX_RETURN_NAMES
FUNCTION = "switch"
def switch(self, ctx_01=None, ctx_02=None, ctx_03=None, ctx_04=None, ctx_05=None):
"""Chooses the first non-empty Context to output.
"""
ctx = None
if not is_context_empty(ctx_01):
ctx = ctx_01
elif not is_context_empty(ctx_02):
ctx = ctx_02
elif not is_context_empty(ctx_03):
ctx = ctx_03
elif not is_context_empty(ctx_04):
ctx = ctx_04
elif not is_context_empty(ctx_05):
ctx = ctx_05
return get_context_return_tuple(ctx)