Shots

Typed, serialisable shot models – Shot, Sequence and CoveragePlan – and apply_shot(), the single apply path the Cinematics builders are adapters over. Shot library builds common shots, coverage and conversations as these models.

from dazpy.shots import CoveragePlan, Framing, Lens, RenderOutput, Sequence, Shot, apply_shot

cu = Shot(id="anna_cu",
          camera=Framing(subjects=("anna",), size="close_up", angle="low",
                         composition="left_third"),
          lens=Lens(focal_length=85),
          output=RenderOutput(path="C:/renders/anna_cu.png"))
apply_shot(scene, cu, subjects={"anna": scene.find_node("Genesis 9")})

# Static shots drop straight into a scene recipe
plan = CoveragePlan(id="cafe", subjects=("anna", "ben"), axis=("anna", "ben"),
                    sequences=(Sequence(id="talk", shots=(cu,)),))
recipe = plan.merge_into_recipe(recipe)

Blocking beats, gaze beats, the lighting continuity key and storyboard notes are planning data: they serialise and round-trip, but apply_shot() does not apply them, and recipe conversion drops them. Camera movement and focus pulls apply through apply_shot() but are not part of recipe_version 1.

Typed, serialisable shot models: Shot, Sequence, CoveragePlan.

A Shot describes one camera setup as a whole: what it frames (Framing) or where it stands (Placement), through which Lens, how it moves (Orbit / Keyframed), where focus goes (FocusPull), and the planning data around it – blocking and gaze beats, the lighting setup it must match, storyboard notes and its render output. apply_shot() puts a shot into a live scene; the dazpy.cinematics builders are thin adapters over it.

Every model is a frozen dataclass with to_dict() / from_dict() (JSON-compatible; union fields carry a kind discriminator, default-valued fields are omitted). Targets are an actor/prop key (str, resolved through the subjects mapping of apply_shot()), a Vec3, or a live DazNode – the last is not serialisable.

Static shots convert to and from scene-recipe camera entries (Shot.to_recipe(), shot_from_recipe_camera(), CoveragePlan.to_recipe_sections(), CoveragePlan.merge_into_recipe()).

Units are DAZ native: centimetres, Y-up, degrees, timeline frames.

dazpy.shots.SHOT_SIZES: Mapping[str, tuple[float, float]] = {'close_up': (40.0, 160.0), 'extreme_close_up': (15.0, 165.0), 'extreme_wide': (600.0, 90.0), 'full_body': (210.0, 90.0), 'medium': (100.0, 130.0), 'medium_close_up': (60.0, 145.0), 'medium_wide': (140.0, 115.0), 'wide': (350.0, 90.0)}

(cm of subject that fills the frame height, cm above an actor’s root to aim at). Assumes a standing Genesis-scale (~175 cm) figure. full_body / medium / close_up are the scene-recipe values.

Type:

Per shot size

dazpy.shots.CAMERA_ANGLES: Mapping[str, float] = {'birds_eye': 80.0, 'eye_level': 0.0, 'high': 30.0, 'low': -20.0, 'worms_eye': -45.0}

Camera elevation (degrees above the aim point) per named angle.

dazpy.shots.KEY_INTERPOLATIONS: tuple[str, ...] = ('linear', 'constant', 'smooth')

CameraKeyframe interpolation values (the segment to the next key).

dazpy.shots.CAMERA_EASINGS: tuple[str, ...] = ('linear', 'smooth', 'ease_in', 'ease_out')

Keyframed easing values (the whole move).

class dazpy.shots.Lens(focal_length=50.0, depth_of_field=None, focal_distance=None, f_stop=None)[source]

Bases: _Model

Camera optics. None fields leave Studio’s current value untouched.

focal_length: float = 50.0
depth_of_field: bool | None = None
focal_distance: float | None = None
f_stop: float | None = None
class dazpy.shots.Framing(subjects, size='medium', angle='eye_level', azimuth_deg=0.0, elevation_deg=None, composition='center', distance_cm=None, anchor_cm=None)[source]

Bases: _Model

Frame one or more subjects at a named shot size.

Parameters:
  • subjects (tuple[Target, ...]) – One or more targets; the camera aims at their centroid. Keys and DazNode targets are raised by the size’s anchor height (they are assumed to be standing figures); Vec3 targets only by anchor_cm.

  • size (str) – Shot size – see SHOT_SIZES.

  • angle (str) – Named camera angle – see CAMERA_ANGLES.

  • azimuth_deg (float) – Camera azimuth around the aim point (0 = the subject’s +Z side; see spherical_offset()).

  • elevation_deg (float | None) – Explicit elevation; overrides angle when set.

  • composition (str) – "left_third" / "right_third" places the subject on that third of the frame by turning the camera, not moving it.

  • distance_cm (float | None) – Explicit camera distance; overrides the size’s fit.

  • anchor_cm (float | None) – Explicit aim height above every subject; overrides the size’s anchor (and applies to Vec3 subjects too).

subjects: tuple[Target, ...]
size: str = 'medium'
angle: str = 'eye_level'
azimuth_deg: float = 0.0
elevation_deg: float | None = None
composition: str = 'center'
distance_cm: float | None = None
anchor_cm: float | None = None
property effective_elevation_deg: float
class dazpy.shots.Placement(position, look_at=None, look_at_offset_cm=0.0, rotation=None)[source]

Bases: _Model

An explicit camera position, aimed at look_at or turned to rotation.

position: Vec3
look_at: Target | None = None
look_at_offset_cm: float = 0.0
rotation: tuple[float, float, float] | None = None
class dazpy.shots.CameraKeyframe(frame, position, look_at=None, look_at_offset_cm=0.0, rotation=None, interpolation=None)[source]

Bases: _Model

A single waypoint in an animated camera move (see Keyframed).

Parameters:
  • frame (int) – Timeline frame number for this waypoint.

  • position (Vec3) – World-space camera position at frame.

  • look_at (Target | None) – Aim target at frame. Ignored if None; in that case rotation (if set) is used instead.

  • look_at_offset_cm (float) – Vertical offset (cm) applied when resolving look_at – see resolve_target().

  • rotation (tuple[float, float, float] | None) – Explicit (x, y, z) degrees for this waypoint. Ignored if look_at is set.

  • interpolation (KeyInterpolation | None) – How Studio moves from this waypoint to the next: "linear", "constant" (hold, then cut) or "smooth" (Studio’s default curve). Overrides the move’s Keyframed.easing for this segment; None follows it. Ignored on the last waypoint.

frame: int
position: Vec3
look_at: Target | None = None
look_at_offset_cm: float = 0.0
rotation: tuple[float, float, float] | None = None
interpolation: KeyInterpolation | None = None
class dazpy.shots.Orbit(radius, elevation_deg=15.0, start_azimuth_deg=0.0, end_azimuth_deg=360.0, frame_start=0, frame_end=90, target_offset_cm=25.0)[source]

Bases: _Model

Movement: sweep around the shot’s subject, baking one placement per frame.

The orbit target is the shot’s camera target: a Framing’s first subject, or a Placement’s look_at. See dazpy.cinematics.apply_orbit_camera() for the side effects (anim range widened, timeline left at frame_end).

radius: float
elevation_deg: float = 15.0
start_azimuth_deg: float = 0.0
end_azimuth_deg: float = 360.0
frame_start: int = 0
frame_end: int = 90
target_offset_cm: float = 25.0
class dazpy.shots.Keyframed(keyframes, easing=None)[source]

Bases: _Model

Movement: real Daz keyframes, one per waypoint; Studio interpolates between.

Waypoints must be strictly ascending (at least two), and either every waypoint specifies an orientation (look_at/rotation) or none does.

easing shapes the whole move, on position and rotation:

  • None: leave Studio’s interpolation as it is (new keys are smooth).

  • "linear": constant speed along each segment, sharp turns at waypoints.

  • "smooth": Studio’s default curve: starts and stops gently, passes through interior waypoints without a speed jump.

  • "ease_in": starts gently, arrives at speed (a two-waypoint move is t**2).

  • "ease_out": leaves at speed, stops gently (2t - t**2).

A waypoint’s own CameraKeyframe.interpolation overrides easing for the segment after it. See set_transform_key_interpolation() for the curves.

keyframes: tuple[CameraKeyframe, ...]
easing: Literal['linear', 'smooth', 'ease_in', 'ease_out'] | None = None
property has_orientation: bool
key_interpolation()[source]

(kinds, fast_start, fast_end) for set_transform_key_interpolation(), one kind per waypoint; None when neither easing nor any waypoint asks for one.

class dazpy.shots.FocusKey(frame: 'int', focal_distance: 'float')[source]

Bases: _Model

frame: int
focal_distance: float
class dazpy.shots.FocusPull(keys)[source]

Bases: _Model

Keyed focal distance (a rack focus): at least two strictly ascending keys.

keys: tuple[FocusKey, ...]
class dazpy.shots.GazeBeat(frame, actor, look_at)[source]

Bases: _Model

From frame, actor looks at look_at. Planning data; not applied yet.

frame: int
actor: str
look_at: Target
class dazpy.shots.BlockingBeat(frame, actor, position, facing=None, note=None)[source]

Bases: _Model

At frame, actor stands at position (facing facing). Planning data; not applied yet.

frame: int
actor: str
position: Vec3
facing: Target | None = None
note: str | None = None
class dazpy.shots.Storyboard(description=None, dialogue=None, beat=None, notes=None)[source]

Bases: _Model

Free-text storyboard metadata.

description: str | None = None
dialogue: str | None = None
beat: str | None = None
notes: str | None = None
class dazpy.shots.RenderOutput(path, engine=None, resolution=None, iray_samples=None)[source]

Bases: _Model

Where a shot renders, and per-shot render overrides (see dazpy.render_api.render()).

path: str
engine: str | None = None
resolution: tuple[int, int] | None = None
iray_samples: int | None = None
class dazpy.shots.AspectSettings(aspect_width=None, aspect_height=None, pixels_width=None, pixels_height=None)[source]

Bases: _Model

Camera aspect/pixel settings; None leaves Studio’s value untouched.

aspect_width: float | None = None
aspect_height: float | None = None
pixels_width: int | None = None
pixels_height: int | None = None
class dazpy.shots.Shot(id, camera, lens=<factory>, movement=None, focus=None, frame_range=None, aspect=None, blocking=(), gaze=(), lighting=None, storyboard=None, output=None)[source]

Bases: _Model

One camera setup and everything planned around it.

Parameters:
  • id (str) – Stable shot id (also the recipe camera/shot key on conversion).

  • camera (Framing | Placement) – Framing (auto-framed) or Placement (explicit).

  • lens (Lens) – Optics.

  • movement (Orbit | Keyframed | None) – None (static), Orbit or Keyframed.

  • focus (FocusPull | None) – Optional FocusPull.

  • frame_range (tuple[int, int] | None) – Optional (start, end) the shot covers on the timeline.

  • aspect (AspectSettings | None) – Optional camera aspect/pixel settings.

  • blocking (tuple[BlockingBeat, ...]) – Actor blocking beats (planning data; not applied yet).

  • gaze (tuple[GazeBeat, ...]) – Gaze beats (planning data; not applied yet).

  • lighting (str | None) – Lighting continuity key – the lighting setup/rig this shot must match (planning data).

  • storyboard (Storyboard | None) – Storyboard metadata.

  • output (RenderOutput | None) – Where the shot renders.

id: str
camera: Framing | Placement
lens: Lens
movement: Orbit | Keyframed | None = None
focus: FocusPull | None = None
frame_range: tuple[int, int] | None = None
aspect: AspectSettings | None = None
blocking: tuple[BlockingBeat, ...] = ()
gaze: tuple[GazeBeat, ...] = ()
lighting: str | None = None
storyboard: Storyboard | None = None
output: RenderOutput | None = None
property is_static: bool
to_recipe()[source]

Scene-recipe (cameras[id] entry, shots[] entry or None).

Only static shots convert (shots[].movement is reserved in recipe_version 1). Framing subjects must be keys; explicit positions/aims must be keys or Vec3 literals. Planning data (blocking, gaze, lighting continuity, storyboard) and aspect settings are not carried – recipes have nowhere to put them.

Raises:
  • ValueError – The shot moves, pulls focus, frames a Vec3, or uses a field recipes can’t express.

  • TypeError – A target is a live DazNode.

class dazpy.shots.Sequence(id, shots=(), lighting=None, storyboard=None)[source]

Bases: _Model

An ordered run of shots that cut together.

id: str
shots: tuple[Shot, ...] = ()
lighting: str | None = None
storyboard: Storyboard | None = None
shot(shot_id)[source]
class dazpy.shots.CoveragePlan(id, subjects=(), axis=None, sequences=(), lighting=None, storyboard=None)[source]

Bases: _Model

How a scene is covered: its subjects, line of action and sequences.

Parameters:
  • id (str) – Plan id.

  • subjects (tuple[str, ...]) – The actor keys the plan covers.

  • axis (tuple[str, str] | None) – Optional pair of subject keys defining the line of action (the 180-degree line). Stored for the shot library to enforce.

  • sequences (tuple[Sequence, ...]) – The sequences; shot ids are unique across the whole plan.

  • lighting (str | None) – Default lighting continuity key for shots that set none.

  • storyboard (Storyboard | None) – Storyboard metadata for the scene.

id: str
subjects: tuple[str, ...] = ()
axis: tuple[str, str] | None = None
sequences: tuple[Sequence, ...] = ()
lighting: str | None = None
storyboard: Storyboard | None = None
all_shots()[source]
lighting_for(shot)[source]

The shot’s lighting continuity key: its own, its sequence’s, else the plan’s.

to_recipe_sections()[source]

{"cameras": {...}, "shots": [...]} for every shot, in plan order.

Raises:

ValueError / TypeError – See Shot.to_recipe().

merge_into_recipe(recipe)[source]

A copy of recipe (a dict) with this plan’s cameras and shots added.

Raises:

ValueError – A camera key or shot id already exists in recipe.

dazpy.shots.shot_from_recipe_camera(key, camera, shot=None)[source]

Build a Shot from a scene-recipe cameras[key] entry (and optional shots[] entry).

Recipe framing cameras without angle keep the recipe’s 10 degree default elevation (as an explicit elevation_deg).

dazpy.shots.framing_distance(size, focal_length, *, frame_width_mm=36.0, aspect=0.75)[source]

Distance at which size’s fit height fills the frame height at focal_length.

Studio’s Frame Width spans the frame height whatever the aspect, so the distance does not depend on aspect (kept for signature compatibility).

dazpy.shots.framing_transform(points, framing, focal_length, *, frame_width_mm=36.0, aspect=0.75)[source]

Camera (position, aim) for framing of already-resolved subject points.

Parameters:
  • points (Iterable[tuple[Vec3, bool]]) – (base point, is_figure) per subject. Figures are raised by the size’s anchor height; other points only by framing.anchor_cm (which, when set, raises every point).

  • framing (Framing) – The framing spec.

  • focal_length (float) – Lens focal length (mm), used to fit the shot size.

  • frame_width_mm (float) – Camera “Frame Width” (mm), which Studio applies to the frame height.

  • aspect (float) – Frame height / width; sets the frame width for a third composition.

dazpy.shots.apply_shot(scene, shot, *, camera=None, name=None, subjects=None, frame_width_mm=36.0, aspect=0.75, clear_keys=True)[source]

Put shot into the scene on a camera and return the camera.

Planning data (blocking, gaze, lighting continuity, storyboard, output) is not applied.

Parameters:
  • scene (DazScene) – A DazScene; creates the camera when camera is None and widens the anim range for an Orbit.

  • shot (Shot) – The shot.

  • camera (DazCamera | None) – An existing camera to reuse; otherwise one is created.

  • name (str | None) – Name for a newly created camera.

  • subjects (Mapping[str, Any] | None) – Resolves key targets to a DazNode or a Vec3 (an actor root on the floor).

  • frame_width_mm (float) – Camera frame width used to fit a Framing.

  • aspect (float) – Frame height / width used to fit a Framing.

  • clear_keys (bool) – Clear the camera’s existing position/rotation (for a Keyframed move) and focal-distance (for a focus pull) keys first. False adds the shot’s keys to what is there, so successive moves on one camera chain.

Raises:

ValueError – A key target isn’t in subjects, or an Orbit has no target.