IC Python API:RLPy RICamera

From Reallusion Wiki!
Revision as of 23:42, 26 March 2019 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} == Detailed Description == This class is the interface to cameras in the scene. <span style="background:#ffcccc">( E...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Main article: Modules.

Detailed Description

This class is the interface to cameras in the scene. ( Experimental Class ) 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.
camera = RLPy.RScene.FindObject(RLPy.EObjectType_Camera, "Camera")

# set focal length
camera.SetFocalLength(RLPy.RTime(60), 100.0)
print(camera.GetFocalLength(RLPy.RTime(60))) # 100

# set transform
control = camera.GetControl("Transform")
transform = RLPy.RTransform.IDENTITY
transform.T().x = -75.0
transform.T().y = -150.0
transform.T().z = 250.0
time = RLPy.RTime(0)
control.SetValue(time, transform)

prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2")
# set Parent
result = camera.SetParent(prop2)
result = camera.SetParent(None) #detach from parent

# link to & unlink
result = camera.LinkTo(prop2, RLPy.RTime(0))
result = camera.UnLink(RLPy.RTime(0))

# set name
camera.SetName( "new_name" )

#get bound
ret_max = RLPy.RVector3()
ret_center = RLPy.RVector3()
ret_min = RLPy.RVector3()
ret = camera.GetBounds( ret_max, ret_center, ret_min )

#get pivot
ret_pos = RLPy.RVector3()
ret_rot = RLPy.RVector3()
camera.GetPivot( ret_pos, ret_rot )

#is selected
print(camera.IsSelected()) #True


This class supports the following operators:

Member Operation Syntax Description Example
__eq__ Equality a == b If the values of two operands are equal, then the condition becomes true. (a == b) is not true.

Member Functions


RLPy.RICamera.GetFocalLength ( self, kTime )

Get the focal length of the camera. ( Experimental API )


The focal length of the camera - float


kTime [IN] the time to get - RLPy.RTime


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

Set the focal length of the camera. ( Experimental API )


kTime [IN] the time to set - RLPy.RTime

fFocalLength [IN] The focal length value to be set - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail