Nodes/Avatar Graph/Object Material Slot Add
ComfyUI Node

Object Material Slot Add

Giving an object a fresh empty material slot in Avatar Graph

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Material Slot Add
  • BPY_OBJ
  • BPY_OBJ

About as simple as nodes in this pack get: Object Material Slot Add appends one new, empty material slot to an object. Nothing gets assigned to it automatically - no faces reference it, no material is attached - it's just a fresh slot waiting for something to fill it, the same as clicking the + in Blender's Material Properties tab.

How it works

This wraps Blender's object.material_slot_add operator. Every mesh object in Blender holds a list of material slots, and each face on the mesh points at one slot by index to decide what material it renders with. This node grows that list by one, appending to the end. It's a setup step, not something that changes how the mesh looks by itself - you'd follow it with whatever assigns an actual material into the new slot, or with face-assignment logic elsewhere in your graph.

The inputs and outputs that matter

There's exactly one input:

  • BPY_OBJ - the object to add a slot to.

Output is a single BPY_OBJ, the same object with one more material slot than it had going in.

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, pinned to Python 3.10.x - a dedicated conda environment on macOS/Linux, or Avatech's prebuilt Python-3.10 ComfyUI zip on Windows with the pack installed through Manager afterward.

Common issues & troubleshooting

If the node won't load, that's the pack's Python-version pin, not this operator - check ComfyUI's console at startup for an import error and confirm a clean Python 3.10.x environment with requirements.txt installed without complaints.

Because this node has no visible effect by itself - an empty slot doesn't change how anything renders - the easiest way to be confused about whether it "worked" is expecting to see a visual change and not getting one. That's expected: the new slot exists, it's just unassigned. If you're building toward a specific material setup, check that whatever comes after this in your graph is actually targeting the slot index it just created, rather than assuming it lands automatically. New slots always append at the end of the list, so if you're chaining several Object Material Slot Add calls in a row before assigning materials, the index of each one is predictable - first added is the lowest new index, most recently added is the highest - which matters if a downstream node needs to reference a specific slot by number.

And if you're accumulating slots you don't end up using across a chain of joins and edits, Object Material Slot Remove Unused elsewhere in this pack is the cleanup pass for stripping out any that never end up referenced by a face. Running that periodically is worth doing on any object that's passed through several rounds of geometry edits, rather than only at the very end of a graph - empty slots don't cost much individually, but they add up on an object that's been through a long pipeline of joins and duplicates.

Categoryblender

Inputs (1)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ