IC Python API:RLPy RICamera

From Reallusion Wiki!
Revision as of 01:26, 27 March 2019 by Chuck (RL) (Talk | contribs)

Jump to: navigation, search
Main article: Modules.

This class inherits member functions from: RLPy.RIObject RLPy.RIBase

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 )
print(ret)

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

#is selected
RLPy.RScene.SelectObject(camera)
print(camera.IsSelected()) #True

Operators

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

GetFocalLength

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.RTime


SetFocalLength

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

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

Parameters

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