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_upare 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')
CameraKeyframeinterpolationvalues (the segment to the next key).
- dazpy.shots.CAMERA_EASINGS: tuple[str, ...] = ('linear', 'smooth', 'ease_in', 'ease_out')
Keyframedeasingvalues (the whole move).
- class dazpy.shots.Lens(focal_length=50.0, depth_of_field=None, focal_distance=None, f_stop=None)[source]
Bases:
_ModelCamera optics.
Nonefields leave Studio’s current value untouched.
- 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:
_ModelFrame 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
DazNodetargets are raised by the size’s anchor height (they are assumed to be standing figures);Vec3targets 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
+Zside; seespherical_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
Vec3subjects too).
- class dazpy.shots.Placement(position, look_at=None, look_at_offset_cm=0.0, rotation=None)[source]
Bases:
_ModelAn explicit camera position, aimed at look_at or turned to rotation.
- class dazpy.shots.CameraKeyframe(frame, position, look_at=None, look_at_offset_cm=0.0, rotation=None, interpolation=None)[source]
Bases:
_ModelA 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’sKeyframed.easingfor this segment;Nonefollows it. Ignored on the last waypoint.
- 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:
_ModelMovement: 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 aPlacement’slook_at. Seedazpy.cinematics.apply_orbit_camera()for the side effects (anim range widened, timeline left at frame_end).
- class dazpy.shots.Keyframed(keyframes, easing=None)[source]
Bases:
_ModelMovement: 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 ist**2)."ease_out": leaves at speed, stops gently (2t - t**2).
A waypoint’s own
CameraKeyframe.interpolationoverrides easing for the segment after it. Seeset_transform_key_interpolation()for the curves.- keyframes: tuple[CameraKeyframe, ...]
- key_interpolation()[source]
(kinds, fast_start, fast_end)forset_transform_key_interpolation(), one kind per waypoint;Nonewhen neither easing nor any waypoint asks for one.
- class dazpy.shots.FocusPull(keys)[source]
Bases:
_ModelKeyed focal distance (a rack focus): at least two strictly ascending keys.
- class dazpy.shots.GazeBeat(frame, actor, look_at)[source]
Bases:
_ModelFrom frame, actor looks at look_at. Planning data; not applied yet.
- look_at: Target
- class dazpy.shots.BlockingBeat(frame, actor, position, facing=None, note=None)[source]
Bases:
_ModelAt frame, actor stands at position (facing facing). Planning data; not applied yet.
- class dazpy.shots.Storyboard(description=None, dialogue=None, beat=None, notes=None)[source]
Bases:
_ModelFree-text storyboard metadata.
- class dazpy.shots.RenderOutput(path, engine=None, resolution=None, iray_samples=None)[source]
Bases:
_ModelWhere a shot renders, and per-shot render overrides (see
dazpy.render_api.render()).
- class dazpy.shots.AspectSettings(aspect_width=None, aspect_height=None, pixels_width=None, pixels_height=None)[source]
Bases:
_ModelCamera aspect/pixel settings;
Noneleaves Studio’s value untouched.
- 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:
_ModelOne 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) orPlacement(explicit).lens (Lens) – Optics.
movement (Orbit | Keyframed | None) –
None(static),OrbitorKeyframed.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.
- aspect: AspectSettings | None = None
- blocking: tuple[BlockingBeat, ...] = ()
- storyboard: Storyboard | None = None
- output: RenderOutput | None = None
- to_recipe()[source]
Scene-recipe
(cameras[id] entry, shots[] entry or None).Only static shots convert (
shots[].movementis reserved in recipe_version 1). Framing subjects must be keys; explicit positions/aims must be keys orVec3literals. 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.
- class dazpy.shots.Sequence(id, shots=(), lighting=None, storyboard=None)[source]
Bases:
_ModelAn ordered run of shots that cut together.
- storyboard: Storyboard | None = None
- class dazpy.shots.CoveragePlan(id, subjects=(), axis=None, sequences=(), lighting=None, storyboard=None)[source]
Bases:
_ModelHow 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.
- storyboard: Storyboard | None = None
- 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
Shotfrom a scene-recipecameras[key]entry (and optionalshots[]entry).Recipe framing cameras without
anglekeep the recipe’s 10 degree default elevation (as an explicitelevation_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 byframing.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 isNoneand widens the anim range for anOrbit.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
DazNodeor aVec3(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
Keyframedmove) and focal-distance (for a focus pull) keys first.Falseadds 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
Orbithas no target.