Object Material Slot Assign
Painting the active material onto selected faces
- BPY_OBJ
- BPY_OBJ
Basic multi-material mesh editing, exposed as a node: Object Material Slot Assign wraps bpy.ops.object.material_slot_assign, which takes whatever material slot is currently active on the object and assigns it to the currently selected faces (or vertices/edges, for material-related selection purposes). It's the scripted equivalent of selecting some faces in Edit Mode, picking a material slot in the sidebar, and hitting "Assign."
How it works
A mesh with multiple materials needs some way to say "these faces use material 2, those faces use material 3." That mapping lives per-face, and this is the operator that writes it: it doesn't create materials or slots, it just stamps the active slot's index onto whatever's currently selected. Run it after a selection step and after the material slot you want is made active - this node itself doesn't pick which slot is active, it just commits to it.
The inputs and outputs that matter
There's a single input beyond the object itself, and it doesn't even appear as a separate parameter - this operator genuinely takes no arguments other than the object it runs on:
BPY_OBJ- the object whose selected faces get the active material slot assigned.
Output is the same BPY_OBJ, with the material assignment now written into the selected faces.
How to install it
ComfyUI Manager, search "Avatar Graph" and install - or manually: cd ComfyUI/custom_nodes && git clone https://github.com/avatechai/avatar-graph-comfyui, cd avatar-graph-comfyui && pip install -r requirements.txt, then restart. Avatar Graph is built on bpy, which only ships wheels for Python 3.10.x - a newer ComfyUI environment fails this install or leaves the blender-category nodes absent from your node list entirely. macOS/Linux: dedicated conda env at 3.10. Windows: Avatech's prebuilt Python-3.10 ComfyUI zip, pack installed through Manager afterward.
Common issues & troubleshooting
Nothing gets assigned, or the wrong material shows up. This operator has two silent dependencies that this node doesn't expose: it needs the object in Edit Mode with faces already selected, and it needs the correct material slot already made active before it runs. Neither "which faces" nor "which material" is a parameter here - get either wrong upstream in the graph and you'll either assign nothing or assign the wrong material without any error telling you so.
RuntimeError: ... poll() failed, context is incorrect. The classic failure mode for this whole category of raw Blender-operator nodes - this one specifically requires Edit Mode with a live face/vertex selection. If your BPY_OBJ hasn't been through a selection step, or is still in Object Mode when this runs, that's why it errors instead of doing anything.
Not in the pack's README. Correct - the README documents roughly seven higher-level, hand-built Avatech nodes (Create Mesh Layer, Plane Texture Unwrap, and so on); this is one of the lower-level blender-category operator wrappers auto-generated from Blender's operator registry via generate_blender_types.py. Blender's manual entry for "Assign Material" is the real reference if this page doesn't answer your specific question.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |