Object Set Pass Index
The little integer that powers object-index masks and renders
- BPY_OBJ
- BPY_OBJ
Every Blender object carries an pass_index - an integer that does absolutely nothing by itself but becomes a superpower once you use it as an object index. In the compositor, the Cryptomatte-style "Object Index" render pass lets you key out a specific object by its index; in Avatar Graph, tagging a mesh layer with a pass index is how you tell "this part is the eye" from "this is the cheek" when you're building a mask pipeline or exporting per-layer renders. Object Set Pass Index is the setter for that number.
How it works
Same story as every ObjectSet_* node: it's auto-generated from Blender's bpy.types.Object property list and does a single setattr(object, "pass_index", value) inside the embedded bpy instance. The one thing that makes this node different from its siblings is the value input is an INT with default 0 - not a string or boolean. That's the whole node: integer in, integer written, same BPY_OBJ out for chaining.
The reason it matters in practice: if you're rendering the avatar and need a clean mask of just one mesh layer, set that layer's pass index to something like 1, enable the Object Index pass, and read the mask in the compositor. It's also how some pipelines separate foreground from background parts at export time. In the typical Avatar Graph rig, most layers can sit at their default 0; you only assign distinct indices to the few parts you actually need to isolate.
The inputs
- BPY_OBJ - the mesh layer or object reference from
Create Mesh Layer/ aMesh_primitive. - value - integer index, default
0.
Output: same BPY_OBJ. Nothing else to configure.
Install & gotchas
Part of the Avatar Graph pack:
cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui && python -m pip install -r requirements.txt
Or ComfyUI Manager → "Avatar Graph". Hard requirement: bpy==3.6.0 pins you to Python 3.10 - bpy ships no wheel for 3.11+, so the pack won't load on newer runtimes. Use a conda python=3.10 env per the README. First start auto-downloads a ~2.5 GB SAM model and mediapipe landmarker files, so expect a slow first run.
The trap here is expectation management: pass_index is a tag, not a layer toggle. Setting it doesn't hide or reorder anything - it just stamps the object for downstream readers. And because the bpy scene is reset at the start of every queue run, the setter must be wired after the object is created in the same graph, or you're stamping a ghost. The pack also wants --enable-cors-header for its live preview; without it, the graph runs and you can still Save File the export from Avatar Main Output, you just lose the realtime editor.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| valueopt | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |