IC8 Python API:RLPy RICamera

From Reallusion Wiki!
Revision as of 18:44, 11 January 2023 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_8_Python_API:Modules|iC8 Modules}} {{Modified}} ==Description== This class is the interface to cameras in the scene. It provides methods to access variou...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: iC8 Modules.
Last modified: 01/11/2023

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)