Nodes/Avatar Graph/Object Set Rotation Mode
ComfyUI Node

Object Set Rotation Mode

Object Set Rotation Mode — how Blender stores a rotation

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Set Rotation Mode
  • BPY_OBJ
  • BPY_OBJ
valueXYZ

Rotations in Blender can be stored in a few mathematically different ways, and rotation_mode picks which one: the Euler order (XYZ, XZY, YZX), quaternion, or axis-angle. Object Set Rotation Mode is the setter for that choice. For 95% of avatar work the default XYZ is fine and you never touch it - you reach for this node when a part rotates wrong, wobbles during interpolation, or when you're feeding rotation values from the editor that assume a specific representation.

How it works

Generated from bpy.types.Object's property list, this node runs setattr(object, "rotation_mode", value) against the embedded bpy instance and returns the same BPY_OBJ. The value input is a STRING defaulting to "XYZ". Meaningful values are the ones Blender itself offers: XYZ (default Euler order), XZY, YXZ, YZX, ZXY, ZYX (alternative Euler orders), QUATERNION (four-component, best for smooth interpolation between arbitrary orientations), and AXIS_ANGLE.

Why would you care? Euler angles suffer from gimbal lock - at certain orientations a part can flip wildly through one axis. If a jaw or head layer spins out while animating between two poses, switching the mode to QUATERNION usually fixes the interpolation. The flip side: the pack's editor and shape flow graph emit rotations in a specific mode, so if you change rotation_mode after the fact, the numbers it writes may be interpreted differently. Change it deliberately, not experimentally.

The inputs

  • BPY_OBJ - the object from Create Mesh Layer, a Mesh_ primitive, or an Object_ op.
  • value - rotation mode string, default "XYZ".

Output: same BPY_OBJ for chaining.

Install & gotchas

Ships with the Avatar Graph pack - install once, get all ObjectSet_* nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui && python -m pip install -r requirements.txt

Or ComfyUI Manager → search "Avatar Graph". The heavy requirement: bpy==3.6.0 needs Python 3.10; there's no wheel for 3.11+, so newer environments can't load the pack. Conda with python=3.10 is the README's path. First launch downloads a ~2.5 GB SAM model plus mediapipe landmarker files.

The realistic failure mode: you set QUATERNION to fix a flip, then feed it Euler-based values from a transform node and get garbage. Rotation mode defines the storage format, so whatever writes rotation after this node has to match. Also keep setters downstream of creation - the bpy scene resets each queue run. And remember the live preview needs --enable-cors-header; without it the workflow still runs and exports via Avatar Main Output, just without the realtime editor.

Categoryblender

Inputs (2)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
valueoptSTRINGXYZ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ