Object Link To Collection
Organize your avatar's parts into Blender collections without leaving the graph
- BPY_OBJ
- BPY_OBJ
Object_LinkToCollection wraps Blender's bpy.ops.object.link_to_collection, which moves the selected objects into a different collection. If you've ever had a Blender scene where everything ends up in one giant pile - and in Avatar Graph's headless Blender, that's the default - this is how you file your avatar's parts into named collections from inside the graph.
For the avatar pipeline this is more useful than it sounds. You're building mesh layers for eyes, mouth, and body out of segmented images, and they all land in the same scene. A LinkToCollection node after each mesh-layer node gives you a tidy scene structure: Eyes, Mouth, Body. That organization carries straight into what you export and what you debug in the live preview, and it keeps the rigging logic readable when the graph starts to sprawl.
The inputs that matter
BPY_OBJ(optional) - the object to move. Unwired, it acts on the active object.collection_index- which existing collection to move into. Leave it at-1unless you know the index; the node is much more predictable when you create a new collection instead.is_new- tick this to create a brand-new collection.new_collection_name- the name used whenis_newis on. This is the one you'll actually type.
So the beginner-friendly recipe is: set is_new to true, type a name like "Mouth", wire in the object. Blender creates the collection, moves the object, and you get the same BPY_OBJ back to continue the chain.
Gotchas
Index-based collection targeting is the fiddly part. collection_index refers to the order collections exist in the scene, which shifts as you create and delete them - that's why the recommended path is is_new + a name, which is stable. Also note this moves the object to the new collection rather than just linking it to an additional one, which is Blender semantics and worth remembering if you expected the object to stay in both places.
Installation
Avatar Graph requires Python 3.10.x - the bpy==3.6.0 dependency only ships 3.10 wheels. Install via ComfyUI Manager (search "Avatar Graph") or:
cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui
pip install -r requirements.txt
Restart with --enable-cors-header for the live preview. First launch auto-downloads the SAM model (~2.4 GB) and mediapipe landmarkers, so don't panic at the boot time. If you run without --enable-cors-header, you can still export a .GLB from Avatar Main Output and check your collection layout in real Blender.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| collection_indexopt | INT | -1-1–2147483647 | — |
| is_newopt | BOOLEAN | false | — |
| new_collection_nameopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |