# blackoutbuild/textrig architecture

> Architecture diagram of the GitHub repository blackoutbuild/textrig, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blackoutbuild/textrig
- Repository: https://github.com/blackoutbuild/textrig

## Overview

TextRig turns a flat image plus agent-authored rig markup into a DragonBones rig, then supports visual inspection and human review. The main workflow is documented in the README; sampled files confirm the MCP wrapper, editor geometry, rendering, morph processing, occlusion filling, and export responsibilities. Some pipeline stages are represented at their documented module paths, but their internal call wiring was not sampled, so uncertain links are omitted.

Main entry points: [`pipeline/build_pieces_rig.py`](https://github.com/blackoutbuild/textrig/blob/master/pipeline/build_pieces_rig.py) (Rig builder), [`mcp/server.py`](https://github.com/blackoutbuild/textrig/blob/master/mcp/server.py) (MCP tools), [`renderer/src/markup/editor.ts`](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/editor.ts) (Markup editor), [`renderer/src/renderEntry.ts`](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/renderEntry.ts) (Filmstrip renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Agent and review"]
  node_mcp["MCP tools<br/>[server.py]"]
  node_markup["Markup editor<br/>[editor.ts]"]
  node_geometry["Markup geometry<br/>[geometry.ts]"]
  node_skeleton["Skeleton helpers<br/>[skeleton.ts]"]
end

subgraph group_build["Rig build pipeline"]
  node_normalize["Input normalization<br/>[normalize_input.py]"]
  node_cut["Piece cutting<br/>[cut_pieces.py]"]
  node_occlusion["Occlusion filling<br/>[fill_occlusions.py]"]
  node_mesh["Mesh generation<br/>[mesh_gen.py]"]
  node_weights["Bone weights<br/>[weights_gen.py]"]
  node_atlas["Texture atlas<br/>[pack_atlas.py]"]
  node_writer["DragonBones export"]
  node_orchestrator["Rig builder"]
end

subgraph group_features["Rig capabilities"]
  node_deform["Whole-image deform<br/>[mesh_gen.py]"]
  node_morph["Morph compiler<br/>[morph_compiler.py]"]
  node_motion["Path and wave motion<br/>[flow_gen.py]"]
end

subgraph group_runtime["Output and runtime"]
  node_rig[("DragonBones rig")]
  node_render["Filmstrip renderer<br/>[renderEntry.ts]"]
  node_preview["Live preview<br/>[previewEntry.ts]"]
  node_renderer["Renderer service<br/>[vite.config.ts]"]
end

node_agent(("Vision agent"))
node_human(("Human rigger"))

node_agent -->|"authors via"| node_mcp
node_mcp -->|"builds rig"| node_orchestrator
node_orchestrator -->|"normalizes input"| node_normalize
node_orchestrator -->|"cuts pieces"| node_cut
node_orchestrator -->|"fills occlusions"| node_occlusion
node_orchestrator -->|"generates meshes"| node_mesh
node_orchestrator -->|"generates weights"| node_weights
node_orchestrator -->|"packs atlas"| node_atlas
node_orchestrator -->|"exports rig"| node_writer
node_writer -->|"writes files"| node_rig
node_orchestrator -->|"builds deform rigs"| node_deform
node_orchestrator -->|"compiles morphs"| node_morph
node_orchestrator -->|"supports motion tracks"| node_motion
node_mcp -->|"requests render"| node_render
node_render -->|"reads rig"| node_rig
node_render -->|"returns filmstrip"| node_mcp
node_mcp -->|"starts preview"| node_preview
node_renderer -->|"serves files"| node_rig
node_human -->|"edits markup"| node_markup
node_markup -->|"uses geometry"| node_geometry
node_markup -->|"uses helpers"| node_skeleton
node_mcp -->|"opens review"| node_markup
node_markup -->|"submits edits"| node_mcp
node_preview -->|"loads rig assets"| node_renderer

click node_mcp "https://github.com/blackoutbuild/textrig/blob/master/mcp/server.py"
click node_markup "https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/editor.ts"
click node_geometry "https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/geometry.ts"
click node_skeleton "https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/skeleton.ts"
click node_normalize "https://github.com/blackoutbuild/textrig/blob/master/pipeline/normalize_input.py"
click node_cut "https://github.com/blackoutbuild/textrig/blob/master/pipeline/cut_pieces.py"
click node_occlusion "https://github.com/blackoutbuild/textrig/blob/master/pipeline/fill_occlusions.py"
click node_mesh "https://github.com/blackoutbuild/textrig/blob/master/pipeline/mesh_gen.py"
click node_weights "https://github.com/blackoutbuild/textrig/blob/master/pipeline/weights_gen.py"
click node_atlas "https://github.com/blackoutbuild/textrig/blob/master/pipeline/pack_atlas.py"
click node_writer "https://github.com/blackoutbuild/textrig/blob/master/pipeline/dragonbones_writer.py"
click node_orchestrator "https://github.com/blackoutbuild/textrig/blob/master/pipeline/build_pieces_rig.py"
click node_deform "https://github.com/blackoutbuild/textrig/blob/master/pipeline/mesh_gen.py"
click node_morph "https://github.com/blackoutbuild/textrig/blob/master/pipeline/morph_compiler.py"
click node_motion "https://github.com/blackoutbuild/textrig/blob/master/pipeline/flow_gen.py"
click node_render "https://github.com/blackoutbuild/textrig/blob/master/renderer/src/renderEntry.ts"
click node_preview "https://github.com/blackoutbuild/textrig/blob/master/renderer/src/previewEntry.ts"
click node_renderer "https://github.com/blackoutbuild/textrig/blob/master/renderer/vite.config.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp,node_markup,node_geometry,node_skeleton toneBlue
class node_normalize,node_cut,node_occlusion,node_mesh,node_weights,node_atlas,node_writer,node_orchestrator toneAmber
class node_deform,node_morph,node_motion toneMint
class node_rig,node_render,node_preview,node_renderer toneRose
class node_agent,node_human toneIndigo
```

## Components

### Agent and review

- [MCP tools](https://github.com/blackoutbuild/textrig/blob/master/mcp/server.py): `mcp/server.py`
- [Markup editor](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/editor.ts): `renderer/src/markup/editor.ts`
- [Markup geometry](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/geometry.ts): `renderer/src/markup/geometry.ts`
- [Skeleton helpers](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/markup/skeleton.ts): `renderer/src/markup/skeleton.ts`

### Rig build pipeline

- [Input normalization](https://github.com/blackoutbuild/textrig/blob/master/pipeline/normalize_input.py): `pipeline/normalize_input.py`
- [Piece cutting](https://github.com/blackoutbuild/textrig/blob/master/pipeline/cut_pieces.py): `pipeline/cut_pieces.py`
- [Occlusion filling](https://github.com/blackoutbuild/textrig/blob/master/pipeline/fill_occlusions.py): `pipeline/fill_occlusions.py`
- [Mesh generation](https://github.com/blackoutbuild/textrig/blob/master/pipeline/mesh_gen.py): `pipeline/mesh_gen.py`
- [Bone weights](https://github.com/blackoutbuild/textrig/blob/master/pipeline/weights_gen.py): `pipeline/weights_gen.py`
- [Texture atlas](https://github.com/blackoutbuild/textrig/blob/master/pipeline/pack_atlas.py): `pipeline/pack_atlas.py`
- [DragonBones export](https://github.com/blackoutbuild/textrig/blob/master/pipeline/dragonbones_writer.py): `pipeline/dragonbones_writer.py`
- [Rig builder](https://github.com/blackoutbuild/textrig/blob/master/pipeline/build_pieces_rig.py): `pipeline/build_pieces_rig.py`

### Rig capabilities

- [Whole-image deform](https://github.com/blackoutbuild/textrig/blob/master/pipeline/mesh_gen.py): `pipeline/mesh_gen.py`
- [Morph compiler](https://github.com/blackoutbuild/textrig/blob/master/pipeline/morph_compiler.py): `pipeline/morph_compiler.py`
- [Path and wave motion](https://github.com/blackoutbuild/textrig/blob/master/pipeline/flow_gen.py): `pipeline/flow_gen.py`

### Output and runtime

- **DragonBones rig**
- [Filmstrip renderer](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/renderEntry.ts): `renderer/src/renderEntry.ts`
- [Live preview](https://github.com/blackoutbuild/textrig/blob/master/renderer/src/previewEntry.ts): `renderer/src/previewEntry.ts`
- [Renderer service](https://github.com/blackoutbuild/textrig/blob/master/renderer/vite.config.ts): `renderer/vite.config.ts`

### Other components

- **Vision agent**
- **Human rigger**

## Connections

- Vision agent → MCP tools: authors via
- MCP tools → Rig builder: builds rig
- Rig builder → Input normalization: normalizes input
- Rig builder → Piece cutting: cuts pieces
- Rig builder → Occlusion filling: fills occlusions
- Rig builder → Mesh generation: generates meshes
- Rig builder → Bone weights: generates weights
- Rig builder → Texture atlas: packs atlas
- Rig builder → DragonBones export: exports rig
- DragonBones export → DragonBones rig: writes files
- Rig builder → Whole-image deform: builds deform rigs
- Rig builder → Morph compiler: compiles morphs
- Rig builder → Path and wave motion: supports motion tracks
- MCP tools → Filmstrip renderer: requests render
- Filmstrip renderer → DragonBones rig: reads rig
- Filmstrip renderer → MCP tools: returns filmstrip
- MCP tools → Live preview: starts preview
- Renderer service → DragonBones rig: serves files
- Human rigger → Markup editor: edits markup
- Markup editor → Markup geometry: uses geometry
- Markup editor → Skeleton helpers: uses helpers
- MCP tools → Markup editor: opens review
- Markup editor → MCP tools: submits edits
- Live preview → Renderer service: loads rig assets
