Derived and external assets
Not every asset is generated. Art recolored from another asset, or built by a
script, still belongs in plan, the lockfile, and quality snapshots. Two
asset kinds declare that, and they are deliberately separate: one pixelkiln
makes itself, one it only keeps track of.
derive: made by pixelkiln from existing pixels
"hedge_autumn": { "derive": { "from": "hedge", "transform": "recolor", "map": { "#4a7a3a": "#b8742c" } } },
"hedge_2x": { "derive": { "from": "hedge", "transform": "scale", "width": 64, "height": 64 } },
"tile_snapped": { "derive": { "file": "art/tile.png", "transform": "palette-snap", "palette": ["#000000", "#ffffff"] } }
The input is from (another asset of the same style) or file (a committed
PNG, relative to the manifest), never both. recolor, palette-snap and
hue-shift treat every pixel alike, so their from may be a set, a
character's rotations, a loop or a paperdoll layer: every image is
transformed and written under the same role, which is how one drawn layer
becomes several colours of it for nothing. The others take a single image.
The transform is one of:
transform | Fields | Does |
|---|---|---|
recolor | map | Replaces exact #rrggbb colors. Unmapped colors and every alpha value stay. |
palette-snap | palette (2 to 256 colors) | Moves every visible pixel to the nearest palette color. |
hue-shift | degrees, hue, saturation, brightness, reference | Turns each pixel's hue by degrees (-180 to 180) and multiplies its saturation and brightness, keeping its shading. hue: [from, to] limits it to hues in that window, clockwise, so [330, 30] is the reds. Greys and near-blacks are never touched, so outlines and steel stay as they are. reference, a list of PNGs, limits it further to pixels in a colour one of them uses: a character's own frames pick out its skin on a layer that also holds an item. |
scale | width, height, mode | Resizes to the exact size. nearest (default) keeps hard edges; box averages the covered pixels, weighted by alpha. |
key-skin | skin, key, tolerance | Repaints skin in a stand-in colour (key, default cyan), keeping its shading. skin lists the skin colours and tolerance how far a pixel may sit from one; with no skin, every pixel that is not outline is keyed. |
despeckle | reference (1 to 64 PNGs), tolerance | Removes the ghost pixels an animation model leaves around a figure. reference names committed stills whose colours are the figure's own; a colour they barely use, on the outside of the figure, is removed. |
gen writes the file in the wave after its source lands, calls no provider, and
costs nothing in any unit. The plan reports a derived asset stale, free to fix,
when its source's recorded output, its file, the transform, or its parameters
change. An edit by hand makes it orphaned, like any generated file. The lock entry
records the input's hash under derive. A run that only derives needs no
provider key.
In a style with a quality profile, a derived asset waits until its source's
refined output is approved; plan and refine show it as blocked until then,
and refine counts it as blocked, not failed (it still exits 1, since the style
cannot be packed yet). Once approved, gen derives it, and it is refined and
approved like any other asset in the style.
external: built elsewhere, tracked here
"dock": { "external": { "builder": "python tools/iso_kit.py dock", "inputs": ["tools/iso_kit.py"] } }
pixelkiln never runs the builder; it is the command you run, recorded so the
plan can tell you what to do. inputs are files the builder reads. Their hashes
and the builder text are the asset's identity. Record the built file with
adopt --local, which stores the file's hash, the builder, and the inputs' hashes.
An external asset is never actionable, so gen skips it, including under
--force. The plan reports it as: untracked when the file exists but is not
recorded (run adopt --local), orphaned when the file is missing, when the
builder or an input changed, or when the file changed since it was recorded
(rebuild, then adopt --local --force), and ok otherwise.
