Nodes/Avatar Graph/UV Shortest Path Pick
ComfyUI Node

UV Shortest Path Pick

Path selection, but by vertex index instead of a mouse

By avatechai·Created 3 years ago·Updated 2 years ago· 264
UV Shortest Path Pick
  • BPY_OBJ
  • BPY_OBJ
use_face_stepfalse
use_topology_distancefalse
use_fillfalse
skip0
nth1
offset0
object_index-1
index-1

Shortest-path selection is how you grab a clean line of UVs across a mesh: pick two endpoints, and Blender walks the shortest connected route between them, selecting every UV along the way. It's the classic move for isolating a seam line or a lip outline. In the Blender UI you do it with two clicks. Inside Avatar Graph there's no mouse, so UV Shortest Path Pick does it with numbers instead.

It wraps bpy.ops.uv.shortest_path_pick(), from the pack's auto-generated Blender operator family. Where the plain shortest-path node (UV ShortestPathSelect) works from two already-selected UVs, this one takes object_index and index directly - you name the object and the vertex index, and it picks the path for you. It's the "I know exactly which vertices I want" version of the tool, which makes it the deterministic one for scripts and repeatable workflows.

The inputs

The interesting ones are the index pair:

  • object_index (int, default -1) - which object's indices to interpret. -1 typically means "the active one."
  • index (int, default -1) - the mesh vertex index of the target you're pathing to. With -1, the operator falls back to picking behavior using the current selection as the anchor.

Then the path-finding qualifiers, shared with its sibling:

  • use_face_step (bool) - allow the path to move face-to-face rather than only along edges.
  • use_topology_distance (bool) - compute distance in mesh topology instead of 3D space; usually what you want on a UV layout.
  • use_fill (bool) - also select the faces along the path, not just the edge UVs. Great when you want the whole lip band, not just its outline.
  • skip / nth / offset (ints) - select every nth vertex along the path, skip the first skip of them. Handy for feathering a selection so you don't grab a solid slab.

The flip side of being deterministic: you need to know your vertex indices. On a mesh that came out of Create Mesh Layer, indices are whatever the generator assigned, so you'll typically discover them by experimenting (or by counting on a known mesh) rather than guessing.

Outputs

  • BPY_OBJ out - the same mesh, selection now set to the path.

Selection persists on the mesh, so the natural follow-up is pin, snap, or a vertex-group assignment that turns the path into a deformable seam.

Installing it

Standard Avatar Graph install. The pack pins bpy==3.6.0, so Python 3.10 is required in your ComfyUI environment. 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, then let the first launch pull the SAM ViT-H model (~2.5 GB) and mediapipe landmarkers. --enable-cors-header unlocks the live editor preview; without it, export a .GLB from Avatar Main Output.

Troubleshooting

The most common "nothing happened" is index confusion: an object_index/index that doesn't point at a real vertex means the pick has nothing to resolve, and the operator silently gives up. If your indices are correct but the path still looks wrong, check use_face_step - with it off, the path is restricted to edge hops and can take a detour around a quad. And remember the README's own warning that the pack is still changing; if a demo template's path behavior seems off, pull the latest version before debugging your indices.

Categoryblender

Inputs (9)

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

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ