/unreal-skills:gimp-importfrom Unreal Harness Skills
Imports layered GIMP .xcf files into Unreal Engine as UTexture2D assets. Two modes: MOCKUP recreates UI/HUD layouts as UMG widgets; CONTRACT establishes living layered assets with naming grammar and reproducible export.
Ships in Unreal Harness Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Take art authored as GIMP layers on one canvas and land it in Unreal as
correctly-configured UTexture2Ds. There are two distinct products — decide which
one the user needs before doing anything:
| MOCKUP mode | CONTRACT mode | |
|---|---|---|
| The art is | a one-shot layout to recreate | a living asset, re-painted + re-exported many times |
| Semantics come from | layer structure (group = coupled, loose = free) | a naming grammar the layers follow |
| Export framing | tight-crop each element, place with anchor math | full-canvas co-registered — zero placement math |
| Export driver | this session, live over the GIMP MCP | a committed script in the consuming project |
| In UMG | one Image per element, slot math per element | sibling full-canvas Images, toggled by visibility |
| Interaction | none (static presentation) | optional CPU hit-mask + bbox sidecars for irregular shapes |
| Re-import story | agent re-derives decisions | filename = layer name = join key; repaint → re-export, no re-wire |
| Right for | a HUD composition the user will hand-tune after import | maps, state overlays (hover/selected), fog, drill-down UI, anything with interaction states painted as layers |
When in doubt ask one question: "will an artist repaint and re-export this?" Yes → CONTRACT. No, it's a one-time recreate → MOCKUP. (This split is lifted from a production project whose region-overlay world map ran the contract for years: committed exporter, manifest validation, mask sidecars — and whose doc explicitly rejects ad-hoc per-export MCP calls as unreproducible drift.)
Prerequisites. The mcp__gimp-mcp__* tools come from
maorcc/gimp-mcp — an external MCP server this
repo doesn't bundle (GIMP 3.2+, plugin installed, Tools → MCP → Start MCP Server,
TCP :9877; install walkthrough: /onboard). If check_server fails, that setup is
what's missing. CONTRACT mode can also run fully headless via gimp-console-3
batch (no GIMP UI, no MCP server, artist's open session untouched) — see §Contract.
is_group)The gimp-mcp server's list_layers / get_image_metadata report is_group: true
for every layer (they test hasattr(layer,'get_children'), always true in GIMP 3.x)
and enumerate only top-level layers — nested children are invisible to them and to
set_layer_properties' name lookup. Read the tree yourself via call_api, which
runs Python in GIMP's live context:
# call_api(api_path="exec", args=["exec", ["<this, as one \n-joined string>"]])
import json
img = Gimp.get_images()[0]
def walk(layers, parent=None):
out = []
for L in layers:
g = bool(L.is_group()) # Gimp.Item.is_group() — the reliable check
out.append({"name": L.get_name(), "is_group": g, "parent": parent,
"offsets": list(L.get_offsets())[1:], # (_, x, y) -> [x, y]
"w": L.get_width(), "h": L.get_height(), "vis": L.get_visible()})
if g:
out += walk(list(L.get_children()), L.get_name())
return out
print("GROUPTREE:" + json.dumps(walk(img.get_layers())))
You only ever export leaf layers — a group is an organizational node, not a graphic.
The core inversion vs MOCKUP: the canvas is the coordinate system, and you keep it.
Every layer exports onto the full transparent canvas at its authored offset, so every
PNG is the same size and every pixel is already in place. In UMG the layers are
sibling Images filling one identical rectangle, drawn in Z-order, toggled by
SetVisibility — zero per-layer positioning math, which deletes the entire
crop/threshold/anchor error surface. The engine's only job is deciding which
pre-authored layers are visible; every visual state is exactly what the artist drew.
Layer names encode semantics. The canonical grammar (parse structurally, never positionally — underscores inside names must never break parsing):
<SCOPE>_<MID>_<STATE>[_<NONCE>]
SCOPE — the owning top-level group (a map region, a HUD cluster, a menu
screen; e.g. NORTH_FOOTHILLS). Known from the tree, stripped as a prefix.MID — optional: a sub-unit (a group child of the scope, e.g. west) or a
named scope layer (e.g. roads). Absent for plain scope overlays.STATE — the role/state descriptor; may itself contain underscores
(selected_hovered).NONCE — optional trailing integer for multiples (town_1).| Pattern | Meaning | Example |
|---|---|---|
| Top-level group | a scope | NORTH_FOOTHILLS |
<SCOPE>_<state> (full-canvas @0,0) | scope state overlay | NORTH_FOOTHILLS_hovered |
<SCOPE>_<layer>_<state> | scope named-layer overlay | NORTH_FOOTHILLS_roads_dirt |
<SCOPE>_<sub>_<state> (leaf at scope level) | sub-unit overlay | NORTH_FOOTHILLS_west_selected_hovered |
nested group <SCOPE>_<sub> | a sub-unit | NORTH_FOOTHILLS_west |
<SCOPE>_<sub>_<type>_<n> (leaf inside the sub-group) | a feature icon | NORTH_FOOTHILLS_west_town_1 |
BASE group | static backdrop, composited to ONE png | — |
| loose top-level layer | full-canvas veil, exports solo | FOG_OF_WAR |
WIP/DECALS/SCRATCH groups | never exported | — |
Feature vs sub-unit overlay (both sub-scoped) is disambiguated by structure: a leaf inside the sub-group is a feature; a sub-scoped leaf at scope level is an overlay. Sub-unit membership is decided by matching the scope's group-child names — never by guessing at underscores.
Setting up a fresh asset: propose this grammar to the user, map their layers onto it (renames in GIMP are cheap now, expensive after textures/registries bind to the names), and record any project-specific vocabulary. Adopting an existing asset: derive the vocabulary from the tree walk and confirm it.
.xcf layer name → PNG filename →
UTexture2D asset name → whatever registry/C++ binds textures to roles. Keep names
stable across repaints and re-export is a reimport-in-place with no code touched.Artist-action → cost table (tell the user this — it's the iteration promise):
Artist action in the .xcf | Effect on re-export | Action required |
|---|---|---|
| Repaint an existing layer | same filename → reimport replaces in place | none |
| Add a layer (grammar-conforming) | new texture, unreferenced | bind it in the consumer |
| Rename a layer | old asset orphaned, new name unmapped | update the binding (or rename back) |
| Resize the canvas | every texture changes size | re-export all; normalized UV math survives |
| Move a full-canvas overlay off (0,0) | de-registers | restore to (0,0) |
Ad-hoc per-export MCP calls are rejected in contract mode. They aren't reproducible by other contributors and invite drift in filenames/sizes that silently breaks the join key. Instead, copy the skill's template into the consuming project and commit it:
${CLAUDE_SKILL_DIR}/scripts/gimp_export_contract.py — implements
the grammar parser, full-canvas per-leaf export, BASE compositing, scratch skipping,
stale-PNG cleanup, manifest.json emission, loud warnings for every
non-conforming layer, and the optional mask/bbox sidecars. Config-driven
(EXPORT_CONFIG dict); the header documents every key.projects/<Game>/tools/gimp_export/ (or the project's tools dir) with
a small committed driver that sets EXPORT_CONFIG (out_dir, skip_groups, mask
config, known_states) and execs the template copy. Project-specific reserved
groups (e.g. a _travel road-segment group) are extensions the copy owns.call_api exec, against the artist's open image;"<GIMP bin>/gimp-console-3" -idf --batch-interpreter=python-fu-eval -b "EXPORT_CONFIG={...,'xcf': r'<path>'}; exec(open(r'<driver>').read())" --quit —
loads the saved .xcf into its own instance; the artist's session is untouched.warnings non-empty = stale/mis-named
layers about to ship; surface them, don't paper over them. manifest[] entries
carry kind/scope/sub/state/nonce plus each layer's authored rect
(content_bbox optional) — this is the machine-readable model of the art.A Slate slot is an axis-aligned rectangle; painted regions are irregular blobs, and in a co-registered stack every Image covers the whole canvas — per-widget hover/click events are useless. Cursor→shape resolution is done by sampling alpha in canvas space (inverse any pan/zoom transform first).
UTexture2D is NOT CPU-readable at runtime — mip-0 BulkData is freed after
the RHI upload (verified: empty even in PIE). Hit-testing must read a sidecar,
never the texture.mask config bakes one: a binary WMSK file (per-mask downsampled
alpha grid, default 256²) written under Content/ so it ships and stages when
cooked. Sub-unit overlays and configured scope states (default hovered) double as
their own masks — lightly alpha-filled painted shapes need no separate mask art
(alpha > 0 = inside).rect/content_bbox and
sub_group footprints are the off-paint fallback (e.g. an icon just outside the
painted wash), tighter box first. Bounds must never outrank paint — icon-group
bboxes and painted territory drift apart freely as art iterates.normalize_mean boosts under-painted scope masks to a canonical mean
on the export duplicate only — the source .xcf is never modified.WMSK + sampling is ~30 lines of consumer C++ (read header, cache flat
arrays, index [y*res+x] scaled from canvas UV). The skill emits the sidecar; the
consumer wires the hit-test, like all runtime behaviour.pie_active blocks asset + widget mutation).asset_textures_import all PNGs, force_overwrite:true, one call. For painted UI
art the load-bearing settings are:
"settings": { "sRGB": true, "compression": "EditorIcon",
"lod_group": "UI", "mip_gen": "NoMipmaps" }
lod_group:"UI" — UI-group textures are never streamed, so the full mip is
always resident; without it the art streams in and renders a blurry low mip on
first open. mip_gen:"NoMipmaps" — drawn near 1:1, a single full-res mip can't
show a blurry lower mip and mips waste memory. (EditorIcon = uncompressed RGBA;
block compression muddies thin painted boundaries. For huge always-scaled-down art,
Default + lod_group:"UI" is an acceptable size trade.)/Game/<Project>/UI/<AssetName>/<Scope>/.Images in GIMP stacking order
(bottom = lowest ZOrder), DrawAs: Image, visibility driven by state. Two traps:
every layer widget needs a unique name (ConstructWidget with a reused name
silently replaces the object — siblings collapse into one, last texture wins), and
keep visibility rules as pure functions of state (testable headless) rather than
scattered imperative toggles.For a composition the user will hand-tune after import. Semantics come from structure:
a layer GROUP is a coupled unit whose members keep their relative geometry (a bar
trough + its fill); an ungrouped layer is an independent graphic placed freely. Ask
which group members are runtime-driven (a draining fill, a needle) unless a name
hint says so (convention: leading ~ or dyn:).
call_api — name lookup can't reach
them), export_image(flatten=FALSE) — flatten=true composites onto an opaque
background and discards alpha (the "red bands" bug) — then restore visibility.scripts/gimp_place.py spec.json. Measures each layer's
opaque rect (alpha-THRESHOLD bbox, never -trim — stray sub-1%-alpha pixels
defeat -trim and the art renders tiny/squashed), tight-crops, and computes
placements on the shared canvas ruler. Order elements bottom→top (emitted
zorder follows input order). Threshold ~50 for crisp art; ~10–20 to keep a soft
glow.asset_textures_import settings as contract §5.Anchors min==max==(0,0), Offsets=(Left=canvas_x, Top=canvas_y, Right=native_w, Bottom=native_h), Alignment=(0,0) — the slot is exactly native-pixel sized, both
axes scale by one uniform DPI factor, the element cannot distort, any canvas or
screen aspect. Mode B (fraction anchor box, Offsets=0) locks the HUD to screen
fractions instead — pixel-faithful only when canvas aspect == screen aspect,
else everything stretches by screen/canvas (3:2 art on 16:9 ⇒ ×1.19 wide). Use B
only for a deliberately screen-fractional HUD authored at the target aspect. Either
way: one consistent mode for every element (mixing framings is exactly what
destroys relative sizing), Brush.DrawAs = Image (never Box/9-slice), explicit
ZOrder from GIMP stacking, respect existing BindWidget names (change slot +
ZOrder only; re-parenting a C++-bound image is risky).pie_start → poll pie_get_state →
editor_screenshot → always pie_stop (release the lease). Zoom the region
(ImageMagick crop/resize), compare to the GIMP composite, iterate one defect at a
time.flatten=false on every export — flatten=true bleeds an opaque background in;
-trim then keys off that color and mis-crops.-trim (mockup mode).lod_group:"UI" + mip_gen:"NoMipmaps" for HUD art — or it streams in blurry
on first open. The import tool supports these natively; set them at import, not as
a post-fix.GetPlatformData().ConstructWidget name reuse silently
collapses siblings into one Image.ZOrder from GIMP stacking; DrawAs: Image — never add-order or default brush.sRGB:true for painted/albedo art; masks/normals would be false.save_xcf; always restore layer visibility — the file is the artist's;
contract-mode alpha normalization happens on the export duplicate only.is_group/list_layers — walk the tree with call_api.BindWidget data) is the consumer's;
it cannot be derived from GIMP./icon;
standalone geometry measurement: /see (feed its numbers here)..xcf → one widget or one contract). Re-run for
another.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
gimp-import, unreal-engine, texture-import, umg-widget, hud-layout, layered-asset
npx claudepluginhub oliver-io/unreal-harness --plugin unreal-skills22 skills in this plugin
/architectWrite or update an architecture document for an Unreal Engine system — a conceptual spec a senior engineer can build from. Use when someone wants to "document this system", "write an architecture doc", "spec a feature before building it", "describe how X works for the team", or "update the docs to match the code". Plan-only and code-free: it researches the live editor, Blueprints, and source, then writes a Design-level document about intent, boundaries, contracts, and invariants — no implementation, no builds, no editor mutation. Works in any UE project, not one studio's house style./automated-testerSet up an automated, agent-observed end-to-end test (or a guarded dev loop) for an Unreal feature in this harness. Use when someone wants to "add a test", "test this feature end-to-end", "verify X works in PIE", "build a verification harness", "guard this feature with a test", or "make a guardrail loop for an agent building X". Opinionated: the engine constructs the scenario via typed C++ primitives, the agent observes the behaviour it controls through a DIFFERENT read primitive, no mocks, headless-first. Encodes docs/TESTING.md./bootstrapCreate a new Unreal Engine project under projects/ wired to this repo's UnrealMCP plugin and pre-configured with the recommended engine built-in plugins (Niagara, Water, GeometryScripting, GAS, StateTree, animation, runtime mesh, etc.), and give the project its own agent-facing CLAUDE.md. Use when someone wants to "bootstrap a project", "make a new UE project", "scaffold a test/sandbox project", get a fresh project to drive with the MCP, or "write a CLAUDE.md for this game". Produces a minimal C++ host project that loads the plugin from this repo (no copy) and builds against the engine at UNREAL_ENGINE_ROOT. Asks the intended architecture (C++-first vs Blueprint-first, single- vs multiplayer) and writes a project CLAUDE.md tuned to the answers; can also adopt an existing project by exploring it and writing a CLAUDE.md that describes it.