-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add MatchType, DynamicCombo, and Autogrow support to V3 Schema #10832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…port for MatchType, created nodes_logic.py and added SwitchNode
…igger when connecting to non-lazy stuff
…d of what is in __all__ of _io.py and _ui.py
…d in execution code
…ata, add helper functions for dynamic behavior, preparing for restructuring dynamic type into object (not finished yet)
…hat in code, refactor build_nested_inputs
…g expected values
 Also fixes connections to widget inputs created by a dynamic combo breaking on reload. Performs some refactoring to group the prior dynamic inputs code. See also, the overarching frontend PR: comfyanonymous/ComfyUI#10832 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6830-Add-support-for-growable-inputs-2b36d73d365081c484ebc251a10aa6dd) by [Unito](https://www.unito.io)
guill
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments just documenting what we discussed in-person about what we're going to do in follow-up PRs.
Would slightly prefer prefixing the new function that we intend to remove with _, but good to merge either way 👍
| @final | ||
| @classmethod | ||
| def INPUT_TYPES(cls, include_hidden=True, return_schema=False) -> dict[str, dict] | tuple[dict[str, dict], Schema]: | ||
| def INPUT_TYPES(cls, include_hidden=True, return_schema=False, live_inputs=None) -> dict[str, dict] | tuple[dict[str, dict], Schema, V3Data]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note for posterity of what we discussed in-person: in a follow-up PR, we're going to want to refactor this a bit to remove the live_inputs argument from INPUT_TYPES. We really want the schema definition to be plain ol' data that we can cache or store without actually loading up the full node itself. Then, we can augment that with the dynamic information in a second pass.
| def validate(self): | ||
| self.input.validate() | ||
|
|
||
| def expand_schema_for_dynamic(self, d: dict[str, Any], live_inputs: dict[str, Any], curr_prefix=''): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note for posterity of what we discussed in-person: in a follow-up PR, we're going to move this logic off of the class itself so that it doesn't seem like people can define their own versions of these functions when they define their own types.
I'd kind of prefer that we prefix the function with a _ since it's new, but it's not that big a deal if we just want to merge it as-is and remove it later.
|
Oh, we should probably also add Execution Tests for this stuff at some point. |
Adds support for the first 3 native dynamic types:
MatchType,DynamicCombo, andAutogrow. The layout of the V3 python API is also edited a bit to properly respect publicly-exposed classes/functions.These types will not be usable unless 1) you are on latest frontend or 2) the time comes that ComfyUI's frontend version gets bumped to a version that supports these types.
I commented out the Switch node + test nodes to prevent issues until the right version of frontend arrives in ComfyUI. At that point, there will be a separate PR to enable the Switch node, and likely the addition of some nodes that will immediately make use of the dynamic types.
MatchType
Frontend PR: Comfy-Org/ComfyUI_frontend#6582
chrome_Vp58DY6YpM.mp4
Example code:
DynamicCombo
Frontend PR: Comfy-Org/ComfyUI_frontend#6661
chrome_ogUbrN6YS5.mp4
Example code:
Autogrow
Frontend PR: Not made yet, here is the in-progress-branch https://github.com/Comfy-Org/ComfyUI_frontend/tree/austin/growable-inputs
(Made in early version of development, so things that should appear as 'optional' aren't.
chrome_aLLKyzqCPk.mp4
Example code:
Future Work
This PR also contains the schema for
DynamicSlot, which is similar toDynamicComboexcept the extra widgets are determined by whether or not an optional input has a connection or not. This type is not publicly exposed in V3 API right now, as the frontend work for that is not started. If that changes before this PR gets merged, I will update this.