Nodes/Avatar Graph/UV Snap Cursor
ComfyUI Node

UV Snap Cursor

Park the 2D cursor where the next pivot lives

By avatechai·Created 3 years ago·Updated 2 years ago· 264
UV Snap Cursor
  • BPY_OBJ
  • BPY_OBJ
target

Every transform in the UV editor has a pivot, and the 2D cursor is the pivot you can put anywhere. UV Snap Cursor is the node that moves that cursor to a precise target - pixels, the current selection, or the mesh origin - so whatever rotates or scales next does it around a point you actually chose.

It wraps Blender's bpy.ops.uv.snap_cursor() in the Avatar Graph pack's auto-generated UV operator family. It sounds like a nothing node - and honestly it often is, which is fine. It's a positioning step, the kind of quiet move that makes a downstream operation behave. In a node graph you can't wiggle a mouse around to aim at something, so having the cursor land somewhere exact is the whole point.

How it works

The shared wrapper enters edit mode on your BPY_OBJ, calls the operator, and returns the same object. The operator takes a single target and relocates the 2D cursor to it:

  • target - one of:
    • PIXELS - snap to the nearest texel corner. The precision move: cursor lands exactly on the texture grid, so anything you pivot around it stays aligned to the texture.
    • SELECTED - snap to the center of whatever UVs are selected. Great "center of mass" pivot when you want to rotate a whole island around its own middle.
    • ORIGIN - snap to the mesh object's origin point projected into UV space.

Where it fits in an avatar workflow

The recurring pattern: select the mouth island, run UV Snap Cursor with SELECTED to park the pivot at its center, then run a rotate or scale node - and the mouth pivots around its own middle instead of around the world origin or some arbitrary corner. Alternatively, PIXELS before a snap-selected pass keeps everything on the texel grid, which is exactly what prevents texture bleeding when the avatar animates.

It's not a node you'll use every run. It's a node you'll need on the run where a rotation suddenly spins around the wrong point - because the pivot was wherever the last operation left it, and you had no way to aim.

Inputs and outputs

  • BPY_OBJ in/out - the mesh object.
  • target - the enum above. That's the whole control surface.

Installing it

Avatar Graph is one pack with one install story, and the part to respect is Python: bpy==3.6.0 is pinned, so your ComfyUI environment must be 3.10. 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

Restart ComfyUI. First launch pulls the SAM ViT-H model (~2.5 GB) and mediapipe face/pose landmarkers - that startup download is normal. For the live preview in editor.avatech.ai, start ComfyUI with --enable-cors-header.

Troubleshooting

Hard to break, easy to misread: the node doesn't visibly change the mesh, so if you're watching the wrong thing it looks dead. The cursor is a hidden piece of editor state, not geometry - the effect only shows up in whatever transform runs next. If a following operation ignores the pivot you set, check that the cursor actually moved (it may have been reset by a scene reset between executions) and that the transform node is configured to use the cursor as its pivot rather than median or bounding-box.

Categoryblender

Inputs (2)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
targetoptCOMBO3 options: PIXELS, SELECTED, ORIGIN

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ