viewport.camera
Camera position, orientation, projection, and framing.
7 functions / 11 types
Index
| Function | Description |
|---|---|
| GetCameraTransform | Get the position and rotation of one viewport camera. |
| GetProjection | Get one viewport camera’s projection type. |
| SetCameraTransform | Set the position and rotation of viewport cameras. |
| SetProjection | Set viewport cameras to perspective or orthographic projection. |
| ToggleProjection | Toggle viewport cameras between perspective and orthographic projection. |
| ZoomExtents | Move viewport cameras to frame the scene. |
| ZoomToAabb | Fit the world-space AABB in matching viewport cameras without changing their rotation. Moves a perspective camera; also adjusts scale for an orthographic camera. By default, the fit does not animate. Returning does not mean a new frame has rendered. No matching camera means no change. |
| Type | Description |
|---|---|
| CameraTransform | World-space position and orientation of a camera. The three angles are the YXZ Euler decomposition of the camera rotation, in radians. |
| CameraTransformResult | Result of GetCameraTransform. |
| GetCameraTransform | Get the position and rotation of one viewport camera. |
| GetProjection | Get one viewport camera’s projection type. |
| GetProjectionResponse | |
| ProjectionKind | Camera projection type. |
| SetCameraTransform | Set the position and rotation of viewport cameras. |
| SetProjection | Set viewport cameras to perspective or orthographic projection. |
| ToggleProjection | Toggle viewport cameras between perspective and orthographic projection. |
| ZoomExtents | Move viewport cameras to frame the scene. |
| ZoomToAabb | Fit the world-space AABB in matching viewport cameras without changing their rotation. Moves a perspective camera; also adjusts scale for an orthographic camera. By default, the fit does not animate. Returning does not mean a new frame has rendered. No matching camera means no change. |
GetCameraTransform
RPC
GetCameraTransform(request: viewport.camera.GetCameraTransform) -> viewport.camera.CameraTransformResultGet the position and rotation of one viewport camera.
Returns a CameraTransformResult containing the world-space position and YXZ Euler
angles in radians. The transform is absent when the camera has no transform.
Fails unless exactly one viewport camera matches viewport.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.GetCameraTransform.
Returns viewport.camera.CameraTransformResult.
viewport optional : string
Label of the viewport to read. Absent, the only viewport is read.
GetProjection
RPC
GetProjection(request: viewport.camera.GetProjection) -> viewport.camera.GetProjectionResponseGet one viewport camera’s projection type.
Fails unless exactly one viewport camera matches viewport.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.GetProjection.
Returns viewport.camera.GetProjectionResponse.
viewport optional : string
Label of the viewport to read. Absent, the only viewport is read.
SetCameraTransform
RPC
SetCameraTransform(request: viewport.camera.SetCameraTransform) -> google.protobuf.EmptySet the position and rotation of viewport cameras.
The rotation is specified as three Euler angles in YXZ order, matching
EulerRot.YXZ. Despite the field names, the angles are passed to
DQuat.from_euler(EulerRot.YXZ, x_rot, y_rot, z_rot), so:
x_rotis applied around the Y axis (first rotation, horizontal heading).y_rotis applied around the X axis (second rotation, vertical tilt).z_rotis applied around the Z axis (third rotation, roll).
Angles are in radians. Camera-local forward is -Z and local up is +Y;
rotate these vectors to obtain their world-space directions. The editor world is Z-up.
With zero rotation, the camera looks along world -Z with world +Y at the top of the image.
Values returned by GetCameraTransform can be passed directly back to this statement.
Acts on every viewport camera whose label is viewport, or on all of them when it is absent.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.SetCameraTransform.
Returns google.protobuf.Empty.
x : double
World-space X position.
y : double
World-space Y position.
z : double
World-space Z position.
x_rot : double
Rotation around the Y axis (horizontal heading), applied first.
y_rot : double
Rotation around the X axis (vertical tilt), applied second.
z_rot : double
Rotation around the Z axis (roll), applied third.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
SetProjection
RPC
SetProjection(request: viewport.camera.SetProjection) -> google.protobuf.EmptySet viewport cameras to perspective or orthographic projection.
Applies to cameras matching viewport, or all viewport cameras when omitted.
Repeating the same request does not toggle the projection.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.SetProjection.
Returns google.protobuf.Empty.
projection : viewport.camera.ProjectionKind
Target projection type.
viewport optional : string
Label of the viewports to change. Absent, every viewport changes.
ToggleProjection
RPC
ToggleProjection(request: viewport.camera.ToggleProjection) -> google.protobuf.EmptyToggle viewport cameras between perspective and orthographic projection.
Applies to cameras matching viewport, or all viewport cameras when omitted.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.ToggleProjection.
Returns google.protobuf.Empty.
viewport optional : string
Label of the viewports to change. Absent, every viewport changes.
ZoomExtents
RPC
ZoomExtents(request: viewport.camera.ZoomExtents) -> google.protobuf.EmptyMove viewport cameras to frame the scene.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.ZoomExtents.
Returns google.protobuf.Empty.
duration_seconds optional : double
Animation length in seconds. A positive value eases the camera over that long. Absent, zero, negative or non-finite snaps it in one tick.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
ZoomToAabb
RPC
ZoomToAabb(request: viewport.camera.ZoomToAabb) -> google.protobuf.EmptyFit the world-space AABB in matching viewport cameras without changing their rotation. Moves a perspective camera; also adjusts scale for an orthographic camera. By default, the fit does not animate. Returning does not mean a new frame has rendered. No matching camera means no change.
Service method: spatialengine.v1.viewport.camera.ViewportCamera.ZoomToAabb.
Returns google.protobuf.Empty.
min_x : double
World-space minimum corner X.
min_y : double
World-space minimum corner Y.
min_z : double
World-space minimum corner Z.
max_x : double
World-space maximum corner X.
max_y : double
World-space maximum corner Y.
max_z : double
World-space maximum corner Z.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
duration_seconds optional : double
Animation length in seconds. A positive finite value animates; other values snap.
CameraTransform
Message
World-space position and orientation of a camera. The three angles are the YXZ Euler decomposition of the camera rotation, in radians.
translation : math.Vec3
Camera position in world space.
yaw : double
Rotation about the Y axis (horizontal heading), applied first.
pitch : double
Rotation about the X axis (vertical tilt), applied second.
roll : double
Rotation about the Z axis (roll), applied third.
CameraTransformResult
Message
Result of GetCameraTransform.
transform optional : viewport.camera.CameraTransform
Camera position and orientation. Absent when the camera has no transform.
vertical_field_of_view optional : double
The vertical field of view of a perspective camera, in radians, as of the same frame as
transform. Absent for any other projection.
GetCameraTransform
Message
Get the position and rotation of one viewport camera.
Returns a CameraTransformResult containing the world-space position and YXZ Euler
angles in radians. The transform is absent when the camera has no transform.
Fails unless exactly one viewport camera matches viewport.
viewport optional : string
Label of the viewport to read. Absent, the only viewport is read.
GetProjection
Message
Get one viewport camera’s projection type.
Fails unless exactly one viewport camera matches viewport.
viewport optional : string
Label of the viewport to read. Absent, the only viewport is read.
GetProjectionResponse
Message
value optional : viewport.camera.ProjectionKind
ProjectionKind
Enum
Camera projection type.
PROJECTION_KIND_PERSPECTIVE = 0
Objects appear smaller as their distance from the camera increases.
PROJECTION_KIND_ORTHOGRAPHIC = 1
Object size on screen is independent of distance from the camera.
SetCameraTransform
Message
Set the position and rotation of viewport cameras.
The rotation is specified as three Euler angles in YXZ order, matching
EulerRot.YXZ. Despite the field names, the angles are passed to
DQuat.from_euler(EulerRot.YXZ, x_rot, y_rot, z_rot), so:
x_rotis applied around the Y axis (first rotation, horizontal heading).y_rotis applied around the X axis (second rotation, vertical tilt).z_rotis applied around the Z axis (third rotation, roll).
Angles are in radians. Camera-local forward is -Z and local up is +Y;
rotate these vectors to obtain their world-space directions. The editor world is Z-up.
With zero rotation, the camera looks along world -Z with world +Y at the top of the image.
Values returned by GetCameraTransform can be passed directly back to this statement.
Acts on every viewport camera whose label is viewport, or on all of them when it is absent.
x : double
World-space X position.
y : double
World-space Y position.
z : double
World-space Z position.
x_rot : double
Rotation around the Y axis (horizontal heading), applied first.
y_rot : double
Rotation around the X axis (vertical tilt), applied second.
z_rot : double
Rotation around the Z axis (roll), applied third.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
SetProjection
Message
Set viewport cameras to perspective or orthographic projection.
Applies to cameras matching viewport, or all viewport cameras when omitted.
Repeating the same request does not toggle the projection.
projection : viewport.camera.ProjectionKind
Target projection type.
viewport optional : string
Label of the viewports to change. Absent, every viewport changes.
ToggleProjection
Message
Toggle viewport cameras between perspective and orthographic projection.
Applies to cameras matching viewport, or all viewport cameras when omitted.
viewport optional : string
Label of the viewports to change. Absent, every viewport changes.
ZoomExtents
Message
Move viewport cameras to frame the scene.
duration_seconds optional : double
Animation length in seconds. A positive value eases the camera over that long. Absent, zero, negative or non-finite snaps it in one tick.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
ZoomToAabb
Message
Fit the world-space AABB in matching viewport cameras without changing their rotation. Moves a perspective camera; also adjusts scale for an orthographic camera. By default, the fit does not animate. Returning does not mean a new frame has rendered. No matching camera means no change.
min_x : double
World-space minimum corner X.
min_y : double
World-space minimum corner Y.
min_z : double
World-space minimum corner Z.
max_x : double
World-space maximum corner X.
max_y : double
World-space maximum corner Y.
max_z : double
World-space maximum corner Z.
viewport optional : string
Label of the viewports to move. Absent, every viewport moves.
duration_seconds optional : double
Animation length in seconds. A positive finite value animates; other values snap.