Math & Geometry Types
Vec3
Quat
- class dazpy.Quat(x, y, z, w)[source]
Bases:
objectUnit quaternion representing a 3D rotation.
Stored as
(x, y, z, w)— imaginary components first, scalar last. The dazpy API (DazNode.rotation,DazBone.local_rotation) returns the same dict shape but with Studio’s DzQuat convention, which is the conjugate: convert withfrom_dz()/to_dz().All methods return new
Quatinstances. The object is immutable.- Parameters:
- classmethod from_dict(d)[source]
Create from an
{"x", "y", "z", "w"}dict, components taken as-is.For a quaternion read from Studio (
rotation,local_rotation,getOrientation()) usefrom_dz()instead: a DzQuat stores the conjugate.
- classmethod from_dz(d)[source]
Create from a DAZ Studio
DzQuatdict.A DzQuat stores the conjugate
(-x, -y, -z, w)of the math3 quaternion for the same rotation (live-verified forgetLocalRot,getWSRotandgetOrientation;DzQuat.multVecrotates vectors likerotate()on the converted value). Use this forrotationandlocal_rotation.
- classmethod from_dz_euler(x, y, z, rotation_order='XYZ', orientation=None)[source]
The local rotation Studio produces from rotation channel values.
Studio’s rotation order string (
getRotationOrder(), e.g."YZX") is the reverse of math3’s order, and the channels rotate about the bone’s oriented axes, solocal = O * from_euler(x, y, z, reversed_order) * O⁻¹. Live-verified againstgetLocalRot()on Genesis 9 bones and cameras.- Parameters:
x (float) – X rotation channel value in degrees (as applied, after limits).
y (float) – Y rotation channel value in degrees.
z (float) – Z rotation channel value in degrees.
rotation_order (str) – Studio’s order string (
rotation_order). Nodes such as cameras report"XYZ".orientation (Quat | None) – The node’s orientation as a math3 quaternion, i.e.
Quat.from_dz(<getOrientation() dict>).Nonefor identity.
- Returns:
The math3 quaternion equal to
Quat.from_dz(<getLocalRot()>).- Return type:
- to_dz_euler(rotation_order='XYZ', orientation=None)[source]
Rotation channel values
(x, y, z)that reproduce this local rotation.Inverse of
from_dz_euler(); pass the values toset_local_rotation(). Joint limits are not applied.
- classmethod from_euler(x, y, z, order='XYZ')[source]
Create from Euler angles in degrees using intrinsic rotations.
Intrinsic means each rotation is applied in the frame left by the previous rotation — the same convention DAZ Studio uses for bone rotation channels.
- Parameters:
x (float) – Rotation around the X axis in degrees.
y (float) – Rotation around the Y axis in degrees.
z (float) – Rotation around the Z axis in degrees.
order (str) – Application order — one of
XYZ,XZY,YXZ,YZX,ZXY,ZYX. This is the reverse of Studio’srotation_orderstring; to convert Studio channel values usefrom_dz_euler().
- Returns:
A unit quaternion.
- Return type:
- to_euler(order='XYZ')[source]
Extract Euler angles in degrees.
The inverse of
from_euler()for the same order. Gimbal-lock configurations (singularities) are handled by setting the last rotation in the order to zero.
- multiply(other)[source]
Hamilton product
self * other.Composing rotations:
a.multiply(b)applies a first, then b in the rotated frame (intrinsic), or equivalently b first then a in the world frame (extrinsic).
BoundingBox
- class dazpy.BoundingBox(min, max)[source]
Bases:
objectAxis-aligned bounding box.
- Parameters:
- classmethod from_dict(d)[source]
Create from the dict returned by
bounding_box().Expected shape:
{"min": {"x":..., "y":..., "z":...}, "max": {...}}.
AxisRemap
- class dazpy.AxisRemap(x, y, z)[source]
Bases:
objectConverts
Vec3,Quat, andBoundingBoxvalues between axis conventions (e.g. Y-up to Z-up).A generic signed-axis-permutation remap — no application-specific knowledge (Blender/Unreal naming, camera or figure orientation fixups) is baked in beyond the
Y_UP_TO_Z_UPpreset.Each of x, y, z names which source axis (optionally signed) the corresponding output axis is derived from. All three of the source axes
x,y,zmust be referenced exactly once (signs aside).Example:
# DAZ Studio (Y-up) -> Blender-style Z-up remap = AxisRemap(x="x", y="-z", z="y") blender_pos = remap.apply_vec3(daz_pos)
- Parameters:
- apply_quat(q)[source]
Remap a rotation.
- Raises:
ValueError – If this remap is a reflection (determinant
-1). Reflections cannot be represented by a quaternion; useapply_vec3()for vectors/points instead.
- dazpy.Y_UP_TO_Z_UP = AxisRemap(x='x', y='-z', z='y')
Converts
Vec3,Quat, andBoundingBoxvalues between axis conventions (e.g. Y-up to Z-up).A generic signed-axis-permutation remap — no application-specific knowledge (Blender/Unreal naming, camera or figure orientation fixups) is baked in beyond the
Y_UP_TO_Z_UPpreset.Each of x, y, z names which source axis (optionally signed) the corresponding output axis is derived from. All three of the source axes
x,y,zmust be referenced exactly once (signs aside).Example:
# DAZ Studio (Y-up) -> Blender-style Z-up remap = AxisRemap(x="x", y="-z", z="y") blender_pos = remap.apply_vec3(daz_pos)
- Parameters:
x – Source axis for the output X component, e.g.
"x"or"-z".y – Source axis for the output Y component.
z – Source axis for the output Z component.