Nodes/Avatar Graph/Object Vertex Group Invert
ComfyUI Node

Object Vertex Group Invert

Everything except the mouth

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Vertex Group Invert
  • BPY_OBJ
  • group_select_mode
  • BPY_OBJ
auto_assigntrue
auto_removetrue

Inverting a vertex group is one of those operations that feels like cheating once you discover it. A vertex with weight 0.8 in a group becomes 0.2; a vertex with 1.0 becomes 0.0, and one with 0.0 becomes 1.0. Everything flips. Object Vertex Group Invert wraps the Blender operator bpy.ops.object.vertex_group_invert(), and in an avatar pipeline it's how you go from "this group is the mouth region" to "this group is everything except the mouth region" without re-painting a single vertex.

That's more useful than it sounds. Shape keys, deformation targets, and export ranges often want the complement of a region you already have. You spent effort making a clean "mouth" group; rather than building an "anti-mouth" group from scratch, invert the first one. In the Avatar Graph flow this is a legitimate, everyday tool - one of the few auto-generated vertex-group nodes that earns its place in a graph.

The inputs: BPY_OBJ (the mesh), then two booleans that control edge cases. auto_assign and auto_remove (both default true) decide how the operator handles vertices whose weight becomes zero: with them on, zero-weight vertices are automatically removed from the group, and vertices that were outside it get assigned at full weight - which is exactly the "flip membership" behavior you want. Turn them off and you get a more literal weight-mirroring that can leave dead entries lying around. The group_select_mode input is a B_ENUM - the pack's custom string-through type, resolved against Blender's enum at runtime; wire the pack's "ENUM (Blender)" node if you need to target something other than the active group, or leave it unwired to hit the default.

Output is your BPY_OBJ, group flipped. One practical tip: run Object Vertex Group Copy first if you want to keep the original group around - inversion is destructive to the group's weights, and in this pack the scene rebuilds every run so there's no undo sitting in memory.

Install is pack-wide: ComfyUI Manager → "Avatar Graph", or git clone https://github.com/avatechai/avatar-graph-comfyui into ComfyUI/custom_nodes and pip install -r requirements.txt on Python 3.10 (bpy==3.6.0). First launch downloads the ~2.4 GB SAM model.

Troubleshooting: if the inverted group looks wrong, check auto_assign/auto_remove - with them off you'll see weird membership edges. And if the whole group turns out empty after inversion, the original was probably all-ones (nothing outside it to flip to 1.0); run Object Vertex Group Levels with a small offset first to give it headroom.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
group_select_modeoptB_ENUM
auto_assignoptBOOLEANtrue
auto_removeoptBOOLEANtrue

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ