Object Constraint Add
Add a bare Blender constraint, no target set
- BPY_OBJ
- type
- BPY_OBJ
A direct wrap of bpy.ops.object.constraint_add(type) - adds one of Blender's object constraints (Track To, Copy Location, Limit Rotation, IK, and every other type in Blender's constraint stack) to the object. This is the bare version: it adds the constraint with its type set, but nothing wired to a target - you set the target(s) separately, or use the sibling node below if you already know what you want to target.
Where it fits in Avatar Graph
Avatar Graph (avatechai/avatar-graph-comfyui) rigs a flat character image into a real-time interactive avatar - segmentation, mesh layers, a "Shape Flow" runtime graph, exported via Avatar Main Output. Constraints aren't part of that documented flow (the pack's own rigging model runs on shape keys and the Shape Flow graph, not Blender's bone/object constraint system); this node is part of the much larger family the pack generates by exposing Blender's Object operators directly. It's genuinely useful if you're layering traditional Blender rigging on top of what Avatar Graph produces - pointing a camera at your avatar, say - but not something the standard tutorial calls for.
How it works
Blender constraints are procedural: they modify an object's final transform at evaluation time without baking anything into its actual location/rotation/scale data. Adding one just appends it to the object's constraint stack with sensible defaults for that type - most constraint types need at least one target object set afterward before they visibly do anything.
Inputs and outputs
type- aB_ENUMselecting the constraint type to add (Track To, Copy Rotation, IK, Limit Distance, and so on - the full list matches Blender's own Add Constraint menu).BPY_OBJ(optional) - the object receiving the constraint. Unwired, it falls back to Blender's active object.
Output: BPY_OBJ - the same object, passed through for chaining onto further nodes.
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 requires Python 3.10.x specifically - the actual blocker most people hit. Windows gets a prebuilt Python 3.10 ComfyUI zip from the README; on Mac/Linux, set up a dedicated conda env (conda create --name comfyui python=3.10). Restart with --enable-cors-header if you want the live avatar preview to work with editor.avatech.ai - exports work fine without it.
Common issues & troubleshooting
Install failures almost always trace to Python version - a 3.11/3.12 environment, the 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 (an oversized logo, an unexpected audio-permission popup) after install, bad enough that a full reinstall didn't fully clear it - test in a spare, portable ComfyUI instance first if you're not already sandboxed on 3.10.
For the node itself: if the constraint seems to do nothing after being added, that's expected for most constraint types until a target is set - this node only adds it, it doesn't wire one up. If you already know what the target should be, Object Constraint Add With Targets does both steps in one call instead of leaving you to set the target separately.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| typeopt | B_ENUM | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |