pantin

The command line

pantin checks files, packs atlases, makes normal maps, builds bundles, imports, renders, and serves projects to agents, for a terminal and for a CI. It ends with 0 when all is well, 1 when a file has a problem, and 2 when it was not asked properly.

cargo build --release -p pantin-cli
target/release/pantin help

check

pantin check <project or file>...

Reads each one and says what is wrong with it. A folder is checked as a project, with its images; a file whose name ends in .atlas.json as an atlas, with its image; any other file as a skeleton of the format before, with the images it names.

pack

pantin pack <project> [--out <atlas file>] [--padding <pixels>] [--page <pixels>]
            [--trim] [--rotate] [--tight] [--scale <1 to 100>] [--per-skin]

Packs every image the project shows, but those its settings leave out, into pages of at most --page pixels a side (the project's, or 4096), one PNG for each, and writes the atlas file that says where each image is, by its identifier. Without --out, they go in the folder atlas of the project. --trim leaves out the transparent border of each image, --rotate turns an image a quarter when that takes less room, --tight packs slower and closer, --scale packs every image at that share of its pixels, in hundredths, and --per-skin writes the atlas of each skin beside; the settings of the project ([pack] of pantin.toml) may say each of them already.

light

pantin light <project> [--out <atlas file>] [--strength <0 to 10>] [--softness <pixels>]

Makes the normal map of every image the atlas packs, for lighting the character in a game, and lays them out on pages exactly as pantin pack lays out the images, so that a colour and its normal share their place: an atlas file and one PNG a page. The strength (1) makes the slopes steeper, the softness (4) rounds the edges over more pixels; without them, those of the project. Without --out, they go in the folder normals of the project.

build

pantin build <project> [--out <file.pantinpack>]

Checks the project as check does and, when it has no problem, packs its images, makes their normal maps and writes the bundle a game loads: one file with the manifest, the rig, the boxes, the atlas and the normal maps. Without --out, it is build/<name>.pantinpack in the folder of the project. It ends with 1 when the check fails, and writes nothing.

zip

pantin zip <project> [--out <file.zip>]

Packs the project into one ZIP file, to be sent: its folder with every image it shows, those outside the folder brought into its sources, and nothing else (no atlas, no normal maps, which are made again). Without --out, it is <name>.zip beside the folder.

unzip

pantin unzip <file.zip>

Unpacks the ZIP of a project beside it, as File › Import › A project packed as ZIP… does; a folder of its name that is there already is never written over.

migrate

pantin migrate <file.pantin.json> [--out <project folder>]

Turns a file of the format before into a project: a folder with its manifest, its rig, and its images gathered in sources.

import-psd

pantin import-psd <file.psd> <project> [--hidden] [--remove-gone]

Puts each layer of a PSD file in the project as an image where it was, in a slot named after it and its groups. A slot of that name that is already there gets the new image and keeps its bone, its mesh and its keys, so a PSD can be imported again after it was drawn over. Hidden layers are imported with --hidden. The tags in the names of layers and groups are followed: [bone], [merge], [origin], [ignore], [scale:n] and [rotate:degrees] (see the manual). The project remembers the file: imported again, it is read into the same folder and the pieces of its layers are found by their images; a piece whose layer is gone is said, and deleted with --remove-gone.

import-json

pantin import-json <skeleton.json> [--out <project folder>]

Makes a project of a skeleton exported as JSON by another tool of skeletal animation (versions 2 to 4.2 of its export), with the images cut out of the atlas beside it, or else read from the folder of images it names. A skeleton exported as binary (.skel) is read too, in the version the public page of that format describes. What pantin cannot hold yet is said thing by thing.

web

pantin web <project> --out <folder> [--animation <name>]… [--skin <name>]…

Writes a web page that plays the character into the folder: index.html, which holds the web runtime and the bundle and plays offline, opened from the disk, and the bundle beside it. The animations offered are those named, the first played; with none, the character follows its graph. The web runtime is the one tools/web_runtime.sh target/web builds, or the folder PANTIN_WEB_RUNTIME names.

plugin

pantin plugin <project> <plugin.rhai> [<command>]

Runs a command of a plugin on a project and saves it: everything the command changes is one change. Without a command, says the commands of the plugin. What the command says is printed; a command that cannot be done changes nothing.

render

pantin render <project> <animation> --out <folder, or file .gif, .mp4 or .webm>
              [--size <width>x<height>] [--fps <frames a second>] [--background <colour>]
              [--margin <share>] [--scale <pixels a unit>]
              [--from <frame>] [--to <frame>] [--loops <times>] [--speed <times>]
              [--colors <16 to 256>] [--dither] [--once] [--quality <0 to 100>]
              [--skin <name>] [--jpeg]

Draws an animation frame after frame, in the format the name of --out says:

--outWhat is writtenAlpha
a folderPNG files frame_0001.png and onkept
a folder, with --jpegJPEG files frame_0001.jpg and on, of --qualitynone: an opaque --background is needed
.gifone animated GIFone colour: a pixel is transparent or opaque
.mp4a video H.264, which every player readsnone: give a --background
.webma video VP9kept

A video is written by ffmpeg, which must be on the path (or named by PANTIN_FFMPEG), with libx264 for MP4 and libvpx-vp9 for WebM. By default 512×512, 30 frames a second, on a transparent background; a colour is written #rrggbb or #rrggbbaa. The character fits the picture over the whole animation with a margin of 0.05 of each side (--margin), or is drawn at --scale pixels a unit. --from and --to draw a part, its frames counted from 0; --loops writes them so many times; --speed plays faster (2) or slower (0.5). A GIF has --colors colours, mixed in small patterns by --dither, and plays for ever unless --once; a video is better and larger as --quality grows (75 by default). --skin shows a skin: a slot shows the attachment of its name in it before any other. In an animation said to loop, the springs swing from the first frame as they do when it comes round again, so the frames loop without a jump; otherwise they start at rest.

pantin render examples/fish.pantin swim --out swim.mp4 --background '#ffffff' --quality 90
pantin render examples/fish.pantin swim --out swim.webm --size 1024x1024
pantin render examples/fish.pantin swim --out swim.gif --colors 64 --dither --loops 2

mcp

pantin mcp [<project>]

Serves a project to an agent by the Model Context Protocol, on stdin and stdout, until stdin is closed. See Pantin for an agent and the manual.