Nodes/Avatar Graph/Object Hide Collection
ComfyUI Node

Object Hide Collection

Hide it from the viewport in one node

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Hide Collection
  • BPY_OBJ
  • BPY_OBJ
collection_index-1
togglefalse
extendfalse

Object_HideCollection hides (or unhides) a whole collection in the viewport. Collections in Blender are folders for objects - your avatar's eye layers, its supporting meshes, the grease pencil overlays - and hiding one hides everything inside it in one move. The node wraps bpy.ops.object.hide_collection, and it's how you tidy up the shared scene so you're only looking at (and only exporting) what matters.

When you'd reach for it

The avatar pipeline accumulates a lot of intermediate objects: mesh layers, test geometry, sketch layers you drew while blocking things in. They clutter the scene, slow the viewport, and sometimes sneak into renders. Object_HideCollection is the sledgehammer that takes a whole folder of them out of the picture at once - and, because it's a toggle underneath, the same node can bring them back. If your graph produces a collection you want gone from the working view but not deleted, this is the tool.

How it works

Auto-generated wrapper over the hide_collection operator. It makes your BPY_OBJ active and runs the operator with your parameters. Inputs:

  • BPY_OBJ (optional) - the object whose collection gets hidden. The object you pass determines which collection - the node hides the collection that object belongs to, not the object itself.
  • collection_index (INT, default -1) - an alternative way to target a collection by index in the scene. -1 typically means "the active/last-selected collection," and that's the default for a reason: most of the time you let the object pick.
  • toggle (BOOLEAN, default false) - flip it true and the node switches the collection between hidden and shown instead of always hiding.
  • extend (BOOLEAN, default false) - with toggle off, extend adds the collection to the set of currently hidden ones rather than replacing the hide state wholesale.

Output: BPY_OBJ, the same object, passed through.

The thing to keep straight

Hiding a collection is a viewport thing, not a deletion thing - the objects are still in the scene, still evaluated, still exported unless you also handle render hiding. If you want to keep geometry out of the render rather than just the view, that's the job of a different node in this family (Object_HideRenderClearAll clears render-hide flags across the scene). And because the scene resets to factory settings every run, your hide state is rebuilt fresh each execution - you can't rely on a hide from a previous run sticking.

Install and gotchas

Standard pack install:

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

or ComfyUI Manager → "Avatar Graph". House rules: Python 3.10 for bpy==3.6.0, ~2.5GB SAM checkpoint + mediapipe models on first load, scene resets every run, live preview needs --enable-cors-header.

One honest caveat: in a headless, graph-driven pipeline you rarely look at the viewport, so hiding collections is mostly useful when you're debugging or when hiding affects export/visibility flags downstream. For cleaning up a busy avatar scene before handing it to the runtime, though, it's exactly the right lever.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
collection_indexoptINT-1-1–2147483647
toggleoptBOOLEANfalse
extendoptBOOLEANfalse

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ