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

From Reallusion Wiki!
Jump to: navigation, search
(Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Inheritance== This class inherits public member functions from: *RLPy.RILight *IC...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
==Inheritance==
+
{{last_modified}}
This class inherits public member functions from:
+
*[[IC_Python_API:RLPy_RILight|RLPy.RILight]]
+
*[[IC_Python_API:RLPy_RIObject|RLPy.RIObject]]
+
*[[IC_Python_API:RLPy_RIBase|RLPy.RIBase]]
+
==Detailed Description==
+
This class is the interface to directional 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. <span style="background:#ffcccc">( Experimental Class )</span> <syntaxhighlight lang="Python">
+
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light") # use light name to find object
+
  
light_object.SetCastShadow(True)
+
== Description ==
print(light_object.IsCastShadow())
+
+
#set light shadow strength
+
light_object.SetDarkenShadowStrength(RLPy.RTime(0), 50.0)
+
print(light_object.GetDarkenShadowStrength())
+
  
prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2")
+
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.
# set Parent
+
result = light_object.SetParent(prop2)
+
result = light_object.SetParent(None) #detach from parent
+
  
# set name
+
=== Inheritance ===
light_object.SetName( "new_name" )
+
  
#get bound
+
[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > [[IC_Python_API:RLPy_RILight|RILight]] > [[IC_Python_API:RLPy_RIDirectionalLight|RIDirectionalLight]]
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
+
== Member Functions ==
ret_pos = RLPy.RVector3()
+
ret_rot = RLPy.RVector3()
+
light_object.GetPivot( ret_pos, ret_rot )
+
print(ret)
+
  
#clone object
+
=== SetCastShadow ( self, bEnable ) ===
clone_light_object = light_object.Clone()
+
print( clone_light_object )
+
  
#is selected
+
Turn on or off the directional light's cast shadow.
RLPy.RScene.SelectObject(light_object)
+
 
print(light_object.IsSelected()) #True
+
<syntaxhighlight lang="python" line='line'>
 +
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 +
 
 +
if light_object:
 +
    light_object.SetCastShadow(True)
 +
    light_object.SetCastShadow(False)
 
</syntaxhighlight>
 
</syntaxhighlight>
==Operators==
+
 
This class supports the following operators:
+
==== Parameters ====
{| class="wikitable"
+
:'''bEnable''' [IN] Enable or disable cast shadows for the light  - bool
!Member
+
 
!Operation
+
==== Returns ====
!Syntax
+
:Success - RLPy.RStatus.Success
!Description
+
:Failure - RLPy.RStatus.Failure
!Example
+
 
|-
+
=== IsCastShadow ( self ) ===
! scope="row"|__eq__
+
 
|Equality
+
Check whether or not the light is casting shadows.
|a == b
+
 
|If the values of two operands are equal, then the condition becomes true.
+
<syntaxhighlight lang="python" line='line'>
|(a == b) is not true.
+
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
|}
+
 
==Member Functions==
+
if light_object:
===GetDarkenShadowStrength===
+
    light_object.SetCastShadow(True)
<syntaxhighlight lang="Python">
+
    print(light_object.IsCastShadow())
RLPy.RIDirectionalLight.GetDarkenShadowStrength ( self )
+
 
 +
    light_object.SetCastShadow(False)
 +
    print(light_object.IsCastShadow())
 
</syntaxhighlight>
 
</syntaxhighlight>
Get the light darken shadow strength.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Returns====
 
<div style="margin-left: 2em;">The value of the "shadow strength" attribute of the light node - float
 
</div>
 
-----
 
===IsCastShadow===
 
<syntaxhighlight lang="Python">
 
RLPy.RIDirectionalLight.IsCastShadow ( self )
 
</syntaxhighlight>
 
Get the light if cast shadow enable.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Returns====
 
<div style="margin-left: 2em;">True if light is cast shadow enable, False if not - bool
 
</div>
 
-----
 
===SetCastShadow===
 
<syntaxhighlight lang="Python">
 
RLPy.RIDirectionalLight.SetCastShadow ( self, bEnable )
 
</syntaxhighlight>
 
Set the light's cast shadow is enable.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''bEnable''' [in] If light's cast shadow is enable - bool
+
==== Returns ====
</div>
+
:'''True''' if the light is casting shadows, else '''False''' - bool
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
=== SetDarkenShadowStrength ( self, kTime, fStrength ) ===
  
'''RLPy.RStatus.Failure''' Fail
+
Set the directional light's shadow strength at a given point in time (0 to 100).
</div>
+
 
-----
+
<syntaxhighlight lang="python" line='line'>
===SetDarkenShadowStrength===
+
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
<syntaxhighlight lang="Python">
+
 
RLPy.RIDirectionalLight.SetDarkenShadowStrength ( self, kTime, fStrength )
+
if light_object:
 +
  result = light_object.SetDarkenShadowStrength(RLPy.RGlobal.GetTime(), 50)
 +
  print(result)
 
</syntaxhighlight>
 
</syntaxhighlight>
Set the light's shadow strength.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''fStrength''' [in] The Light shadow strength value - float
+
==== Parameters ====
</div>
+
:'''fStrength''' [IN] The Light shadow strength value - float
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
==== Returns ====
 +
:Success - RLPy.RStatus.Success
 +
:Failure - RLPy.RStatus.Failure
  
'''RLPy.RStatus.Failure''' Fail
+
=== GetDarkenShadowStrength ( self ) ===
</div>
+
 
 +
Get the directional light's shadow strength at a given point in time (0 to 100).
 +
 
 +
==== Returns ====
 +
:The light's shadow strength value - float
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
light_object = RLPy.RScene.FindObject(RLPy.EObjectType_Light, "Dir. Light")
 +
 
 +
if light_object:
 +
  result = light_object.SetDarkenShadowStrength(RLPy.RGlobal.GetTime(), 50)
 +
  print(light_object.GetDarkenShadowStrength())
 +
</syntaxhighlight>

Latest revision as of 00: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())