This commit is contained in:
justumen
2025-03-19 17:36:25 +01:00
parent 44d69e8907
commit 39dfb0220a
76 changed files with 3207 additions and 955 deletions

View File

@@ -45,4 +45,29 @@ class SwitchText:
if switch:
return (STRING,)
else:
return ("",)
return ("",)
class ConditionalSwitch:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"condition": ("BOOLEAN", {"default": False}), # True or False to pick the path
},
"optional": {
"input_data": (Everything("*"), {"forceInput": True}), # Passthrough any data type
}
}
RETURN_TYPES = (Everything("*"), Everything("*")) # Two outputs, dynamically typed
RETURN_NAMES = ("TRUE", "FALSE") # Named outputs for clarity
FUNCTION = "switch"
CATEGORY = "Utilities"
def switch(self, condition, input_data=None):
if condition:
# If condition is True, send data to TRUE output, FALSE gets None
return (input_data, None)
else:
# If condition is False, send data to FALSE output, TRUE gets None
return (None, input_data)