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

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

Assign Material

tb.ops.material.assign(
    *,
    meshes: Sequence[MeshRef] = ...,
    nodes: Sequence[ObjectRef] = ...,
    material: MaterialRef | None = ...,
    link: Literal["data", "object", "current"] = "data",
    link_only: bool = False,
    slot: int = ...,
    targets: Targets = None,
) -> Result

Assign shared mesh DATA or placement OBJECT materials without changing face groups. Current Link assigns through each placement slot's existing source. Link-only edits copy the effective value into OBJECT or restore DATA inheritance. One undo step for the complete batch.

  • Operation material.assign
  • Works on selected mesh objects
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
meshesSequence[MeshRef]—Meshes or mesh objects (default: the selected mesh objects).
nodesSequence[ObjectRef]—Explicit mesh placements for OBJECT, Current Link or link-only edits. Do not combine with meshes.
materialMaterialRef | None—Material to assign; null is explicitly Empty. Required for assignments, omitted for link-only edits.
linkLiteral["data", "object", "current"]"data"Mesh edits shared DATA and preserves OBJECT links; Object edits only the named placements; Current Link preserves each slot's current source. (data / object / current).
link_onlyboolFalseChange only the slot link: Object copies its current effective value, including Empty; Mesh removes the override and inherits DATA. Requires nodes and slot; omit material.
slotint—Existing slot index; omit to assign the whole DATA table or all Current Link slots. (0…32767).

Assign Faces to Material Slot

tb.ops.material.assign_faces(
    *,
    node: ObjectRef,
    mesh: MeshRef,
    slot: int,
    faces: Sequence[int],
) -> Result

Assign authored stable face IDs to an existing shared slot. Every captured ID must still exist; an empty face list changes nothing.

  • Operation material.assign_faces
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe captured mesh placement.
meshMeshRefrequiredThe authored mesh currently referenced by that placement.
slotintrequiredSlot (0…32767).
facesSequence[int]requiredAuthored stable face IDs, not dense face indices.

Assign Material to Selection

tb.ops.material.assign_selection(
    *,
    material: MaterialRef = ...,
    name: str = "Material",
) -> Result

Assign a material to the selection. In Face mode only the selected faces change: they use the mesh's slot holding the material, added when missing. Otherwise the selected mesh objects get it on every shared slot. Without material, a new material named name is created first. One undo step.

  • Operation material.assign_selection
  • In Model
ArgumentTypeDefaultDescription
materialMaterialRef—Existing material (default: create a new one).
namestr"Material"Name of the new material when material is omitted (made unique).

Bind Material Texture

tb.ops.material.bind_texture(
    *,
    material: MaterialRef,
    channel: Literal["baseColor", "normal", "metallicRoughness", "occlusion", "emissive"],
    texture: str | None,
) -> Result

Bind or clear one PBR texture slot. The slot's graph inputs are replaced explicitly; unrelated nodes, links and layout are kept. Mixed or ambiguous shader destinations refuse without changing the material.

  • Operation material.bind_texture
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
channelLiteral["baseColor", "normal", "metallicRoughness", "occlusion", "emissive"]requiredChannel (baseColor / normal / metallicRoughness / occlusion / emissive).
texturestr | NonerequiredScene texture UUID, or null to clear the slot. Sampling settings are retained.

Browse Materials Catalog

tb.ops.material.catalog_browse() -> Result

Open the mounted Materials Catalog in any editor without changing the scene or settling a preview. Import remains limited to the Materials authoring lanes. A standalone API without an application browser reports Unavailable.

  • Operation material.catalog_browse
  • In Previewer, Model, Control Rig, Animation, Texture Paint

Import Catalog Material

tb.ops.material.catalog_import(*, entry_id: str = ...) -> Result

Import a Materials Catalog entry into the scene as an editable material. The application downloads and verifies the entry's package, then adds it with material.import as one undo step; the call returns as soon as the import is queued. Entry ids are listed in the Materials Catalog (for example the id shown under a material's name).

  • Operation material.catalog_import
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
entry_idstr—Catalog entry id, such as the id of a library material.

Create Material

tb.ops.material.create(
    *,
    name: str = "Material",
    base_color: Color4 = [1.0, 1.0, 1.0, 1.0],
    metallic: float = 0.0,
    roughness: float = 0.5,
    emissive: Color3 = [0.0, 0.0, 0.0],
    emissive_intensity: float = 1.0,
    alpha_mode: Literal["opaque", "mask", "blend"] = "opaque",
    alpha_cutoff: float = 0.5,
    double_sided: bool = False,
) -> Result

Create a new PBR material.

  • Operation material.create
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
namestr"Material"Name.
base_colorColor4[1.0, 1.0, 1.0, 1.0]Linear RGBA base color. (0…1).
metallicfloat0.0Metallic (factor; 0…1).
roughnessfloat0.5Roughness (factor; 0…1).
emissiveColor3[0.0, 0.0, 0.0]Linear RGB emission color. (0…1).
emissive_intensityfloat1.0Emission strength multiplier. (0…1000).
alpha_modeLiteral["opaque", "mask", "blend"]"opaque"Alpha Mode (opaque / mask / blend).
alpha_cutofffloat0.5Mask threshold. (0…1).
double_sidedboolFalseDouble Sided.

Delete Material

tb.ops.material.delete(*, material: MaterialRef) -> Result

Remove a material and unassign it from every mesh slot, curve and placement override using it.

  • Operation material.delete
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Duplicate Material

tb.ops.material.duplicate(*, material: MaterialRef, name: str = ...) -> Result

Copy a material under a new id. The copy has no paint stack (paint stacks belong to Texture Paint).

  • Operation material.duplicate
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
namestr—Name of the copy (default: '<source>_dup', suffixed if taken).

Export Maps

tb.ops.material.export_maps(
    *,
    material: MaterialRef,
    size: float = ...,
    preset: str = "separateMaps",
    custom: Any = ...,
    format: Literal["png8", "png16", "jpeg", "tga", "tiff8", "tiff16", "tiff32", "bmp", "webp", "exr", "hdr"] = "png8",
    normal_convention: Literal["opengl", "directx"] = ...,
    height_range: Any = ...,
    pattern: str = "{material}_{suffix}",
    zip: bool = False,
    download: bool = False,
) -> Result

Write a material's maps (Base Color, Normal, Roughness, Metallic, Height, AO, Emission, Opacity) as image files, made from the material's tile with no mesh and no bake step, packed by a texture export preset. Maps the material does not drive (no height, no glow …) are skipped. With download the app saves the files (a download on the web).

  • Operation material.export_maps
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
sizefloat—Map size in pixels: 128, 256, 512, 1024, 2048 or 4096 (default: the material's graph size).
presetstr"separateMaps"Export preset id: separateMaps, gltfOrm, unreal, unityStandard, unityHdrp, blender, godot, openPbr, baseColorOnly or a plugin preset (texture.paint.export.presets).
customAny—A user export preset instead of 'preset': {id: 'user.…', label, normal, outputs: [{id, suffix, channels: [R, G, B, A tokens or null], colorSpace, optional}]}.
formatLiteral["png8", "png16", "jpeg", "tga", "tiff8", "tiff16", "tiff32", "bmp", "webp", "exr", "hdr"]"png8"Format (png8 / png16 / jpeg / tga / tiff8 / tiff16 / tiff32 / bmp / webp / exr / hdr).
normal_conventionLiteral["opengl", "directx"]—Normal map green direction (default: as the preset writes it). (opengl / directx).
height_rangeAny—Height mapped to black and white: [min, max] (default [-1, 1]).
patternstr"{material}_{suffix}"File names with {material}, {suffix}, {preset} and {resolution}.
zipboolFalseBundle every map in one ZIP.
downloadboolFalseHand the files to the user (the app saves them; a download on the web).

Add Frame

tb.ops.material.graph.add_frame(
    *,
    material: MaterialRef,
    group: str = ...,
    label: str = "Frame",
    x: float = 0.0,
    y: float = 0.0,
    nodes: Any = ...,
    frames: Any = ...,
) -> Result

Add a frame around nodes and frames (Shift+P; layout only, frames never affect the material).

  • Operation material.graph.add_frame
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
labelstr"Frame"Label.
xfloat0.0X.
yfloat0.0Y.
nodesAny—Nodes.
framesAny—Frames to nest in the new frame.

Add Image Textures

tb.ops.material.graph.add_images(
    *,
    material: MaterialRef,
    group: str = ...,
    images: Any,
    x: float = 0.0,
    y: float = 0.0,
    expected_revision: str = ...,
    wire: Literal["none", "pbr"] = "none",
) -> Result

Add 1..64 image nodes from existing texture IDs, staged images or encoded data. Resource publication and graph changes are one transaction and Undo step.

  • Operation material.graph.add_images
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
imagesAnyrequiredEach entry contains exactly one of texture UUID, staged token or encoded data, optional name and interpretation=srgb/linear/data.
xfloat0.0X.
yfloat0.0Y.
expected_revisionstr—Expected Revision.
wireLiteral["none", "pbr"]"none"pbr: connect the images to the PBR node by their names (base color / albedo, roughness, metallic, normal through a Normal Map, height, AO, emission); a lone unmatched image becomes the Base Color; the rest are placed unconnected. (none / pbr).

Add Node

tb.ops.material.graph.add_node(
    *,
    material: MaterialRef,
    group: str = ...,
    type: str,
    revision: int = ...,
    properties: Any = ...,
    x: float = ...,
    y: float = ...,
) -> Result

Add a catalog node (newest revision unless given). 'properties' merge onto the node's defaults. Returns the node with its socket ids.

  • Operation material.graph.add_node
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
typestrrequiredType.
revisionint—Revision (1…1000).
propertiesAny—Properties.
xfloat—Editor x position.
yfloat—Editor y position.

Adjust Mix Factors

tb.ops.material.graph.adjust_factor(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    by: float = ...,
    to: float = ...,
) -> Result

Set or add a finite factor, clamped to 0..1; linked inputs retain their stored value.

  • Operation material.graph.adjust_factor
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
byfloat—By.
tofloat—To.

Arrange Nodes

tb.ops.material.graph.arrange(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any = ...,
    frames: Any = ...,
    active: str = ...,
    kind: str = "flow",
    edge: str = ...,
    axis: str = ...,
    scope: str = ...,
    spacing: int = 50,
    sizes: Any = ...,
    bounds: Any = ...,
) -> Result

Arrange by dependency flow (default), align in the dominant orientation or to an edge of the selection, distribute the selection evenly, or center selected node/frame subtrees at the origin. Uses measured bounds/sizes when supplied.

  • Operation material.graph.arrange
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAny—Nodes.
framesAny—Frames.
activestr—Active.
kindstr"flow"flow, align, distribute or center.
edgestr—align only: left, center, right, top, middle or bottom of the selection's bounds; omitted aligns in the dominant orientation.
axisstr—distribute only: horizontal or vertical (equal gaps between the selected nodes).
scopestr—auto, all or selected; omitted preserves explicit nodes-only flow calls, otherwise auto.
spacingint50Spacing.
sizesAny—Measured node sizes {node:[width,height]}.
boundsAny—Measured node/frame bounds {id:{x,y,width,height}}.

Node Catalog

tb.ops.material.graph.catalog(*, type: str = ..., all: bool = False) -> Result

The shader node catalog (creatable types, newest revisions unless 'all'): labels, categories, properties and default sockets.

  • Operation material.graph.catalog
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
typestr—Only this node type.
allboolFalseInclude hidden types and older revisions.

Change Node Modes

tb.ops.material.graph.change_mode(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    blend: str = "CURRENT",
    operation: str = "CURRENT",
) -> Result

Set or cycle selected Color Mix blend modes and Math operations independently in catalog order.

  • Operation material.graph.change_mode
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
blendstr"CURRENT"CURRENT, NEXT, PREV or a declared blend mode.
operationstr"CURRENT"CURRENT, NEXT, PREV or a declared Math operation.

Connect Sockets

tb.ops.material.graph.connect(
    *,
    material: MaterialRef,
    group: str = ...,
    from_node: str,
    from_socket: str,
    to_node: str,
    to_socket: str,
    expected_revision: str = ...,
    replace_existing: bool = True,
) -> Result

Link an output to an input (sockets by id or key). An occupied single input is replaced; incompatible types and cycles are refused.

  • Operation material.graph.connect
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
from_nodestrrequiredFrom Node.
from_socketstrrequiredFrom Socket.
to_nodestrrequiredTo Node.
to_socketstrrequiredTo Socket.
expected_revisionstr—Optional material revision from connection_choices; refuse a changed source.
replace_existingboolTrueKeep the ordinary replacement default, or explicitly refuse an occupied single input.

Connect to Material Output

tb.ops.material.graph.connect_output(
    *,
    material: MaterialRef,
    group: str = ...,
    active: str,
    positions: Any = ...,
    output_key: str = ...,
) -> Result

Connect an active output by matching name, then type, then compatibility. Create a PBR output when absent; explicitly report replaced input links.

  • Operation material.graph.connect_output
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
activestrrequiredActive.
positionsAny—Optional {node: {x, y, width}} layout snapshot for a newly created output.
output_keystr—Exact available output key; omit to choose by terminal type.

Node Connection Choices

tb.ops.material.graph.connection_choices(
    *,
    material: MaterialRef,
    group: str = ...,
    source: str,
    target: str,
) -> Result

Available socket pairs in reference lazy-link order, including invalid fallback diagnostics and links that need explicit replacement review.

  • Operation material.graph.connection_choices
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
sourcestrrequiredSource.
targetstrrequiredTarget.

Copy Nodes

tb.ops.material.graph.copy(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
) -> Result

Copy nodes (Ctrl+C) as a node fragment: their internal links, arrangement and the node groups they use. Changes nothing; paste the result with material.graph.paste.

  • Operation material.graph.copy
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.

Copy Node Settings

tb.ops.material.graph.copy_settings(
    *,
    material: MaterialRef,
    group: str = ...,
    active: str,
    nodes: Any,
    include_label: bool = False,
) -> Result

Copy the active node's properties and stored socket defaults to nodes of the same type/revision, retaining identities, connections and layout.

  • Operation material.graph.copy_settings
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
activestrrequiredActive.
nodesAnyrequiredNodes.
include_labelboolFalseInclude Label.

Create Material Graph

tb.ops.material.graph.create(
    *,
    material: MaterialRef,
    seed: bool = True,
    template: str = ...,
    size: int = ...,
) -> Result

Give a material a node graph. Seeded from its PBR values and textures, or a bare PBR output when 'seed' is false, or a New Material template (material.templates) when 'template' is given.

  • Operation material.graph.create
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
seedboolTrueSeed.
templatestr—A template id from material.templates: empty, pbr, brickWall, brushedMetal, woodPlanks, fabric, concrete, scratchedPaint, tiles, lava, or a smart material 'smart.<id>' (e.g. smart.iron_rusted).
sizeint—The graph size (128, 256, 512 or 1024; default 1024). (128…1024).

Delete Unused Nodes

tb.ops.material.graph.delete_unused(
    *,
    material: MaterialRef,
    group: str = ...,
    retain_nodes: Any = ...,
    delete_frames: bool = True,
    dry_run: bool = False,
    expected_revision: str = ...,
) -> Result

Keep terminal upstream dependencies, unknown nodes and explicitly retained nodes; optionally remove nested empty frames. dryRun returns an exact read-only review.

  • Operation material.graph.delete_unused
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
retain_nodesAny—Retain Nodes.
delete_framesboolTrueDelete Frames.
dry_runboolFalseDry Run.
expected_revisionstr—Expected Revision.

Detach Outputs

tb.ops.material.graph.detach_outputs(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    active: str = ...,
    positions: Any = ...,
    dx: float = 60.0,
    dy: float = 60.0,
) -> Result

Duplicate selected nodes keeping inputs, bypass their original downstream consumers through the first same-type linked input (or first linked input), and select the copies.

  • Operation material.graph.detach_outputs
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
activestr—Active.
positionsAny—Positions.
dxfloat60.0Dx.
dyfloat60.0Dy.

Check Material Graph

tb.ops.material.graph.diagnostics(*, material: MaterialRef) -> Result

Compile the graph without changing anything: errors that stop it rendering, warnings for features the viewport approximates, and the compiled channels.

  • Operation material.graph.diagnostics
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Disconnect

tb.ops.material.graph.disconnect(
    *,
    material: MaterialRef,
    group: str = ...,
    links: Any = ...,
    node: str = ...,
    socket: str = ...,
) -> Result

Remove links by id, or every link into one input ('node' + 'socket').

  • Operation material.graph.disconnect
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
linksAny—Links.
nodestr—Node.
socketstr—Socket.

Duplicate Nodes

tb.ops.material.graph.duplicate(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    keep_inputs: bool = False,
    dx: float = 40.0,
    dy: float = 40.0,
) -> Result

Duplicate nodes with their internal links (Shift+D); 'keep_inputs' also keeps links entering the selection (Ctrl+Shift+D). Copies are offset by (dx, dy).

  • Operation material.graph.duplicate
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
keep_inputsboolFalseKeep Inputs.
dxfloat40.0Dx.
dyfloat40.0Dy.

Edit Frame

tb.ops.material.graph.edit_frame(
    *,
    material: MaterialRef,
    group: str = ...,
    frame: str,
    label: str = ...,
    color: str = ...,
    auto_size: bool = ...,
    x: float = ...,
    y: float = ...,
    width: float = ...,
    height: float = ...,
) -> Result

Change a frame's label, color (#rrggbb, empty = default), Fit Contents and/or manual bounds (x, y, width, height).

  • Operation material.graph.edit_frame
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
framestrrequiredFrame.
labelstr—Label.
colorstr—Color.
auto_sizebool—Auto Size.
xfloat—X.
yfloat—Y.
widthfloat—Width.
heightfloat—Height.

Edit Node Group

tb.ops.material.graph.edit_group(
    *,
    material: MaterialRef,
    group: str,
    name: str = ...,
    interface: Any = ...,
) -> Result

Rename a node group and/or replace its interface ({inputs, outputs}); every instance follows, links to removed sockets are dropped.

  • Operation material.graph.edit_group
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstrrequiredGroup.
namestr—Name.
interfaceAny—Interface.

Edit Graph Labels

tb.ops.material.graph.edit_labels(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any = ...,
    frames: Any = ...,
    operation: str = "modify",
    prepend: str = "",
    append: str = "",
    replace_from: str = "",
    replace_to: str = "",
    copy_mode: str = "active",
    source_id: str = ...,
    dry_run: bool = False,
    expected_revision: str = ...,
) -> Result

Review and modify, copy or clear selected node/frame labels. Literal replacement precedes prefix/suffix; unknown node settings and connections stay intact.

  • Operation material.graph.edit_labels
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAny—Nodes.
framesAny—Frames.
operationstr"modify"modify, copy or clear.
prependstr""Prepend.
appendstr""Append.
replace_fromstr""Replace From.
replace_tostr""Replace To.
copy_modestr"active"active, upstream-node or upstream-output.
source_idstr—Source Id.
dry_runboolFalseDry Run.
expected_revisionstr—Expected Revision.

Expose to Group Input

tb.ops.material.graph.expose_to_group(
    *,
    material: MaterialRef,
    group_id: str,
    node: str,
    socket: str,
) -> Result

Expose an inner node's unlinked input on its node group's interface (a new input of its type, label and current value, linked from the Group Input), so each instance of the group sets it for its own use.

  • Operation material.graph.expose_to_group
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
group_idstrrequiredThe node group's id (the group whose interface takes the input).
nodestrrequiredA node inside the group.
socketstrrequiredThe input's key.

Read Material Graph

tb.ops.material.graph.get(*, material: MaterialRef) -> Result

The material's node graph as stored (nodes with their sockets and values, links) and its layout, plus 'types': each node type's node ids, so a script can find e.g. the PBR output. Read-only.

  • Operation material.graph.get
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Group Nodes

tb.ops.material.graph.group(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    name: str = "NodeGroup",
    positions: Any = ...,
) -> Result

Move nodes into a reusable group; crossing links become the interface and the inner layout is preserved.

  • Operation material.graph.group
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
namestr"NodeGroup"Name.
positionsAny—Positions.

Import Material Image

tb.ops.material.graph.import_image(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str,
    property: str,
    staged: str = ...,
    data: str = ...,
    name: str = ...,
    texture_id: str = ...,
    expected_revision: str,
    expected_graph: str,
) -> Result

Prepare and publish an image and bind the exact image property as one Undo step.

  • Operation material.graph.import_image
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodestrrequiredNode.
propertystrrequiredProperty.
stagedstr—Staged.
datastr—Data.
namestr—Name.
texture_idstr—Texture Id.
expected_revisionstrrequiredExpected Revision.
expected_graphstrrequiredExpected Graph.

Insert Node Group

tb.ops.material.graph.insert_group(
    *,
    material: MaterialRef,
    group: str = ...,
    group_id: str,
    x: float = ...,
    y: float = ...,
) -> Result

Insert another instance of a node group from this material's library (Add ▸ Group).

  • Operation material.graph.insert_group
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
group_idstrrequiredGroup Id.
xfloat—Editor x position.
yfloat—Editor y position.

Insert Reroute

tb.ops.material.graph.insert_reroute(
    *,
    material: MaterialRef,
    group: str = ...,
    link: str,
    x: float = ...,
    y: float = ...,
) -> Result

Insert a typed reroute point on a link.

  • Operation material.graph.insert_reroute
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
linkstrrequiredLink.
xfloat—Editor x position.
yfloat—Editor y position.

Merge Nodes

tb.ops.material.graph.merge(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    positions: Any = ...,
    type: str = "auto",
    mode: str = "MIX",
    position: str = "center",
    collapse: str = "never",
) -> Result

Merge selected outputs using the declared Mix, Math, Vector Math or Shader node; preserve downstream links without cycles.

  • Operation material.graph.merge
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
positionsAny—Optional {node: {x, y, width}} layout snapshot for ordering and merge placement.
typestr"auto"auto, mix, math or shader.
modestr"MIX"Mode.
positionstr"center"center or bottom.
collapsestr"never"never, non-shader or always.

Move Nodes

tb.ops.material.graph.move_nodes(
    *,
    material: MaterialRef,
    group: str = ...,
    positions: Any = [],
    frames: Any = ...,
) -> Result

Move nodes ([{node, x, y}]) and frames ([{frame, x, y}]) to absolute editor positions. A drag is one undo step.

  • Operation material.graph.move_nodes
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
positionsAny[]Positions.
framesAny—Frame positions [{frame, x, y}].

Paste Nodes

tb.ops.material.graph.paste(
    *,
    material: MaterialRef,
    group: str = ...,
    fragment: Any,
    x: float = ...,
    y: float = ...,
) -> Result

Paste a node fragment (from material.graph.copy) with fresh identities; (x, y) places its top-left. Returns the new node ids.

  • Operation material.graph.paste
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
fragmentAnyrequiredFragment.
xfloat—Editor x position.
yfloat—Editor y position.

Remove Material Graph

tb.ops.material.graph.remove(*, material: MaterialRef) -> Result

Remove a material's node graph; the viewport draws its plain PBR values again.

  • Operation material.graph.remove
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Remove Frame

tb.ops.material.graph.remove_frame(
    *,
    material: MaterialRef,
    group: str = ...,
    frame: str,
) -> Result

Remove a frame (its nodes stay).

  • Operation material.graph.remove_frame
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
framestrrequiredFrame.

Delete Nodes

tb.ops.material.graph.remove_nodes(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    reconnect: bool = False,
) -> Result

Delete nodes and their links; with 'reconnect' links pass through where types match.

  • Operation material.graph.remove_nodes
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
reconnectboolFalseReconnect.

Reroute Outputs

tb.ops.material.graph.reroute_outputs(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
    mode: str = "all",
    positions: Any = ...,
    socket_positions: Any = ...,
) -> Result

Insert one reroute per eligible available output, retaining all authored consumer links and their metadata. Connectivity includes muted/dormant links.

  • Operation material.graph.reroute_outputs
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.
modestr"all"all, connected or unconnected.
positionsAny—Optional measured source {node:{x,y,width,height,collapsed}}.
socket_positionsAny—Optional graph-space socket {socketID:{x,y}}.

Reset Node Settings

tb.ops.material.graph.reset_settings(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any = ...,
    frames: Any = ...,
    include_children: bool = False,
    acknowledge_inactive: bool = False,
    dry_run: bool = False,
    expected_revision: str = ...,
) -> Result

Review declaration defaults while retaining labels, identities, connections and layout; explicitly acknowledge newly inactive connections.

  • Operation material.graph.reset_settings
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAny—Nodes.
framesAny—Frames.
include_childrenboolFalseInclude Children.
acknowledge_inactiveboolFalseAcknowledge Inactive.
dry_runboolFalseDry Run.
expected_revisionstr—Expected Revision.

Set Material Graph

tb.ops.material.graph.set(
    *,
    material: MaterialRef,
    graph: Any,
    layout: Any = ...,
) -> Result

Replace a material's whole graph document: the document is checked for shape and the shader domain; semantic problems are reported by material.graph.diagnostics, never silently dropped.

  • Operation material.graph.set
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
graphAnyrequiredGraph.
layoutAny—Editor layout (node positions, frames).

Set Node Label

tb.ops.material.graph.set_label(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str,
    label: str = "",
) -> Result

Set a node's label (empty clears it).

  • Operation material.graph.set_label
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodestrrequiredNode.
labelstr""Label.

Node Display

tb.ops.material.graph.set_node_layout(
    *,
    material: MaterialRef,
    nodes: Any,
    collapsed: bool = ...,
    width: float = ...,
) -> Result

Collapse / expand nodes (H) and/or set their card width (32–600).

  • Operation material.graph.set_node_layout
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
nodesAnyrequiredNodes.
collapsedbool—Collapsed.
widthfloat—Width.

Node Output

tb.ops.material.graph.set_output(
    *,
    material: MaterialRef,
    node: str,
    relative: int = ...,
    absolute: int = ...,
    format: Literal["16f", "32f", "16", "8"] = ...,
    tiling: Literal["both", "horizontal", "vertical", "none"] = ...,
) -> Result

Set an image node's output (blurs, effects, normal-map filters): its size relative to the graph size (relative: -3 to 1, from 1/8 to 2 times) or absolute (64 to 2048 texels), and its format ('16f' 16-bit float, '32f' 32-bit float, '16' 16 bits per channel, '8' 8 bits per channel; on a device without 32-bit float filtering or 16-bit norm formats, the web, the GPU holds 32f and 16 as 16-bit float). and whether it tiles (tiling: 'both', 'horizontal', 'vertical' or 'none': a filter stops at an edge that does not tile, and the picture clamps there). Omitted values are kept. Returns the output.

  • Operation material.graph.set_output
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
nodestrrequiredNode.
relativeint—Relative (-3…1).
absoluteint—Absolute (64…2048).
formatLiteral["16f", "32f", "16", "8"]—Format (16f / 32f / 16 / 8).
tilingLiteral["both", "horizontal", "vertical", "none"]—Tiling (both / horizontal / vertical / none).

Attach to Frame

tb.ops.material.graph.set_parent_frame(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any = ...,
    frames: Any = ...,
    frame: str = ...,
) -> Result

Attach nodes and frames to a frame, or detach them (no 'frame'; Alt+P).

  • Operation material.graph.set_parent_frame
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAny—Nodes.
framesAny—Frames.
framestr—Parent frame; omit to detach.

Graph Presentation

tb.ops.material.graph.set_presentation(
    *,
    material: MaterialRef,
    disclosure: Any = ...,
    preview: Any = ...,
    view: Any = ...,
) -> Result

Editor presentation saved with the layout but outside undo: a socket-group / color disclosure ({node, kind: group|color, key, open}), a node preview footer ({node, hidden?, output?}) and/or a graph pane's view ({graph?: "" or a node group id, x, y, zoom, selection?: [node ids]}) that a reopened project restores.

  • Operation material.graph.set_presentation
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
disclosureAny—Disclosure.
previewAny—Preview.
viewAny—View.

Set Node Properties

tb.ops.material.graph.set_properties(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str,
    properties: Any,
    replace: bool = False,
) -> Result

Merge (or with 'replace' set) a node's properties, validated against its declaration. Mode changes only change socket availability; links and values are kept.

  • Operation material.graph.set_properties
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodestrrequiredNode.
propertiesAnyrequiredProperties.
replaceboolFalseReplace.

Graph Settings

tb.ops.material.graph.set_settings(
    *,
    material: MaterialRef,
    size: int = ...,
    seed: int = ...,
    preview: int = ...,
) -> Result

Set the graph size (the default width and height of images made from the graph: 128, 256, 512 or 1024) and/or the random seed (0 to 999999; mixed into every random node's own Seed, so each seed gives every random node another pattern), and/or the preview size (128 to 1024: the size the editor cooks image nodes at for its pictures and 2D view, 0 for the graph size; exports always use the graph size). Omitted values are kept. Returns the settings.

  • Operation material.graph.set_settings
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
sizeint—Size (128…1024).
seedint—Seed (0…999999).
previewint—Preview (0…1024).

Set Socket Value

tb.ops.material.graph.set_value(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str,
    socket: str,
    value: Any,
) -> Result

Set an input's stored value (numbers splat to vectors/colors; RGB gets alpha 1). Rapid edits of one socket are one undo step.

  • Operation material.graph.set_value
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodestrrequiredNode.
socketstrrequiredSocket.
valueAnyrequiredValue.

Ungroup

tb.ops.material.graph.ungroup(
    *,
    material: MaterialRef,
    group: str = ...,
    nodes: Any,
) -> Result

Replace group instances with fresh copies, retaining their inner frame layout and reusable definitions.

  • Operation material.graph.ungroup
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodesAnyrequiredNodes.

Upgrade Material Output

tb.ops.material.graph.upgrade_output(*, material: MaterialRef, node: str) -> Result

Upgrade a saved PBR output revision 1/2 to revision 4, adding Surface and any missing normal/AO sockets while preserving existing identities, values, connections and layout.

  • Operation material.graph.upgrade_output
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
nodestrrequiredNode.

Import Material

tb.ops.material.import_(*, staged: str = ..., data: str = ...) -> Result

Add the materials and textures of a material package (.tbmat) to the scene; colliding ids get fresh ones, identical textures are reused.

  • Operation material.import
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
stagedstr—Token from tb_api::stage_material_package (the read package).
datastr—Base64 .tbmat archive, or a base64 data URL. Give exactly one of data or staged; the file picker reads packages in a background job.

Import Blender Material

tb.ops.material.import_blender(
    *,
    tree: Any,
    name: str = ...,
    images: Any = ...,
) -> Result

Create an editable material from a Blender shader node tree: {name, nodes:[{nodeIndex, type (bl_idname such as ShaderNodeBsdfPrincipled), name, label, location, mute, isActiveOutput, properties, inputs/outputs:[{identifier, type, defaultValue}], imageIndex}], links:[{from:{nodeIndex, identifier}, to:{nodeIndex, identifier}, muted}]}. Only nodes feeding the active EEVEE material output are converted; node groups, muted nodes and nodes or settings without an exact counterpart refuse the import and list every cause.

  • Operation material.import_blender
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
treeAnyrequiredThe captured Blender node tree.
namestr—Material name (default: the tree's name).
imagesAny—Texture ids by image index, or {texture, colorSpace: sRGB | Linear | Non-Color}.

Add Material Layer

tb.ops.material.layers.add(
    *,
    material: MaterialRef,
    source: MaterialRef,
    index: int = ...,
    opacity: float = ...,
    color_blend: Literal["MIX", "MULTIPLY", "OVERLAY", "SCREEN", "SOFT_LIGHT", "ADD"] = ...,
    mask: Any = ...,
) -> Result

Layer another scene material over this one (on top unless 'index' is given; 0 = directly above the base). Edits to that material update this one live.

  • Operation material.layers.add
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
sourceMaterialRefrequiredSource.
indexint—Index (0…1000).
opacityfloat—Opacity (0…1).
color_blendLiteral["MIX", "MULTIPLY", "OVERLAY", "SCREEN", "SOFT_LIGHT", "ADD"]—Color Blend (MIX / MULTIPLY / OVERLAY / SCREEN / SOFT_LIGHT / ADD).
maskAny—{kind: none | noise {scale, detail} | edgeWear | cavity | ao {radius, strength, contrast} | image {texture} | image {data, name} | output {node, output}}. An image mask may bring its picture as encoded PNG / JPEG / WebP data (base64 or a data: URL) instead of a texture id: it joins the scene's textures in the same undo step.

List Material Layers

tb.ops.material.layers.list(*, material: MaterialRef) -> Result

The material's layer stack, bottom to top: each layer's material, visibility, opacity, blends and mask, and the base.

  • Operation material.layers.list
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Reorder Material Layer

tb.ops.material.layers.move(*, material: MaterialRef, layer: str, index: int) -> Result

Move a layer to a stack position (0 = directly above the base).

  • Operation material.layers.move
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
layerstrrequiredThe layer id (its Layer Blend node, from material.layers.list).
indexintrequiredIndex (0…1000).

Remove Material Layer

tb.ops.material.layers.remove(*, material: MaterialRef, layer: str) -> Result

Remove a layer; the layers above drop onto the one below. Mask nodes the layer created go with it.

  • Operation material.layers.remove
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
layerstrrequiredThe layer id (its Layer Blend node, from material.layers.list).

Edit Material Layer

tb.ops.material.layers.set(
    *,
    material: MaterialRef,
    layer: str,
    mask: Any = ...,
    visible: bool = ...,
    opacity: float = ...,
    color_blend: Literal["MIX", "MULTIPLY", "OVERLAY", "SCREEN", "SOFT_LIGHT", "ADD"] = ...,
    normal_blend: Literal["REORIENT", "MIX"] = ...,
    source: MaterialRef = ...,
    mask_low: float = ...,
    mask_high: float = ...,
    mask_hard: bool = ...,
    mask_threshold: float = ...,
    mask_invert: bool = ...,
) -> Result

Change a layer: visibility, opacity, color / normal blend, its material, its mask, and the mask's levels (low / high), hard threshold and invert. Unset values stay.

  • Operation material.layers.set
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
layerstrrequiredThe layer id (its Layer Blend node, from material.layers.list).
maskAny—{kind: none | noise {scale, detail} | edgeWear | cavity | ao {radius, strength, contrast} | image {texture} | image {data, name} | output {node, output}}. An image mask may bring its picture as encoded PNG / JPEG / WebP data (base64 or a data: URL) instead of a texture id: it joins the scene's textures in the same undo step.
visiblebool—Visible.
opacityfloat—Opacity (0…1).
color_blendLiteral["MIX", "MULTIPLY", "OVERLAY", "SCREEN", "SOFT_LIGHT", "ADD"]—Color Blend (MIX / MULTIPLY / OVERLAY / SCREEN / SOFT_LIGHT / ADD).
normal_blendLiteral["REORIENT", "MIX"]—Normal Blend (REORIENT / MIX).
sourceMaterialRef—Source.
mask_lowfloat—Mask Low (0…1).
mask_highfloat—Mask High (0…1).
mask_hardbool—Mask Hard.
mask_thresholdfloat—Mask Threshold (0…1).
mask_invertbool—Mask Invert.

Set Base Material

tb.ops.material.layers.set_base(
    *,
    material: MaterialRef,
    source: MaterialRef = ...,
) -> Result

The bottom of the stack: another scene material, or (no 'source') the nodes already wired into this material's output.

  • Operation material.layers.set_base
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
sourceMaterialRef—Source.

Merge Duplicate Materials

tb.ops.material.merge_duplicates(*, remove_data: bool = False) -> Result

Reassign numbered copies (BRICK.001, BRICK.002) to their original material (BRICK) when their shader graphs match; optionally delete the merged copies.

  • Operation material.merge_duplicates
  • In Model
ArgumentTypeDefaultDescription
remove_databoolFalseAlso delete the merged duplicate materials.

Expose as Material Parameter

tb.ops.material.parameters.expose(
    *,
    material: MaterialRef,
    node: str,
    socket: str,
    label: str = ...,
) -> Result

Make a node input one of the material's parameters: it then shows in the material's Parameters, keeps presets and can be set per use on the Material nodes that use this material. Returns the parameter (the existing one when the input is already exposed).

  • Operation material.parameters.expose
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
nodestrrequiredNode.
socketstrrequiredThe input's key, e.g. 'Roughness'.
labelstr—The parameter's name (default: the node's and the input's).

Read Material Parameters

tb.ops.material.parameters.get(*, material: MaterialRef) -> Result

The material's parameters (id, name, node, input, type, current value) and its presets. Read-only.

  • Operation material.parameters.get
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.

Group Material Parameter

tb.ops.material.parameters.group(
    *,
    material: MaterialRef,
    parameter: str,
    heading: str = ...,
) -> Result

Put a parameter under a group heading (MaterialCraft's parameter groups); an empty or omitted heading takes it out of its group.

  • Operation material.parameters.group
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
parameterstrrequiredParameter.
headingstr—The group heading's name (at most 64 characters). ('group' names a node group to edit inside, as in the other graph operations.).

Material Parameter Preset

tb.ops.material.parameters.preset(
    *,
    material: MaterialRef,
    action: Literal["save", "apply", "rename", "delete"],
    name: str,
    to: str = ...,
) -> Result

save: keep the current parameter values under 'name' (replacing a preset of that name); apply: set the parameters to the preset; rename: give preset 'name' the name 'to'; delete: remove it.

  • Operation material.parameters.preset
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
actionLiteral["save", "apply", "rename", "delete"]requiredAction (save / apply / rename / delete).
namestrrequiredName.
tostr—rename: the preset's new name.

Remove Material Parameter

tb.ops.material.parameters.remove(*, material: MaterialRef, parameter: str) -> Result

Stop exposing an input (it keeps its value; presets forget it).

  • Operation material.parameters.remove
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
parameterstrrequiredParameter.

Rename Material Parameter

tb.ops.material.parameters.rename(
    *,
    material: MaterialRef,
    parameter: str,
    label: str,
) -> Result

Rename a parameter (1 to 64 characters).

  • Operation material.parameters.rename
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
parameterstrrequiredParameter.
labelstrrequiredLabel.

Set Material Parameters

tb.ops.material.parameters.set(*, material: MaterialRef, values: Any) -> Result

Set parameter values: {values: {id: value}} (numbers, or [r, g, b(, a)] / [x, y, z]). Rapid edits are one undo step.

  • Operation material.parameters.set
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
valuesAnyrequiredValues.

Set Material Node Parameters

tb.ops.material.parameters.set_use(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str,
    side: Literal["bottom", "top"] = ...,
    values: Any = ...,
    reset: bool = False,
) -> Result

Give one Material node, or one side of a Layer Blend, its own values of the referenced material's parameters: {node, side, values: {id: value or null}}; null (or reset) goes back to the material's value. The referenced material itself is unchanged.

  • Operation material.parameters.set_use
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Edit inside this node group (its id) instead of the top-level graph.
nodestrrequiredA Material node (MaterialReference) or a Layer Blend (MaterialLayerMix).
sideLiteral["bottom", "top"]—A Layer Blend's material slot (required for a Layer Blend). (bottom / top).
valuesAny—Parameter id → value; null removes that override.
resetboolFalseRemove every override first.

Render Preview Image

tb.ops.material.preview_image(
    *,
    material: MaterialRef,
    group: str = ...,
    node: str = ...,
    output: str = ...,
    name: str = ...,
    size: int = ...,
    format: Literal["png", "png16", "jpeg", "webp", "exr"] = ...,
    role: Literal["color", "data"] = "color",
    keep_alpha: bool = True,
) -> Result

Render a named node output or a whole material on its own preview chart. Returns a scoped request; use .status and bounded .read calls, then .cancel to release it. No scene or history change. The installed host renders shader surfaces under current viewport lighting; standalone numeric API calls use the same CPU oracle and encoding.

  • Operation material.preview_image
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
groupstr—Group.
nodestr—Node.
outputstr—Output.
namestr—Name.
sizeint—Width and height in pixels (32 to 2048, a power of two); omitted uses an image node's own output size (material.graph.set_output), else the material's graph size (material.graph.set_settings). (32…2048).
formatLiteral["png", "png16", "jpeg", "webp", "exr"]—Omitted: an image node's output format sets the depth (8-bit PNG, 16-bit PNG, or for 16-bit and 32-bit float EXR as data and 16-bit PNG as colour); anything else PNG. (png / png16 / jpeg / webp / exr).
roleLiteral["color", "data"]"color"Role (color / data).
keep_alphaboolTrueKeep Alpha.

Release Preview Image

tb.ops.material.preview_image.cancel(*, request: str) -> Result
  • Operation material.preview_image.cancel
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
requeststrrequiredRequest.

Read Preview Image Bytes

tb.ops.material.preview_image.read(
    *,
    request: str,
    offset: int = 0,
    length: int = 49152,
) -> Result

Read at most 48 KiB of the current encoded file, base64 with offset/length/total/eof. Release the same request with .cancel after delivery.

  • Operation material.preview_image.read
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
requeststrrequiredRequest.
offsetint0Offset (0…75497472).
lengthint49152Length (1…49152).

Get Preview Image Status

tb.ops.material.preview_image.status(*, request: str) -> Result
  • Operation material.preview_image.status
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
requeststrrequiredRequest.

Set Preview Row

tb.ops.material.preview_row.set(
    *,
    height: float = ...,
    folded: bool = ...,
    editor: str = ...,
) -> Result

Size or fold the row holding the 3D and 2D views above the Material Editor's graph. Each editor keeps its own row.

  • Operation material.preview_row.set
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
heightfloat—Share of the pane height the row takes (0.15 to 0.7).
foldedbool—Fold the row away (the graph takes the pane), or unfold it.
editorstr—The editor whose row changes (model, texturePaint, …); omitted: the active editor.

Remove Unused Materials

tb.ops.material.remove_unused() -> Result

Delete every material no mesh, curve or solid slot and no placement override uses.

  • Operation material.remove_unused
  • In Model

Set Material Properties

tb.ops.material.set(
    *,
    material: MaterialRef,
    name: str = ...,
    base_color: Color4 = ...,
    metallic: float = ...,
    roughness: float = ...,
    emissive: Color3 = ...,
    emissive_intensity: float = ...,
    alpha_mode: Literal["opaque", "mask", "blend"] = ...,
    alpha_cutoff: float = ...,
    double_sided: bool = ...,
) -> Result

Set one or more material fields. Fields not given keep their values.

  • Operation material.set
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
namestr—Name.
base_colorColor4—Linear RGBA base color. (0…1).
metallicfloat—Metallic (factor; 0…1).
roughnessfloat—Roughness (factor; 0…1).
emissiveColor3—Linear RGB emission color. (0…1).
emissive_intensityfloat—Emission strength multiplier. (0…1000).
alpha_modeLiteral["opaque", "mask", "blend"]—Alpha Mode (opaque / mask / blend).
alpha_cutofffloat—Mask threshold. (0…1).
double_sidedbool—Double Sided.

Set Up PBR Textures

tb.ops.material.setup_textures(
    *,
    material: MaterialRef,
    node: str = ...,
    textures: Any,
    uv_channel: int = 0,
    alpha_mode: Literal["auto", "preserve", "mask", "blend"] = "auto",
) -> Result

Connect scene textures to a PBR node's free inputs (Base Color, Metallic, Roughness, Normal, AO, Alpha, Emission, …) through one shared UV Map → Mapping chain, as one undo step. Existing input links are kept; packed ORM / metallic-roughness maps feed their channels; gloss becomes 1 - gloss roughness; normal, height and bump maps chain into Normal. Returns a per-file report.

  • Operation material.setup_textures
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRefrequiredMaterial.
nodestr—The Material Output / Principled PBR node (default: the graph's only one).
texturesAnyrequired[{texture, channel, normalConvention?: 'opengl'|'directx', heightDistance?}]; channel: ignore, baseColor, metallic, specular, roughness, gloss, normal, bump, displacement, transmission, emissive, alpha, occlusion, metallicRoughness, orm.
uv_channelint0Uv Channel (0…7).
alpha_modeLiteral["auto", "preserve", "mask", "blend"]"auto"Alpha Mode (auto / preserve / mask / blend).

Add Material Slot

tb.ops.material.slot_add(
    *,
    node: ObjectRef,
    mesh: MeshRef,
    material: MaterialRef | None,
) -> Result

Append a shared DATA slot. Null creates an Empty slot; existing OBJECT links and face groups are preserved.

  • Operation material.slot_add
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe captured mesh placement.
meshMeshRefrequiredThe authored mesh currently referenced by that placement.
materialMaterialRef | NonerequiredMaterial.

Remove Material Slot

tb.ops.material.slot_remove(*, node: ObjectRef, mesh: MeshRef, slot: int) -> Result

Remove a shared slot. Faces in it fall to the preceding slot or zero; higher face and linked OBJECT indices shift down. Unassigned faces stay unassigned.

  • Operation material.slot_remove
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe captured mesh placement.
meshMeshRefrequiredThe authored mesh currently referenced by that placement.
slotintrequiredSlot (0…32767).

Reorder Material Slots

tb.ops.material.slot_reorder(
    *,
    node: ObjectRef,
    mesh: MeshRef,
    order: Sequence[int],
) -> Result

Reorder shared DATA slots with a complete new-to-old permutation, preserving each face's effective material and linked OBJECT source.

  • Operation material.slot_reorder
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe captured mesh placement.
meshMeshRefrequiredThe authored mesh currently referenced by that placement.
orderSequence[int]requiredOld slot index for each new position; every current slot must appear exactly once.

Material Slots

tb.ops.material.slots(*, node: ObjectRef = ...) -> Result

List a mesh object's material slots: each slot's shared DATA material, the material this placement shows and whether an OBJECT link overrides it. Read-only.

  • Operation material.slots
  • In Model, Texture Paint
ArgumentTypeDefaultDescription
nodeObjectRef—Mesh placement (default: the active selected mesh object).

Material Templates

tb.ops.material.templates() -> Result

The template library (id, name, what it starts as, typical colour, group): the New Material templates, then Texture Paint's smart materials as graphs ('smart.<id>'). Pass an id as material.graph.create's 'template'. Read-only.

  • Operation material.templates
  • In Model, Texture Paint

Get Material Views

tb.ops.material.view.get() -> Result

Read the Material Editor's preview row (of the active editor), its 3D view settings and the 2D view's output and display options.

  • Operation material.view.get
  • In Previewer, Model, Control Rig, Animation, Texture Paint

Set 2D View

tb.ops.material.view_2d.set(
    *,
    material: MaterialRef = ...,
    group: str = ...,
    node: str = ...,
    output: str = ...,
    channel: Literal["rgba", "r", "g", "b", "a"] = ...,
    tiled: bool = ...,
    histogram: bool = ...,
    zoom: Literal["fit", "actual"] = ...,
    frame: bool = ...,
) -> Result

Choose the node output the Material Editor's 2D view shows and how: its channels, a 3 × 3 tiling check, the histogram and the zoom. Omitted values are kept; node "" clears the output.

  • Operation material.view_2d.set
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
materialMaterialRef—The material of the shown output.
groupstr—The node group the node is in (omitted: the material's graph).
nodestr—The node whose output is shown; "" shows none.
outputstr—The output socket shown.
channelLiteral["rgba", "r", "g", "b", "a"]—All channels, or one channel as gray. (rgba / r / g / b / a).
tiledbool—Repeat the image 3 × 3 to check that it tiles.
histogrambool—Show the 64-bin histogram of the shown channels.
zoomLiteral["fit", "actual"]—Fit the image to the view, or show it at one image pixel per screen pixel. (fit / actual).
framebool—Centre the image again (after panning).

Load Preview Shape

tb.ops.material.view_3d.load_shape(*, name: str, data: str) -> Result

Show the material on a mesh from a file (OBJ, glTF / GLB, FBX, STL, PLY …): the file's largest mesh becomes the 3D view's Custom Shape. View state only: nothing is added to the scene.

  • Operation material.view_3d.load_shape
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
namestrrequiredThe file name (its extension picks the format).
datastrrequiredThe file's bytes as base64 (or a base64 data URL).

Set 3D View

tb.ops.material.view_3d.set(
    *,
    shape: Literal["sphere", "roundedCube", "cube", "plane", "cylinder", "torus", "materialBall", "sceneMesh", "custom"] = ...,
    environment: Literal["city", "courtyard", "forest", "interior", "night", "studio", "sunrise", "sunset"] = ...,
    rotation: float = ...,
    exposure: float = ...,
    tiling: float = ...,
    height: Literal["bump", "parallax", "displacement"] = ...,
    height_scale: float = ...,
    tone_mapping: bool = ...,
    yaw: float = ...,
    pitch: float = ...,
    frame: bool = ...,
) -> Result

Choose what the Material Editor's 3D view shows the material on and how it is lit. Omitted values are kept.

  • Operation material.view_3d.set
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
shapeLiteral["sphere", "roundedCube", "cube", "plane", "cylinder", "torus", "materialBall", "sceneMesh", "custom"]—The shape the material is shown on ('sceneMesh': the selected mesh of the scene). (sphere / roundedCube / cube / plane / cylinder / torus / materialBall / sceneMesh / custom).
environmentLiteral["city", "courtyard", "forest", "interior", "night", "studio", "sunrise", "sunset"]—The lighting environment (an HDRI). (city / courtyard / forest / interior / night / studio / sunrise / sunset).
rotationfloat—Environment rotation in degrees (-180 to 180).
exposurefloat—Exposure in stops (-4 to 4).
tilingfloat—How many times the material's UVs repeat across the shape (1 to 16).
heightLiteral["bump", "parallax", "displacement"]—The Displacement height as bump shading only, also as a parallax offset of the surface, or as the shape's own displacement (a finely divided shape moved along its normals on the GPU). (bump / parallax / displacement).
height_scalefloat—Parallax depth, or Displace distance in shape units per height unit (0 to 0.25).
tone_mappingbool—Neutral tone mapping on (the viewport's look) or off (linear, clipped).
yawfloat—Camera angle around the shape in degrees (-180 to 180; 0 looks at its front). Re-frames the shape.
pitchfloat—Camera angle above the shape in degrees (-89 to 89). Re-frames the shape.
framebool—Reset the camera to frame the shape.

Get Material Workspace Layout

tb.ops.material.workspace.get_layout() -> Result

Material mode's workspace sizes: the node editor's share of the height and the 2D view's share of the top row.

  • Operation material.workspace.get_layout
  • In Previewer, Model, Control Rig, Animation, Texture Paint

Set Material Workspace Layout

tb.ops.material.workspace.set_layout(*, graph: float = ..., view: float = ...) -> Result

Size Material mode's workspace: the node editor's share of the height and the 2D view's share of the top row (each 0.2 to 0.8). Saved with the project; not an undo step.

  • Operation material.workspace.set_layout
  • In Previewer, Model, Control Rig, Animation, Texture Paint
ArgumentTypeDefaultDescription
graphfloat—The node editor's share of the height (0.2 to 0.8). (0.20000000298023224…0.800000011920929).
viewfloat—The 2D view's share of the top row's width (0.2 to 0.8). (0.20000000298023224…0.800000011920929).