Nodes/ComfyUI_RP_Cast/RP Prompt Parser
ComfyUI Node

RP Prompt Parser

Two characters, one prompt, no attribute bleeding

By AISeDam·Created 4 months ago·Updated 4 months ago· 4
RP Prompt Parser
    • regional_prompts_nolora
    • regional_lora_map
    • divide_ratio
    • divide_mode
    • original_prompts
    • NL_prompts
    promptbeautiful scenery, 2girls ADDCOMM high quality, masterpiece ADDBASE character A, blonde hair ADDCOL character B, dark hair <lora:charB:0.8>
    divide_mode
    divide_ratio
    auto_div_calcauto
    debugfalse

    Why you're here

    The problem that drags everyone into regional prompting: you want a blonde character on the left and a dark-haired one on the right, in the same image, and a single prompt describing both hands back their attributes blurred together - blonde bleeding onto the right, dark hair creeping left. That isn't a prompt-engineering failure; prompt adherence is global. The KB's regional-prompting panel calls this the standing answer to attribute bleeding, and RP Prompt Parser is the front door to that answer inside the RP Cast pack.

    This is the node every RP Cast workflow starts at. You paste one multi-region prompt into it, it splits the text into per-region chunks plus a per-region LoRA map, and everything else in the pack consumes those outputs. There's no way around learning its syntax - it's the pack's spine.

    The syntax

    The default prompt widget is a working example:

    beautiful scenery, 2girls
    ADDCOMM
    high quality, masterpiece
    ADDBASE
    character A, blonde hair
    ADDCOL
    character B, dark hair <lora:charB:0.8>
    

    The markers come straight from hako-mikan's sd-webui-regional-prompter, the A1111 extension this pack ports to ComfyUI:

    • Everything before ADDCOMM is the common prompt, applied to every region.
    • Text between ADDCOMM and ADDBASE is the base.
    • Each ADDCOL starts a new column region; adding ADDROW gives you a second row, so the parser builds a 2D grid in left-to-right, top-to-bottom order.
    • LoRA tags are stripped from the text and collected into the regional_lora_map output, so the sampler and detailer can weight them per region instead of mangling them into the prompt string.

    What to actually set

    Three fields matter for a beginner:

    • divide_mode: Horizontal (columns) or Vertical (rows).
    • auto_div_calc: auto is the sane default - it derives the divide_ratio from your prompt structure. Switch to manual only when you want to override region sizes with the divide_ratio widget (e.g. 1,2 gives the second column twice the width).
    • debug: prints the parse to console when you're chasing a mis-mapped region.

    Outputs

    The ones that matter: regional_prompts_nolora and regional_lora_map feed the sampler or detailer directly; divide_ratio and divide_mode go to RPRatioParser, which turns them into the grid geometry the sampler needs. original_prompts and NL_prompts are plain STRING conveniences - NL_prompts (added in v0.6.00) is a natural-language rendering you can feed straight into a CLIP Encode node or one of the pack's Txt2Img API nodes.

    Install

    ComfyUI Manager → search "ComfyUI_RP_Cast", or clone it in:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AISeDam/ComfyUI_RP_Cast
    

    Restart ComfyUI and the eight nodes register. The parser itself has no heavy dependencies (Pillow at most) - only the detailer nodes drag in ultralytics/opencv, and the Txt2Img nodes need an API key, not a GPU.

    Where people trip

    Keep use_base consistent: if you flip it on here, set it identically on RP KSampler (SDXL), or your regions mis-map. And know the honest limitation up front - the sampler averages all region LoRAs into one model, so true per-character LoRA isolation only happens later, in the detailer's inpainting pass. The parser isn't the bottleneck; it just hands the right data to both stages.

    CategoryRegional Prompter

    Inputs (5)

    NameTypeDefaultDescription
    promptSTRINGbeautiful scenery, 2girls ADDCOMM high quality, masterpiece ADDBASE character A, blonde hair ADDCOL character B, dark hair <lora:charB:0.8>
    divide_modeCOMBO2 options: Horizontal, Vertical
    divide_ratioSTRINGUsed when auto_div_calc=manual. Leave empty for auto calculation.
    auto_div_calcCOMBOautoauto: calculate divide_ratio from prompt automatically. manual: use the divide_ratio widget value directly.
    debugBOOLEANfalsePrint debug log when enabled.

    Outputs (6)

    NameTypeDescription
    regional_prompts_noloraRP_SUBPROMPTS
    regional_lora_mapRP_LORA_MAP
    divide_ratioRP_DIV_RATIO
    divide_modeRP_DIV_MODE
    original_promptsSTRING
    NL_promptsSTRING