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.
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.
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.
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.
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.
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).
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.
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.
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).
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).
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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').
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).
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).
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.
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.
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.
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.
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.
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.
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).
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.
Link Active to Selected
tb.ops.material.graph.link_selected(
*,
material: MaterialRef,
group: str = ...,
active: str,
nodes: Any,
match: str = "type",
replace: bool = False,
) -> Result
Link the active output to selected nodes by type, node name or output name, optionally replacing existing input links; cycles are skipped and reported.
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.
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.
Mute Link
tb.ops.material.graph.mute_link(
*,
material: MaterialRef,
group: str = ...,
link: str,
muted: bool = True,
) -> Result
Mute or unmute a link (muted links are kept but not compiled).
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.
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.
Remove Frame
tb.ops.material.graph.remove_frame(
*,
material: MaterialRef,
group: str = ...,
frame: str,
) -> Result
Remove a frame (its nodes stay).
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.
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.
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.
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.
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).
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).
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.
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).
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.
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.
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.
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.
Swap Connections
tb.ops.material.graph.swap_links(
*,
material: MaterialRef,
group: str = ...,
nodes: Any,
) -> Result
Swap outputs between two nodes, or one node's same-type linked input pair/lone input; preserve link identities and refuse loss, cycles or ambiguous inputs.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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).
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.
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.
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.
Remove Material Parameter
tb.ops.material.parameters.remove(*, material: MaterialRef, parameter: str) -> Result
Stop exposing an input (it keeps its value; presets forget it).
Rename Material Parameter
tb.ops.material.parameters.rename(
*,
material: MaterialRef,
parameter: str,
label: str,
) -> Result
Rename a parameter (1 to 64 characters).
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.
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.
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.
Release Preview Image
tb.ops.material.preview_image.cancel(*, request: str) -> Result
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.
Get Preview Image Status
tb.ops.material.preview_image.status(*, request: str) -> Result
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.
Remove Unused Materials
tb.ops.material.remove_unused() -> Result
Delete every material no mesh, curve or solid slot and no placement override uses.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.