Ops reference

About ops

Ops are a small JSON language for building scenes without shipping a full ProjectJSON. Send an ops array to POST /v1/scenes. Coordinates are integers in voxel space.

Scene & layers

OpFields
scene.set_name{ name }
scene.clearRemove all voxels
layer.add{ id?, name? }
layer.set_active{ id }
layer.clear{ id? } — active layer if omitted

Color & mode

OpFields
color.set{ hex } or { rgba }
mode.setadd | sub | paint
color.replace{ fromHex|fromRgba, toHex|toRgba } — active layer

Voxels

OpFields
voxel.set{ x, y, z, hex?, rgba? }
voxel.remove{ x, y, z }
voxel.set_many{ voxels: [...] }

Shapes

OpFields
shape.box{ from, to, hex?, rgba?, mode? }
shape.sphere{ center, radius, ... }
shape.cylinder{ from, to, radius, ... }
shape.line{ from, to, ... } — 3D Bresenham line
shape.pyramid{ from, to, ... } — base at min Y, apex at max Y
shape.stairs{ from, to, ... } — steps along longer X/Z span

Transforms

OpFields
xform.mirror{ axis: x|y|z, origin? } — mirror active layer

Palette

OpFields
palette.useCurated id, e.g. curated_pico8

Example

[
  { "op": "palette.use", "id": "curated_pico8" },
  { "op": "color.set", "hex": "#ff004d" },
  { "op": "mode.set", "mode": "add" },
  { "op": "shape.box", "from": [0, 0, 0], "to": [4, 4, 4] }
]