Object Constraint Add With Targets
Add a constraint pre-wired to your selection
- BPY_OBJ
- type
- BPY_OBJ
The sibling to Object Constraint Add, wrapping bpy.ops.object.constraint_add_with_targets(type) - the same operator behind Blender's "Add Constraint (with Targets)" menu (Ctrl+Shift+C in the viewport). Where the plain version leaves the new constraint's target empty, this one auto-fills it using whatever other object is selected alongside the active one, so the constraint arrives already pointed at something.
Where it fits in Avatar Graph
Avatar Graph (avatechai/avatar-graph-comfyui) rigs a flat character image into a real-time interactive avatar via segmentation, mesh layers, and a "Shape Flow" runtime graph, exported through Avatar Main Output. Object constraints aren't part of that documented pipeline (Avatar Graph's own rigging runs through shape keys and Shape Flow, not Blender's constraint stack); this node belongs to the much larger family the pack generates by exposing Blender's Object operators directly. It's a genuine Blender rigging convenience if you're building traditional constraint-based setups on top of an avatar rig - a camera tracking your character, say - but outside anything the core tutorial covers.
How it works
In Blender's own UI, this operator relies on you having multiple objects selected - the last-selected (active) object gets the constraint, and the other selected object(s) become its target(s) automatically, skipping the separate step of opening the constraint panel and manually assigning a target. The underlying mechanic is identical to constraint_add; the difference is entirely in target auto-assignment.
Inputs and outputs
type- aB_ENUMpicking the constraint type (Track To, Copy Location, Limit Distance, and the rest of Blender's constraint list).BPY_OBJ(optional) - the object receiving the constraint. Unwired, it defaults to Blender's active object.
Output: BPY_OBJ - passed through for chaining, same as every node in this family. Note there's no separate target socket here - target assignment happens implicitly the way it does in Blender's own selection-based UI, which is worth keeping in mind since a ComfyUI graph doesn't have a "selection" the same way the 3D viewport does; what counts as selected/active at the moment this node runs depends on the rest of your Blender-side scripting context.
How to install it
ComfyUI Manager: search "avatar-graph-comfyui", install, restart. Manual clone:
cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui && python -m pip install -r requirements.txt
bpy needs Python 3.10.x, nothing later - the requirement that actually causes install failures. Windows gets a prebuilt Python 3.10 ComfyUI zip from the README; on Mac/Linux, use a dedicated conda env (conda create --name comfyui python=3.10). Restart with --enable-cors-header for the live avatar preview to connect to editor.avatech.ai - exports work without it.
Common issues & troubleshooting
Install issues are almost always the Python version - a 3.11/3.12 environment (default on most current ComfyUI installs) can't load bpy. There's also a real report of Avatar Graph leaving a ComfyUI Desktop install badly broken after installation (an oversized logo, an unexpected audio-permission popup) severe enough that a full reinstall didn't fully clear it - test in a spare, portable ComfyUI instance first if you're not already isolated on 3.10.
For this node specifically: since target assignment relies on Blender's own selection state rather than an explicit socket, the most common surprise is the constraint targeting the wrong object (or nothing) because selection wasn't what you expected at that point in the graph. If targets keep coming out wrong, fall back to Object Constraint Add and set the target explicitly through whatever field that constraint type exposes instead.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| typeopt | B_ENUM | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |