Nodes/Avatar Graph/Object Hook Assign
ComfyUI Node

Object Hook Assign

The hook 'Assign' button, as a ComfyUI node

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Hook Assign
  • BPY_OBJ
  • modifier
  • BPY_OBJ

In Blender's modifier panel, every Hook modifier has an Assign button. It takes the vertices you currently have selected and commits them to that hook's influence set. Object_HookAssign is that button, exposed as a node in the Avatar Graph pack - and if you're rigging an avatar, you'll probably use it more than any other hook node.

Here's the workflow it fits into. You create a hook (via Object_HookAddNewob or Object_HookAddSelob), then come back later and say "actually, these other verts should also follow that hook." Or you set up a hook that covers the wrong region and need to re-bind. That's Assign's job: it repopulates which vertices the named hook drives, based on whatever is selected right now.

How it works

It calls bpy.ops.object.hook_assign(), with one real input beyond the object:

  • modifier - the name of the Hook modifier you're assigning to. This is the gotcha: the field is typed as B_ENUM, which in this pack means a plain string you supply via the ENUM (Blender) helper node. You have to type the modifier's exact name (e.g. Hook), matching what the hook-creation nodes generated. Misspelled or wrong name → the operator silently no-ops or errors.

Blender's hook operators take the modifier name rather than an index, so this string is genuinely how you pick which hook. The pack's auto-generated schemas inherit that quirk.

BPY_OBJ sets the active object in the embedded scene and passes back out unchanged - the standard pass-through for this pack. And like the other hook nodes, this is an edit-mode operator: the mesh needs to be in edit mode with the target vertices selected. Drive selection upstream with the pack's Mesh_* nodes.

When you'd use it in an avatar graph

Any time you refine a rig. The classic path: hook the whole ponytail, realize the bottom three rows of verts shouldn't follow the head bone, deselect them, re-run Assign so only the top portion is bound. It's also how you'd graft a second accessory onto an existing hook without creating a new modifier. If you've built a character with a few hooks and want them to behave, Assign is your corrective tool.

Inputs and outputs

  • BPY_OBJ - the mesh whose hook you're modifying.
  • modifier - the hook modifier name (feed via the pack's ENUM node, or a string).
  • BPY_OBJ output - the same object, so you can keep chaining.

Installing it

Part of Avatar Graph (avatechai/avatar-graph-comfyui). ComfyUI Manager: search "Avatar Graph". Manual:

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

The pack pins bpy==3.6.0, which needs Python 3.10.x; on 3.11+ the wheel won't build and the whole pack vanishes from the node list. First launch also downloads the SAM ViT-H checkpoint (~2.5 GB) and MediaPipe models, so the first run is slow.

Common issues

"If I connect a string to modifier, nothing happens" is the #1 report - and it's because the field wants the ENUM helper, not a plain string widget, and the value has to be the exact modifier name. Also remember edit mode + selection: run Assign in object mode and it errors exactly like Blender would. The README flags this pack as a work-in-progress, so if a hook node misbehaves, check the repo for a fix before assuming it's you.

Categoryblender

Inputs (2)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
modifieroptB_ENUM

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ