Pose

class dazpy.DazPose(figure, bones, morphs, props)[source]

Bases: object

A snapshot of a figure’s complete pose state.

Stores bone rotations (Euler XYZ degrees), geometry morph values, and node-level numeric properties. Sparse by default — zero values are omitted so the object stays compact for morph-heavy figures.

Typical workflow:

from dazpy import DazScene, DazPose

scene = DazScene()
figure = scene.find_skeleton_by_label("Genesis 9")

neutral = DazPose.capture(figure)
neutral.save("neutral.json")

smile = DazPose.load("smile.json")
neutral.lerp(smile, t=0.5).apply(figure)

JSON schema (same as character_state.py output):

{
  "figure": "Genesis 9",
  "bones":  {"hip": [0, 2.3, 0], "rForeArm": [0, 0, -45]},
  "morphs": {"PHMSmileFull": 0.8},
  "props":  {"facs_ctrl_SmileFullFace": 0.5}
}
Parameters:
  • figure (str) – The label of the figure this pose belongs to.

  • bones (dict[str, list[float]]) – Bone name → [x, y, z] Euler angles in degrees.

  • morphs (dict[str, float]) – Morph name → blend value (typically 0–1).

  • props (dict[str, float]) – Node property name → numeric value.

classmethod capture(skeleton)[source]

Capture the current pose of skeleton in a single HTTP call.

Records all non-zero bone rotations, morph values, and node-level numeric properties. Zero values are omitted (sparse storage); they are implied as 0.0 during lerp() and apply_full().

Parameters:

skeleton (DazSkeleton) – The figure to capture.

Returns:

A new DazPose.

Raises:

NodeNotFoundError – If the skeleton is not found.

Return type:

DazPose

classmethod load(path)[source]

Load a pose from a JSON file.

Accepts files produced by save() and by the character_state.py example script.

Parameters:

path (str | Path) – Path to the JSON file.

Returns:

A new DazPose.

Return type:

DazPose

save(path)[source]

Write this pose to a JSON file.

Parameters:

path (str | Path) – Destination path. Parent directories must exist.

to_dict()[source]

Return the pose as a plain dict (same schema as the JSON file).

lerp(other, t)[source]

Linearly interpolate between this pose and other.

Missing keys in either pose are treated as zero. The result uses the figure label from self.

This is a pure-Python operation — no HTTP round-trip.

Parameters:
  • other (DazPose) – The target pose (t=1.0 yields an exact copy of other).

  • t (float) – Blend factor. 0.0 = this pose, 1.0 = other. Values outside [0, 1] extrapolate.

Returns:

A new DazPose at the interpolated position.

Return type:

DazPose

apply(skeleton)[source]

Apply this pose to skeleton in a single HTTP call.

Only channels present in the pose are changed. Bones and morphs not stored in the pose are left at their current values. Use apply_full() when you need a clean, authoritative reset to exactly this pose.

Parameters:

skeleton (DazSkeleton) – The figure to pose.

apply_full(skeleton)[source]

Apply this pose and zero every channel not present in the pose.

Unlike apply(), every bone rotation, morph, and node property on the skeleton is explicitly set — channels absent from the pose are driven to zero. Use this to restore a known baseline cleanly.

Parameters:

skeleton (DazSkeleton) – The figure to pose.