Skip to content
AlphaToolBox3D is in early alpha: features are incomplete and things can break. Use it at your own risk and keep copies of your files. Report a problem
ToolBox3D

Docs · Python API

tb.ops.scene

28 operations. Without targets=, an operation works on the current selection, like its button in the editor.

Add Image Plane

tb.ops.scene.add_image_plane(
    *,
    staged: str = ...,
    texture: str = ...,
    opacity: float = 0.699999988079071,
) -> Result

Add a reference image to the viewport: a plane at the origin named after the image, scaled to its aspect ratio, drawn translucent. The image comes from the file picker (staged) or from a texture already in the library. The image and the plane are one undo step.

  • Operation scene.add_image_plane
  • In Model
ArgumentTypeDefaultDescription
stagedstr—Token from tb_api::stage_texture (the picked image file).
texturestr—Id or name of a library texture to show instead of a staged image.
opacityfloat0.699999988079071How see-through the image plane is, from 0 (invisible) to 1 (solid). (factor; 0…1).

Clear Parent Inverse

tb.ops.scene.clear_parent_inverse(
    *,
    nodes: Sequence[ObjectRef] = ...,
    targets: Targets = None,
) -> Result

Reset objects' parent inverse to identity so their local channels apply directly in the parent's frame. Objects whose parenting kept a different frame move to where their channels place them.

  • Operation scene.clear_parent_inverse
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to clear (default: the selected objects).

Closest Surface Point

tb.ops.scene.closest_point(
    *,
    nodes: Sequence[ObjectRef] = ...,
    mesh: MeshRef = ...,
    include_hidden: bool = False,
    max_distance: float = ...,
    point: Vec3Like,
) -> Result

The surface point nearest to 'point': the object, its mesh, the point and face normal, the distance and the face index; null when nothing is in range. Meshes are read as stored (before modifiers and deformation). Read-only.

  • Operation scene.closest_point
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Only these objects (default: every visible mesh object).
meshMeshRef—Query this mesh's own data in its local space instead of the placed objects.
include_hiddenboolFalseAlso hit hidden objects.
max_distancefloat—Ignore anything farther than this (scene units; default: no limit). (0…1000000000000).
pointVec3LikerequiredThe query point (world space, or the mesh's local space with 'mesh').

Create Locator

tb.ops.scene.create_locator() -> Result

Add a locator: a transform-only crosshair at the origin, used as an anchor, reference target or attachment point. One undo step.

  • Operation scene.create_locator
  • In Model

Delete

tb.ops.scene.delete(
    *,
    nodes: Sequence[ObjectRef] = ...,
    targets: Targets = None,
) -> Result

Delete objects and everything below them. Meshes and curves no other object uses are removed with them.

  • Operation scene.delete
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to delete (default: the selected objects).

Scene Digest

tb.ops.scene.digest(
    *,
    mode: Literal["quick", "deep"] = "quick",
    object: ObjectRef = ...,
) -> Result

A read-only summary of the scene: objects (name, path, kind, transform), counts, materials, clips and the selection. mode 'deep' adds per-mesh topology, bounds and content hashes, the skeleton's bones and clip details. Pass object to describe one object.

  • Operation scene.digest
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
modeLiteral["quick", "deep"]"quick"Mode (quick / deep).
objectObjectRef—Only this object (name or path) and its mesh.

Duplicate

tb.ops.scene.duplicate(
    *,
    nodes: Sequence[ObjectRef] = ...,
    translate: Vec3Like = ...,
    rotate: Vec3Like = ...,
    scale: Vec3Like = ...,
    targets: Targets = None,
) -> Result

Duplicate objects with everything below them, in place (zero offset), right after each original. Meshes and curves are copied so the duplicates edit independently; the duplicates become the selection.

  • Operation scene.duplicate
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to duplicate (default: the selected objects).
translateVec3Like—Added to each copy's local translation. (scene units).
rotateVec3Like—Added to each copy's local rotation, Euler degrees. (degrees).
scaleVec3Like—Multiplies each copy's local scale. (factor).

Group

tb.ops.scene.group(
    *,
    nodes: Sequence[ObjectRef] = ...,
    name: str = "Group",
    targets: Targets = None,
) -> Result

Create a group node at the scene root, optionally containing the selected objects (their world placement is kept).

  • Operation scene.group
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to put in the group (default: the selected objects; none creates an empty group).
namestr"Group"Group name; a numeric suffix is added if taken.

Hide

tb.ops.scene.hide(
    *,
    nodes: Sequence[ObjectRef] = ...,
    visible: bool = False,
    targets: Targets = None,
) -> Result

Hide objects (visible=true shows them).

  • Operation scene.hide
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
visibleboolFalseOn: Show. Off: Hide.

Hide Unselected

tb.ops.scene.hide_unselected(
    *,
    nodes: Sequence[ObjectRef] = ...,
    material: str = ...,
) -> Result

Hide every object except the kept ones: the given objects (default: the selected ones), or every object that draws material (a material id or name). Their parents and children stay visible; Show All brings the rest back. One undo step.

  • Operation scene.hide_unselected
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to keep visible (default: the selected objects).
materialstr—Keep every object that draws this material (id or name) instead.

Lock

tb.ops.scene.lock(
    *,
    nodes: Sequence[ObjectRef] = ...,
    locked: bool = True,
    targets: Targets = None,
) -> Result

Lock objects so viewport and outliner clicks ignore them (locked=false unlocks).

  • Operation scene.lock
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
lockedboolTrueOn: Lock. Off: Unlock.

Ray Cast

tb.ops.scene.ray_cast(
    *,
    nodes: Sequence[ObjectRef] = ...,
    mesh: MeshRef = ...,
    include_hidden: bool = False,
    max_distance: float = ...,
    origin: Vec3Like,
    direction: Vec3Like,
) -> Result

The nearest surface hit along a ray from 'origin' in 'direction' (both sides of every face): the object, its mesh, the world point and face normal, the distance and the face index; null on a miss. Meshes are read as stored (before modifiers and deformation). Read-only.

  • Operation scene.ray_cast
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Only these objects (default: every visible mesh object).
meshMeshRef—Query this mesh's own data in its local space instead of the placed objects.
include_hiddenboolFalseAlso hit hidden objects.
max_distancefloat—Ignore anything farther than this (scene units; default: no limit). (0…1000000000000).
originVec3LikerequiredRay start (world space, or the mesh's local space with 'mesh').
directionVec3LikerequiredRay direction (any length but zero).

Rename

tb.ops.scene.rename(
    *,
    node: ObjectRef = ...,
    name: str,
    targets: Targets = None,
) -> Result

Rename one object. Names are unique among siblings and cannot contain path separators ('/', '|', ''); clip curves that animate the object follow.

  • Operation scene.rename
  • Works on selected objects (exactly 1)
  • In Previewer, Model
ArgumentTypeDefaultDescription
nodeObjectRef—Object to rename (default: the single selected object).
namestrrequiredNew name.

Reparent

tb.ops.scene.reparent(
    *,
    nodes: Sequence[ObjectRef] = ...,
    parent: ObjectRef | None = None,
    index: int = ...,
    keep_world: bool = True,
    targets: Targets = None,
) -> Result

Move objects under a new parent (or to the root) at a sibling position, keeping their world placement by default.

  • Operation scene.reparent
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to move, in the order they should appear (default: the selected objects).
parentObjectRef | NoneNoneNew parent; null moves to the scene root.
indexint—Sibling position among the new parent's other children (default: last). (0…4294967295).
keep_worldboolTrueKeep each object's world placement exactly: its parent inverse absorbs the new parent's frame and its local channels stay as they are. Off keeps the local channels and clears the parent inverse, so the object follows the new parent.

Rotate

tb.ops.scene.rotate(
    *,
    nodes: Sequence[ObjectRef] = ...,
    axis: Vec3Like,
    angle: float,
    pivot: Vec3Like = ...,
    targets: Targets = None,
) -> Result

Rotate objects about a world axis by an angle. With a pivot every object also orbits that point (gizmo behavior); without one each object turns about its own origin.

  • Operation scene.rotate
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
axisVec3LikerequiredWorld-space rotation axis (normalized internally).
anglefloatrequiredAngle in degrees (right-handed about the axis). (degrees).
pivotVec3Like—World-space pivot (default: each object's own origin). (scene units).

Scale

tb.ops.scene.scale(
    *,
    nodes: Sequence[ObjectRef] = ...,
    factor: Vec3Like,
    pivot: Vec3Like = ...,
    orientation: Literal["world", "local"] = "world",
    reference: ObjectRef = ...,
    snap: float = 0.0,
    targets: Targets = None,
) -> Result

Multiply objects' local scale channels by per-axis factors. With a pivot each object's origin also moves away from or towards that point along the chosen axes (gizmo behavior).

  • Operation scene.scale
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
factorVec3LikerequiredFactors for the X, Y and Z scale channels. (factor).
pivotVec3Like—World-space pivot (default: each object's own origin). (scene units).
orientationLiteral["world", "local"]"world"Axes along which origins move relative to the pivot: world axes, or the local axes of the reference object. (world / local).
referenceObjectRef—Object whose local axes are used with orientation 'local' (default: the first target).
snapfloat0.0Round every scaled channel to a multiple of this step (0: off). (0…1000000).

Set Channel

tb.ops.scene.set_channel(
    *,
    nodes: Sequence[ObjectRef] = ...,
    channels: Any,
    value: float,
    targets: Targets = None,
) -> Result

Set one or more transform channels (translateX … scaleZ, or tx … sz) of objects to one value, keeping every other channel exactly — the channel-box edit. Rotation channels are XYZ Euler degrees; the other rotation channels keep the values the object displays.

  • Operation scene.set_channel
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
channelsAnyrequiredChannel names, e.g. ["translateX"] or ["sx", "sy", "sz"].
valuefloatrequiredNew value (length in metres, rotation in degrees, scale as a factor).

Display as Wire

tb.ops.scene.set_display_wire(
    *,
    nodes: Sequence[ObjectRef] = ...,
    wire: bool = True,
    targets: Targets = None,
) -> Result

Draw objects as their wire only, as live boolean cutters are; they stay selectable and editable (wire=false draws the surface again).

  • Operation scene.set_display_wire
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
wireboolTrueOn: Display as Wire. Off: Display as Solid.

Set Exportable

tb.ops.scene.set_exportable(
    *,
    nodes: Sequence[ObjectRef] = ...,
    exportable: bool = True,
    targets: Targets = None,
) -> Result

Write objects to interchange exports (exportable=false keeps an object and everything below it out of glTF, FBX, OBJ, USD and the other export formats, e.g. rigging helper meshes; native saves keep it).

  • Operation scene.set_exportable
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
exportableboolTrueOn: Exportable. Off: Not Exportable.

Set Image Plane Opacity

tb.ops.scene.set_image_plane_opacity(
    *,
    node: ObjectRef = ...,
    opacity: float,
    targets: Targets = None,
) -> Result

Set how opaque an image plane is drawn (0 invisible, 1 opaque).

  • Operation scene.set_image_plane_opacity
  • Works on selected objects (exactly 1)
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—The image plane (default: the single selected object).
opacityfloatrequiredOpacity (factor; 0…1).

Set Renderable

tb.ops.scene.set_renderable(
    *,
    nodes: Sequence[ObjectRef] = ...,
    renderable: bool = True,
    targets: Targets = None,
) -> Result

Include objects in rendered output (renderable=false leaves them out of Save Viewport Screenshot; the viewport still draws them).

  • Operation scene.set_renderable
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
renderableboolTrueOn: Renderable. Off: Not Renderable.

Set Studio Tint

tb.ops.scene.set_studio_tint(
    *,
    nodes: Sequence[ObjectRef] = ...,
    preset: Literal["warm-gray", "cool-gray", "light-gray", "dark-gray", "terracotta", "olive", "slate", "cream", "charcoal"] = ...,
    color: str = ...,
    clear: bool = False,
    gesture: str = ...,
    targets: Targets = None,
) -> Result

Tint the selected objects in MatCap shading with a studio preset or a custom color; clear=true shows the MatCap's own color again. Display only: materials and exports are unchanged. Groups tint the geometry inside them.

  • Operation scene.set_studio_tint
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to tint (default: the selected objects).
presetLiteral["warm-gray", "cool-gray", "light-gray", "dark-gray", "terracotta", "olive", "slate", "cream", "charcoal"]—A studio tint preset. (warm-gray / cool-gray / light-gray / dark-gray / terracotta / olive / slate / cream / charcoal).
colorstr—A custom sRGB color, "#RRGGBB".
clearboolFalseRemove the tint.
gesturestr—Calls with the same gesture within 0.8 s form one undo step (a color-picker drag).

Set Template

tb.ops.scene.set_template(
    *,
    nodes: Sequence[ObjectRef] = ...,
    template: bool = True,
    targets: Targets = None,
) -> Result

Template objects: drawn grayed and never picked by viewport clicks or marquee (template=false restores them).

  • Operation scene.set_template
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to change (default: the selected objects).
templateboolTrueOn: Template. Off: Untemplate.

Set Transform

tb.ops.scene.set_transform(
    *,
    nodes: Sequence[ObjectRef] = ...,
    translation: Vec3Like = ...,
    rotation: Vec3Like = ...,
    scale: Vec3Like = ...,
    rotation_order: Literal["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"] = ...,
    targets: Targets = None,
) -> Result

Set translation, rotation, scale channels and/or the rotation order of objects. Channels not given keep their exact values.

  • Operation scene.set_transform
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
translationVec3Like—Local translation. (scene units).
rotationVec3Like—Local rotation, Euler degrees in the object's rotation order. (degrees).
scaleVec3Like—Local scale. (factor).
rotation_orderLiteral["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]—Euler order of the rotation channels. Changing it keeps the orientation and re-expresses the channels; a rotation given in the same call is read in the new order. (XYZ / YZX / ZXY / XZY / YXZ / ZYX).

Set Transform Axis

tb.ops.scene.set_transform_axis(
    *,
    nodes: Sequence[ObjectRef] = ...,
    channel: Literal["translation", "rotation", "scale"],
    axis: Literal["x", "y", "z"],
    value: float,
    relative: bool = False,
    targets: Targets = None,
) -> Result

Set or offset one axis of the translation, rotation (Euler degrees) or scale of objects. Absolute moves several objects together so their mean takes the value; relative adds it to each.

  • Operation scene.set_transform_axis
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
channelLiteral["translation", "rotation", "scale"]requiredChannel (translation / rotation / scale).
axisLiteral["x", "y", "z"]requiredAxis (x / y / z).
valuefloatrequiredTranslation in metres, rotation in degrees, scale as a factor.
relativeboolFalseAdd the value instead of setting it.

Show All

tb.ops.scene.show_all() -> Result

Show every hidden object.

  • Operation scene.show_all
  • In Model

Translate

tb.ops.scene.translate(
    *,
    nodes: Sequence[ObjectRef] = ...,
    offset: Vec3Like,
    align_normal: Vec3Like = ...,
    align_pivot: Vec3Like = ...,
    targets: Targets = None,
) -> Result

Move objects by a world-space offset. Only the top-most selected objects move; their descendants follow.

  • Operation scene.translate
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Objects to transform (default: the selected objects).
offsetVec3LikerequiredWorld-space offset. (scene units).
align_normalVec3Like—Align Rotation to Target: also turn each object (the shortest way) so its up axis (+Y) points along this world direction, such as the normal of the face a snapped move lands on.
align_pivotVec3Like—World point the alignment turns about, such as the snap target (default: each object's moved origin). (scene units).

Ungroup

tb.ops.scene.ungroup(
    *,
    nodes: Sequence[ObjectRef] = ...,
    targets: Targets = None,
) -> Result

Dissolve groups: their children take the group's place under its parent, keeping their world placement, and the groups are deleted. With no group selected, the groups of the selected objects are dissolved.

  • Operation scene.ungroup
  • Works on selected objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Groups to dissolve (default: the selected groups, else the groups of the selected objects).