Nodes/Avatar Graph/Mesh Shortest Path Pick
ComfyUI Node

Mesh Shortest Path Pick

Select a path to a specific element by index

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

In Blender's viewport, this is what happens when you Ctrl-click a second element: Blender draws the shortest connected path from your active element to whatever you just clicked. There's no mouse in a headless ComfyUI graph, so this node wraps Blender's real bpy.ops.mesh.shortest_path_pick operator and exposes that "whatever you clicked" as an explicit index parameter instead. It's part of Avatar Graph, the pack that runs actual Blender inside ComfyUI's process (via the bpy Python package) to build interactive 2D-to-3D avatars, auto-generating a node for every mesh operator Blender has.

How it works, and how it differs from its sibling

This node needs a specific target: the numeric index of the element you want the path to reach. Its sibling, Mesh Shortest Path Select, works differently - it connects two elements that are already both selected, with no index required. Pick this one when you know exactly which element (by index) you're pathing toward; reach for Select instead when you've already got both endpoints selected and just want the connecting route.

Inputs and output

  • BPY_OBJ - the mesh coming in, with an active element already established as the path's starting point.
  • edge_mode - SELECT, SEAM, SHARP, CREASE, BEVEL, or FREESTYLE. SELECT just selects the path; the others mark the resulting path with that property in the same step (tag it as a seam for UV unwrapping, mark it sharp for shading, and so on).
  • use_face_step (default false) - lets the path cross face interiors instead of sticking strictly to existing edges.
  • use_topology_distance (default false) - weighs the path by hop count across the mesh's connectivity rather than actual physical edge length.
  • use_fill (default false) - fills the path with connecting geometry rather than only selecting what's already there.
  • skip, nth, offset - the same checker-style thinning pattern as Mesh Select Nth, applied along the resulting path.
  • index (default -1) - the target element's index. This is the field that replaces the mouse click.

Output is a single BPY_OBJ, path selected (and optionally marked).

Installing it

ComfyUI Manager: search "avatar-graph-comfyui", install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/avatechai/avatar-graph-comfyui, then cd avatar-graph-comfyui && python -m pip install -r requirements.txt, then restart.

Python 3.10.x is the requirement to nail down first - the bpy package this pack is built on needs that exact minor version, and the README recommends a dedicated conda environment on macOS/Linux (conda create --name comfyui python=3.10) rather than trusting an existing Python install. Windows users get a prebuilt ComfyUI + Python 3.10 zip linked in the README to unzip over their install before adding the pack via Manager. Restart with --enable-cors-header (macOS also wants --force-fp16) for the live 3D preview.

Common issues

Rule out the Python version first if this pack's nodes aren't loading. On this node specifically, index needs to correspond to a real, currently valid element index on the mesh - there's no picker UI here to catch a mistake before it runs, so an out-of-range or stale index (especially from a mesh that's changed shape between when you determined the index and when this node actually executes) surfaces as a straightforward operator failure. If you don't have a specific index in mind and just want to connect two points you've already selected, Mesh Shortest Path Select is the node you actually want.

Categoryblender

Inputs (9)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
edge_modeoptCOMBO6 options: SELECT, SEAM, SHARP, CREASE, BEVEL, FREESTYLE
use_face_stepoptBOOLEANfalse
use_topology_distanceoptBOOLEANfalse
use_filloptBOOLEANfalse
skipoptINT00–2147483647
nthoptINT11–2147483647
offsetoptINT0-2147483648–2147483647
indexoptINT-1-1–2147483647

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ