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.modifier

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

Add Modifier

tb.ops.modifier.add(
    *,
    type: str,
    node: ObjectRef = ...,
    name: str = ...,
    settings: Any = ...,
    index: int = ...,
) -> Result

Add a modifier to the object's stack: it goes above pinned modifiers (a curve generator goes below the mesh modifiers it feeds), gets a unique name and becomes the active modifier. One undo step.

  • Operation modifier.add
  • In Model, Control Rig
ArgumentTypeDefaultDescription
typestrrequiredType id (see modifier.types), e.g. subdivide, mirror, bevel.
nodeObjectRef—The mesh object (default: the active object).
namestr—Name (default: the type's name).
settingsAny—Settings to start from, merged over the type's defaults.
indexint—Stack position (default: above pinned modifiers). (0…1024).

Apply Modifier

tb.ops.modifier.apply(
    *,
    modifier: str,
    node: ObjectRef = ...,
    keep: bool = False,
    render: bool = False,
) -> Result

Make a modifier's result the object's mesh and remove the modifier: only that modifier is evaluated, on the original mesh. On a curve object the first (curve-to-mesh) modifier converts the object to a mesh object; the curves are removed when no other object uses them. Refused for meshes shared by several objects and, for topology-changing modifiers, meshes with morph targets. One undo step.

  • Operation modifier.apply
  • In Model
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
keepboolFalseKeep the modifier in the stack after applying.
renderboolFalseApply the Render level instead of the Viewport level (Multires Bake at Render Level).

Apply as Blendshape Target

tb.ops.modifier.apply_as_blendshape_target(
    *,
    modifier: str,
    node: ObjectRef = ...,
    keep: bool = False,
) -> Result

Store a deform modifier's result as a new blendshape target on the mesh and remove the modifier (keep: Save as Blendshape Target keeps it). Only modifiers that keep the topology. One undo step.

  • Operation modifier.apply_as_blendshape_target
  • In Model
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
keepboolFalseKeep the modifier (Save as Blendshape Target).

Bake Modifiers

tb.ops.modifier.bake(*, nodes: Any) -> Result

Bake all Model modifiers on the exact requested mesh objects in one transaction, retaining Control Rig entries, morph data and material bindings.

  • Operation modifier.bake
  • In Model
ArgumentTypeDefaultDescription
nodesAnyrequiredNonempty array of exact mesh object IDs; shared lattices supply every driven host.

Bind Modifier

tb.ops.modifier.bind(
    *,
    modifier: str,
    node: ObjectRef = ...,
    unbind: bool = False,
) -> Result

Capture a binding modifier's data from its current input: Vertex Snap's welded target points, Volumetric Wrap's cage weights. The input is the stack evaluated up to the modifier. unbind clears the binding. One undo step.

  • Operation modifier.bind
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
unbindboolFalseClear the binding instead.

Copy to Selected

tb.ops.modifier.copy_to_selected(*, modifier: str, node: ObjectRef = ...) -> Result

Copy a modifier from the active object to the other selected mesh objects. One undo step.

  • Operation modifier.copy_to_selected
  • In Model
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).

Duplicate Modifier

tb.ops.modifier.duplicate(*, modifier: str, node: ObjectRef = ...) -> Result

Copy a modifier with its settings right below itself. One undo step.

  • Operation modifier.duplicate
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).

Flood Modifier Weights

tb.ops.modifier.flood_weights(
    *,
    modifier: str,
    node: ObjectRef = ...,
    operation: Literal["replace", "add", "subtract", "scale", "smooth"] = "replace",
    value: float = 1.0,
    strength: float = 1.0,
    min: float = 0.0,
    max: float = 1.0,
    iterations: int = 1,
) -> Result

Apply a paint operation to a modifier's whole weight map: Replace moves every weight toward value by strength, Add / Subtract by value·strength, Scale erases by strength, Smooth blends each vertex toward its neighbours (iterations passes). Results are clamped to min..max. One undo step.

  • Operation modifier.flood_weights
  • In Model
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier whose map is painted: its id or name (map <name>.weights).
nodeObjectRef—The mesh object (default: the active object).
operationLiteral["replace", "add", "subtract", "scale", "smooth"]"replace"Operation (replace / add / subtract / scale / smooth).
valuefloat1.0Target (Replace) or amount (Add / Subtract). (0…1).
strengthfloat1.0How far each vertex moves (the brush opacity). (0…1).
minfloat0.0Min (0…1).
maxfloat1.0Max (0…1).
iterationsint1Smooth passes. (1…100).

Modifier Stack

tb.ops.modifier.list(*, node: ObjectRef = ..., evaluate: bool = False) -> Result

The object's modifier stack, top to bottom, with each modifier's mode toggles and settings; with evaluate, also each modifier's last result (ran, off, error and why) and the evaluated vertex and face counts.

  • Operation modifier.list
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRef—The mesh object (default: the active object).
evaluateboolFalseEvaluate the stack and report per-modifier status and the result's size.

Load Modifier Stack

tb.ops.modifier.load_stack(
    *,
    text: str,
    targets: Sequence[ObjectRef] = ...,
    node: ObjectRef = ...,
    mode: Literal["append", "replace"] = "append",
    match: Literal["auto", "index", "position", "uv"] = "auto",
    modifier: str = ...,
    settings: bool = False,
) -> Result

Add the modifiers of a .tbmodifier document to the selected objects: 'append' adds them below the existing ones, 'replace' swaps the stack. Per-vertex weights follow 'match' (auto: by index when the vertex counts agree, else by nearest position; or index, position, uv). Objects the modifiers refer to are found by name. With 'modifier', only the file's weights go onto that existing modifier ('settings' also takes the settings both modifiers have). One undo step.

  • Operation modifier.load_stack
  • In Model
ArgumentTypeDefaultDescription
textstrrequiredThe document's text.
targetsSequence[ObjectRef]—Objects to load onto (default: the selected mesh and curve objects).
nodeObjectRef—The mesh object (default: the active object).
modeLiteral["append", "replace"]"append"Append below the current modifiers, or replace the stack. (append / replace).
matchLiteral["auto", "index", "position", "uv"]"auto"How per-vertex weights find their vertices on a different mesh. (auto / index / position / uv).
modifierstr—Put only the file's weights on this existing modifier (id or name; single target).
settingsboolFalseWith 'modifier': also take the file modifier's settings that this modifier has too, with the same kind of value (so a Bend's Curvature does nothing on a Smooth).

Move Modifier

tb.ops.modifier.move(
    *,
    modifier: str,
    node: ObjectRef = ...,
    direction: Literal["up", "down", "first", "last"] = ...,
    index: int = ...,
) -> Result

Move a modifier up, down, to the top, bottom or a position in the stack (pinned modifiers stay last). One undo step.

  • Operation modifier.move
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
directionLiteral["up", "down", "first", "last"]—Where to move (or give index). (up / down / first / last).
indexint—The new stack position, 0 = top. (0…1024).

Remove Modifier

tb.ops.modifier.remove(*, modifier: str, node: ObjectRef = ...) -> Result

Remove a modifier from the stack; the one above it becomes active. One undo step.

  • Operation modifier.remove
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).

Save Modifier Stack

tb.ops.modifier.save_stack(
    *,
    node: ObjectRef = ...,
    modifiers: Any = ...,
    name: str = ...,
) -> Result

Write the object's modifiers (or the listed ones) as a .tbmodifier document: settings, mode toggles, per-vertex weights and bindings, with object references by name. Returns the document text and a file name; nothing in the scene changes.

  • Operation modifier.save_stack
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—The mesh object (default: the active object).
modifiersAny—Modifier ids or names to save, in stack order (default: the whole stack).
namestr—The document's name (default: the object's name).

Modifier Settings

tb.ops.modifier.set(
    *,
    modifier: str,
    node: ObjectRef = ...,
    settings: Any = ...,
    controls: Any = ...,
    name: str = ...,
    envelope: float = ...,
    pin_last: bool = ...,
    expanded: bool = ...,
    drag: int = ...,
) -> Result

Change a modifier's settings (merged over the current ones), name, envelope, pin or panel state. Each call is one undo step unless an explicit drag id joins one gesture. Slider previews accept as one undo step.

  • Operation modifier.set
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
settingsAny—Setting values to change, e.g. {"level": 2}.
controlsAny—Authoritative role/node references for scene transform controls.
namestr—A new name (made unique in the stack).
envelopefloat—Deform modifiers: blend between the input (0) and the full effect (1). (0…1).
pin_lastbool—Keep the modifier at the bottom of the stack.
expandedbool—Panel open (stored with the stack).
dragint—Identifies one slider drag: equal values coalesce into one undo step. Omit for an independent edit.

Set Active Modifier

tb.ops.modifier.set_active(*, modifier: str, node: ObjectRef = ...) -> Result

Make a modifier the active one (its panel is highlighted; Apply and keyboard actions use it).

  • Operation modifier.set_active
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).

Modifier Display

tb.ops.modifier.set_mode(
    *,
    modifier: str,
    node: ObjectRef = ...,
    flag: Literal["realtime", "render", "editMode", "onCage"],
    value: bool = ...,
) -> Result

Turn a modifier's mode toggles on or off: Viewport (realtime), Render (export and bakes), Edit Mode, On Cage. Without value the toggle flips. One undo step.

  • Operation modifier.set_mode
  • In Model, Control Rig
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier: its id or its name in the object's stack.
nodeObjectRef—The mesh object (default: the active object).
flagLiteral["realtime", "render", "editMode", "onCage"]requiredWhich toggle. (realtime / render / editMode / onCage).
valuebool—On or off (default: flip).

Set Modifier Weights

tb.ops.modifier.set_weights(
    *,
    modifier: str,
    node: ObjectRef = ...,
    weights: Any = ...,
    indices: Sequence[int] = ...,
    values: Any = ...,
    clear: bool = ...,
    drag: int = ...,
) -> Result

Set a deform modifier's weight map: weights (every vertex), indices with values (just those vertices; the brush's stroke frames) or clear (unpainted: the full effect everywhere). Values are clamped to 0..1. One undo step; calls with the same drag id join one gesture.

  • Operation modifier.set_weights
  • In Model
ArgumentTypeDefaultDescription
modifierstrrequiredThe modifier whose map is painted: its id or name (map <name>.weights).
nodeObjectRef—The mesh object (default: the active object).
weightsAny—The weight of every vertex, in vertex order.
indicesSequence[int]—Vertices to set (with values).
valuesAny—The weights of indices, in the same order.
clearbool—Remove the map: the modifier acts fully everywhere.
dragint—Identifies one brush stroke: equal values coalesce into one undo step.

Transfer Modifier Weights

tb.ops.modifier.transfer_weights(
    *,
    node: ObjectRef = ...,
    modifier: str,
    source_node: ObjectRef = ...,
    source_modifier: str,
    match: Literal["auto", "index", "position", "uv"] = "auto",
) -> Result

Copy another deform modifier's weight map without changing settings or geometry. Auto matches by vertex index when counts agree, otherwise nearest object-space position; UV uses each vertex's first corner. Unpainted maps remain full effect, and zero weights remain zero. One undo step.

  • Operation modifier.transfer_weights
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—The mesh object (default: the active object).
modifierstrrequiredThe modifier whose map is painted: its id or name (map <name>.weights).
source_nodeObjectRef—The source object (default: the target object).
source_modifierstrrequiredThe source modifier's name or id.
matchLiteral["auto", "index", "position", "uv"]"auto"Match (auto / index / position / uv).

Modifier Types

tb.ops.modifier.types() -> Result

Every modifier type: id, name, kind (deform, constructive…), which editor adds it (rigPointModifier: the Control Rig editor adds it as a point modifier on top of the skinning), default settings and the settings the panel shows.

  • Operation modifier.types
  • In Previewer, Model, Control Rig, Animation, Texture Paint

Modifier Weight Maps

tb.ops.modifier.weight_maps(*, node: ObjectRef = ..., values: bool = False) -> Result

The paintable weight maps of the object's modifiers (<name>.weights: the per-vertex amount of each deform modifier), with whether each is painted and why one cannot be; values adds every map's weight per vertex (1 where unpainted).

  • Operation modifier.weight_maps
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRef—The mesh object (default: the active object).
valuesboolFalseInclude each map's weight per vertex.