77 lines
4.5 KiB
Markdown
77 lines
4.5 KiB
Markdown
# ComfyUI Set Input / Get Output
|
||
|
||
Virtual **Set** and **Get** nodes for ComfyUI: name a value on a **Set** node and read it from a **Get** node without long wires. This project was **extracted from [kijai/ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes)** (Set/Get idea and JS-style implementation) some time ago and then adapted here. That upstream repository is licensed under **[GNU GPL v3.0](https://github.com/kijai/ComfyUI-KJNodes/blob/main/LICENSE)**. Unlike the usual single-setter pattern, **several Set nodes may share the same name**. The **Get** node always resolves to whichever Set with that name is **active** (not bypassed and not muted), so you can disable whole group sections—e.g. different themes or parameter packs—and the Get follows the group you left on.
|
||
|
||
There are **no Python node classes** in this package: behavior lives entirely in [`web/js/setinputgetoutput.js`](web/js/setinputgetoutput.js). Nodes appear under **Utilities → InputOutput** as `SetInputNode` and `GetOutputNode`.
|
||
|
||
## How active setter selection works
|
||
|
||
- **Set** nodes store an **Input Name** and take one typed input. Duplicate names are allowed.
|
||
- **Get** nodes pick a name from a combo populated from all Set names on the graph.
|
||
- Resolution uses the **first** Set with that name whose `mode` is not bypass (LiteGraph mode `4`) and not muted/never (`2`).
|
||
**Practical rule:** keep **exactly one** non-bypassed Set per name so the source is predictable. If two stay active, order depends on internal graph node order.
|
||
|
||
Execution data flows via `getInputInfo` / `getInputLink` on the Get node, which point at the **active** setter’s upstream link—so the backend sees the same graph as if you had wired through the Set.
|
||
|
||
## Group / theme switching
|
||
|
||
Use parallel branches (e.g. “Theme A”, “Theme B”), each ending in a Set with the **same** name (`prompt`, `style`, etc.). Bypass the branches you don’t want; un-bypass the one you want. Connected Gets update their output type and title from the active Set.
|
||
|
||
```
|
||
[Theme A …] → [Set: "theme"] ← bypass when off
|
||
[Theme B …] → [Set: "theme"] ← active
|
||
↓
|
||
[Get: "theme"] → rest of workflow
|
||
```
|
||
|
||
## Set node
|
||
|
||
- Typed input; connects from any compatible output.
|
||
- If **Input Name** is empty when you connect, it can auto-fill from the slot type.
|
||
- **`Set_<name>`** title when a name is set (prefix can be disabled in JS via `disablePrefix`).
|
||
|
||
## Get node
|
||
|
||
- Combo **Output Name**; options are unique non-empty names from all Set nodes on the graph.
|
||
- Output slot type tracks the **active** Set’s input type; incompatible downstream links may be removed when the type changes.
|
||
- Title **`Get_<name>`** when bound to a named setter.
|
||
|
||
## UI features
|
||
|
||
- **Show / Hide connections**: optional Bézier hints between Set and matching Gets (or Get to active Set). **Hide all connections** clears hints on every Set/Get on the graph.
|
||
- **Go to first active Getter** (on Set) / **Go to active setter** (on Get).
|
||
- **Convert** Set ↔ Get in place (disconnects links; use when restructuring). **Create … to the right** adds the counterpart node. With multiple nodes selected, **Convert selected Set/Get nodes** runs on the canvas or node menu (ComfyUI context menu API).
|
||
|
||
## Installation
|
||
|
||
1. Copy or clone this folder into `ComfyUI/custom_nodes/` (e.g. `ComfyUI/custom_nodes/ComfyUI-SetInputGetOutput`).
|
||
2. Restart ComfyUI.
|
||
|
||
If you use `git clone`, point it at **your** fork or source repository URL for this project.
|
||
|
||
## Troubleshooting
|
||
|
||
**Get doesn’t match the branch I expect**
|
||
Ensure only one Set with that name is non-bypassed (and not muted). Bypass the other groups.
|
||
|
||
**Empty or missing combo names**
|
||
Add at least one Set with a non-empty Input Name on the graph.
|
||
|
||
**Type / link errors after switching**
|
||
The Get’s output type follows the active Set. Reconnect or fix downstream nodes if types no longer match; the extension can drop links that are clearly incompatible after a type change.
|
||
|
||
**Wrong data**
|
||
Confirm the active Set’s input is still wired to the intended upstream node.
|
||
|
||
---
|
||
|
||
## License
|
||
|
||
This project is licensed under the **GNU General Public License v3.0**. See [`LICENSE`](LICENSE) for the full text.
|
||
|
||
Set/Get functionality is derived from **[ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes)** (also GPL-3.0). The [`LICENSE`](LICENSE) file includes that attribution and links to their repository.
|
||
|
||
---
|
||
|
||
Main implementation file: [`web/js/setinputgetoutput.js`](web/js/setinputgetoutput.js). Loader: [`__init__.py`](__init__.py) (serves `web/` and registers no Python nodes).
|