mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-21 20:52:11 -03:00
0.77
This commit is contained in:
27
switches.py
27
switches.py
@@ -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)
|
||||
Reference in New Issue
Block a user