Nodes/Avatar Graph/UV Shortest Path Select
ComfyUI Node

UV Shortest Path Select

Draw a clean UV line between two points you already have

By avatechai·Created 3 years ago·Updated 2 years ago· 265
UV Shortest Path Select
  • BPY_OBJ
  • BPY_OBJ
use_face_stepfalse
use_topology_distancefalse
use_fillfalse
skip0
nth1
offset0

UV Shortest Path Select is the "already know the endpoints" half of Blender's shortest-path pair. If you have two UVs selected, this node draws the shortest connected line between them, selecting every UV along the way. It's how you isolate a seam, a lip line, or any clean cut across an avatar face - without a mouse, without indices, just from selection state.

It wraps bpy.ops.uv.shortest_path_select() in the Avatar Graph pack's auto-generated Blender operator family. Its sibling, UV ShortestPathPick, takes raw object/vertex indices; this one is the friendlier version because it reads the endpoints straight off your current selection. Feed it two selected UVs, get a path.

The inputs that matter

  • BPY_OBJ - the mesh, in and out.
  • use_face_step (bool) - let the path hop through faces instead of being stuck to edges. On an auto-generated avatar mesh this is often the difference between a sensible cut and a detour around a quad.
  • use_topology_distance (bool, default off) - measure distance by mesh topology rather than 3D space. For UV work you usually want this on, so the path follows the actual connected structure of the layout.
  • use_fill (bool) - also select the faces the path passes through, not just the edge UVs. On for "grab the whole lip band," off for "just the outline."
  • skip / nth / offset (ints) - thin the result: skip the first skip vertices, keep every nth, shift by offset. This is how you select a dashed line of UVs instead of a solid one - useful when you want a vertex group to deform gently rather than on a hard line.

Everything else is the standard wrapper plumbing: the node enters edit mode, fires the operator, returns the same mesh with the path selected.

When you'll reach for it

The signature avatar move: select the two corners of the mouth, run UV Shortest Path Select with use_fill on, and you've isolated the entire mouth region in one step - the exact set of UVs you want pinned before a smile shape key. Same pattern works for the eye ring. Because selection persists between chained nodes, path then pin (or path then snap) is a two-node pipeline that keeps coming back.

Output

  • BPY_OBJ out - the same mesh object, selection now set to the path. Wire it onward into any other blender node.

Installing it

Standard Avatar Graph install, and the thing to get right is Python: the pack pins bpy==3.6.0, 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 downloads the SAM ViT-H model (~2.5 GB) and mediapipe face/pose landmarkers in the background. For the live preview in editor.avatech.ai you'd start ComfyUI with --enable-cors-header; without it, right-click Avatar Main Output to save a .GLB.

Troubleshooting

The failure mode here is endpoint ambiguity. Shortest-path needs exactly two endpoints; if your selection has three or more separate UVs, the operator picks whichever pair it decides on and the path looks arbitrary. Deselect down to two before running it. And if the path ignores what looks like an obvious route, flip use_face_step - edge-only traversal on a heavily triangulated auto-generated mesh will happily walk around the short way through topology you didn't intend.

Categoryblender

Inputs (7)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
use_face_stepoptBOOLEANfalse
use_topology_distanceoptBOOLEANfalse
use_filloptBOOLEANfalse
skipoptINT00–2147483647
nthoptINT11–2147483647
offsetoptINT0-2147483648–2147483647

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ