Badge Edit State Load (DAELab)
Picking a badge project back up without paying for it twice
- current_master
- normalized_flat_image
- current_height
- current_foreground_mask
- height_enabled
- metadata
What it is and why you'd reach for it
The badge workflow in this pack is a loop, not a pipeline. You generate a master, register it to the design, make one local edit, look at it, decide the lettering needs another pass, make a second edit. Each hop through the generative node is a billable GPT-Image-2 request. So the interesting operational question isn't "how do I generate a badge" - it's "can I close the tab and come back tomorrow without redoing the expensive part."
Badge Edit State Load is the other half of that answer. Point it at a .badge_state file written by Badge Edit State Save and it restores the entire editing context: current master, normalized flat design, height map, foreground mask, plus the metadata that says whether the height branch was enabled and what prompt and registration transform produced the current state. From there you pick up at edit number six instead of re-rolling numbers one through five.
How it works
One input, state_path, a string. It expands ~, checks the file exists, and raises Badge state package does not exist: <path> if not - no silent empty tensors. Then it opens the zip and reads metadata.json, current_master.npy, normalized_flat_image.npy and current_foreground_mask.npy as float32 tensors.
The height map is the one entry that's allowed to be missing. Older or height-disabled snapshots have no current_height.npy, and rather than failing, the node hands back a zeros mask of the right shape. Downstream that reads as "flat badge, no relief," which is the correct degradation - but it also means a zeros height map is indistinguishable from a real one in the output sockets, so height_enabled is the flag you should actually branch on.
metadata comes out as a JSON string rather than a dict, which is a deliberate pack-wide convention: it's readable in a text/display node and doesn't pretend ComfyUI has a structured metadata type. It contains the version, the height flag, your saved registration_info, the current_prompt, and any colour-group configs harvested from Multi Color Mask nodes at save time.
Inputs and outputs that matter
state_path only. In practice you either wire it from the save node (same run, zero typing) or paste the absolute path of a snapshot you kept - the save node's state_path output, copied out of the UI or a report node.
Outputs, in order: current_master (feeds the local-edit chain and the composite's previous_master), normalized_flat_image (design coordinates, feeds prompt builders and material configuration), current_height (the discrete six-level mask), current_foreground_mask (topology - protects every downstream mask assertion), height_enabled (boolean branch flag), metadata (JSON).
Wire height_enabled into whatever gates your height stage, and don't hand-fake it - if the snapshot says heights are disabled and you push pixels through Badge Height Patch anyway, you're editing a map that no longer corresponds to the master.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/TeutonicMepheles/ComfyUI-DAELab-Custom-Nodes-Library
Restart ComfyUI afterwards. Manager install by pack title works too. The badge modules import OpenCV, which isn't in the pack's requirements.txt, so pip install opencv-python-headless if the node is absent from the menu. Loading also needs NumPy and Torch, both of which every ComfyUI install already has.
Common issues
Badge state package does not exist. Windows paths with backslashes are the usual culprit - the pack's own docs are PowerShell-flavoured, and a path pasted from Explorer with quotes around it won't resolve. Use forward slashes or a path underComfyUI/output/.- It loads but downstream nodes reject the canvas. Snapshots are whatever size they were saved at. The strict nodes (
Badge Height Locked Base V1,Badge Studio Composite V1) require 1024×1024 and will tell you so. - You edited the snapshot file. The
.badge_stateis a zip of.npyarrays and a JSON blob. Renaming entries or hand-editing the JSON will get you a KeyError or a tensor with the wrong rank, not a helpful message. - The workflow feels stale after a reload. This node caches on
state_path. If you overwrite the file at the same path, the graph may reuse the previous read - touch the filename or re-point the widget.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| state_path | STRING | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| current_master | IMAGE | — |
| normalized_flat_image | IMAGE | — |
| current_height | MASK | — |
| current_foreground_mask | MASK | — |
| height_enabled | BOOLEAN | — |
| metadata | STRING | — |