Scene kit command

driver.add

Add Driver

Adds a driver to a property (of an object, bone or shape key) computed from `expression` and its variables.

Kit
Scene 0.1.0 (.kscene)
Changes the document
yes
Acts on
object (one id), which a run step’s on fills

Parameters

Parameters of driver.add
NameTypeRequiredDescription
bonestringnoThe bone of a bone property
expressionstringnoscripted: Python-style arithmetic over the variables and `frame` (+ - * / // % **, comparisons, and, or, not, a if c else b, sin, cos, min, max, clamp, lerp, radians, ...); angles in radians
indexintegernoThe component (x 0, y 1, z 2, alpha 3); every component when left out
kind"average" | "sum" | "min" | "max" | "scripted"noHow the variables combine (scripted evaluates `expression`)
objectinteger | stringnoThe object (or the armature of `bone`, the mesh of `shapeKey`, the owner of the material); the active object when left out
picknumber[]noInstead of `object`/`objects`: a world point [x, y, z] in metres; the command acts on the object there now (the smallest whose mesh's bounds hold the point, else the nearest light, camera, empty, curve, text, lattice or armature whose origin is within 0.25 m). A place: with `basis`, a write by it is refused when what is at the point is no longer what was there (moved away, another moved in, its parent moved)
property"location" | "rotation" | "scale" | "hidden" | "power" | "color" | "lens" | "baseColor" | "boneLocation" | "boneRotation" | "boneScale" | "shapeKey"yesThe driven property (bone ones name `bone`, shapeKey names `shapeKey`, baseColor is the object's material's)
shapeKeystringnoThe shape key of a shapeKey property
variablesobject[]noThe variables, replacing any: { name, type: singleProperty, object, property, index, bone?, shapeKey? } | { name, type: transform, object, bone?, channel: locationX..scaleZ or scaleAverage, space: world, transform, or local } | { name, type: distance or rotationDifference, a, aBone?, b, bBone? }

Call through scene_run

text
scene_run {
  "path": "<file>.kscene",
  "steps": [{ "command": "driver.add", "params": { "property": <"location" | "rotation" | "scale" | "hidden" | "power" | "color" | "lens" | "baseColor" | "boneLocation" | "boneRotation" | "boneScale" | "shapeKey"> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: bone, expression, index, kind, object, pick, shapeKey, variables. scene_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "bone": {
      "description": "The bone of a bone property",
      "type": "string"
    },
    "expression": {
      "description": "scripted: Python-style arithmetic over the variables and `frame` (+ - * / // % **, comparisons, and, or, not, a if c else b, sin, cos, min, max, clamp, lerp, radians, ...); angles in radians",
      "type": "string"
    },
    "index": {
      "description": "The component (x 0, y 1, z 2, alpha 3); every component when left out",
      "type": "integer"
    },
    "kind": {
      "description": "How the variables combine (scripted evaluates `expression`)",
      "enum": [
        "average",
        "sum",
        "min",
        "max",
        "scripted"
      ],
      "type": "string"
    },
    "object": {
      "description": "The object (or the armature of `bone`, the mesh of `shapeKey`, the owner of the material); the active object when left out",
      "oneOf": [
        {
          "description": "the object's id",
          "type": "integer"
        },
        {
          "description": "the object's name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Object"
      ]
    },
    "pick": {
      "description": "Instead of `object`/`objects`: a world point [x, y, z] in metres; the command acts on the object there now (the smallest whose mesh's bounds hold the point, else the nearest light, camera, empty, curve, text, lattice or armature whose origin is within 0.25 m). A place: with `basis`, a write by it is refused when what is at the point is no longer what was there (moved away, another moved in, its parent moved)",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "property": {
      "description": "The driven property (bone ones name `bone`, shapeKey names `shapeKey`, baseColor is the object's material's)",
      "enum": [
        "location",
        "rotation",
        "scale",
        "hidden",
        "power",
        "color",
        "lens",
        "baseColor",
        "boneLocation",
        "boneRotation",
        "boneScale",
        "shapeKey"
      ],
      "type": "string"
    },
    "shapeKey": {
      "description": "The shape key of a shapeKey property",
      "type": "string"
    },
    "variables": {
      "description": "The variables, replacing any: { name, type: singleProperty, object, property, index, bone?, shapeKey? } | { name, type: transform, object, bone?, channel: locationX..scaleZ or scaleAverage, space: world, transform, or local } | { name, type: distance or rotationDifference, a, aBone?, b, bBone? }",
      "items": {
        "additionalProperties": true,
        "properties": {
          "a": {
            "description": "The first source object by id or name",
            "oneOf": [
              {
                "description": "the object's id",
                "type": "integer"
              },
              {
                "description": "the object's name",
                "type": "string"
              }
            ],
            "x-khp-name": "name",
            "x-khp-role": "object",
            "x-khp-types": [
              "Object"
            ]
          },
          "b": {
            "description": "The second source object by id or name",
            "oneOf": [
              {
                "description": "the object's id",
                "type": "integer"
              },
              {
                "description": "the object's name",
                "type": "string"
              }
            ],
            "x-khp-name": "name",
            "x-khp-role": "object",
            "x-khp-types": [
              "Object"
            ]
          },
          "object": {
            "description": "The source object by id or name",
            "oneOf": [
              {
                "description": "the object's id",
                "type": "integer"
              },
              {
                "description": "the object's name",
                "type": "string"
              }
            ],
            "x-khp-name": "name",
            "x-khp-role": "object",
            "x-khp-types": [
              "Object"
            ]
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "property"
  ],
  "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.