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

From Reallusion Wiki!
Jump to: navigation, search
m (Member Functions)
m
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 +
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 +
==Detailed Description==
 +
This class providing common API global functions.
 +
<syntaxhighlight lang="Python">
 +
# Get Secen info
 +
print(RLPy.RGlobal.GetProjectLength()) # print project length of the current scene
 +
print(RLPy.RGlobal.GetFps()) # print 60 FPS
 +
 +
# Time info
 +
RLPy.RGlobal.SetTime(RLPy.RTime(30000)) # set time to 30s
 +
print(RLPy.RGlobal.GetTime().GetValue()) # print 30000
 +
print(RLPy.RGlobal.GetStartTime().GetValue()) # print start time
 +
print(RLPy.RGlobal.GetEndTime().GetValue()) # print end time
 +
 +
# play control
 +
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) # play form 0 to 1s
 +
RLPy.RGlobal.Stop() # stop
 +
RLPy.RGlobal.Pause() # pause
 +
 +
# Get Environment info
 +
temp = ""
 +
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp) # print path,like: Temp,TemplateContent,CustomContent......
 +
print(ret_list[1])
 +
 +
# undo / redo
 +
RLPy.RGlobal.BeginAction("Motion")
 +
# do something
 +
RLPy.RGlobal.EndAction()
 +
</syntaxhighlight>
 +
==Member Functions==
 +
===BeginAction===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.BeginAction ( strAction )
 +
</syntaxhighlight>
 +
Begin action.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''strAction''' [IN] action name - string
 +
</div>
 +
-----
 +
===DoPluginTrialFollowUp===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.DoPluginTrialFollowUp ( strProductNamePath )
 +
</syntaxhighlight>
 +
Trial Follow up (Internal use)
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''strProductNamePath''' [IN] Product name path - string
 +
</div>
 +
-----
 +
===DoSNVerification===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.DoSNVerification ( nProductID, strRegistry, strProductName, strSNFailTitle, strSNFailMsg, strSNExceedTitle, strSNExceedMsg )
 +
</syntaxhighlight>
 +
Verify serial number.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''nProductID''' [IN] product ID - int
  
{{TOC}}
+
'''strRegistry''' [IN] registry - string
{{Parent|IC_Python_API:RL_Python_Modules#System|System Module}}
+
  
Class in RLPy / Inherits from: _object
+
'''strProductName''' [IN] product name - string
  
== Description ==
+
'''strSNFailTitle''' [IN] fail title - string
  
This class provides many of the common API global functions.
+
'''strSNFailMsg''' [IN] fail message - string
  
== Member Functions ==
+
'''strSNExceedTitle''' [IN] exceed title - string
  
{|class = "wikitable" style = "width:100%"
+
'''strSNExceedMsg''' [IN] exceed message - string
!Function
+
</div>
!Syntax
+
====Returns====
!Description
+
<div style="margin-left: 2em;">Remain days of trial version - bool
!Examples
+
</div>
|-
+
-----
!IsPlaying
+
===GetEndTime===
|<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="Python">
def RLPy.RGlobal.IsPlaying()
+
RLPy.RGlobal.GetEndTime ( )
 
</syntaxhighlight>
 
</syntaxhighlight>
|Check if the timeline is playing and returns either TRUE or FALSE.
+
Get end frame time.
|<div class="toccolours mw-collapsible mw-collapsed">
+
====Returns====
Check if the timeline playback is active.
+
<div style="margin-left: 2em;">End frame time - RLPy.RTime
<div class="mw-collapsible-content">
+
</div>
 +
-----
 +
===GetFps===
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
import RLPy
+
RLPy.RGlobal.GetFps ( )
 
+
print(RLPy.RGlobal.IsPlaying())
+
 
+
# True / False
+
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
Get frame per second.
 +
====Returns====
 +
<div style="margin-left: 2em;">Frame rate - int
 
</div>
 
</div>
</div>
+
-----
|-
+
===GetMocapManager===
!GetProjectLength
+
<syntaxhighlight lang="Python">
|<syntaxhighlight lang="Python">
+
RLPy.RGlobal.GetMocapManager ( )
def RLPy.RGlobal.GetProjectLength()
+
 
</syntaxhighlight>
 
</syntaxhighlight>
|Get the length of the project in milliseconds.
+
Get mocap manager.
|<div class="toccolours mw-collapsible mw-collapsed">
+
====Returns====
Fetch the current frame time in milliseconds:
+
<div style="margin-left: 2em;">Pointer to mocap manager - RLPy.RIMocapManager
<div class="mw-collapsible-content">
+
</div>
 +
-----
 +
===GetPath===
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
import RLPy
+
RLPy.RGlobal.GetPath ( ePath, strPath )
 +
</syntaxhighlight>
 +
Get path.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''ePath''' [IN] path type - RLPy.EPathType
 +
*'''RLPy.EPathType_Temp Temporary folder.
 +
*'''RLPy.EPathType_TemplateContent Template content folder.
 +
*'''RLPy.EPathType_CustomContent Custom content folder.
 +
*'''RLPy.EPathType_ProgramDefault Program default folder.
 +
*'''RLPy.EPathType_Morph Morph data folder.
 +
*'''RLPy.EPathType_CreateFace CreateFace data folder.
 +
*'''RLPy.EPathType_Puppet Puppet data folder.
 +
*'''RLPy.EPathType_FacialLayer Facial layer data folder.
 +
*'''RLPy.EPathType_ShareTemplateContent Shared template content folder.
 +
*'''RLPy.EPathType_Thumb Thumbnail folder.
 +
*'''RLPy.EPathType_Image Image folder.
 +
*'''RLPy.EPathType_CreatorAssets Creator assets folder.
 +
*'''RLPy.EPathType_Resource Resource folder.
 +
*'''RLPy.EPathType_FacialSystem Facial system folder.
 +
*'''RLPy.EPathType_CustomWidget Custom widget folder.
 +
*'''RLPy.EPathType_iCloneAssets iClone assets folder
  
# Put the current frame time into a variable.
+
'''strPath''' [OUT] path name - string
time = RLPy.RGlobal.GetTime()
+
</div>
 +
====Return Values====
 +
<div style="margin-left: 2em;">
 +
'''RLPy.RStatus.Success''' Success
  
# Return the current frame time in milliseconds.
+
'''RLPy.RStatus.Failure''' Fail
print(time.GetValue())
+
</div>
 +
-----
 +
===GetProjectLength===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.GetProjectLength ( )
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
Get project length.
 +
====Returns====
 +
<div style="margin-left: 2em;">Project length - RLPy.RTime
 
</div>
 
</div>
 +
-----
 +
===GetStartTime===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.GetStartTime ( )
 +
</syntaxhighlight>
 +
Get start frame time.
 +
====Returns====
 +
<div style="margin-left: 2em;">Start frame time - RLPy.RTime
 
</div>
 
</div>
|-
+
-----
!GetFps
+
===GetTime===
|<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="Python">
def RLPy.RGlobal.GetFps()
+
RLPy.RGlobal.GetTime ( )
 
</syntaxhighlight>
 
</syntaxhighlight>
|Get frames per second.
+
Get current frame time.
|<div class="toccolours mw-collapsible mw-collapsed">
+
====Returns====
Get the project frames per second.
+
<div style="margin-left: 2em;">Current time - RLPy.RTime
<div class="mw-collapsible-content">
+
</div>
 +
-----
 +
===IsPlaying===
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
import RLPy
+
RLPy.RGlobal.IsPlaying ( )
# Get frames per second
+
print(RLPy.RGlobal.GetFps())
+
 
+
#60
+
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
Is application playing?
 +
====Returns====
 +
<div style="margin-left: 2em;">True when application playing - bool
 
</div>
 
</div>
 +
-----
 +
===Play===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.Play ( kStart, kEnd )
 +
</syntaxhighlight>
 +
Play the project.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''kStart''' [IN] start time - RLPy.RTime
 +
 +
'''kEnd''' [IN] end time - RLPy.RTime
 
</div>
 
</div>
|-
+
-----
!GetPath
+
===RemoveAllAnimations===
|<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="Python">
def RLPy.RGlobal.GetPath(ePath, strPath)
+
RLPy.RGlobal.RemoveAllAnimations ( spObject )
 
</syntaxhighlight>
 
</syntaxhighlight>
|<div class="toccolours mw-collapsible mw-collapsed">
+
Remove all animations of object.
Get iClone related path locations using the following enumeration (ePath):
+
<span style="background:#ffcccc">( Experimental API )</span>
<div class="mw-collapsible-content">
+
====Parameters====
*'''RLPy.EPathType_Temp''' Temporary folder.
+
<div style="margin-left: 2em;">
*'''RLPy.EPathType_TemplateContent''' Template content folder.
+
'''spObject''' [IN] The object to remove animations - RLPy.RIObject
*'''RLPy.EPathType_CustomContent''' Custom content folder.
+
*'''RLPy.EPathType_ProgramDefault''' Program default folder.
+
*'''RLPy.EPathType_Morph''' Morph data folder.
+
*'''RLPy.EPathType_CreateFace''' CreateFace data folder.
+
*'''RLPy.EPathType_Puppet''' Puppet data folder.
+
*'''RLPy.EPathType_FacialLayer''' Facial layer data folder.
+
*'''RLPy.EPathType_ShareTemplateContent''' Shared template content folder.
+
*'''RLPy.EPathType_Thumb''' Thumbnail folder.
+
*'''RLPy.EPathType_Image''' Image folder.
+
*'''RLPy.EPathType_CreatorAssets''' Creator assets folder.
+
*'''RLPy.EPathType_Resource''' Resource folder.
+
*'''RLPy.EPathType_FacialSystem''' Facial system folder.
+
*'''RLPy.EPathType_CustomWidget''' Custom widget folder.
+
*'''RLPy.EPathType_iCloneAssets''' iClone assets folder.
+
 
</div>
 
</div>
 +
====Return Values====
 +
<div style="margin-left: 2em;">
 +
'''RLPy.RStatus.Success''' Success
 +
 +
'''RLPy.RStatus.Failure''' Remove failed
 
</div>
 
</div>
|<div class="toccolours mw-collapsible mw-collapsed">
+
-----
Print out a few path locations (Individual path locations may vary).
+
===RenderVideo===
<div class="mw-collapsible-content">
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
import RLPy
+
RLPy.RGlobal.RenderVideo ( )
 +
</syntaxhighlight>
 +
Export project into video file.
 +
<span style="background:#ffcccc">( Experimental API )</span>
 +
====Return Values====
 +
<div style="margin-left: 2em;">
 +
'''RLPy.RStatus.Success''' Success
  
temp = ""
+
'''RLPy.RStatus.Failure''' Remove failed
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)
+
</div>
print("Temp folder: "+ret_list[1])
+
-----
 +
===SetTime===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.SetTime ( kTime )
 +
</syntaxhighlight>
 +
Set current frame time.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''kTime''' [IN] Specifies the time to set - RLPy.RTime
 +
</div>
 +
====Return Values====
 +
<div style="margin-left: 2em;">
 +
'''RLPy.RStatus.Success''' Success
  
# Temp folder: C:\Users\User_Name\AppData\Local\Temp\iClone7Temp\iClone7Temp\
+
'''RLPy.RStatus.Failure''' Fail
 
+
</div>
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_TemplateContent, temp)
+
-----
print("Template content folder: "+ret_list[1])
+
===TrialVersionRemainingDays===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.TrialVersionRemainingDays ( strBinPath, uProductID, strProductFold, strRegRoot )
 +
</syntaxhighlight>
 +
Get remain days of trial version.
 +
====Parameters====
 +
<div style="margin-left: 2em;">
 +
'''strBinPath''' [IN] bin file path - string
  
# Template content folder: C:\Users\Public\Documents\Reallusion\Template\iClone 7 Template
+
'''kProductID''' [IN] product ID
  
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_CustomContent, temp)
+
'''kProductFold''' [IN] product Folder
print("Custom content folder: "+ret_list[1])
+
  
# Custom content folder: C:\Users\Public\Documents\Reallusion\Custom\iClone 7 Custom
+
'''kRegRoot''' [IN] registry root
 
+
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_ProgramDefault, temp)
+
print("Program default folder: "+ret_list[1])
+
 
+
# Program default folder: C:\Program Files\Reallusion\iClone 7\Program\Default\
+
</syntaxhighlight>
+
 
</div>
 
</div>
 +
====Returns====
 +
<div style="margin-left: 2em;">Remain days of trial version - int
 
</div>
 
</div>
|}
+
-----
 +
===EndAction===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.EndAction ( )
 +
</syntaxhighlight>
 +
End action.
 +
-----
 +
===Pause===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.Pause ( )
 +
</syntaxhighlight>
 +
Pause the project.
 +
-----
 +
===Stop===
 +
<syntaxhighlight lang="Python">
 +
RLPy.RGlobal.Stop ( )
 +
</syntaxhighlight>
 +
Stop playing.

Revision as of 19:38, 11 April 2019

Main article: Modules.

Detailed Description

This class providing common API global functions.

# Get Secen info
print(RLPy.RGlobal.GetProjectLength()) # print project length of the current scene
print(RLPy.RGlobal.GetFps()) # print 60 FPS

# Time info
RLPy.RGlobal.SetTime(RLPy.RTime(30000)) # set time to 30s
print(RLPy.RGlobal.GetTime().GetValue()) # print 30000
print(RLPy.RGlobal.GetStartTime().GetValue()) # print start time
print(RLPy.RGlobal.GetEndTime().GetValue()) # print end time

# play control
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) # play form 0 to 1s
RLPy.RGlobal.Stop() # stop
RLPy.RGlobal.Pause() # pause

# Get Environment info
temp = ""
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp) # print path,like: Temp,TemplateContent,CustomContent......
print(ret_list[1])

# undo / redo
RLPy.RGlobal.BeginAction("Motion")
# do something
RLPy.RGlobal.EndAction()

Member Functions

BeginAction

RLPy.RGlobal.BeginAction ( strAction )

Begin action.

Parameters

strAction [IN] action name - string


DoPluginTrialFollowUp

RLPy.RGlobal.DoPluginTrialFollowUp ( strProductNamePath )

Trial Follow up (Internal use)

Parameters

strProductNamePath [IN] Product name path - string


DoSNVerification

RLPy.RGlobal.DoSNVerification ( nProductID, strRegistry, strProductName, strSNFailTitle, strSNFailMsg, strSNExceedTitle, strSNExceedMsg )

Verify serial number.

Parameters

nProductID [IN] product ID - int

strRegistry [IN] registry - string

strProductName [IN] product name - string

strSNFailTitle [IN] fail title - string

strSNFailMsg [IN] fail message - string

strSNExceedTitle [IN] exceed title - string

strSNExceedMsg [IN] exceed message - string

Returns

Remain days of trial version - bool

GetEndTime

RLPy.RGlobal.GetEndTime ( )

Get end frame time.

Returns

End frame time - RLPy.RTime

GetFps

RLPy.RGlobal.GetFps ( )

Get frame per second.

Returns

Frame rate - int

GetMocapManager

RLPy.RGlobal.GetMocapManager ( )

Get mocap manager.

Returns

Pointer to mocap manager - RLPy.RIMocapManager

GetPath

RLPy.RGlobal.GetPath ( ePath, strPath )

Get path.

Parameters

ePath [IN] path type - RLPy.EPathType

  • RLPy.EPathType_Temp Temporary folder.
  • RLPy.EPathType_TemplateContent Template content folder.
  • RLPy.EPathType_CustomContent Custom content folder.
  • RLPy.EPathType_ProgramDefault Program default folder.
  • RLPy.EPathType_Morph Morph data folder.
  • RLPy.EPathType_CreateFace CreateFace data folder.
  • RLPy.EPathType_Puppet Puppet data folder.
  • RLPy.EPathType_FacialLayer Facial layer data folder.
  • RLPy.EPathType_ShareTemplateContent Shared template content folder.
  • RLPy.EPathType_Thumb Thumbnail folder.
  • RLPy.EPathType_Image Image folder.
  • RLPy.EPathType_CreatorAssets Creator assets folder.
  • RLPy.EPathType_Resource Resource folder.
  • RLPy.EPathType_FacialSystem Facial system folder.
  • RLPy.EPathType_CustomWidget Custom widget folder.
  • RLPy.EPathType_iCloneAssets iClone assets folder

strPath [OUT] path name - string

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


GetProjectLength

RLPy.RGlobal.GetProjectLength ( )

Get project length.

Returns

Project length - RLPy.RTime

GetStartTime

RLPy.RGlobal.GetStartTime ( )

Get start frame time.

Returns

Start frame time - RLPy.RTime

GetTime

RLPy.RGlobal.GetTime ( )

Get current frame time.

Returns

Current time - RLPy.RTime

IsPlaying

RLPy.RGlobal.IsPlaying ( )

Is application playing?

Returns

True when application playing - bool

Play

RLPy.RGlobal.Play ( kStart, kEnd )

Play the project.

Parameters

kStart [IN] start time - RLPy.RTime

kEnd [IN] end time - RLPy.RTime


RemoveAllAnimations

RLPy.RGlobal.RemoveAllAnimations ( spObject )

Remove all animations of object. ( Experimental API )

Parameters

spObject [IN] The object to remove animations - RLPy.RIObject

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Remove failed


RenderVideo

RLPy.RGlobal.RenderVideo ( )

Export project into video file. ( Experimental API )

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Remove failed


SetTime

RLPy.RGlobal.SetTime ( kTime )

Set current frame time.

Parameters

kTime [IN] Specifies the time to set - RLPy.RTime

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


TrialVersionRemainingDays

RLPy.RGlobal.TrialVersionRemainingDays ( strBinPath, uProductID, strProductFold, strRegRoot )

Get remain days of trial version.

Parameters

strBinPath [IN] bin file path - string

kProductID [IN] product ID

kProductFold [IN] product Folder

kRegRoot [IN] registry root

Returns

Remain days of trial version - int

EndAction

RLPy.RGlobal.EndAction ( )

End action.


Pause

RLPy.RGlobal.Pause ( )

Pause the project.


Stop

RLPy.RGlobal.Stop ( )

Stop playing.