Nodes/comfyui-panels/Complementary Cardinals (Grow Panel)
ComfyUI Node

Complementary Cardinals (Grow Panel)

The directions you didn't ask for

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Complementary Cardinals (Grow Panel)
    • STRING
    cardinals

    While Invert Cardinals flips directions to their opposites, this one computes the complement: give it "N" and it returns "SWE" - every cardinal direction that wasn't in your input. It's the other half of the pack's tiny direction-string helpers, and it exists to make Grow Panel direction logic composable instead of hardcoded.

    When is "the opposite set" useful? Think about panel operations where you want to grow away from a specific edge, or hold one edge fixed while everything else moves. If your logic says "the panel keeps its north edge" and everything else is free to grow, that's literally the complement of "N". Computing it in the graph means the direction set updates itself when the fixed edge changes - one wire to update instead of retyping a string in three places. Combined with Invert Cardinals, you can derive every direction relationship from a single source of truth. It's the kind of node that looks pointless in a screenshot and quietly saves you a whole class of "I updated one hardcoded string and forgot the other" bugs.

    How it works

    Also trivial, also by design: it reads the input letters, checks which of N, S, E, W are not present, and returns those, ordered as N S E W. So "N""SWE", "NS""EW", and """NSEW". The input is forceInput, so the pack expects it wired from another node's string output. Everything not in the N/S/E/W alphabet is ignored when computing the set.

    The input and output

    • cardinals - a STRING of letters like "N" or "ES".
    • Output: the complement STRING (e.g. "N""SWE").

    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

    Same gotcha as its sibling, mirrored: complement is not inversion. "N" inverts to "S" but complements to "SWE" - grab the wrong helper and your panels grow from the wrong side. Also, the output is a set that's re-ordered to the canonical NSEW order, so if you were relying on the input's letter order for anything, it's gone. And as with all these string helpers, the output only matters when it actually reaches a Grow Panel.

    CategoryBmad/Panels

    Inputs (1)

    NameTypeDefaultDescription
    cardinalsSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING