ComfyUI Node

Badge Entry Route V1

Two starting points for a badge job, and only one of them gets loaded

By TeutonicMepheles·Created 4 months ago·Updated 3 days ago· 0
Badge Entry Route V1
  • route_1_master
  • route_1_reference
  • route_1_support
  • route_2_master
  • route_2_reference
  • route_2_support
  • pre_edit_master
  • direct_selection_reference
  • edit_support_mask
  • route_id
  • status
◄route_flat_heighttrue►
◄route_effectfalse►

What this is for

A badge job can start two ways. Either you have flat artwork and a height map and the model is going to build the render from scratch, or you already have an effect render and you're going to work off that. Same downstream pipeline, different upstream graph - different loaders, different pre-processing, in the pack's case different image pairs entirely.

Badge Entry Route V1 picks one. Two booleans, six optional inputs arranged as two sets of three, and the unselected route's inputs are never evaluated at all. You get back the master, the reference used for colour picking, and the support mask, all validated against the badge canvas, plus a route_id string so downstream nodes and your own debugging can tell which door the job came through.

The lazy part is the whole reason this exists as a node instead of two wires and a delete key. In a graph with a background-removal pass, a height-map build and a whole flat-art preparation chain upstream, evaluating the branch you didn't pick is wasted work at best and a paid call at worst.

How it works

route_flat_height defaults on, route_effect defaults off. Exactly one must be true - if both or neither are set, execute raises Select exactly one badge entry route. There's no soft fallback, which I'd call the right call: a routing node that guesses is worse than one that stops.

check_lazy_status mirrors that: when the two flags are equal it requests nothing (because it's about to fail anyway); otherwise it asks only for the three inputs of the chosen route that are still None. So with the default flags and the flat-height set wired, only route_1_* gets pulled.

Validation is stricter than you'd guess and it's all about the canvas. The chosen master must be exactly one image; it must be the same shape as its reference; the support mask must match the master's canvas; and the master must be 1024×1024. A 2048×2048 render that skipped normalisation fails with must be normalized to 1024x1024 - deliberately, because every deterministic stage downstream assumes that canvas. The pack's Badge Material Canvas Normalize V1 is the node that gets you there.

Outputs: pre_edit_master (the image your edit is applied to), direct_selection_reference (the image colour picking reads from - not always the same thing), edit_support_mask (where edits are allowed to land at all), route_id (flat_height or effect), and status JSON reporting state: ready, the route, a digest of the master, and unselected_route_resolved: false - an explicit statement that the other branch never loaded.

The inputs and outputs you touch

Practically all you touch is the two booleans and the wiring of the active set. The field names are numbered, not named per route, which is mildly annoying: you have to remember that route 1 is flat+height and route 2 is effect. route_1_master, route_1_reference, route_1_support for the first; route_2_* for the second.

The three outputs map cleanly onto the next stage: master into the edit, reference into the picker, support mask into the guard that limits where a selection is allowed to be.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/TeutonicMepheles/ComfyUI-DAELab-Custom-Nodes-Library.git
# restart ComfyUI

V3 node - needs comfy_api.latest, i.e. a current ComfyUI core. No models or extra packages of its own.

Where people get burned

Both booleans ticked in App Mode. These flags exist to be exposed as app inputs, and app users will absolutely tick both. Instead of a crash you get a clear English error, which is fine for you and a wall for them - if you're shipping an app, hide the flags behind a single two-option selector or leave one of them out of the exposed inputs.

Pointing the reference at the master. It's legal and it'll run - reference only has to match the master's shape - but the point of splitting them is that colour picking often wants a flatter, cleaner image than the one being edited. Wire the same tensor into both and you've thrown away the feature.

Assuming the support mask is optional. It's needed to shape what edits can touch. A mask that's all-ones reads as "anything goes", which is exactly what the deterministic composite downstream exists to clean up after - you're making it do more work and getting a worse edge for it.

Un-normalised inputs. Non-1024 images are rejected, not resized. If you're coming from a random render, normalise first; that's the whole reason Badge Material Canvas Normalize V1 exists in this pack.

CategoryDAELab/Badge/App

Inputs (8)

NameTypeDefaultDescription
route_flat_heightBOOLEANtrue—
route_effectBOOLEANfalse—
route_1_masteroptIMAGE—
route_1_referenceoptIMAGE—
route_1_supportoptMASK—
route_2_masteroptIMAGE—
route_2_referenceoptIMAGE—
route_2_supportoptMASK—

Outputs (5)

NameTypeDescription
pre_edit_masterIMAGE—
direct_selection_referenceIMAGE—
edit_support_maskMASK—
route_idSTRING—
statusSTRING—