scene.camera

scene.camera

Classes

Name Description
Camera A class to handle camera settings in Blender.

Camera

scene.camera.Camera()

A class to handle camera settings in Blender.

Attributes

Name Description
basis The camera’s orthonormal basis as rows (right, up, forward).
camera Get Camera object
camera_data Get Camera data
clip_end Get Camera far clipping distance
clip_start Get Camera near clipping distance
lens Get Camera focal length
rotation Get Camera rotation in degrees (XYZ)

Methods

Name Description
frame_bounds The edges of what the camera sees, as (left, right, bottom, top).
frame_points Move the camera so that every one of these points is in frame.
set_viewpoint Set viewpoint to a preset or a custom Euler rotation.
frame_bounds
scene.camera.Camera.frame_bounds(scene=None)

The edges of what the camera sees, as (left, right, bottom, top).

For a perspective camera these are ratios of offset to depth, so a point at depth d is in frame when left * d <= x <= right * d. For an orthographic camera they are world-space offsets at its current scale.

Taken from Blender’s own view frame, so the sensor fit, render aspect ratio, pixel aspect and any lens shift are all accounted for - a shifted camera gives asymmetric bounds, which the framing solve handles.

frame_points
scene.camera.Camera.frame_points(points, margin=0.05, scene=None)

Move the camera so that every one of these points is in frame.

Solves for the closest position that still contains the points, without changing where the camera is pointing. See molecularnodes.framing.fit_camera_to_points for the solve.

Parameters
Name Type Description Default
points array_like (N, 3) world-space positions to fit into the frame. Any number of points is fine. required
margin float Fraction of the frame to leave empty around the subject. The small default keeps the subject off the edge of the frame; 0 fits it exactly, and a negative value crops in tighter. 0.05
scene bpy.types.Scene Scene to read the render aspect ratio from. Defaults to the active scene. None
set_viewpoint
scene.camera.Camera.set_viewpoint(viewpoint)

Set viewpoint to a preset or a custom Euler rotation.

Parameters
Name Type Description Default
viewpoint Viewpoint | str | Sequence[float] Either a named viewpoint (a Viewpoint or its name, e.g. “front”, “top”) or a tuple/list of three Euler angles in degrees (XYZ), matching :attr:rotation. required