Scene kit command

file.render

Render Preview

Renders a preview of the scene as a PNG without changing anything: from `target.view` (`camera`, the scene's active camera; `front`, `back`, `left`, `right`, `top`, `bottom` or `persp`, framed to fit the scene or `objectId`) or `target.camera` (another camera, by id or name), at `target.time` (seconds from the first frame; 0 without it), in `target.pass` (`color`, `id` with a legend of object colours, `depth` or `wireframe`). `target.views` (2 to 6) draws one labelled sheet of views; `target.range` [from, to] with `target.frames` (2 to 12) one labelled sheet of times from one view. Without a target it answers four views (the camera or `persp`, then front, right and top). It never reads or moves the viewport, the current frame, the mode or the selection.

Kit
Scene 0.1.0 (.kscene)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
maxSizeintegernoThe most pixels on the picture's longer side, 16 to 4096 (default 1024).
scalenumbernoPicture pixels per render pixel (the scene's render size), above 0 and at most 2 (default 1). Each cell of a sheet is drawn at it. Reduced so the picture fits `maxSize`.
targetobjectnoWhat to show. One view (`view` or `camera`) at one `time`; a sheet of `views`; or a sheet over `range` from one view. Without a target, four views at the first frame.

Call through scene_run

text
scene_run {
  "path": "<file>.kscene",
  "steps": [{ "command": "file.render" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: maxSize, scale, target. scene_run answers the step’s result in completed[i].result.

Result

Result of file.render
NameTypeRequiredDescription
columnsintegeryes
framesany[]yesEach cell, in reading order: {time (seconds from the first frame), frame (the scene's frame number), label, view, camera (the camera's id, when looking through one)}.
heightintegeryes
legendany[]noWith `pass: "id"`: {id, name, color (#rrggbb)} for each object the pass can draw.
mimeTypestringyes
pngstringyesThe picture as base64 PNG.
rowsintegeryes
scalenumberyesThe scale each cell was drawn at, after `maxSize`.
widthintegeryes
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "columns": {
      "type": "integer"
    },
    "frames": {
      "description": "Each cell, in reading order: {time (seconds from the first frame), frame (the scene's frame number), label, view, camera (the camera's id, when looking through one)}.",
      "items": {},
      "type": "array"
    },
    "height": {
      "type": "integer"
    },
    "legend": {
      "description": "With `pass: \"id\"`: {id, name, color (#rrggbb)} for each object the pass can draw.",
      "items": {},
      "type": "array"
    },
    "mimeType": {
      "type": "string"
    },
    "png": {
      "description": "The picture as base64 PNG.",
      "type": "string"
    },
    "rows": {
      "type": "integer"
    },
    "scale": {
      "description": "The scale each cell was drawn at, after `maxSize`.",
      "type": "number"
    },
    "width": {
      "type": "integer"
    }
  },
  "required": [
    "columns",
    "frames",
    "height",
    "mimeType",
    "png",
    "rows",
    "scale",
    "width"
  ],
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "The most pixels on the picture's longer side, 16 to 4096 (default 1024).",
      "type": "integer"
    },
    "scale": {
      "description": "Picture pixels per render pixel (the scene's render size), above 0 and at most 2 (default 1). Each cell of a sheet is drawn at it. Reduced so the picture fits `maxSize`.",
      "type": "number"
    },
    "target": {
      "additionalProperties": false,
      "description": "What to show. One view (`view` or `camera`) at one `time`; a sheet of `views`; or a sheet over `range` from one view. Without a target, four views at the first frame.",
      "properties": {
        "camera": {
          "description": "A camera object's id or name, to look through it instead of the scene's active camera. Not with `view`.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Object"
          ]
        },
        "frames": {
          "description": "How many frames the sheet of `range` shows, 2 to 12 (default 6).",
          "type": "integer"
        },
        "objectId": {
          "description": "An object (id, a diagnostic's string id, or name) a named view frames instead of the whole scene. Not with the camera's view: a camera's framing is its own.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Object"
          ]
        },
        "pass": {
          "description": "color (default): the materials lit by the scene's lights. id: each object in a flat colour of its own on black, named in `legend`. depth: grey, nearer is lighter, nothing is black. wireframe: the edges.",
          "enum": [
            "color",
            "id",
            "depth",
            "wireframe"
          ],
          "type": "string"
        },
        "path": {
          "description": "`object:<id or name>`, the same as `objectId`.",
          "type": "string"
        },
        "range": {
          "description": "[from, to]: seconds from the first frame, from < to, within the animation. A sheet of `frames` frames spread evenly from `from` to `to`, both included, each labelled with its time and frame. Not with `views` or `time`.",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        "time": {
          "description": "Seconds from the first frame of the animation (the scene's start frame at 0 s, at its fps), from 0 to before its end. The frame that starts at or before that time is drawn. 0 when left out.",
          "type": "number"
        },
        "view": {
          "description": "One of camera, front, back, left, right, top, bottom, persp. `camera` is the scene's active camera; the others are framed to fit the scene's visible meshes (or `objectId`): the six along the axes orthographically, `persp` from front right, above.",
          "enum": [
            "camera",
            "front",
            "back",
            "left",
            "right",
            "top",
            "bottom",
            "persp"
          ],
          "type": "string"
        },
        "views": {
          "description": "2 to 6 views for one sheet, each a view name or {\"camera\": id or name}; each cell is labelled with its view.",
          "items": {},
          "type": "array"
        }
      },
      "type": "object"
    }
  },
  "returns": "{png (base64), mimeType, width, height, scale, frames: [{time, frame, label, view, camera?}], columns, rows, legend?: [{id, name, color}]}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (scene_commands through @kition/[email protected], built from KitionAI/kition-scene@4d06faf). As data: commands.jsonl.