Nodes/Avatar Graph/Object Hook Add Selob
ComfyUI Node

Object Hook Add Selob

Hooking vertices to a bone or empty that already exists

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Hook Add Selob
  • BPY_OBJ
  • BPY_OBJ
use_bonefalse

Object_HookAddSelob is the sibling of Object_HookAddNewob, and it's the one you reach for when the hook target already exists. Instead of spawning a fresh empty, it takes the object you already have - a bone, an armature, a parent empty - and hooks your selected vertices to it. In the Avatar Graph pack's rigging flow, this is how hair and accessories actually get attached to the character's skeleton.

Think of it as Blender's hook system, exposed as a node. Where Object_HookAddNewob is "make me a hook point from scratch," this one is "I have the bone, wire my verts to it."

How it works

Under the hood it calls bpy.ops.object.hook_add_selob(). Same setup as the new-object variant: you need the target mesh active with the vertices you care about selected in edit mode, plus the hook target selected too. The operator then creates a Hook modifier on the mesh pointing at that target object.

The one real knob is use_bone (default off):

  • false - hooks to the selected object (typically an empty or the mesh you want to drive it).
  • true - hooks to the active bone of a selected armature instead. That's the money option for avatar rigs: select a bone in pose/object mode, flip use_bone on, and your selected verts now follow that bone directly, no parenting dance required.

The BPY_OBJ input sets the active object in the embedded Blender scene and passes back through unchanged, like every Object_* node in the pack.

Selection is the whole game

This operator is a state machine dressed as a node: it does whatever selection says. The Avatar Graph pack is built around this, so you're expected to drive selection with the pack's Mesh_* selection nodes upstream - select the verts on the mesh, select the target object, then fire this. Get the ordering wrong and Blender's operator will error or hook the wrong thing, same as it would in the Blender UI.

One nuance worth knowing: hooking to a bone with use_bone only makes sense if the target is an armature with an active bone. Feeding in a plain empty with use_bone on is a footgun - you'll get an operator error rather than a silent hook.

Inputs and outputs

  • BPY_OBJ - the mesh being hooked (sets active, returned as output).
  • use_bone - hook to the active bone instead of the whole target object.
  • BPY_OBJ output - the same mesh, pass-through.

Installing it

This node lives in Avatar Graph (avatechai/avatar-graph-comfyui). Install via ComfyUI Manager by searching "Avatar Graph", or:

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

Watch the Python version - the pack pins bpy==3.6.0, which requires Python 3.10.x. Newer Pythons break the build and the entire pack stops showing up. First startup also downloads the SAM ViT-H model (~2.5 GB) and MediaPipe landmarker files, so give it room.

Common issues

Most "it didn't hook" reports trace back to selection state, not the node. If the operator errors out, check that the mesh is in edit mode with verts selected and that your hook target is also selected - that ordering matters and the pack's UI won't save you from it. And keep the README's caveat in mind: this pack is actively being reworked, so behavior can shift between versions.

Categoryblender

Inputs (2)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
use_boneoptBOOLEANfalse

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ