Difference between revisions of "IC Python API:RLPy RGlobal"
Chuck (RL) (Talk | contribs) m |
Chuck (RL) (Talk | contribs) m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
== Description == | == 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. | + | This class provides global settings and information for the application, like querying project related settings like [[#GetFps ( )|GetFps]], [[#GetTime ( )|GetTime]], [[#GetScreenSize ( self, nWidth, nHeight )|GetScreenSize]], etc., and operations such as [[#SetTime ( )|SetTime]], [[#RenderVideo ( )|RenderVideo]], etc. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Member Functions == | == Member Functions == | ||
Line 62: | Line 14: | ||
==== Returns ==== | ==== Returns ==== | ||
− | :Project duration - | + | :Project duration - [[IC_Python_API:RLPy_RTime|RTime]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
− | print(RLPy.RGlobal.GetProjectLength()) # | + | print(RLPy.RGlobal.GetProjectLength()) # Print project duration for the current scene |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 75: | Line 27: | ||
:Frame rate - int | :Frame rate - int | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
− | print(RLPy.RGlobal.GetFps()) | + | print(RLPy.RGlobal.GetFps()) # 60 |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 135: | Line 87: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :ePath [IN] path type - RLPy.EPathType | + | :'''ePath''' [IN] path type - RLPy.EPathType |
:*RLPy.EPathType_Temp | :*RLPy.EPathType_Temp | ||
:*RLPy.EPathType_TemplateContent | :*RLPy.EPathType_TemplateContent | ||
Line 152: | Line 104: | ||
:*RLPy.EPathType_CustomWidget | :*RLPy.EPathType_CustomWidget | ||
:*RLPy.EPathType_iCloneAssets | :*RLPy.EPathType_iCloneAssets | ||
− | :strPath [OUT] path name - string | + | :'''strPath''' [OUT] path name - string |
==== Returns ==== | ==== Returns ==== | ||
:Success - RLPy.RStatus.Success | :Success - RLPy.RStatus.Success | ||
− | : | + | :Failure - RLPy.RStatus.Failure |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
temp = "" | temp = "" | ||
ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp) | ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp) | ||
Line 170: | Line 122: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :strAction [IN] action name - string | + | :'''strAction''' [IN] action name - string |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
RLPy.RGlobal.BeginAction('ActionName') | RLPy.RGlobal.BeginAction('ActionName') | ||
RLPy.RGlobal.EndAction() | RLPy.RGlobal.EndAction() | ||
Line 181: | Line 133: | ||
Perform undo and redo actions. This function is currently incomplete | Perform undo and redo actions. This function is currently incomplete | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
+ | # undo / redo | ||
+ | RLPy.RGlobal.BeginAction("Motion") | ||
+ | # do something | ||
+ | RLPy.RGlobal.EndAction() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 189: | Line 145: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :kStart [IN] start time - | + | :'''kStart''' [IN] start time - [[IC_Python_API:RLPy_RTime|RTime]] |
− | :kEnd [IN] end time - | + | :'''kEnd''' [IN] end time - [[IC_Python_API:RLPy_RTime|RTime]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
start_time = RLPy.RTime(0) | start_time = RLPy.RTime(0) | ||
end_time = RLPy.RTime(1000.0) | end_time = RLPy.RTime(1000.0) | ||
Line 202: | Line 158: | ||
Pause the timeline playback and keep the playhead in place. | Pause the timeline playback and keep the playhead in place. | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | ||
RLPy.RGlobal.Pause() | RLPy.RGlobal.Pause() | ||
Line 211: | Line 167: | ||
Stop the timeline playback and return the playhead to the start marker. | Stop the timeline playback and return the playhead to the start marker. | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | ||
RLPy.RGlobal.Stop() | RLPy.RGlobal.Stop() | ||
Line 223: | Line 179: | ||
:Returns true when application playing - bool | :Returns true when application playing - bool | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
if(not RLPy.RGlobal.IsPlaying()): | if(not RLPy.RGlobal.IsPlaying()): | ||
RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000)) | ||
Line 235: | Line 191: | ||
==== Returns ==== | ==== Returns ==== | ||
− | :current time - | + | :current time - [[IC_Python_API:RLPy_RTime|RTime]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
time = RLPy.RGlobal.GetTime() | time = RLPy.RGlobal.GetTime() | ||
print(time) | print(time) | ||
Line 246: | Line 202: | ||
Change the current time for the scene and update the playhead. | Change the current time for the scene and update the playhead. | ||
− | See Also: GetTime | + | See Also: [[#GetTime ( )|GetTime]] |
==== Parameters ==== | ==== Parameters ==== | ||
− | :kTime [IN] Specifies the time to set - | + | :'''kTime''' [IN] Specifies the time to set - [[IC_Python_API:RLPy_RTime|RTime]] |
==== Returns ==== | ==== Returns ==== | ||
:Success - RLPy.RStatus.Success | :Success - RLPy.RStatus.Success | ||
− | : | + | :Failure - RLPy.RStatus.Failure |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
result = RLPy.RGlobal.SetTime(RLPy.RTime(1000)) | result = RLPy.RGlobal.SetTime(RLPy.RTime(1000)) | ||
print(result) # Success or fail | print(result) # Success or fail | ||
Line 268: | Line 224: | ||
==== Returns ==== | ==== Returns ==== | ||
− | :Start frame time - | + | :Start frame time - [[IC_Python_API:RLPy_RTime|RTime]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
time = RLPy.RGlobal.GetStartTime() | time = RLPy.RGlobal.GetStartTime() | ||
print(time) | print(time) | ||
Line 280: | Line 236: | ||
==== Returns ==== | ==== Returns ==== | ||
− | :End frame time - | + | :End frame time - [[IC_Python_API:RLPy_RTime|RTime]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
time = RLPy.RGlobal.GetEndTime() | time = RLPy.RGlobal.GetEndTime() | ||
print(time) | print(time) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === GetMocapManager () === | + | === GetMocapManager ( ) === |
− | Access the Mocap Manager and member functions for | + | Access the Mocap Manager and member functions for [[IC_Python_API:RLPy_RIMocapManager|RIMocapManager]]. |
See Also: [[IC_Python_API:RLPy_RIMocapManager|RIMocapManager]] | See Also: [[IC_Python_API:RLPy_RIMocapManager|RIMocapManager]] | ||
==== Returns ==== | ==== Returns ==== | ||
− | :Pointer to mocap manager - | + | :Pointer to mocap manager - [[IC_Python_API:RLPy_RIMocapManager|RIMocapManager]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
mocap_manager = RLPy.RGlobal.GetMocapManager() | mocap_manager = RLPy.RGlobal.GetMocapManager() | ||
− | print(mocap_manager.IsRunning()) | + | print(mocap_manager.IsRunning()) # True or False |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 306: | Line 262: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :spObject [IN] The object to remove animations - | + | :'''spObject''' [IN] The object to remove animations - [[IC_Python_API:RLPy_RIObject|RIObject]] |
==== Returns ==== | ==== Returns ==== | ||
Line 312: | Line 268: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
avatar_list = RLPy.RScene.GetAvatars() | avatar_list = RLPy.RScene.GetAvatars() | ||
result = RLPy.RGlobal.RemoveAllAnimations( avatar_list[0] ) | result = RLPy.RGlobal.RemoveAllAnimations( avatar_list[0] ) | ||
Line 318: | Line 274: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === RenderVideo () === | + | === RenderVideo ( ) === |
Use the current iClone render settings to output a video. Returns '''RLPy.RStatus.Success''' when successful, else '''RLPy.RStatus.Failure'''. | Use the current iClone render settings to output a video. Returns '''RLPy.RStatus.Success''' when successful, else '''RLPy.RStatus.Failure'''. | ||
Line 326: | Line 282: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
result = RLPy.RGlobal.RenderVideo() | result = RLPy.RGlobal.RenderVideo() | ||
print(result) | print(result) | ||
Line 336: | Line 292: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :nWidth [IN] screen width in pixels - int | + | :'''nWidth''' [IN] screen width in pixels - int |
− | :nHeight [IN] screen height in pixels - int | + | :'''nHeight''' [IN] screen height in pixels - int |
==== Returns ==== | ==== Returns ==== | ||
Line 346: | Line 302: | ||
::Height - int | ::Height - int | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
width = 0 | width = 0 | ||
height = 0 | height = 0 |
Latest revision as of 00:05, 14 April 2020
Contents
- 1 Description
- 2 Member Functions
- 2.1 GetProjectLength ( )
- 2.2 GetFps ( )
- 2.3 GetPath ( )
- 2.4 BeginAction ( )
- 2.5 EndAction ( )
- 2.6 Play ( )
- 2.7 Pause ( )
- 2.8 Stop ( )
- 2.9 IsPlaying ( )
- 2.10 GetTime ( )
- 2.11 SetTime ( )
- 2.12 GetStartTime ( )
- 2.13 GetEndTime ( )
- 2.14 GetMocapManager ( )
- 2.15 RemoveAllAnimations ( spObject )
- 2.16 RenderVideo ( )
- 2.17 GetScreenSize ( self, nWidth, nHeight )
- Main article: Modules.
- Last modified: 04/14/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.
Member Functions
GetProjectLength ( )
Get the current project duration.
Returns
- Project duration - RTime
1 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
1 print(RLPy.RGlobal.GetFps()) # 60
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
- Failure - RLPy.RStatus.Failure
1 temp = ""
2 ret_list = RLPy.RGlobal.GetPath(RLPy.EPathType_Temp, temp)
3 print(ret_list[0]) # success or faild
4 print(ret_list[1]) # path
BeginAction ( )
Perform undo and redo actions. This function is currently incomplete.
Parameters
- strAction [IN] action name - string
1 RLPy.RGlobal.BeginAction('ActionName')
2 RLPy.RGlobal.EndAction()
EndAction ( )
Perform undo and redo actions. This function is currently incomplete
1 # undo / redo
2 RLPy.RGlobal.BeginAction("Motion")
3 # do something
4 RLPy.RGlobal.EndAction()
Play ( )
Controls the timeline playback.
Parameters
1 start_time = RLPy.RTime(0)
2 end_time = RLPy.RTime(1000.0)
3 RLPy.RGlobal.Play(start_time,end_time)
Pause ( )
Pause the timeline playback and keep the playhead in place.
1 RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
2 RLPy.RGlobal.Pause()
Stop ( )
Stop the timeline playback and return the playhead to the start marker.
1 RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
2 RLPy.RGlobal.Stop()
IsPlaying ( )
Check if timeline playback is in progress.
Returns
- Returns true when application playing - bool
1 if(not RLPy.RGlobal.IsPlaying()):
2 RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))
3 if(RLPy.RGlobal.IsPlaying()):
4 RLPy.RGlobal.Stop()
GetTime ( )
Get the current time for the scene according to the location of the playhead.
Returns
- current time - RTime
1 time = RLPy.RGlobal.GetTime()
2 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 - RTime
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 result = RLPy.RGlobal.SetTime(RLPy.RTime(1000))
2 print(result) # Success or fail
3
4 time = RLPy.RGlobal.GetTime()
5 print(time)
GetStartTime ( )
Get the start time for the current project.
Returns
- Start frame time - RTime
1 time = RLPy.RGlobal.GetStartTime()
2 print(time)
GetEndTime ( )
Get the end time for the current project.
Returns
- End frame time - RTime
1 time = RLPy.RGlobal.GetEndTime()
2 print(time)
GetMocapManager ( )
Access the Mocap Manager and member functions for RIMocapManager.
See Also: RIMocapManager
Returns
- Pointer to mocap manager - RIMocapManager
1 mocap_manager = RLPy.RGlobal.GetMocapManager()
2 print(mocap_manager.IsRunning()) # True or False
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 - RIObject
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 avatar_list = RLPy.RScene.GetAvatars()
2 result = RLPy.RGlobal.RemoveAllAnimations( avatar_list[0] )
3 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
1 result = RLPy.RGlobal.RenderVideo()
2 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
1 width = 0
2 height = 0
3 result = RLPy.RGlobal.GetScreenSize(width, height)
4 print(result[0]) # successful or failed
5 print(result[1]) # width
6 print(result[2]) # height