From 12627ca75aaa81045dab1bbfa9bdf73bef46fde3 Mon Sep 17 00:00:00 2001 From: Jacob Segal Date: Wed, 14 Feb 2024 21:06:53 -0800 Subject: [PATCH] Add a command-line argument to enable variants This allows the use of nodes that have sockets of type '*' without applying a patch to the code. --- comfy/cli_args.py | 1 + execution.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 2cbefefeb..74354ea94 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -117,6 +117,7 @@ parser.add_argument("--windows-standalone-build", action="store_true", help="Win parser.add_argument("--disable-metadata", action="store_true", help="Disable saving prompt metadata in files.") parser.add_argument("--multi-user", action="store_true", help="Enables per-user storage.") +parser.add_argument("--enable-variants", action="store_true", help="Enables '*' type nodes.") if comfy.options.args_parsing: args = parser.parse_args() diff --git a/execution.py b/execution.py index 1e426a32f..57c9cbf78 100644 --- a/execution.py +++ b/execution.py @@ -16,6 +16,7 @@ import comfy.graph_utils from comfy.graph import get_input_info, ExecutionList, DynamicPrompt, ExecutionBlocker from comfy.graph_utils import is_link, GraphBuilder from comfy.caching import HierarchicalCache, LRUCache, CacheKeySetInputSignature, CacheKeySetInputSignatureWithID, CacheKeySetID +from comfy.cli_args import args class ExecutionResult(Enum): SUCCESS = 0 @@ -550,7 +551,8 @@ def validate_inputs(prompt, item, validated): o_id = val[0] o_class_type = prompt[o_id]['class_type'] r = nodes.NODE_CLASS_MAPPINGS[o_class_type].RETURN_TYPES - if r[val[1]] != type_input: + is_variant = args.enable_variants and (r[val[1]] == "*" or type_input == "*") + if r[val[1]] != type_input and not is_variant: received_type = r[val[1]] details = f"{x}, {received_type} != {type_input}" error = {