editor.viewport

Viewport camera and rendering control

← API Reference

editor.viewport.getCamera

Returns the current viewport camera position, rotation, view mode, and realtime status.

No parameters.

Returns:

Name Type Description
positionobject{x, y, z} camera location
rotationobject{pitch, yaw, roll} camera rotation
view_mode_indexnumberNumeric EViewModeIndex
view_modestringHuman-readable name (e.g. "Lit", "Wireframe")
is_realtimeboolWhether viewport is in realtime mode
is_perspectiveboolWhether camera is in perspective mode

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.viewport.getCamera" }

Example Response:

{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "position": { "x": 0.0, "y": 0.0, "z": 200.0 },
    "rotation": { "pitch": -30.0, "yaw": 0.0, "roll": 0.0 },
    "view_mode_index": 0, "view_mode": "Lit",
    "is_realtime": true, "is_perspective": true
  }
}

editor.viewport.setCamera

Sets the viewport camera position and/or rotation.

Parameters:

Name Type Required Description
positionobjectNo*{x, y, z} new camera position
rotationobjectNo*{pitch, yaw, roll} new camera rotation

*At least one of position or rotation must be provided.

Returns:

Name Type Description
successboolWhether camera was updated
position_setboolWhether position was changed
rotation_setboolWhether rotation was changed

Example Request:

{
  "jsonrpc": "2.0", "id": 1, "method": "editor.viewport.setCamera",
  "params": { "position": { "x": 500, "y": 0, "z": 300 }, "rotation": { "pitch": -45, "yaw": 0, "roll": 0 } }
}

editor.viewport.setRenderMode

Changes the viewport render/view mode.

Parameters:

Name Type Required Description
modestringNo*One of: wireframe, unlit, lit, detail_lighting, lighting_only, light_complexity, shader_complexity
indexnumberNo*Numeric EViewModeIndex value

*One of mode or index must be provided.

Returns:

Name Type Description
successboolWhether mode was changed
modestringActive view mode name
mode_indexnumberActive view mode index

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.viewport.setRenderMode", "params": { "mode": "wireframe" } }

editor.viewport.setRealtime

Enables or disables realtime rendering in the viewport.

Parameters:

Name Type Required Description
enabledboolYesWhether realtime mode should be on

Returns:

Name Type Description
successboolWhether setting was applied
is_realtimeboolNew realtime state

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.viewport.setRealtime", "params": { "enabled": true } }

editor.viewport.focusOnActor

Focuses the viewport camera on a specific actor.

Parameters:

Name Type Required Description
actor_pathstringYesFull path name of the actor to focus on
instantboolNoTeleport camera instantly vs. animated (default false)

Returns:

Name Type Description
successboolWhether focus succeeded
actor_pathstringActor path
actor_namestringActor display label

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.viewport.focusOnActor", "params": { "actor_path": "/Game/Maps/Level.Level:PersistentLevel.Cube" } }