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

From Reallusion Wiki!
Jump to: navigation, search
m
m
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
== Description ==
 
== Description ==
  
This class facilitates error handling for each API.  It encapsulates the status code as a return value for each API function.  Developers can query, set, or output status codes through this class.  The RStatus codes and their instructions are listed below:
+
This class facilitates error handling for each API.  It encapsulates the status code as a return value for each API function.  Developers can query, set, or output status codes through this class.  The [[IC_Python_API:RLPy_RStatus|RStatus]] codes and their instructions are listed below:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 44: Line 44:
 
|Not currently used.
 
|Not currently used.
 
|}
 
|}
 
<syntaxhighlight lang="Python">
 
status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 
 
 
if status == RLPy.RStatus.Success:
 
    print("sucess")                                # print sucess
 
 
 
if status == RLPy.RStatus.Failure:
 
    print("failure")
 
    status.Clear()
 
    print(status.IsError())                        # False
 
 
 
if status.GetStatusCode() == RLPy.RStatus.Success:
 
    print("sucess")                                # print sucess
 
 
 
print(status.IsError())                           
 
</syntaxhighlight>
 
  
 
== Member Functions ==
 
== Member Functions ==
Line 66: Line 49:
 
=== Clear( self ) ===
 
=== Clear( self ) ===
  
Clear the current error status. '''Success''' status code is returned upon calling this function.
+
Clear the current error status. '''Success''' status code is returned upon calling this function.
  
 
See also: [[#IsError( self )|IsError( self )]]
 
See also: [[#IsError( self )|IsError( self )]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 
status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 
if status == RLPy.RStatus.Failure:
 
if status == RLPy.RStatus.Failure:
Line 84: Line 67:
 
==== Returns ====
 
==== Returns ====
 
:Return the internal status code - int
 
:Return the internal status code - int
 +
:*RLPy.RStatus.Success
 +
:*RLPy.RStatus.Failure
 +
:*RLPy.RStatus.InsufficientMemory
 +
:*RLPy.RStatus.LicenseFailure
 +
:*RLPy.RStatus.IncompatibleVersion
 +
:*RLPy.RStatus.InvalidParameter
 +
:*RLPy.RStatus.UnknownParameter
 +
:*RLPy.RStatus.NotImplemented
 +
:*RLPy.RStatus.Deprecated
 +
:*RLPy.RStatus.NotFound
 +
:*RLPy.RStatus.EndOfFile
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
if status.GetStatusCode() == RLPy.RStatus.Success:
 
if status.GetStatusCode() == RLPy.RStatus.Success:
 
     print("sucess")                                # print sucess
 
     print("sucess")                                # print sucess
Line 95: Line 89:
  
 
==== Returns ====
 
==== Returns ====
:'''true''': An error has occured.
+
:'''True''': An error has occured.
:'''false''': No error.
+
:'''False''': No error.
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 +
status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 +
 
 +
if status == RLPy.RStatus.Success:
 +
    print("sucess")                                # print sucess
 +
 
 
if status == RLPy.RStatus.Failure:
 
if status == RLPy.RStatus.Failure:
     print(status.IsError())                       #True
+
    print("failure")
 +
    status.Clear()
 +
     print(status.IsError())                         # False
 +
 
 +
if status.GetStatusCode() == RLPy.RStatus.Success:
 +
    print("sucess")                                # print sucess
 +
 
 +
print(status.IsError())
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 00:57, 14 April 2020

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

Description

This class facilitates error handling for each API. It encapsulates the status code as a return value for each API function. Developers can query, set, or output status codes through this class. The RStatus codes and their instructions are listed below:

Constant Value
RStatus.Success The operation was successful.
RStatus.Failure The operation failed.
RStatus.InsufficientMemory The operation failed due to insufficient memory.
RStatus.LicenseFailure Application is not licensed for the attempted operation.
RStatus.IncompatibleVersion The applied operation is not compatible with the current version.
RStatus.InvalidParameter An invalid parameter was provided.
RStatus.UnknownParameter The operation was called with an unrecognized argument.
RStatus.NotImplemented This operation has not been implemented.
RStatus.Deprecated This operation has been deprecated.
RStatus.NotFound Not currently used.
RStatus.EndOfFile Not currently used.

Member Functions

Clear( self )

Clear the current error status. Success status code is returned upon calling this function.

See also: IsError( self )

1 status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
2 if status == RLPy.RStatus.Failure:
3     print("failure")
4     status.Clear()
5     print(status.IsError())  # False

GetStatusCode ( self )

Get the current status code. Refer to the status code table above.

Returns

Return the internal status code - int
  • RLPy.RStatus.Success
  • RLPy.RStatus.Failure
  • RLPy.RStatus.InsufficientMemory
  • RLPy.RStatus.LicenseFailure
  • RLPy.RStatus.IncompatibleVersion
  • RLPy.RStatus.InvalidParameter
  • RLPy.RStatus.UnknownParameter
  • RLPy.RStatus.NotImplemented
  • RLPy.RStatus.Deprecated
  • RLPy.RStatus.NotFound
  • RLPy.RStatus.EndOfFile
1 if status.GetStatusCode() == RLPy.RStatus.Success:
2     print("sucess")                                 # print sucess

IsError( self )

Check whether the current status is an error.

Returns

True: An error has occured.
False: No error.
 1 status = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 2    
 3 if status == RLPy.RStatus.Success:
 4     print("sucess")                                 # print sucess
 5    
 6 if status == RLPy.RStatus.Failure:
 7     print("failure")
 8     status.Clear()
 9     print(status.IsError())                         # False
10    
11 if status.GetStatusCode() == RLPy.RStatus.Success:
12     print("sucess")                                 # print sucess
13    
14 print(status.IsError())