Object Material Slot Remove Unused
Tidying up after Avatar Graph joins your meshes
- BPY_OBJ
- BPY_OBJ
This is a pure housekeeping node, and it earns a spot in Avatar Graph's pipeline because of how the pack builds avatars: joining several mesh layers together (the README's own node table mentions a "Join Meshes" step for combining segmented character pieces) tends to leave the combined object holding material slots that no face on the mesh actually uses anymore - leftovers from whichever source object contributed them. Object Material Slot Remove Unused strips those out.
How it works
It's a direct wrap of Blender's own "remove unused slots" operator: it checks every material slot on the object against which faces are actually assigned to it, and deletes any slot with zero faces pointing to it. Nothing about the visible mesh changes - this is purely cleanup, not a rigging or geometry step. The reason it matters for a real pipeline rather than a one-off model: empty material slots aren't just clutter, they can confuse later steps that iterate over an object's materials (a bake targeting "all materials," an export that writes out a slot per material) by counting or processing slots nothing actually renders with.
The inputs and outputs that matter
There's exactly one input:
BPY_OBJ- the object to clean up. Run this after a join, a duplicate, or any step where material slots could have accumulated.
No configuration beyond that - it either has unused slots to remove or it doesn't. Output is a single BPY_OBJ, the same object with its slot list cleaned.
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
then pip install -r requirements.txt and restart. Needs Blender's bpy module - Python 3.10.x specifically, since that's the only version it ships for. On macOS/Linux, build a dedicated conda environment for this pack; on Windows, Avatech's prebuilt Python-3.10 ComfyUI zip plus installing the pack through Manager is the easier route.
Common issues & troubleshooting
A node that won't load points to the pack's Python version mismatch, not this specific operator - check ComfyUI's console at startup for an import error and confirm you're running a clean Python 3.10.x environment with requirements.txt installed without errors.
Since this node has no visible effect on the mesh's shape or texture, the main way to know it "worked" is checking the material slot count before and after in Blender itself if you're debugging - if you were expecting a specific material to disappear from the object and it's still assigned to at least one face somewhere on the mesh, this node correctly leaves it alone, since it only removes slots with zero faces using them.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |