Scene kit command
constraint.add
Add Constraint
Adds a constraint (track to, copy location, IK, limit, child of, …) with its settings to `object` or one of its bones.
- Kit
- Scene 0.1.0 (.kscene)
- Changes the document
- yes
- Acts on
object(one id), which a run step’sonfills
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
action | string | no | action: the action's name |
axes | boolean[] | no | copyLocation and copyRotation: [x, y, z] axes copied |
axis | "x" | "y" | "z" | "-x" | "-y" | "-z" | no | floor: the plane's side the owner stays on |
bone | string | no | A bone of the owner (an armature) to constrain instead of the object; the active bone in pose mode |
bulge | number | no | stretchTo and splineIk: how strongly the other axes thin as it stretches, 0 to 100 (1 keeps the volume) |
chain | integer | no | ik: bones in the chain counting this one, 0 runs to the root; splineIk: bones fitted to the curve (1) |
chainOffset | boolean | no | splineIk: keep the chain's root where it is |
channel | "locationX" | "locationY" | "locationZ" | "rotationX" | "rotationY" | "rotationZ" | "scaleX" | "scaleY" | "scaleZ" | no | action: the target's channel that picks the frame |
curveRadius | boolean | no | splineIk: the curve's radius scales the bones' thickness (true) |
evenDivisions | boolean | no | splineIk: share the curve evenly between the bones |
extrapolate | boolean | no | transform: map values beyond the source range too |
frameEnd | number | no | action: the frame the channel's maximum plays |
frameStart | number | no | action: the frame the channel's minimum plays |
fromMax | number[] | no | transform: the source range's high end [x, y, z] |
fromMin | number[] | no | transform: the source range's low end (degrees for rotation) [x, y, z] |
influence | number | no | How much of the result is used, 0 to 1 (1) |
invert | boolean[] | no | copyLocation and copyRotation: [x, y, z] axes inverted |
iterations | integer | no | ik: solver iterations (500) |
keepAxis | "swingY" | "planeX" | "planeZ" | no | stretchTo: how Y turns to the target |
limit | boolean[] | no | limitRotation: [x, y, z] angles limited |
mapFrom | "location" | "rotation" | "scale" | no | transform: the target's channel read |
mapTo | "location" | "rotation" | "scale" | no | transform: the owner's channel set |
mapping | ("x" | "y" | "z")[] | no | transform: for the owner's x, y, z, the target axis each reads |
max | number[] | number | no | limitRotation: highest angles, degrees [x, y, z]; action: the channel value that plays frameEnd |
min | number[] | number | no | limitRotation: lowest angles, degrees [x, y, z]; action: the channel value that plays frameStart (degrees for rotation) |
mix | "add" | "replace" | "before" | "after" | "multiply" | "beforeFull" | "beforeSplit" | "afterFull" | "afterSplit" | no | transform: add or replace (location), add, replace, before, or after (rotation), replace or multiply (scale); action: how the action combines with the owner |
object | integer | string | no | The owner; the active object when left out |
offset | number | no | copyLocation: true adds to the owner's location; floor: metres beyond the plane |
ownerSpace | "world" | "local" | "pose" | "localWithParent" | no | copyLocation, copyRotation, transform: the space the owner is read in (pose and localWithParent on bones) |
pick | number[] | no | 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) |
pole | integer | string | no | ik: the pole target object |
poleAngle | number | no | ik: degrees the chain turns from the pole |
poleBone | string | no | ik: a bone of the pole target |
preserveVolume | boolean | no | armature: blend the bones as dual quaternions |
rename | string | no | Its name |
restLength | number | no | stretchTo: the distance, in the owner's Y units, at which it does not stretch; 0 takes the distance now |
space | "world" | "local" | "pose" | "localWithParent" | no | limitRotation: the space the angles are read in (pose and localWithParent on bones) |
target | integer | string | no | The target object |
targetBone | string | no | A bone of the target (an armature) to use instead of the object |
targetSpace | "world" | "local" | "pose" | "localWithParent" | no | copyLocation, copyRotation, transform, action: the space the target is read in |
targets | object[] | no | armature: the bones that move the owner, as { object, bone, weight } |
toMax | number[] | no | transform: the destination range's high end [x, y, z] |
toMin | number[] | no | transform: the destination range's low end (degrees for rotation) [x, y, z] |
trackAxis | "x" | "y" | "z" | "-x" | "-y" | "-z" | no | trackTo and dampedTrack: the axis pointed at the target |
type | "trackTo" | "dampedTrack" | "copyLocation" | "copyRotation" | "limitRotation" | "childOf" | "ik" | "stretchTo" | "floor" | "transform" | "action" | "armature" | "splineIk" | yes | The constraint (ik and splineIk on bones) |
upAxis | "x" | "y" | "z" | no | trackTo: the axis kept up |
useRotation | boolean | no | floor: the plane turns with the target |
volume | "xzx" | "x" | "z" | "none" | no | stretchTo: the axes that thin |
xzScale | "none" | "boneOriginal" | "inversePreserve" | "volumePreserve" | no | splineIk: the bones' thickness |
yScale | "none" | "fitCurve" | "boneOriginal" | no | splineIk: the bones' lengths |
Call through scene_run
scene_run {
"path": "<file>.kscene",
"steps": [{ "command": "constraint.add", "params": { "type": <"trackTo" | "dampedTrack" | "copyLocation" | "copyRotation" | "limitRotation" | "childOf" | "ik" | "stretchTo" | "floor" | "transform" | "action" | "armature" | "splineIk"> } }]
}The required parameters, with placeholders for their types: not a tested example. Optional: action, axes, axis, bone, bulge, chain, chainOffset, channel, curveRadius, evenDivisions, extrapolate, frameEnd, frameStart, fromMax, fromMin, influence, invert, iterations, keepAxis, limit, mapFrom, mapTo, mapping, max, min, mix, object, offset, ownerSpace, pick, pole, poleAngle, poleBone, preserveVolume, rename, restLength, space, target, targetBone, targetSpace, targets, toMax, toMin, trackAxis, upAxis, useRotation, volume, xzScale, yScale. scene_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
Parameter schema
{
"additionalProperties": false,
"properties": {
"action": {
"description": "action: the action's name",
"type": "string"
},
"axes": {
"description": "copyLocation and copyRotation: [x, y, z] axes copied",
"items": {
"type": "boolean"
},
"type": "array"
},
"axis": {
"description": "floor: the plane's side the owner stays on",
"enum": [
"x",
"y",
"z",
"-x",
"-y",
"-z"
],
"type": "string"
},
"bone": {
"description": "A bone of the owner (an armature) to constrain instead of the object; the active bone in pose mode",
"type": "string"
},
"bulge": {
"description": "stretchTo and splineIk: how strongly the other axes thin as it stretches, 0 to 100 (1 keeps the volume)",
"type": "number"
},
"chain": {
"description": "ik: bones in the chain counting this one, 0 runs to the root; splineIk: bones fitted to the curve (1)",
"type": "integer"
},
"chainOffset": {
"description": "splineIk: keep the chain's root where it is",
"type": "boolean"
},
"channel": {
"description": "action: the target's channel that picks the frame",
"enum": [
"locationX",
"locationY",
"locationZ",
"rotationX",
"rotationY",
"rotationZ",
"scaleX",
"scaleY",
"scaleZ"
],
"type": "string"
},
"curveRadius": {
"description": "splineIk: the curve's radius scales the bones' thickness (true)",
"type": "boolean"
},
"evenDivisions": {
"description": "splineIk: share the curve evenly between the bones",
"type": "boolean"
},
"extrapolate": {
"description": "transform: map values beyond the source range too",
"type": "boolean"
},
"frameEnd": {
"description": "action: the frame the channel's maximum plays",
"type": "number"
},
"frameStart": {
"description": "action: the frame the channel's minimum plays",
"type": "number"
},
"fromMax": {
"description": "transform: the source range's high end [x, y, z]",
"items": {
"type": "number"
},
"type": "array"
},
"fromMin": {
"description": "transform: the source range's low end (degrees for rotation) [x, y, z]",
"items": {
"type": "number"
},
"type": "array"
},
"influence": {
"description": "How much of the result is used, 0 to 1 (1)",
"type": "number"
},
"invert": {
"description": "copyLocation and copyRotation: [x, y, z] axes inverted",
"items": {
"type": "boolean"
},
"type": "array"
},
"iterations": {
"description": "ik: solver iterations (500)",
"type": "integer"
},
"keepAxis": {
"description": "stretchTo: how Y turns to the target",
"enum": [
"swingY",
"planeX",
"planeZ"
],
"type": "string"
},
"limit": {
"description": "limitRotation: [x, y, z] angles limited",
"items": {
"type": "boolean"
},
"type": "array"
},
"mapFrom": {
"description": "transform: the target's channel read",
"enum": [
"location",
"rotation",
"scale"
],
"type": "string"
},
"mapTo": {
"description": "transform: the owner's channel set",
"enum": [
"location",
"rotation",
"scale"
],
"type": "string"
},
"mapping": {
"description": "transform: for the owner's x, y, z, the target axis each reads",
"items": {
"enum": [
"x",
"y",
"z"
],
"type": "string"
},
"type": "array"
},
"max": {
"description": "limitRotation: highest angles, degrees [x, y, z]; action: the channel value that plays frameEnd",
"oneOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"type": "number"
}
]
},
"min": {
"description": "limitRotation: lowest angles, degrees [x, y, z]; action: the channel value that plays frameStart (degrees for rotation)",
"oneOf": [
{
"items": {
"type": "number"
},
"type": "array"
},
{
"type": "number"
}
]
},
"mix": {
"description": "transform: add or replace (location), add, replace, before, or after (rotation), replace or multiply (scale); action: how the action combines with the owner",
"enum": [
"add",
"replace",
"before",
"after",
"multiply",
"beforeFull",
"beforeSplit",
"afterFull",
"afterSplit"
],
"type": "string"
},
"object": {
"description": "The owner; 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"
]
},
"offset": {
"description": "copyLocation: true adds to the owner's location; floor: metres beyond the plane",
"type": "number"
},
"ownerSpace": {
"description": "copyLocation, copyRotation, transform: the space the owner is read in (pose and localWithParent on bones)",
"enum": [
"world",
"local",
"pose",
"localWithParent"
],
"type": "string"
},
"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"
},
"pole": {
"description": "ik: the pole target object",
"oneOf": [
{
"description": "the object's id",
"type": "integer"
},
{
"description": "the object's name",
"type": "string"
}
],
"x-khp-name": "name",
"x-khp-types": [
"Object"
]
},
"poleAngle": {
"description": "ik: degrees the chain turns from the pole",
"type": "number"
},
"poleBone": {
"description": "ik: a bone of the pole target",
"type": "string"
},
"preserveVolume": {
"description": "armature: blend the bones as dual quaternions",
"type": "boolean"
},
"rename": {
"description": "Its name",
"type": "string"
},
"restLength": {
"description": "stretchTo: the distance, in the owner's Y units, at which it does not stretch; 0 takes the distance now",
"type": "number"
},
"space": {
"description": "limitRotation: the space the angles are read in (pose and localWithParent on bones)",
"enum": [
"world",
"local",
"pose",
"localWithParent"
],
"type": "string"
},
"target": {
"description": "The target object",
"oneOf": [
{
"description": "the object's id",
"type": "integer"
},
{
"description": "the object's name",
"type": "string"
}
],
"x-khp-name": "name",
"x-khp-types": [
"Object"
]
},
"targetBone": {
"description": "A bone of the target (an armature) to use instead of the object",
"type": "string"
},
"targetSpace": {
"description": "copyLocation, copyRotation, transform, action: the space the target is read in",
"enum": [
"world",
"local",
"pose",
"localWithParent"
],
"type": "string"
},
"targets": {
"description": "armature: the bones that move the owner, as { object, bone, weight }",
"items": {
"additionalProperties": true,
"properties": {
"bone": {
"description": "The bone name",
"type": "string"
},
"object": {
"description": "The armature 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"
]
},
"weight": {
"description": "The bone weight",
"type": "number"
}
},
"type": "object"
},
"type": "array"
},
"toMax": {
"description": "transform: the destination range's high end [x, y, z]",
"items": {
"type": "number"
},
"type": "array"
},
"toMin": {
"description": "transform: the destination range's low end (degrees for rotation) [x, y, z]",
"items": {
"type": "number"
},
"type": "array"
},
"trackAxis": {
"description": "trackTo and dampedTrack: the axis pointed at the target",
"enum": [
"x",
"y",
"z",
"-x",
"-y",
"-z"
],
"type": "string"
},
"type": {
"description": "The constraint (ik and splineIk on bones)",
"enum": [
"trackTo",
"dampedTrack",
"copyLocation",
"copyRotation",
"limitRotation",
"childOf",
"ik",
"stretchTo",
"floor",
"transform",
"action",
"armature",
"splineIk"
],
"type": "string"
},
"upAxis": {
"description": "trackTo: the axis kept up",
"enum": [
"x",
"y",
"z"
],
"type": "string"
},
"useRotation": {
"description": "floor: the plane turns with the target",
"type": "boolean"
},
"volume": {
"description": "stretchTo: the axes that thin",
"enum": [
"xzx",
"x",
"z",
"none"
],
"type": "string"
},
"xzScale": {
"description": "splineIk: the bones' thickness",
"enum": [
"none",
"boneOriginal",
"inversePreserve",
"volumePreserve"
],
"type": "string"
},
"yScale": {
"description": "splineIk: the bones' lengths",
"enum": [
"none",
"fitCurve",
"boneOriginal"
],
"type": "string"
}
},
"required": [
"type"
],
"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.