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

From Reallusion Wiki!
Jump to: navigation, search
m (RStatus.isError)
m
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
{{Parent|IC_Python_API:RL_Python_Modules#System|System Module}}
+
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 +
== Detailed Description ==
 +
This class is used for API level error handling.
 +
Most API methods return this class as a return value. The developer
 +
can query, clear, print the error code along with the error description.
 +
<syntaxhighlight lang="Python">
 +
status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
  
Class in RLPy / Inherits from:_object
+
if status == RLPy.RStatus.Success:
 +
print("sucess") # print sucess
  
== Description ==
+
if status:
 +
print("sucess") # print sucess
  
API level error handling.
+
if status.GetStatusCode() == RLPy.RStatus.Success:
 +
print("sucess") # print sucess
  
Most API methods return this class. you can query, clear, and print the error code along with the error description.
+
print(status.IsError()) # print false
 +
</syntaxhighlight>
 +
==Constructor & Destructors==
 +
===__init__===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RStatus.__init__ ( self, args )
 +
</syntaxhighlight>
 +
The copy constructor of the class.
 +
Initialize a new RStatus object with the values from another RStatus object.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
  
== Member Functions ==
+
'''status''' [IN] The target RStatus object.
 +
</div>
 +
==Member Functions==
 +
===Clear===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RStatus.Clear ( self )
 +
</syntaxhighlight>
 +
Clear error codes from the RStatus instance.
 +
After this call, it will behave as if it contained Success.
 +
-----
 +
===GetStatusCode===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RStatus.GetStatusCode ( self )
 +
</syntaxhighlight>
 +
Retrieve the type of error that occurred, as specified in the RStatusCode enumeration.
 +
====Returns====
 +
<div style="margin-left: 2em;">The type of error that occurred - RLPy.RStatusCode
 +
</div>
 +
-----
 +
===IsError===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RStatus.IsError ( self )
 +
</syntaxhighlight>
 +
Determines whether there is an error.
 +
====Return Values====
 +
<div style="margin-left: 2em;">
  
=== Clear ===
+
'''true''' An error has occurred.
  
{{Input|def RLPY.RStatus.Clear(self)}}
+
'''false''' The operation was successful
 
+
</div>
=== GetStatusCode ===
+
 
+
{{Input|def RLPY.RStatus.GetStatusCode(self)}}
+
 
+
===isError ===
+
 
+
{{Input|def RLPY.RStatus.IsError(self)}}
+
 
+
== Constructor & Destructor ==
+

Revision as of 02:07, 26 March 2019

Main article: Modules.

Detailed Description

This class is used for API level error handling. Most API methods return this class as a return value. The developer can query, clear, print the error code along with the error description.

status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))

if status == RLPy.RStatus.Success:
print("sucess") # print sucess

if status:
print("sucess") # print sucess

if status.GetStatusCode() == RLPy.RStatus.Success:
print("sucess") # print sucess

print(status.IsError()) # print false

Constructor & Destructors

__init__

RLPy.RStatus.__init__ ( self, args )

The copy constructor of the class. Initialize a new RStatus object with the values from another RStatus object.

Parameters

status [IN] The target RStatus object.

Member Functions

Clear

RLPy.RStatus.Clear ( self )

Clear error codes from the RStatus instance. After this call, it will behave as if it contained Success.


GetStatusCode

RLPy.RStatus.GetStatusCode ( self )

Retrieve the type of error that occurred, as specified in the RStatusCode enumeration.

Returns

The type of error that occurred - RLPy.RStatusCode

IsError

RLPy.RStatus.IsError ( self )

Determines whether there is an error.

Return Values

true An error has occurred.

false The operation was successful