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

From Reallusion Wiki!
Jump to: navigation, search
m
m
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
== Detailed Description ==
+
{{last_modified}}
This class providing common API global functions.
+
 
 +
== Description ==
 +
 
 +
This class provides global settings and information for the application, like querying project related settings like [[#GetFps ( )|GetFps]], [[#GetTime ( )|GetTime]], [[#GetScreenSize|GetScreenSize]], etc., and operations such as [[#SetTime ( )|SetTime]], [[#RenderVideo ( )|RenderVideo]], etc.
 +
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
# Get Secen info
 
# Get Secen info
print(RLPy.RGlobal.GetProjectLength()) # print project length of the current scene
+
print(RLPy.RGlobal.GetProjectLength())                                   # print project length of the current scene
print(RLPy.RGlobal.GetFps()) # print 60 FPS
+
print(RLPy.RGlobal.GetFps())                                             # print 60 FPS
+
 
# Time info
 
# Time info
RLPy.RGlobal.SetTime(RLPy.RTime(30000)) # set time to 30s
+
RLPy.RGlobal.SetTime(RLPy.RTime(30000))                                   # set time to 30s
print(RLPy.RGlobal.GetTime().GetValue()) # print 30000
+
print(RLPy.RGlobal.GetTime().GetValue())                                 # print 30000
print(RLPy.RGlobal.GetStartTime().GetValue()) # print start time
+
print(RLPy.RGlobal.GetStartTime().GetValue())                             # print start time
print(RLPy.RGlobal.GetEndTime().GetValue()) # print end time
+
print(RLPy.RGlobal.GetEndTime().GetValue())                               # print end time
+
 
# play control
 
# play control
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) # play form 0 to 1s
+
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))                       # play form 0 to 1s
RLPy.RGlobal.Stop() # stop
+
RLPy.RGlobal.Stop()                                                       # stop
RLPy.RGlobal.Pause() # pause
+
RLPy.RGlobal.Pause()                                                     # pause
+
 
# Get Environment info
 
# Get Environment info
 
temp = ""
 
temp = ""
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp) # print path,like: Temp,TemplateContent,CustomContent......
+
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)               # print path, like: Temp,TemplateContent,CustomContent......
 
print(ret_list[1])
 
print(ret_list[1])
+
 
# undo / redo
 
# undo / redo
 
RLPy.RGlobal.BeginAction("Motion")
 
RLPy.RGlobal.BeginAction("Motion")
 
# do something
 
# do something
 
RLPy.RGlobal.EndAction()
 
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
 
  
'''strRegistry''' [IN] registry - string
+
# Get Mocap Manager
 +
mocap_manager = RLPy.RGlobal.GetMocapManager()
 +
print(mocap_manager.IsRunning()) #true or false
  
'''strProductName''' [IN] product name - string
+
# Remove All Animation
 +
avatar_list = RLPy.RScene.GetAvatars()
 +
result = RLPy.RGlobal.RemoveAllAnimations(avatar_list[0])
 +
print(result)#RLPy.RStatus.Success or RLPy.RStatus.Failure
  
'''strSNFailTitle''' [IN] fail title - string
+
# Render Video
 +
print(RLPy.RGlobal.RenderVideo())
 +
#RLPy.RStatus.Success or RLPy.RStatus.Failure
  
'''strSNFailMsg''' [IN] fail message - string
+
# Get Screen Size
 +
width = 0
 +
height = 0
 +
result = RLPy.RGlobal.GetScreenSize(width, height)
 +
print(result[0]) #RLPy.RStatus.Success or RLPy.RStatus.Failure
 +
print(result[1]) #screen width
 +
print(result[2]) #screen height
 +
</syntaxhighlight>
  
'''strSNExceedTitle''' [IN] exceed title - string
+
== Member Functions ==
 +
 
 +
=== GetProjectLength ( ) ===
 +
 
 +
Get the current project duration.
  
'''strSNExceedMsg''' [IN] exceed message - string
 
</div>
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:Project duration - RLPy.RTime
Remain days of trial version - bool
+
 
</div>
+
-----
+
=== EndAction ===
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RGlobal.EndAction ( )
+
import RLPy
 +
print(RLPy.RGlobal.GetProjectLength()) # print project duration for the current scene
 
</syntaxhighlight>
 
</syntaxhighlight>
End action.
+
 
-----
+
=== GetFps ( ) ===
=== GetEndTime ===
+
 
<syntaxhighlight lang="Python">
+
Get the frames-per-second for the current project. Currently fixed at 60 fps.
RLPy.RGlobal.GetEndTime ( )
+
 
</syntaxhighlight>
+
Get end frame time.
+
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:Frame rate - int
End frame time - RLPy.RTime
+
 
</div>
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
print(RLPy.RGlobal.GetFps())
 +
</syntaxhighlight>
  
time = RLPy.RGlobal.GetEndTime() # Grab the end time in milliseconds.
+
=== GetPath ( ) ===
  
# Get seconds from milliseconds.
+
This function can return the absolute paths for the following directories:
mark_out_secs = round(time.GetValue() * 0.001)
+
print("Timeline mark-out located at {0} seconds.".format(mark_out_secs))
+
  
# Timeline mark-out located at 30 seconds.
+
{| class="wikitable"
 +
|-
 +
|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
 +
|}
  
mark_out_frame = RLPy.RTime.GetFrameIndex(time, RLPy.RGlobal.GetFps())
+
==== Parameters ====
print("Timeline mark-out on frame {0}.".format(mark_out_frame))
+
:ePath [IN] path type - RLPy.EPathType
 +
:*RLPy.EPathType_Temp
 +
:*RLPy.EPathType_TemplateContent
 +
:*RLPy.EPathType_CustomContent
 +
:*RLPy.EPathType_ProgramDefault
 +
:*RLPy.EPathType_Morph
 +
:*RLPy.EPathType_CreateFace
 +
:*RLPy.EPathType_Puppet
 +
:*RLPy.EPathType_FacialLayer
 +
:*RLPy.EPathType_ShareTemplateContent
 +
:*RLPy.EPathType_Thumb
 +
:*RLPy.EPathType_Image
 +
:*RLPy.EPathType_CreatorAssets
 +
:*RLPy.EPathType_Resource
 +
:*RLPy.EPathType_FacialSystem
 +
:*RLPy.EPathType_CustomWidget
 +
:*RLPy.EPathType_iCloneAssets
 +
:strPath [OUT] path name - string
  
# Timeline mark-out on frame 1799.
 
</syntaxhighlight>
 
-----
 
=== GetFps ===
 
<syntaxhighlight lang="Python">
 
RLPy.RGlobal.GetFps ( )
 
</syntaxhighlight>
 
Get frame per second.
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:Success - RLPy.RStatus.Success
Frame rate - int
+
:Fail - RLPy.RStatus.Failure
</div>
+
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
temp = ""
 +
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)
 +
print(ret_list[0]) # success or faild
 +
print(ret_list[1]) # path
 +
</syntaxhighlight>
  
# Get the project frames per second.
+
=== BeginAction ( ) ===
  
print(RLPy.RGlobal.GetFps()) # Get frames per second
+
Perform undo and redo actions. This function is currently incomplete.
 +
 
 +
==== Parameters ====
 +
:strAction [IN] action name - string
  
# 60
 
</syntaxhighlight>
 
-----
 
=== GetMocapManager ===
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RGlobal.GetMocapManager ( )
+
import RLPy
 +
RLPy.RGlobal.BeginAction('ActionName')
 +
RLPy.RGlobal.EndAction()
 
</syntaxhighlight>
 
</syntaxhighlight>
Get mocap manager.
+
 
==== Returns ====
+
=== EndAction ( ) ===
<div style="margin-left: 2em;">
+
 
Pointer to mocap manager - RLPy.RIMocapManager
+
Perform undo and redo actions. This function is currently incomplete
</div>
+
 
-----
+
=== GetPath ===
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RGlobal.GetPath ( ePath, strPath )
 
 
</syntaxhighlight>
 
</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
 
  
'''strPath''' [OUT] path name - string
+
=== Play ( ) ===
</div>
+
 
==== Return Values ====
+
Controls the timeline playback.
<div style="margin-left: 2em;">
+
 
'''RLPy.RStatus.Success''' Success
+
==== Parameters ====
 +
:kStart [IN] start time - RLPy.RTime
 +
:kEnd [IN] end time - RLPy.RTime
  
'''RLPy.RStatus.Failure''' Fail
 
</div>
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
start_time = RLPy.RTime(0)
 +
end_time = RLPy.RTime(1000.0)
 +
RLPy.RGlobal.Play(start_time,end_time)
 +
</syntaxhighlight>
  
# Print out a few path locations (Individual path locations may vary).
+
=== Pause ( ) ===
  
temp = ""
+
Pause the timeline playback and keep the playhead in place.
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)
+
print("Temp folder: "+ret_list[1])
+
  
# Temp folder: C:\Users\User_Name\AppData\Local\Temp\iClone7Temp\iClone7Temp\
+
<syntaxhighlight lang="Python">
 +
import RLPy
 +
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
 +
RLPy.RGlobal.Pause()
 +
</syntaxhighlight>
  
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_TemplateContent, temp)
+
=== Stop ( ) ===
print("Template content folder: "+ret_list[1])
+
  
# Template content folder: C:\Users\Public\Documents\Reallusion\Template\iClone 7 Template
+
Stop the timeline playback and return the playhead to the start marker.
  
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_CustomContent, temp)
+
<syntaxhighlight lang="Python">
print("Custom content folder: "+ret_list[1])
+
import RLPy
 +
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
 +
RLPy.RGlobal.Stop()
 +
</syntaxhighlight>
  
# Custom content folder: C:\Users\Public\Documents\Reallusion\Custom\iClone 7 Custom
+
=== IsPlaying ( ) ===
  
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_ProgramDefault, temp)
+
Check if timeline playback is in progress.
print("Program default folder: "+ret_list[1])
+
  
# Program default folder: C:\Program Files\Reallusion\iClone 7\Program\Default\
+
==== Returns ====
 +
:Returns true when application playing - bool
  
</syntaxhighlight>
 
-----
 
=== GetProjectLength ===
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RGlobal.GetProjectLength ( )
+
import RLPy
 +
if(not RLPy.RGlobal.IsPlaying()):
 +
        RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
 +
if(RLPy.RGlobal.IsPlaying()):
 +
        RLPy.RGlobal.Stop()
 
</syntaxhighlight>
 
</syntaxhighlight>
Get project length.
+
 
 +
=== GetTime ( ) ===
 +
 
 +
Get the current time for the scene according to the location of the playhead.
 +
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:current time - RLPy.RTime
Project length - RLPy.RTime
+
 
</div>
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
time = RLPy.RGlobal.GetTime()
 +
print(time)
 +
</syntaxhighlight>
  
# Grab the project duration in milliseconds
+
=== SetTime ( ) ===
time = RLPy.RGlobal.GetProjectLength()
+
  
project_secs = round(time.GetValue() * 0.001)
+
Change the current time for the scene and update the playhead.
print("This project length is {0} seconds.".format(project_secs))
+
  
# This project length is 30 seconds.
+
See Also: GetTime
  
project_frames = RLPy.RTime.GetFrameIndex(time, RLPy.RGlobal.GetFps())
+
==== Parameters ====
print("This project has {0} frames.".format(project_frames))
+
:kTime [IN] Specifies the time to set - RLPy.RTime
  
# This project has 1800 frames.
 
</syntaxhighlight>
 
-----
 
=== GetStartTime ===
 
<syntaxhighlight lang="Python">
 
RLPy.RGlobal.GetStartTime ( )
 
</syntaxhighlight>
 
Get start frame time.
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:Success - RLPy.RStatus.Success
Start frame time - RLPy.RTime
+
:Fail - RLPy.RStatus.Failure
</div>
+
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
result = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
 +
print(result) # Success or fail
  
time = RLPy.RGlobal.GetStartTime() # Grab the start time in milliseconds.
+
time = RLPy.RGlobal.GetTime()
print("Timeline starts at {0} milliseconds.".format(time.GetValue()))
+
print(time)
 
+
# Timeline starts at 0.0 milliseconds.
+
 
</syntaxhighlight>
 
</syntaxhighlight>
-----
+
 
=== GetTime ===
+
=== GetStartTime ( ) ===
<syntaxhighlight lang="Python">
+
 
RLPy.RGlobal.GetTime ( )
+
Get the start time for the current project.
</syntaxhighlight>
+
 
Get current frame time.
+
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:Start frame time - RLPy.RTime
Current time - RLPy.RTime
+
 
</div>
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 
+
time = RLPy.RGlobal.GetStartTime()
time = RLPy.RGlobal.GetTime() # Get the current frame time.
+
print(time)
print(time.GetValue()) # Return the current frame time in milliseconds.
+
 
</syntaxhighlight>
 
</syntaxhighlight>
-----
+
 
=== IsPlaying ===
+
=== GetEndTime ( ) ===
<syntaxhighlight lang="Python">
+
 
RLPy.RGlobal.IsPlaying ( )
+
Get the end time for the current project.
</syntaxhighlight>
+
 
Is application playing?
+
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:End frame time - RLPy.RTime
True when application playing - bool
+
 
</div>
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
time = RLPy.RGlobal.GetEndTime()
 +
print(time)
 +
</syntaxhighlight>
  
# Check if the timeline playback is active.
+
=== GetMocapManager () ===
  
print(RLPy.RGlobal.IsPlaying())
+
Access the Mocap Manager and member functions for RLPy.RIMocapManager.
  
# True / False
+
See Also: [[IC_Python_API:RLPy_RIMocapManager|RIMocapManager]]
</syntaxhighlight>
+
 
-----
+
==== Returns ====
=== Pause ===
+
:Pointer to mocap manager - RLPy.RIMocapManager
<syntaxhighlight lang="Python">
+
RLPy.RGlobal.Pause ( )
+
</syntaxhighlight>
+
Pause the project.
+
-----
+
=== 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>
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 +
mocap_manager = RLPy.RGlobal.GetMocapManager()
 +
print(mocap_manager.IsRunning())
 +
</syntaxhighlight>
 +
 +
=== RemoveAllAnimations ( spObject  ) ===
 +
 +
Remove all animations on a given object and return '''RLPy.RStatus.Success''' if successful, else '''RLPy.RStatus.Failure'''.  Currently supports characters, props, accessories, particles, PopcornFX, lights, motion paths, cameras, wind, images, and global illumination. The timeline needs to update after execution in order to show the changes.
  
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) # play from 0 to 1 second
 
</syntaxhighlight>
 
-----
 
=== RemoveAllAnimations ===
 
<syntaxhighlight lang="Python">
 
RLPy.RGlobal.RemoveAllAnimations ( spObject )
 
</syntaxhighlight>
 
Remove all animations of object.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:spObject [IN] The object to remove animations - RLPy.RIObject
'''spObject''' [IN] The object to remove animations - RLPy.RIObject
+
</div>
+
==== Return Values ====
+
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Remove failed
+
==== Returns ====
</div>
+
:Success - RLPy.RStatus.Success
-----
+
:Failure - RLPy.RStatus.Failure
=== RenderVideo ===
+
<syntaxhighlight lang="Python">
+
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
+
  
'''RLPy.RStatus.Failure''' Remove failed
 
</div>
 
-----
 
=== SetTime ===
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RGlobal.SetTime ( kTime )
+
import RLPy
 +
avatar_list = RLPy.RScene.GetAvatars()
 +
result = RLPy.RGlobal.RemoveAllAnimations( avatar_list[0] )
 +
print(result)
 
</syntaxhighlight>
 
</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
 
  
'''RLPy.RStatus.Failure''' Fail
+
=== RenderVideo () ===
</div>
+
 
 +
Use the current iClone render settings to output a video.  Returns '''RLPy.RStatus.Success''' when successful, else '''RLPy.RStatus.Failure'''.
 +
 
 +
==== Returns ====
 +
:Success - RLPy.RStatus.Success
 +
:Failure - RLPy.RStatus.Failure
 +
 
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
 
import RLPy
 
import RLPy
 
+
result = RLPy.RGlobal.RenderVideo()
frame = 50
+
print(result)
# convert frame number to RTime.
+
time = RLPy.RTime.IndexedFrameTime(frame, RLPy.RGlobal.GetFps())
+
RLPy.RGlobal.SetTime(time) # Move the playhead to the indexed frame time.
+
 
</syntaxhighlight>
 
</syntaxhighlight>
-----
 
=== Stop ===
 
<syntaxhighlight lang="Python">
 
RLPy.RGlobal.Stop ( )
 
</syntaxhighlight>
 
Stop playing.
 
-----
 
=== 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
 
  
'''kProductID''' [IN] product ID
+
=== GetScreenSize ( self, nWidth, nHeight ) ===
  
'''kProductFold''' [IN] product Folder
+
Get the render  output size for the current scene.
 +
 
 +
==== Parameters ====
 +
:nWidth [IN] screen width in pixels - int
 +
:nHeight [IN] screen height in pixels - int
  
'''kRegRoot''' [IN] registry root
 
</div>
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:[Success/Fail, Width, Height] - list
Remain days of trial version - int
+
::Success - RLPy.RStatus.Success
</div>
+
::Failure - RLPy.RStatus.Failure
 +
::Width - int
 +
::Height - int
 +
 
 +
<syntaxhighlight lang="Python">
 +
import RLPy
 +
width = 0
 +
height = 0
 +
result = RLPy.RGlobal.GetScreenSize(width, height)
 +
print(result[0]) # successful or failed
 +
print(result[1]) # width
 +
print(result[2]) # height
 +
</syntaxhighlight>

Revision as of 01:07, 25 March 2020

Main article: Modules.
Last modified: 03/25/2020

Description

This class provides global settings and information for the application, like querying project related settings like GetFps, GetTime, GetScreenSize, etc., and operations such as SetTime, RenderVideo, etc.

# 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()

# Get Mocap Manager
mocap_manager = RLPy.RGlobal.GetMocapManager()
print(mocap_manager.IsRunning()) #true or false

# Remove All Animation
avatar_list = RLPy.RScene.GetAvatars()
result = RLPy.RGlobal.RemoveAllAnimations(avatar_list[0])
print(result)#RLPy.RStatus.Success or RLPy.RStatus.Failure

# Render Video
print(RLPy.RGlobal.RenderVideo())
#RLPy.RStatus.Success or RLPy.RStatus.Failure

# Get Screen Size
width = 0
height = 0
result = RLPy.RGlobal.GetScreenSize(width, height)
print(result[0]) #RLPy.RStatus.Success or RLPy.RStatus.Failure 
print(result[1]) #screen width
print(result[2]) #screen height

Member Functions

GetProjectLength ( )

Get the current project duration.

Returns

Project duration - RLPy.RTime
import RLPy
print(RLPy.RGlobal.GetProjectLength()) # print project duration for the current scene

GetFps ( )

Get the frames-per-second for the current project. Currently fixed at 60 fps.

Returns

Frame rate - int
import RLPy
print(RLPy.RGlobal.GetFps())

GetPath ( )

This function can return the absolute paths for the following directories:

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

Parameters

ePath [IN] path type - RLPy.EPathType
  • RLPy.EPathType_Temp
  • RLPy.EPathType_TemplateContent
  • RLPy.EPathType_CustomContent
  • RLPy.EPathType_ProgramDefault
  • RLPy.EPathType_Morph
  • RLPy.EPathType_CreateFace
  • RLPy.EPathType_Puppet
  • RLPy.EPathType_FacialLayer
  • RLPy.EPathType_ShareTemplateContent
  • RLPy.EPathType_Thumb
  • RLPy.EPathType_Image
  • RLPy.EPathType_CreatorAssets
  • RLPy.EPathType_Resource
  • RLPy.EPathType_FacialSystem
  • RLPy.EPathType_CustomWidget
  • RLPy.EPathType_iCloneAssets
strPath [OUT] path name - string

Returns

Success - RLPy.RStatus.Success
Fail - RLPy.RStatus.Failure
import RLPy
temp = ""
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)
print(ret_list[0]) # success or faild
print(ret_list[1]) # path

BeginAction ( )

Perform undo and redo actions. This function is currently incomplete.

Parameters

strAction [IN] action name - string
import RLPy
RLPy.RGlobal.BeginAction('ActionName')
RLPy.RGlobal.EndAction()

EndAction ( )

Perform undo and redo actions. This function is currently incomplete

Play ( )

Controls the timeline playback.

Parameters

kStart [IN] start time - RLPy.RTime
kEnd [IN] end time - RLPy.RTime
import RLPy
start_time = RLPy.RTime(0)
end_time = RLPy.RTime(1000.0)
RLPy.RGlobal.Play(start_time,end_time)

Pause ( )

Pause the timeline playback and keep the playhead in place.

import RLPy
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
RLPy.RGlobal.Pause()

Stop ( )

Stop the timeline playback and return the playhead to the start marker.

import RLPy
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
RLPy.RGlobal.Stop()

IsPlaying ( )

Check if timeline playback is in progress.

Returns

Returns true when application playing - bool
import RLPy
if(not RLPy.RGlobal.IsPlaying()):
        RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
if(RLPy.RGlobal.IsPlaying()):
        RLPy.RGlobal.Stop()

GetTime ( )

Get the current time for the scene according to the location of the playhead.

Returns

current time - RLPy.RTime
import RLPy
time = RLPy.RGlobal.GetTime()
print(time)

SetTime ( )

Change the current time for the scene and update the playhead.

See Also: GetTime

Parameters

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

Returns

Success - RLPy.RStatus.Success
Fail - RLPy.RStatus.Failure
import RLPy
result = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
print(result) # Success or fail

time = RLPy.RGlobal.GetTime()
print(time)

GetStartTime ( )

Get the start time for the current project.

Returns

Start frame time - RLPy.RTime
import RLPy
time = RLPy.RGlobal.GetStartTime()
print(time)

GetEndTime ( )

Get the end time for the current project.

Returns

End frame time - RLPy.RTime
import RLPy
time = RLPy.RGlobal.GetEndTime()
print(time)

GetMocapManager ()

Access the Mocap Manager and member functions for RLPy.RIMocapManager.

See Also: RIMocapManager

Returns

Pointer to mocap manager - RLPy.RIMocapManager
import RLPy
mocap_manager = RLPy.RGlobal.GetMocapManager()
print(mocap_manager.IsRunning())

RemoveAllAnimations ( spObject )

Remove all animations on a given object and return RLPy.RStatus.Success if successful, else RLPy.RStatus.Failure. Currently supports characters, props, accessories, particles, PopcornFX, lights, motion paths, cameras, wind, images, and global illumination. The timeline needs to update after execution in order to show the changes.

Parameters

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

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
import RLPy
avatar_list = RLPy.RScene.GetAvatars()
result = RLPy.RGlobal.RemoveAllAnimations( avatar_list[0] )
print(result)

RenderVideo ()

Use the current iClone render settings to output a video. Returns RLPy.RStatus.Success when successful, else RLPy.RStatus.Failure.

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
import RLPy
result = RLPy.RGlobal.RenderVideo()
print(result)

GetScreenSize ( self, nWidth, nHeight )

Get the render output size for the current scene.

Parameters

nWidth [IN] screen width in pixels - int
nHeight [IN] screen height in pixels - int

Returns

[Success/Fail, Width, Height] - list
Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
Width - int
Height - int
import RLPy
width = 0
height = 0
result = RLPy.RGlobal.GetScreenSize(width, height)
print(result[0]) # successful or failed
print(result[1]) # width
print(result[2]) # height