Difference between revisions of "IC Python API:RLPy RISpotLight"
Chuck (RL) (Talk | contribs) m |
Chuck (RL) (Talk | contribs) m |
||
Line 5: | Line 5: | ||
== Description == | == Description == | ||
− | This class provides | + | This class provides spotlight related operations, i.e. whether or not to cast shadows, light color, light ray direction, light strength, etc. |
− | === Inheritance === | + | === Inheritance === |
− | + | [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > [[IC_Python_API:RLPy_RILight|RILight]] > [[IC_Python_API:RLPy_RISpotLight|RISpotLight]] | |
− | <syntaxhighlight lang=" | + | === Examples === |
+ | |||
+ | <syntaxhighlight lang="python"> | ||
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 54: | Line 56: | ||
:Spotlight's shadow strength - float | :Spotlight's shadow strength - float | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 70: | Line 72: | ||
:Spotlight's range attribute - float | :Spotlight's range attribute - float | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 91: | Line 93: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 115: | Line 117: | ||
:'''True''' if the spotlight is casting shadows, else '''False''' - bool | :'''True''' if the spotlight is casting shadows, else '''False''' - bool | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 134: | Line 136: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
light_object.SetCastShadow(True) | light_object.SetCastShadow(True) | ||
Line 153: | Line 155: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 174: | Line 176: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Line 197: | Line 199: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name | ||
Revision as of 23:56, 8 April 2020
Contents
- 1 Description
- 2 Member Functions
- 2.1 GetDarkenShadowStrength ( self )
- 2.2 GetRange ( self )
- 2.3 GetSpotLightBeam ( self, nAngle, nFalloff )
- 2.4 IsCastShadow ( self )
- 2.5 SetCastShadow ( self, bEnable )
- 2.6 SetDarkenShadowStrength ( self, kTime, fStrength )
- 2.7 SetRange ( self, kTime, fRange )
- 2.8 SetSpotLightBeam ( self, kTime, fFalloffPower, fAngle )
- Main article: Modules.
- Last modified: 04/8/2020
Description
This class provides spotlight related operations, i.e. whether or not to cast shadows, light color, light ray direction, light strength, etc.
Inheritance
RIBase > RIObject > RILight > RISpotLight
Examples
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
# set Parent
prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2")
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
Member Functions
GetDarkenShadowStrength ( self )
Get the Spotlight's shadow strength at a given point in time (0 to 100).
See Also: SetDarkenShadowStrength
Returns
- Spotlight's shadow strength - float
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
#get light shadow strength
print(light_object.GetDarkenShadowStrength())
GetRange ( self )
Get the Spotlight's range distance.
See Also: SetRange
Returns
- Spotlight's range attribute - float
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
#get light range
print(light_object.GetRange())
GetSpotLightBeam ( self, nAngle, nFalloff )
Get the Spotlight's light beam attributes, e.g. beam angle and spill light attenuation (falloff intensity).
See Also: SetSpotLightBeam
Parameters
- nAngle [OUT] Spotlight's angle value - int
- nFalloff [OUT] Spotlight's falloff value - int
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
# 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)
# get light beam
angle = 0
falloff = 0
light_object.GetSpotLightBeam(angle, falloff)
print(angle) # angle = 135
print(falloff) # falloff = 40
IsCastShadow ( self )
Check whether or not the Spotlight is casting shadows.
See Also: SetCastShadow
Returns
- True if the spotlight is casting shadows, else False - bool
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
print(light_object.IsCastShadow())
SetCastShadow ( self, bEnable )
Turn on / off the Spotlight's cast shadows.
See Also: IsCastShadow
Parameters
- bEnable [IN] Whether to cast shadows - bool
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
light_object.SetCastShadow(True)
print(light_object.IsCastShadow())
SetDarkenShadowStrength ( self, kTime, fStrength )
Set the Spotlight's shadow strength at a given point in time (0 to 100).
See Also: GetDarkenShadowStrength
Parameters
- fStrength [IN] Spotlight shadow strength value - float
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
# Set light shadow strength
light_object.SetDarkenShadowStrength(RLPy.RTime(0), 50.0)
SetRange ( self, kTime, fRange )
Set the Spotlight's range value at a given point in time.
See Also: GetRange
Parameters
- kTime [IN] Time at which to set the beam - RTime
- fRange [IN] Spotlight range value - float
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
# Set light range
light_object.SetRange(RLPy.RTime(0), 1000.0)
print(light_object.GetRange())
SetSpotLightBeam ( self, kTime, fFalloffPower, fAngle )
Set the Spotlight's light beam attributes at a given point in time. These attributes include the light beam's angle and spill light attenuation (falloff intensity).
See Also: GetSpotLightBeam
Parameters
- kTime [IN] Time at which to set the beam - RTime
- fFalloffPower [IN] Light falloff power value - float
- fAngle [IN] Light angle value - float
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Spotlight") # Find the spotlight by name
# Set light beam attributes
spot_light_falloff_power = 40.0
spot_light_angle = 135.0
light_object.SetSpotLightBeam(RLPy.RTime(0), spot_light_falloff_power, spot_light_angle)