IC Python API:RLPy RISpotLight

From Reallusion Wiki!
Jump to: navigation, search
Main article: Modules.

Inheritance

This class inherits public member functions from:

Detailed Description

This class is the interface to spot light in the scene. It provides methods to access various parts of a light such as transformation, color, range etc. All methods of this class are

implemented by the system. ( Experimental Class )
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # use light name to find object

light_object.SetCastShadow(True)
print(light_object.IsCastShadow())

#set light shadow strength
light_object.SetDarkenShadowStrength(RLPy.RTime(0), 50.0)
print(light_object.GetDarkenShadowStrength())

#set light range
light_object.SetRange(RLPy.RTime(0), 1000.0)
print(light_object.GetRange())

# set light beam
spot_light_falloff_power = 40.0
spot_light_angle = 135.0
light_object.SetSpotLightBeam(RLPy.RTime(0), spot_light_falloff_power, spot_light_angle)

angle = 0
falloff = 0
result_list = light_object.GetSpotLightBeam(angle, falloff)
print(result_list[1]) # angle = 135
print(result_list[2]) # falloff = 40


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

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

# set name
light_object.SetName( "new_name" )

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

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

#clone object
clone_light_object = light_object.Clone()
print( clone_light_object )

#is selected
RLPy.RScene.SelectObject(light_object)
print(light_object.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

GetDarkenShadowStrength

RLPy.RISpotLight.GetDarkenShadowStrength ( self )

Get the light darken shadow strength. ( Experimental API )

Returns

The value of the "shadow strength" attribute of the light node - float

GetRange

RLPy.RISpotLight.GetRange ( self )

Get the light range. ( Experimental API )

Returns

The value of the "range" attribute of the light node - float

GetSpotLightBeam

RLPy.RISpotLight.GetSpotLightBeam ( self, nAngle, nFalloff )

Get the spot light beam value. ( Experimental API )

Parameters

nAngle [out] Get the Light angle value - int

nFalloff [out] Get the Light falloff value - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


IsCastShadow

RLPy.RISpotLight.IsCastShadow ( self )

Get the light if cast shadow enable. ( Experimental API )

Returns

True if light is cast shadow enable, False if not - bool

SetCastShadow

RLPy.RISpotLight.SetCastShadow ( self, bEnable )

Set the light's cast shadow is enable. ( Experimental API )

Parameters

bEnable [in] If light's cast shadow is enable - bool

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


SetDarkenShadowStrength

RLPy.RISpotLight.SetDarkenShadowStrength ( self, kTime, fStrength )

Set the light's shadow strength. ( Experimental API )

Parameters

fStrength [in] The Light shadow strength value - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


SetRange

RLPy.RISpotLight.SetRange ( self, kTime, fRange )

Set the light range. ( Experimental API )

Parameters

kTime [in] The time at which to set the beam - RLPy.RTime

fRange [in] The Light range value - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


SetSpotLightBeam

RLPy.RISpotLight.SetSpotLightBeam ( self, kTime, fFalloffPower, fAngle )

Set the spot light beam. ( Experimental API )

Parameters

kTime [in] The time at which to set the beam - RLPy.RTime

fFalloffPower [in] The Light falloff power value - float

fAngle [in] The Light angle value - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail