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.
This commit is contained in:
Jacob Segal 2024-02-14 21:06:53 -08:00
parent 2c7145d525
commit 12627ca75a
2 changed files with 4 additions and 1 deletions

View File

@ -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()

View File

@ -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 = {