ComfyUI Node

OC Generator

One wire in, one prompt out

By Zhuozhuo-219·Created 3 months ago·Updated 2 months ago· 0
OC Generator
  • oc_block_0
  • positive_prompt
  • blocks_json
  • debug_text
prefix_prompt
suffix_prompt
separator,
dedupetrue

OC Generator is the node every other node in this pack is feeding. You build a character out of blocks - body, face, hair, outfit, accessories - and this is where the whole pile gets flattened into a single comma-separated positive prompt you can wire into a CLIP Text Encode. It's the difference between hand-typing 1girl, ahoge, red dress, ... and assembling a character from structured pieces, the way you'd actually think about a character sheet.

It's a pure text-assembly node. Nothing leaves the CPU, no model runs, no image appears. That's the point: ComfyUI-OC-Generator is a prompt builder, not a generator, and the "OC" here means original character, not "online creation." This node is where the plumbing ends and your checkpoint takes over. The output is aimed squarely at the Danbooru-tag lineage of models - Illustrious, NoobAI, Pony V6 - which is exactly the vocabulary the ~3,200 catalog entries in the pack's data/tags.json are written in.

What it does

Every OC block node in the pack outputs an OC_BLOCK structure: the resolved prompt fragment, its category, group, mode, and a pile of metadata. OC Generator takes however many of those you connect, sorts them into a fixed order (Theme → Body → Face → Hair → Outfit → Accessories → … → Camera → Rendering), strips duplicates, and joins the survivors with a separator.

The three inputs that actually matter:

  • prefix_prompt and suffix_prompt - static text glued on at the start and end. Put your quality tags (masterpiece, best quality) or a scene description here, since early keywords get stronger attention on the SDXL lineage.
  • separator - the glue, default ", ". If your target model wants spaces or a different joiner, this is where.
  • dedupe - on by default, and leave it on. When two blocks resolve to the same fragment (you'll hit this with the outfit parts), it silently drops the copy.

The inputs are dynamic: oc_block_0 is the first socket, and ComfyUI lets you add more right on the node, one per connected block. Wire an outfit block and a merge bundle in and it just works - the flattener handles nested bundles recursively.

The outputs

You mostly care about one:

  • positive_prompt - the finished string. Connect it to the CLIP Text Encode node of your sampler.

The other two are debugging gifts that save you real time: blocks_json dumps every received block as structured JSON (handy if you ever want to export a character), and debug_text prints one readable line per block - category, resolved prompt, and mode. When a randomize mode picks something you didn't expect, that's the first place to look.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/Zhuozhuo-219/ComfyUI-OC-Generator

Then restart ComfyUI. ComfyUI Manager can do the same - search for ComfyUI-OC-Generator. The pack's requirements.txt declares no standalone dependencies (it runs on the host ComfyUI's comfy imports) and ships its tag data inside the repo, so there are no model downloads and no pip pain. First load can take a few seconds while the ~3,200-entry catalog builds the dropdowns.

Where people get burned

The catalog is what it is: a curated Chinese/English Danbooru-style tag set. On an Illustrious or NoobAI checkpoint the fragments behave like real tags and the ordering matters. On an LLM-encoded model (Flux 2, Z-Image), comma-separated tags still mostly work but you lose a lot of the leverage - this is a booru-prompting tool, and it's happiest feeding an anime SDXL model.

Also: this pack is new and quiet - you won't find much community chatter about it, so treat it as a work-in-progress rather than battle-tested. The debug_text output is your friend when a dropdown falls back to something you didn't pick.

CategoryOC Generator

Inputs (5)

NameTypeDefaultDescription
prefix_promptSTRINGStatic prompt text inserted before all OC block fragments.
suffix_promptSTRINGStatic prompt text appended after all OC block fragments.
separatorSTRING, String used to join prefix, block prompts, and suffix.
dedupeBOOLEANtrueRemove duplicated prompt fragments after block aggregation.
oc_block_0optOC_BLOCKConnect one OC block per socket. Additional sockets can be added dynamically in the UI.

Outputs (3)

NameTypeDescription
positive_promptSTRINGThe final positive prompt assembled from prefix, OC blocks, and suffix.
blocks_jsonSTRINGJSON dump of all received OC blocks after sorting, useful for inspection or future export.
debug_textSTRINGReadable execution summary for each connected block.