Nodes/petty-paint-comfyui-node/PettyPaintConditioningSetMaskAndCombine
ComfyUI Node

PettyPaintConditioningSetMaskAndCombine

Conditioning Set Mask + Combine in a single node, for batched regions

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
PettyPaintConditioningSetMaskAndCombine
  • positives
  • negatives
  • masks
  • combined_positive
  • combined_negative
set_cond_area

Regional conditioning is the standard way to get different prompt content into different parts of an image - foreground subject here, background scenery there, each masked. In stock ComfyUI that means a chain: one ConditioningSetMask per region, then a ConditioningCombine to merge them, repeated per positive and negative. PettyPaintConditioningSetMaskAndCombine bundles that whole dance into one node that takes the positives, the negatives, and the masks, and returns the combined result - and the node's own description is upfront that it's functionally identical to the native nodes, just packed together. The KJNodes-style category name is a hint about its heritage: this is a convenience wrapper, not new sampling math.

Where it earns its keep is batched regional work. If you have a set of masks (say, one per region of a scene, or per character in a composition) and a matching set of conditionings, this node loops through them in one shot and emits the combined positive and negative - no manual combine pyramids. It's the kind of node that turns a fifteen-node regional setup into a five-node one.

How it works

For each conditioning in positives, it takes the corresponding mask (strength 1.0), stamps the conditioning with the mask, and accumulates it into a combined list. It does the identical pass over negatives. The set_cond_area dropdown switches between default and mask bounds - the latter tells the sampler to restrict attention to the mask's bounding area, which is the setting you reach for when a region's prompt shouldn't leak outside its mask. The result is two CONDITIONING outputs ready for a KSampler's positive and negative inputs.

The inputs and outputs

  • positives - CONDITIONING, a list.
  • negatives - CONDITIONING, a list (can be shorter than positives; the loop just processes what's there).
  • masks - MASK, a list. The i-th mask applies to the i-th conditioning.
  • set_cond_area - default or mask bounds.
  • Outputs: combined_positive and combined_negative (CONDITIONING).

Installing it

It ships in the petty-paint pack:

cd ComfyUI/custom_nodes
git clone https://github.com/mephisto83/petty-paint-comfyui-node

Restart ComfyUI, or install via ComfyUI Manager searching "petty-paint-comfyui-node". Declared dependency: Flask==2.1.2, unused here.

Common issues

The biggest confusion is index alignment: the node pairs masks and conditionings by position, so a mismatch in list order produces wrong regions with no error. Feed it parallel lists and keep them in the same order. Also, mask strength is hardcoded at 1.0 - if you were using the native node's strength slider to feather a region, this wrapper doesn't expose it, so pre-soften the masks themselves. And it expects mask lists that can be indexed per conditioning; a single mask fed in place of a list will fail, so make sure your mask source actually emits a batch. For a one-region workflow the native nodes are just as easy - this one pays off when regions multiply.

CategoryKJNodes/masking/conditioning

Inputs (4)

NameTypeDefaultDescription
positivesCONDITIONING
negativesCONDITIONING
masksMASK
set_cond_areaCOMBO2 options: default, mask bounds

Outputs (2)

NameTypeDescription
combined_positiveCONDITIONING
combined_negativeCONDITIONING