Added If node and ability to link an Any output to a node input if cardinality matches#8869
Added If node and ability to link an Any output to a node input if cardinality matches#8869lstein merged 5 commits intoinvoke-ai:mainfrom
If node and ability to link an Any output to a node input if cardinality matches#8869Conversation
dunkeroni
left a comment
There was a problem hiding this comment.
Singleton cases all work well, and I like that the type restrictions on the inputs to prevent footguns. I have some issues with the handling around collections though:
- Collection and Singleton inputs are (intentionally) not allowed together. We do have inputs that accept unions of singleton and collection types (e.g. loras), and having to wrap the singleton input in a collect node is a bit awkward since most of the collection inputs we have on other nodes are this combined type. Speaking of which...
- The Output can only connect to single or union[single+collection] types. If I am picking between two collections on the inputs, I cannot connect the output to an Iterate, collection primitive, or any other node that requires the input to be a collection. Should we split this off to an
If (collection)version that outputs exclusively collection types?
I'll see about changing this to accept a Singleton of the same type as the Collection. I'd rather do that than have a second |
dunkeroni
left a comment
There was a problem hiding this comment.
Updates work for the single/collection combos. It still can't connect the any output to strict collection inputs, but the fix for that (automatic upcasting to collections) is outside of the scope for this PR.
968f235 to
8b95abc
Compare
Summary
This PR includes a feature + bugfix for the new
Ifinvocation and its editor interoperability:Ifinvocation node (if) with:condition: booltrue_input: Optional[Any]false_input: Optional[Any>value: Optional[Any](withdefault=Noneto avoid persisted-session validation failures when omitted).AnyFieldcan be used as a source where cardinality is compatible (instead of being blocked), which allowsIf.valueto connect to typed inputs in the UI.Iftrue/false behavior and graph connectivityif_outputwhenvalueis missingAnyFieldsource compatibility and cardinality guardrails in UI connection typing.Why:
Ifoutput wiring.if_output.valuein persisted JSON.How:
Related Issues / Discussions
QA Instructions
Backend schema/output checks
IfInvocationOutput.valueis optional with defaultNone.UI connection behavior checks
Ifnode and connectIf.valueto a typed input (e.g. string input).SINGLE -> COLLECTION).Automated tests
Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)