IC8 Python API:RLPy RICamera

From Reallusion Wiki!
Jump to: navigation, search

Contents

Main article: iC8 Modules.
Last modified: 10/21/2026

Description

This class is the interface to cameras in the scene. It provides methods to access various parts of a camera such as FOV, transformation, etc. All methods of this class are implemented by the system.

Class Methods

RLPy.RICamera.AddDofKey(self, kKey, kDofData)

Add a depth of field key in camera.

Experimental API

Parameters

kKey[IN] The key for time and transition control, now only supports linear - RLPy.RKey
kDofData[IN] The dof setting for key - RLPy.RCameraDofData

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
 1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
 2 
 3 #add dof key
 4 new_data = RLPy.RCameraDofData()
 5 new_data.SetEnable( True )
 6 new_data.SetFocus(20)
 7 data.SetRange(80)
 8 dof_key = RLPy.RKey()
 9 dof_key.SetTime(RLPy.RTime(66))
10 dof_key.SetTransitionType(RLPy.ETransitionType_Linear)
11 dof_key.SetTransitionStrength(50)
12 camera.AddDofKey(dof_key, new_data)

RLPy.RICamera.GetAngleOfView(self, kTime)

Get the angle view of the camera.

Experimental API

Returns

the angle view value of the camera - float

Parameters

kTime[IN] the time to get - RLPy.RLTime
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 #get camera angle of view
3 print(camera.GetAngleOfView(RLPy.RGlobal.GetTime()))

RLPy.RICamera.GetAperture(self, fWidth, fHeight)

Get aperture data of the camera.

Experimental API

Parameters

fWidth[IN] the Width to get - float
fHeight[IN] the Height to get - float

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 #get camera aperture
4 width = 0
5 height = 0
6 result = camera.GetAperture(width,height)
7 print(result[0])
8 print(result[1])
9 print(result[2])

RLPy.RICamera.GetDOFData(self)

Get depth of field data of the camera.

Experimental API

Returns

Camera DOF data - RLPy.RCameraDofData

 1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
 2 
 3 #get camera DOF data
 4 data = camera.GetDOFData()
 5 if(data!= None):
 6     print(data.GetEnable())
 7     print(data.GetFocus())
 8     print(data.GetRange())
 9     print(data.GetNearTransitionRegion())
10     print(data.GetFarTransitionRegion())
11     print(data.GetNearBlurScale())
12     print(data.GetFarBlurScale())
13     print(data.GetMinBlendDistance())
14     print(data.GetCenterColorWeight())
15     print(data.GetEdgeDecayPower())

RLPy.RICamera.GetDofKeyCount(self)

Get the number of DOF keys of the control.

Experimental API

Returns

Number of DOF Keys - int

1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 #get dof key count
4 dof_key_count = camera.GetDofKeyCount()
5 print(dof_key_count)

RLPy.RICamera.GetFarClippingPlane(self)

Get far clipping plane of the camera.

Experimental API

Returns

the far clipping plane of the camera - int

1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 #set and get far clipping plane of the camera
4 camera.SetFarClippingPlane(25)
5 print(camera.GetFarClippingPlane())

RLPy.RICamera.GetFitFovType(self)

Get field of view setting of the camera.

Experimental API

Returns

the type of setting(Horizontal / Vertical)- RLPy.ECameraFitResolution

  • RLPy.ECameraFitResolution_None
  • RLPy.ECameraFitResolution_Horizontal
  • RLPy.ECameraFitResolution_Vertical
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 #get field of view setting of the camera
4 fov_type = camera.GetFitFovType()
5 print(fov_type)

RLPy.RICamera.GetFitRenderRegionType(self)

Get fit resolution setting of the camera.

Experimental API

Returns

the type of setting(Horizontal / Vertical)- RLPy.ECameraFitResolution

  • RLPy.ECameraFitResolution_None
  • RLPy.ECameraFitResolution_Horizontal
  • RLPy.ECameraFitResolution_Vertical
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 #get fit resolution setting of the camera
4 fov_type = camera.GetFitRenderRegionType()
5 print(fov_type)

RLPy.RICamera.GetFocalLength(self, kTime)

Get the focal length of the camera.

Experimental API

Returns

the focal length of the camera - float

Parameters

kTime[IN] the time to get - RLPy.RLTime
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 # set and get focal length
4 camera.SetFocalLength(RLPy.RTime(60), 100.0)
5 print(camera.GetFocalLength(RLPy.RTime(60)))    # 100

RLPy.RICamera.GetFocalLengthKeyCount(self)

Get the number of Focal Length keys of the control.

Experimental API

Returns

Number of focal length Keys - int

1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 print(camera.GetFocalLengthKeyCount())

RLPy.RICamera.GetNearClippingPlane(self)

Get near clipping plane of the camera.

Experimental API

Returns

the near clipping plane of the camera - int

1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 print(camera.GetNearClippingPlane())

RLPy.RICamera.IsLookAtMode(self, kTime)

Check that this camera is in LookAt mode.

Experimental API

Parameters

kTime[IN] time for check - RLPy.RLTime

Returns

True means that this camera is in Lookat mode at this time, False means not - bool

1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 print(camera.IsLookAtMode(RLPy.RGlobal.GetTime()))

RLPy.RICamera.RemoveDofKey(self, kKey)

Remove a depth of field key in camera.

Experimental API

Parameters

kKey[IN] Key to remove - RLPy.RKey

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
 1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
 2 
 3 #add and remove DOF key
 4 dof_key = RLPy.RKey()
 5 dof_key.SetTime(RLPy.RTime(66))
 6 dof_key.SetTransitionType(RLPy.ETransitionType_Linear)
 7 dof_key.SetTransitionStrength(50)
 8 camera.AddDofKey(dof_key, new_data)
 9 #remove dof key
10 camera.RemoveDofKey(dof_key)

RLPy.RICamera.RemoveDofKeys(self)

Remove all dof keys of this camera object.

Experimental API

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 
3 # remove focal length key
4 camera.RemoveFocalLengthKey(RLPy.RTime(60))
5 camera.RemoveFocalLengthKeys()
6 print(camera.GetFocalLengthKeyCount()) # 0

RLPy.RICamera.RemoveFocalLengthKey(self, kTime)

Remove a focal length key in camera.

Experimental API

Parameters

kKey[IN] time to remove.

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 # remove focal length key
2 camera.RemoveFocalLengthKey(RLPy.RTime(60))
3 camera.RemoveFocalLengthKeys()
4 print(camera.GetFocalLengthKeyCount()) # 0

RLPy.RICamera.RemoveFocalLengthKeys(self)

Remove all focal length keys of this camera object.

Experimental API

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 camera.RemoveFocalLengthKeys()

RLPy.RICamera.SetFarClippingPlane(self, nFarPlane)

Set far clipping plane of the camera.

Experimental API

Parameters

nFarPlane[IN] the far clipping plane value to set - int

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 camera.SetFarClippingPlane(25)

RLPy.RICamera.SetFocalLength(self, kTime, fFocalLength)

Set the focal length of the camera.

Experimental API

Parameters

kTime[IN] the time to set - RLPy.RLTime
fFocalLength[IN] The focal length value to be set - float

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2    
3 # set focal length
4 camera.SetFocalLength(RLPy.RTime(60), 100.0)
5 print(camera.GetFocalLength(RLPy.RTime(60)))    # 100

RLPy.RICamera.SetNearClippingPlane(self, nNearPlane)

Set near clipping plane of the camera.

Experimental API

Parameters

nNearPlane[IN] the near clipping plane value to set - int

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")
2 camera.SetNearClippingPlane(50)

Description

This class is used to access camera objects in the scene. A camera can be divided into 3 main parts: the device body, camera lens, and viewing area. Therefore, the interfaces available are: aperture, focal length, angle of view, depth of field, near / far plane settings, and viewport fitting. See Also: RCameraDofData, RScene.

Constructor & Destructor

__init__ (self, *args, **kwargs)

Initializes a new ri camera instance.

Parameters

  • args
  • kwargs

Member Functions

AddDofKey (self, kKey, kDofData)

Key the camera's Depth of Field (DOF) at a given time. Use RCameraDofData to adjust the DOF settings.

Parameters

  • kKey
  • kDofData

GetAngleOfView (self, kTime)

Get the camera's Angle of View (AOV) at a given time, in degrees (1° to 165°).

Parameters

  • kTime

GetAperture (self, fWidth, fHeight)

Get the camera's aperture dimensions, i.e. the width and height of the photo-sensitive capture plate.

Parameters

  • fWidth
  • fHeight

GetDOFData (self)

Get the camera's Depth of Field (DOF) data.

GetDofKeyCount (self)

Gets the number of DOF keys of the control.

GetFarClippingPlane (self)

Get the camera's Far Clipping Plane distance.

GetFarClippingPlaneF (self)

Gets far clipping plane of the camera (float version).

GetFitFovType (self)

Get the camera's Fit value for the Field of View. The possible values are the following: *RLPy.ECameraFitResolution_Horizontal - use the horizontal width value for fitting. *RLPy.ECameraFitResolution_Vertical - use the vertical height value for fitting.

GetFitRenderRegionType (self)

Get the camera's Fit Resolution setting. The possible values are the following: *RLPy.ECameraFitResolution_Horizontal - use the horizontal width value for fitting. *RLPy.ECameraFitResolution_Vertical - use the vertical height value for fitting.

GetFocalLength (self, kTime)

Get the camera's Focal Length distance at a given time.

Parameters

  • kTime

GetFocalLengthKeyCount (self)

Gets the number of Focal Length keys of the control.

GetNearClippingPlane (self)

Get the camera's Near Clipping Plane distance.

GetNearClippingPlaneF (self)

Gets near clipping plane of the camera (float version).

GetProjectMode (self)

Gets the projection mode of the camera.

IsLookAtMode (self, kTime)

Checks that this camera is in LookAt mode.

Parameters

  • kTime

RemoveDofKey (self, kKey)

Removes a depth of field key in camera.

Parameters

  • kKey

RemoveDofKeys (self)

Removes all dof keys of this camera object.

RemoveFocalLengthKey (self, kTime)

Removes a focal length key in camera.

Parameters

  • kTime

RemoveFocalLengthKeys (self)

Removes all focal length keys of this camera object.

SetCameraLocation (self, eType)

Sets Camera to default location.

Parameters

  • eType

SetFarClippingPlane (self, nFarPlane)

Set the Far Clipping Plane distance. This value must be larger than the Near Clipping Plane distance.

Parameters

  • nFarPlane

SetFarClippingPlaneF (self, fFarPlane)

Sets far clipping plane of the camera (float version).

Parameters

  • fFarPlane

SetFocalLength (self, kTime, fFocalLength)

Set the camera's Focal Length at a given point in time. The possible values lie between 2.5 and 3,500 mm. If the value set lies outside of this range, then the original Focal Length value remains unchanged.

Parameters

  • kTime
  • fFocalLength

SetNearClippingPlane (self, nNearPlane)

Set the Near Clipping Plane distance, must be smaller than the Far Clipping Plane distance.

Parameters

  • nNearPlane

SetNearClippingPlaneF (self, fNearPlane)

Sets near clipping plane of the camera (float version).

Parameters

  • fNearPlane

SetProjectMode (self, bPerspective)

Sets the projection mode of the camera.

Parameters

  • bPerspective

SetWorldView (self, vWorldPosition, vWorldView, vWorldUp)

Sets the world-space position, view direction and up direction of the camera.

Parameters

  • vWorldPosition
  • vWorldView
  • vWorldUp

Properties

thisown

Indicates whether this SWIG proxy owns the underlying C++ object.