Object Call To Mesh
Object Call To Mesh — ComfyUI Node from Avatar Graph
- BPY_OBJ
- BPY_OBJ
Avatar Graph, Avatech AI's pack for turning a single character portrait into a real-time interactive 2D avatar, builds its meshes out of image segments (via its SAM-based node), deforms them with shape keys, and eventually exports a .glb/.gltf out of the Avatar Main Output node - all running on Blender's Python engine (bpy) under the hood. Object Call To Mesh is part of the large ObjectCall_* family that exposes Blender's bpy.types.Object API roughly one node per method, none of it individually documented in the README's own showcase - but of that whole family, this one wraps the exact mechanism a mesh-export pipeline actually needs: baking a live, deformed object down into a standalone mesh.
It calls object.to_mesh(preserve_all_data_layers, depsgraph) - Blender's evaluate-and-bake operation. Any mesh-type object in Blender is really "base data plus a modifier/shape-key stack," and what you see deformed in the viewport is a live evaluation, not a separate stored mesh. to_mesh() is how you freeze that evaluation into an actual, independent Mesh datablock - capturing the object exactly as its modifiers and shape key mix currently have it posed, at that instant. preserve_all_data_layers (default false) controls whether extra data layers (like certain UV or vertex-group data beyond the basics) get carried into the result; leave it off unless you know you need those layers downstream.
One detail worth knowing before you use this: Blender's own docs are explicit that a mesh created with to_mesh() is temporary and needs to be explicitly freed - which is exactly what the sibling To Mesh Clear node is for. If your workflow calls this one, pair it with a To Mesh Clear later in the graph rather than letting the temporary data pile up.
Schema: BPY_OBJ (optional per the schema, but the node needs a real mesh object wired in from upstream to do anything) and preserve_all_data_layers, a plain BOOLEAN defaulting false - a normal, no-fuss ComfyUI toggle, unlike a lot of this node family's parameters. Note depsgraph appears in Blender's real signature but isn't exposed as a configurable field here. Output is BPY_OBJ, the same object handle passed through, now carrying the baked evaluation.
Installing it means installing the whole Avatar Graph pack. Via ComfyUI Manager: search "Avatar Graph" and install. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/avatechai/avatar-graph-comfyui, then cd avatar-graph-comfyui && pip install -r requirements.txt, restart. bpy needs Python 3.10.x exactly, so the README's dedicated conda create --name comfyui python=3.10 environment is worth setting up rather than reusing an existing Flux/SDXL one. Restart with --enable-cors-header (--force-fp16 too on macOS) for the live avatar preview.
Troubleshooting: bpy failing to import at startup because ComfyUI's Python isn't exactly 3.10.x is the wall you're most likely to actually hit, and it's a common, recurring issue across Blender-Python-based ComfyUI nodes generally. The node-specific gotcha is memory, not crashes: skip the paired To Mesh Clear and you're accumulating temporary mesh data every time this node runs in a loop-heavy or repeatedly-executed graph - not something that fails loudly, just something that slowly eats memory. --enable-cors-header only affects the live preview panel; the graph and its .glb/.gltf export off Avatar Main Output run fine without it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| preserve_all_data_layersopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |