Nodes/D2 Nodes ComfyUI/D2 Merge Cnet
ComfyUI Node

D2 Merge Cnet

D2 Merge Cnet

By da2el-ai·Created 2 years ago·Updated about 18 hours ago· 68
D2 Merge Cnet
    • cnet_stack
    cnet_stack_count2

    D2 Merge Cnet exists for one specific moment in a workflow: the moment you have more than one ControlNet, you've split them across branches, and you need to hand them all to a sampler on a single wire. The D2 pack moves ControlNets around as a cnet_stack - one socket that carries a whole list of control conditions, settings and all - and this node is the joiner that fuses several of those stacks back into one.

    Before you care about the joiner, you need the thing it joins. In a stock ComfyUI graph, each ControlNet is applied to conditioning with its own ControlNetApplyAdvanced, and running two means two of those nodes inline, each taking the previous one's conditioning. D2's KSampler instead accepts a cnet_stack input and does the applying for you. You build that stack with a D2 Controlnet Loader, one per control condition - chain them together and each loader appends its settings (type, model, image, strength, start/end percent, optional mask and VAE) to the list passing through. That list is the pack's own D2_CNET_STACK type, and it's what D2 KSampler chews through in order at sampling time.

    The catch with chaining loaders in a straight line is that the stack is one growing list, so you can't easily have two different combinations and pick between them. That's the gap Merge Cnet fills: it's the fan-in for stack-shaped data. The README frames it as "merge multiple cnet_stack into one" and points at the workflow where you run several ControlNets but want to silence a specific one - split your conditions across branches, mute or bypass a branch, and merge only the live ones.

    What you actually set

    The node is deliberately boring, which is the point. Its one real control:

    • cnet_stack_count (INT, 1–10, default 2) - how many stack inputs you want. Bump it and the node grows cnet_stack_1 through cnet_stack_N sockets on the fly; drop it and they vanish. This isn't a per-socket enable switch - leave an input unconnected and the node just ignores it, which is exactly how you drop a ControlNet from a run without deleting anything.

    Under the hood it's list plumbing with a small kindness: it copies each incoming stack into a fresh list rather than mutating the upstream one, so a merged result can't corrupt the stacks feeding it. If nothing at all is connected it returns nothing, and D2 KSampler treats that as "no ControlNet," so a fully-disconnected merge is a clean bypass, not a crash.

    What it wires into

    The single cnet_stack output goes where any other stack would: into D2 KSampler's cnet_stack input, back into a D2 Controlnet Loader to keep stacking, or into another Merge Cnet if you're being combinatorial about it. The classic setup is the XY-plot one - swap which ControlNet branch is live between runs and let the merge hand the survivor to the sampler.

    Two grounding reminders. First, the sockets are D2-native: a D2_CNET_STACK will not accept a conditioning output from a stock ControlNetApply node, so you can't mix ecosystems mid-wire. Second, this node has no opinions about models - everything it merges was already loaded by D2 Controlnet Loader, so your control files still live in ComfyUI/models/controlnet, and the Anima type still wants kohya-ss's ComfyUI-Anima-LLLite installed separately.

    Install

    ComfyUI Manager is the easy road: search D2 Nodes ComfyUI and hit install. By hand it's the same as any custom node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
    

    then restart ComfyUI. The pack's requirements.txt is just piexif and charset-normalizer, so there's no heavy dependency wait and no bundled model downloads. Two D2-specific gotchas are worth knowing before you panic later: since version 32 the pack runs on ComfyUI's V3 node schema, so it needs a current ComfyUI - if you're pinned to an old build and the nodes won't load, grab a pre-v32 release instead of fighting it. And if you've got the pack's old standalone ancestors installed (ComfyUI-d2-size-selector, ComfyUI-d2-steps, ComfyUI-d2-xyplot-utils), remove them - they're folded in now and they'll just collide.

    Is it a must-have? Only if you live in D2's sampler world and stack ControlNets across branches. If you chain loaders linearly and never branch, you'll never touch it - but the day you want to compare pose-versus-depth without rebuilding the graph, it's the unglamorous node that saves the workflow.

    CategoryD2

    Inputs (1)

    NameTypeDefaultDescription
    cnet_stack_countINT21–10

    Outputs (1)

    NameTypeDescription
    cnet_stackD2_CNET_STACK