Difference between revisions of "IC Python API:RLPy RIDirectionalLight"

From Reallusion Wiki!
Jump to: navigation, search
m
m
 
Line 9: Line 9:
 
=== Inheritance ===  
 
=== Inheritance ===  
  
  [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > [[IC_Python_API:RLPy_RILight|RILight]] > RIDirectionalLight
+
  [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > [[IC_Python_API:RLPy_RILight|RILight]] > [[IC_Python_API:RLPy_RIDirectionalLight|RIDirectionalLight]]
  
 
== Member Functions ==
 
== Member Functions ==
Line 17: Line 17:
 
Turn on or off the directional light's cast shadow.
 
Turn on or off the directional light's cast shadow.
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
  
Line 26: Line 26:
  
 
==== Parameters ====
 
==== Parameters ====
:bEnable [in] Enable or disable cast shadows for the light  - bool
+
:'''bEnable''' [IN] Enable or disable cast shadows for the light  - bool
  
 
==== Returns ====
 
==== Returns ====
Line 36: Line 36:
 
Check whether or not the light is casting shadows.
 
Check whether or not the light is casting shadows.
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
  
Line 54: Line 54:
 
Set the directional light's shadow strength at a given point in time (0 to 100).
 
Set the directional light's shadow strength at a given point in time (0 to 100).
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
  
Line 63: Line 63:
  
 
==== Parameters ====
 
==== Parameters ====
:fStrength [in] The Light shadow strength value - float
+
:'''fStrength''' [IN] The Light shadow strength value - float
  
 
==== Returns ====
 
==== Returns ====
Line 76: Line 76:
 
:The light's shadow strength value - float
 
:The light's shadow strength value - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
  

Latest revision as of 01:02, 15 April 2020

Main article: Modules.
Last modified: 04/15/2020

Description

This class provides operations for Directional Lights, e.g. whether or not to cast shadows, the light's color, light strength, etc. You must first retrieve a directional light from the scene in order to use these operations.

Inheritance

RIBase > RIObject > RILight > RIDirectionalLight 

Member Functions

SetCastShadow ( self, bEnable )

Turn on or off the directional light's cast shadow.

1 light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
2 
3 if light_object:
4     light_object.SetCastShadow(True)
5     light_object.SetCastShadow(False)

Parameters

bEnable [IN] Enable or disable cast shadows for the light - bool

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure

IsCastShadow ( self )

Check whether or not the light is casting shadows.

1 light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
2 
3 if light_object:
4     light_object.SetCastShadow(True)
5     print(light_object.IsCastShadow())
6 
7     light_object.SetCastShadow(False)
8     print(light_object.IsCastShadow())

Returns

True if the light is casting shadows, else False - bool

SetDarkenShadowStrength ( self, kTime, fStrength )

Set the directional light's shadow strength at a given point in time (0 to 100).

1 light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
2 
3 if light_object:
4   result = light_object.SetDarkenShadowStrength(RLPy.RGlobal.GetTime(), 50)
5   print(result)

Parameters

fStrength [IN] The Light shadow strength value - float

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure

GetDarkenShadowStrength ( self )

Get the directional light's shadow strength at a given point in time (0 to 100).

Returns

The light's shadow strength value - float
1 light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
2 
3 if light_object:
4   result = light_object.SetDarkenShadowStrength(RLPy.RGlobal.GetTime(), 50)
5   print(light_object.GetDarkenShadowStrength())