Nodes/Avatar Graph/Object Material Slot Copy
ComfyUI Node

Object Material Slot Copy

Stamp one object's material setup onto everything else

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

Materials in Blender live in slots on an object, and when you've just spent ten minutes getting the skin tone right on one part of an avatar, you want to copy it to the rest without rebuilding anything. Object_MaterialSlotCopy wraps bpy.ops.object.material_slot_copy() - the operator that takes the active material slot of the active object and copies it onto every selected object. One wire, one result: a uniform material across your character parts.

In the Avatar Graph pipeline this shows up right after you've assembled mesh layers from segmented image parts. Each layer often needs the same texture assigned, and doing it one node per part is tedious. Copy the material from a finished layer to the rest and you've saved yourself a dozen identical steps. It's also the natural partner to the pack's Match Texture Aspect Ratio step - once the mesh is the right shape and the texture is on one object, propagate it.

The mechanism. The node sets your BPY_OBJ as the active object and calls the operator, which copies the active slot from the active object to whatever is selected in the hidden Blender scene. Like all the "to selected" operators in this pack, it depends on selection state - wiring in an object makes it active, not selected, so pair this with a selection node if you expect it to hit specific objects.

Inputs.

  • BPY_OBJ - the object whose active material slot becomes the source.

That's the entire input surface. No material picker, no target list. It's a blunt instrument, and it's supposed to be.

Output. BPY_OBJ, passed through so the chain continues.

Installing it. Part of Avatar Graph. Install via ComfyUI Manager ("Avatar Graph") or:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui
python -m pip install -r requirements.txt

Restart with --enable-cors-header for the live preview. The pack pins bpy==3.6.0, so your Python must be 3.10.x.

Troubleshooting. If nothing gets copied, nine times out of ten it's the selection issue - there are no selected targets. If the wrong material shows up, check which slot is active on the source object; this operator copies the active slot only, not the whole list. And remember the pack resets the Blender scene at the start of each run, so material slots need to exist on the source object in this same graph before you run the copy.

Categoryblender

Inputs (1)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ