Nodes/Avatar Graph/Object Vertex Group Lock
ComfyUI Node

Object Vertex Group Lock

The Node That Keeps Your Clean Weights From Getting Wrecked

By avatechai·Created 3 years ago·Updated 2 years ago· 265
Object Vertex Group Lock
  • BPY_OBJ
  • BPY_OBJ
action
mask

Vertex groups in Blender can be locked, and locked groups are skipped by the bulk operations - normalize-all, clean, remove-unused, the works. Object Vertex Group Lock is how you say "hands off these." In an Avatar Graph rig, that usually means the groups driving the eyes and mouth, because those are the weights you already spent the time tuning.

It's a subtle node, but it's the difference between a weight pass that respects your work and one that bulldozes it.

How it works

Like the rest of the Object_VertexGroup* nodes here, it's an auto-generated wrapper around a real Blender operator - bpy.ops.object.vertex_group_lock. You feed it a BPY_OBJ, it drops to edit mode, runs the operator, and passes the same object back out. Two enum inputs do all the work:

  • action - TOGGLE, LOCK, UNLOCK, or INVERT the lock state.
  • mask - which groups the action applies to: ALL, SELECTED, UNSELECTED, or INVERT_UNSELECTED.

So locking the whole mesh takes one node (LOCK + ALL). Locking only the groups whose vertices are currently selected takes LOCK + SELECTED. The INVERT action flips the lock flag on every affected group, which is handy when you're iterating on which groups should be protected.

Output is the same BPY_OBJ it came in with, so you can drop this node in the middle of a chain without rerouting anything.

Installing it

It ships in the Avatar Graph pack from Avatech AI:

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

Then restart ComfyUI - or install "Avatar Graph" straight from ComfyUI Manager. Worth knowing before you hit install: bpy==3.6.0 needs Python 3.10 specifically (the README recommends a dedicated conda env), and bpy is a full headless Blender, so this is a heavy download.

Common issues

If locking "doesn't stick" or your locked groups still get edited, you're probably hitting the ordering problem: the lock node has to run before the bulk op in the graph, and both are editing the same object. Chain them deliberately - lock first, then normalize.

Also remember this only acts on the BPY_OBJ you wire in. No object, no-op. And if you run the graph twice without a reset, the second run can see stale lock state - the pack resets the Blender scene between executions, so re-running from scratch is usually the clean fix.

Categoryblender

Inputs (3)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
actionoptCOMBO4 options: TOGGLE, LOCK, UNLOCK, INVERT
maskoptCOMBO4 options: ALL, SELECTED, UNSELECTED, INVERT_UNSELECTED

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ