MOSS 元素管理 · 定位 / 提示词
The box says where, this node says what
- elements
- character_boxes
Drawing rectangles gets you coordinates, not a prompt. In MOSS-Image's layout format every items entry needs a label, a caption, and - for text - the literal string to render, and the gap between a good poster and a mush of overlapping objects is almost entirely in that prose. MOSSLayoutElements is the table where you write it: one row per box, numbers exposed if you want to nudge them.
It's the middle node of three that ship as one set (Canvas → Elements → StandardPrompt). The canvas owns position, this node owns identity and wording, the third compiles the pair into model-facing JSON.
What it actually does
Feed it the canvas layout and you get a spreadsheet of every element: search box, tag filter, and editable name, tag, generation type, prompt and the four percent values (left, top, width, height). Up, down, duplicate, delete. It's the same layout data the canvas shows - rows instead of rectangles - which is why editing here and dragging there stay in sync as long as both nodes look at the same canvas.
The type field is the one that changes model behaviour. 人物 compiles to character, 文字 to text, everything else to object. Pick 文字 and you must fill in the text content, otherwise the box stays in the layout but is quietly dropped from the compiled prompt. Empty text is a warning, not a crash.
Two outputs, and they do different jobs:
elements- the element array as JSON, wired intoMOSSLayoutStandardPrompt.elements. The compiler parses it and, if it's valid, replaces the draft's element list with yours. It must be a JSON array; hand it a single object and the node raiseselements 必须是 JSON 数组.character_boxes- the 1-based positions of character items in the finalitemsorder, formatted as1, 3, or an empty string if there are none. It's the author's escape hatch: the StandardPrompt node relabels a box as a character without you retyping the element. It also matches the formatMOSSImageLayoutPrompt.character_boxesexpects, so the two packs interoperate.
One detail that burns people: the numbering counts items after the background and empty text boxes are filtered out. Add a decorative object above your character and 1, 3 is off by one. Let the node generate the string; don't hardcode it.
Text styling is a description, not a parameter
For text elements the panel adds font style, colour, reference font size (in pixels of the generated size), line height and alignment, plus a live preview and a capacity estimate. None of that is a model parameter. The pack stores it as optional editor metadata and compiles it into the item's caption as prose - "bold condensed white headline, centred". MOSS-Image has no font argument to set.
So the preview is honest about layout and approximate about typography. The local font on your machine isn't the font MOSS will draw; 黑体 and 宋体 travel as nothing but words in a caption. If a headline overflows, the fixes that actually change the compiled input are manual wrapping with Enter, a wider box, or a smaller reference size.
The few inputs to care about
layout (STRING) - wire MOSSLayoutCanvas.layout here. Not decoration: the pack assigns a node to a canvas based on what's connected, so an unconnected Elements node keeps a private layout that won't match your canvas - the number one "why don't my edits show up" complaint.
state is the hidden layout widget that saves with the workflow. Leave it alone; the backend falls back to it.
Outputs: elements and character_boxes, both STRING, both into the StandardPrompt node's identically named inputs.
Installing it
Same pack as the other two nodes, so there's nothing extra. ComfyUI Manager → search MOSS Layout UI, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MIKOU306/ComfyUI-MOSS-Layout-UI.git comfyui-moss-layout-ui
Restart ComfyUI and hit Ctrl+F5. No pip installs, no model downloads - pyproject.toml declares zero dependencies and the pack only uses the torch/numpy/Pillow ComfyUI already has. It does require a build exposing comfy_api.latest (0.41.0-era or later); on older ones none of the three nodes appear.
Where people get burned
Stale frontend. The panel is DOM code in web/, and a cached copy survives restarts. After any update: restart, then Ctrl+F5. If input ports look invisible once wired, you're on a pre-1.2.1 build - that bug is why layout / elements / character_boxes now draw as a 22px always-visible row.
Typing character_boxes by hand. The parser accepts only bare digit lists like 1, 3. Anything else - including the JSON array older versions emitted - is ignored silently, since empty legitimately means "keep the element types". Read the output instead of guessing.
Mixed canvases. Wire the whole chain from one Canvas node. StandardPrompt flags "inputs from different canvases" because two half-built chains in one workflow is easy to do, and produces a prompt assembled from two unrelated layouts.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| layout | STRING | — | |
| state | STRING | Layout JSON written by the node UI and saved with the workflow. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| elements | STRING | — |
| character_boxes | STRING | — |