Invert Cardinals (Grow Panel)
Flip N to S and E to W
- STRING
Here's a node that does exactly what its name says and nothing else: you feed it a string of cardinal directions - say "N" - and it hands back the opposites, "S". "NE" becomes "SW". It's a tiny string transformer, one of two helper nodes the pack ships specifically for Grow Panel.
Why would a grown-up workflow need this? Because growth directions sometimes have to be relative rather than hardcoded. If you compute "grow the left panel's edge eastward" in one branch of your graph, the mirrored or adjacent panel usually needs the same rule reflected - and rather than hardcode "W" next to a hardcoded "E", you derive it. Wire an Invert Cardinals between them and the direction logic lives in one place. It also pairs naturally with the pack's Complementary Cardinals for building direction sets programmatically. If you've ever wished you could just type the direction twice, this node is the clean way to stop hardcoding.
How it works
Trivially, by design: it maps each letter through N→S, S→N, E→W, W→E and returns the transformed string. Any character that isn't a cardinal letter passes through unchanged, so a malformed string won't crash - it'll just come back with its letters swapped where it can. The input is marked forceInput, meaning the field is designed to be wired from another node's string output rather than typed by hand - though typing works fine too.
The input and output
cardinals- aSTRINGlike"N","SE", or"NEW"(letters in any order).- Output: the inverted
STRING.
Installing it
Part of comfyui-panels - Manager, search "comfyui-panels", or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels
Restart, install deps (shapely, matplotlib, opencv-python), no models.
Where people get burned
The only real trap is conceptual: this inverts directions, it doesn't complement them. Invert Cardinals turns "N" into "S"; the pack's other helper, Complementary Cardinals, turns "N" into "SWE" (all the directions you didn't ask for). If you grab the wrong one the panels grow in the exact wrong places. And remember the output goes into a Grow Panel's cardinals input - a bare string floating in the graph does nothing on its own.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| cardinals | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |