Nodes/Avatar Graph/Object Vertex Group Limit Total
ComfyUI Node

Object Vertex Group Limit Total

Capping Bone Influences Before Export

By avatechai·Created 3 years ago·Updated 2 years ago· 265
Object Vertex Group Limit Total
  • BPY_OBJ
  • group_select_mode
  • BPY_OBJ
limit4

Ever export a rigged avatar and watch a game engine or a glTF viewer choke on a vertex that lists 14 bone influences? Real-time runtimes - including the one behind Avatar Graph - almost always cap it at four. Object Vertex Group Limit Total is the "clean up before you ship" node: it trims every vertex's weight list down to its top N groups, then renormalizes so the survivors still sum to 1.

This is the quiet final step in the pack's pipeline. You build your mesh, slap on the vertex groups that drive the shape keys, tweak the weights, and somewhere before that avatar hits the viewer you want a guaranteed cap. This node is that guarantee.

How it works

Like most of the Object_VertexGroup* nodes in this pack, this one isn't hand-written - it's an auto-generated wrapper around a real Blender operator, bpy.ops.object.vertex_group_limit_total. It takes your BPY_OBJ in, drops the mesh into edit mode, runs the operator, and hands the same object back out. It's a passthrough with a side effect, which means you can chain it anywhere in the graph without worrying about the data type changing.

Two inputs matter:

  • limit - the cap (default 4, range 1–32). Leave it at 4 unless you know your target supports more.
  • group_select_mode - this one looks like an enum in the schema, but in the UI it's a plain text field. You type the value the Blender operator expects: ALL, ACTIVE, or SELECTED. Leave it as ALL and every group gets capped.

The only output is the same BPY_OBJ, ready to wire into whatever comes next (usually the final export or the Shape Flow setup).

Installing it

Avatar Graph ships all its nodes together, so this one rides along with the 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

Restart ComfyUI, or skip the manual steps and search "Avatar Graph" in ComfyUI Manager. Two gotchas are worth knowing before you start: bpy==3.6.0 (pinned in requirements.txt) only builds against Python 3.10, so a venv on 3.11+ will fail at import - the README suggests a dedicated conda env. And bpy is effectively a headless Blender, so the install is a big download, not a quick pip hiccup.

Common issues

The classic one: nothing happens. That's usually because there's no real mesh to operate on - these nodes only do something when a BPY_OBJ is wired in from an upstream pack node like Create Mesh Layer or Join Meshes. You can't test this node on a loose image.

Second: a typo'd group_select_mode. It's a text field with no autocomplete, and Blender is unforgiving about the exact spelling. If the op errors, that's the first place to look. And if your mesh genuinely has only a few groups per vertex, the op is a silent no-op - which is exactly what you want.

Categoryblender

Inputs (3)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
group_select_modeoptB_ENUM
limitoptINT41–32

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ