Difference between revisions of "IC Python API:RLPy RControl"
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Detailed Description== This class is the base class of all controllers. RControl is the class from which you may d...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_Python_API:RL_Python_Modules|Modules}} | {{Parent|IC_Python_API:RL_Python_Modules|Modules}} | ||
− | == | + | {{last_modified}} |
− | This | + | |
− | + | == Description == | |
− | + | ||
− | + | Controllers are used to manage animations and create animation effects, which will give a key value when fed a time. This is the base class for all controller related classes which are distinquished according to different data types that they record and deal with: [[IC_Python_API:RLPy_RTransformControl|RTransformControl]] dealing with transform data types and [[IC_Python_API:RLPy_RFloatControl|RFloatControl]] for float data types. Controllers mainly use keyframes to record animations and create keys; and has the ability to interpolate values between keys. | |
− | + | ||
− | + | Use [[#GetKeyCount ( self )|GetKeyCount]], [[#GetKeyIndex ( self, kTime, nIndex )|GetKeyIndex]], [[#GetKeyTimeAt ( self, uIndex, kTime )|GetKeyTimeAt]], and [[#MaxControlTime ( self )|MaxControlTime]] to retrieve key data within controllers. Use [[#AddKey ( self, pKey, fFps )|AddKey]], [[#ClearKeys ( self )|ClearKeys]], [[#MoveKey ( self, kTime, kOffsetTime )|MoveKey]], [[#RemoveKey ( self, kTime )|RemoveKey]], and [[#RemoveKeyAt ( self, nIndex )|RemoveKeyAt]] to delete or change key data. Additional functions are available for managing key transition data. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RTransformControl|RTransformControl]], [[IC_Python_API:RLPy_RFloatControl|RFloatControl]] | |
+ | |||
+ | === Inheritance === | ||
+ | |||
+ | [[IC_Python_API:RLPy_RControl|RControl]] > [[IC_Python_API:RLPy_RFloatControl|RFloatControl]] | [[IC_Python_API:RLPy_RTransformControl|RTransformControl]] | ||
+ | |||
+ | == Member Functions == | ||
+ | |||
+ | === AddKey ( self, pKey, fFps ) === | ||
+ | |||
+ | Create a new key data at the designated time. If a key already exists at the given time, then it is replaced. | ||
+ | |||
+ | See Also: [[#ClearKeys ( self )|ClearKeys]], [[#RemoveKey ( self, kTime )|RemoveKey]], [[#RemoveKeyAt ( self, nIndex )|RemoveKeyAt]] | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''pKey''' [IN] Data for the new Key - [[IC_Python_API:RLPy_RKey|RKey]] | ||
+ | :'''fFps''' [IN] Frame per second - float | ||
+ | |||
+ | ==== Return ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
# add key | # add key | ||
− | control = avatar.GetControl("Transform") | + | control = avatar.GetControl("Transform") |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
key = RLPy.RTransformKey() | key = RLPy.RTransformKey() | ||
key.SetTime(RLPy.RTime(0)) | key.SetTime(RLPy.RTime(0)) | ||
− | key.SetTransform( | + | key.SetTransform(RLPy.RTransform.IDENTITY) |
control.AddKey(key, RLPy.RGlobal.GetFps()) | control.AddKey(key, RLPy.RGlobal.GetFps()) | ||
− | + | </syntaxhighlight> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | === ClearKeys ( self ) === | |
− | + | ||
− | + | ||
− | + | Remove all keys on this controller. | |
− | + | ||
− | # | + | See Also: [[#RemoveKey ( self, kTime )|RemoveKey]], [[#RemoveKeyAt ( self, nIndex )|RemoveKeyAt]], [[#AddKey ( self, pKey, fFps )|AddKey]] |
− | + | ||
− | + | ==== Returns ==== | |
− | + | :Success - RLPy.RStatus.Success | |
− | + | :Failure - RLPy.RStatus.Failure | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # clear key | |
− | + | control = avatar.GetControl("Transform") | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | # clear | + | |
− | control. | + | |
− | + | ||
control.ClearKeys() | control.ClearKeys() | ||
− | print(control.HasKeys()) # False | + | print(control.HasKeys()) # False |
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | |
− | === | + | === Clone ( self ) === |
− | <syntaxhighlight lang=" | + | |
− | + | Copy this controller and return a duplicate. | |
+ | |||
+ | ==== Returns ==== | ||
+ | :The duplicated controller - RLPy. [[IC_Python_API:RLPy_RControl|RControl]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # clone control | ||
+ | control = avatar.GetControl("Transform") | ||
+ | cloned_control = control.Clone() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetDataBlock ( self ) === | |
− | + | Get the data block on this controller. | |
− | + | ||
− | + | ||
− | + | ||
− | ' | + | ==== Returns ==== |
+ | :The controller's data block - [[IC_Python_API:RLPy_RDataBlock|RDataBlock]] | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
− | + | # get datablock | |
− | + | control = avatar.GetControl("Transform") | |
− | = | + | datablock = control.GetDataBlock() |
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetKeyCount ( self ) === | |
− | + | Get the total number of keys in this controller. To check for existence of a key use Haskey() instead. | |
− | + | ||
− | + | See Also: [[#HasKeys ( self )|HasKeys]] | |
− | === | + | |
− | <syntaxhighlight lang=" | + | ==== Returns ==== |
− | + | :Total number of keys in this controller - int | |
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # get key count | ||
+ | control = avatar.GetControl("Transform") | ||
+ | key_count = control.GetKeyCount(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | + | === GetKeyIndex ( self, kTime, nIndex ) === | |
− | === | + | |
− | + | Get the key index at a given time (starting from 0). If the controller does not contain key data or the corresponding key is not found then return '''RStatus.Failure'''. | |
− | + | ||
− | + | See Also: [[#GetKeyTimeAt ( self, uIndex, kTime )|GetKeyTimeAt]] | |
− | === | + | |
− | + | ==== Parameters ==== | |
− | + | :'''kTime''' [IN] The specified time - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | :'''nIdx''' [OUT] Returns the Key index - int | |
− | + | ||
− | ====Returns==== | + | ==== Returns ==== |
− | + | :Success - RLPy.RStatus.Success | |
− | + | :Failure - RLPy.RStatus.Failure | |
− | - | + | |
− | + | <syntaxhighlight lang="python" line='line'> | |
− | <syntaxhighlight lang=" | + | # get key count |
− | + | control = avatar.GetControl("Transform") | |
− | + | key_index = -1 | |
− | + | ret_list = control.GetKeyIndex(RLPy.RTime(1000), key_index) | |
− | + | key_index = ret_list[1] | |
− | + | print(key_index) | |
− | + | ||
− | + | ||
− | = | + | |
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetKeyTimeAt ( self, uIndex, kTime ) === | |
− | + | Get the key time at a given key index. | |
− | + | ||
− | + | ||
− | + | ||
− | + | See Also: [[#GetKeyIndex ( self, kTime, nIndex )|GetKeyIndex]] | |
− | ''' | + | ==== Parameters ==== |
− | + | :'''uIndex''' [IN] Key Index (Index value starts from zero) - int | |
− | + | :'''kTime''' [OUT] Return the Key’s time value - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | === | + | |
− | <syntaxhighlight lang=" | + | ==== Returns ==== |
− | RLPy. | + | :Success - RLPy.RStatus.Success |
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # get key time | ||
+ | control = avatar.GetControl("Transform") | ||
+ | time = RLPy.RTime() | ||
+ | control.GetKeyTimeAt(1, time) | ||
+ | print(time.GetValue()) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetKeyTransitionStrength ( self, kTime ) === | |
+ | |||
+ | Get the transition strength on this controller at a given time. | ||
+ | |||
+ | See Also: [[#GetKeyTransitionStrength ( self, kTime )|GetKeyTransitionStrength]], [[IC_Python_API:RLPy_RKey#SetTransitionStrength|RKey.SetTransitionStrength()]] | ||
− | '''kTime''' [ | + | ==== Parameters ==== |
− | + | :'''kTime''' [IN] Specified time - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | ||
− | + | ||
− | + | ==== Returns ==== | |
+ | :Key transition strength (default:50) - float [0,100] | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
− | + | # get transition strength | |
− | + | control = avatar.GetControl("Transform") | |
− | = | + | Strength = control.GetKeyTransitionStrength(RLPy.RTime(0)) |
− | + | ||
− | RLPy. | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetKeyTransitionType ( self, kTime ) === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | === | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | '''kTime''' [IN] | + | Get the transition type on this controller at a given time. |
− | + | ||
− | ====Returns==== | + | See Also: [[#SetKeyTransition ( self, kTime, eType, fStrength )|SetKeyTransition]], [[#IC_Python_API:RLPy_RKey#GetTransitionType|RKey.GetTransitionType()]] |
− | + | ||
− | + | ==== Parameters ==== | |
− | + | :'''kTime''' [IN] Specified time - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | ||
− | + | ==== Returns ==== | |
− | + | :Returns the Transition type - RLPy.ETransitionType | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # get transition type | |
− | + | control = avatar.GetControl("Transform") | |
− | + | transition_type = control.GetKeyTransitionType(RLPy.RTime(0)) | |
− | + | if transition_type == RLPy.ETransitionType_Step: | |
− | + | print("Transition Type: Step") | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === HasKeys ( self ) === | |
− | + | Check if this controller has a key. | |
− | + | ||
− | + | See Also: [[#GetKeyCount ( self )|GetKeyCount]] | |
− | === | + | |
− | <syntaxhighlight lang=" | + | ==== Returns ==== |
− | + | :'''True''' if the control has at least one key, else '''False'''. | |
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # get transition strength | ||
+ | control = avatar.GetControl("Transform") | ||
+ | has_key = control.HasKeys(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === MaxControlTime ( self ) === |
− | + | ||
− | + | Get this controller's final key time. If a key does not exist then return 0. | |
− | + | ||
− | + | ==== Returns ==== | |
− | <syntaxhighlight lang=" | + | :The maximum time of the control - [[IC_Python_API:RLPy_RTime|RTime]] |
− | + | ||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # get last key time | ||
+ | control = avatar.GetControl("Transform") | ||
+ | key_time = control.MaxControlTime(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === MoveKey ( self, kTime, kOffsetTime ) === | |
− | + | Offset an animation key at a given time by a duration. The offset key will replace any existing key at the new position. | |
− | + | ||
− | + | ||
− | + | ||
− | ''' | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Specified time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''kOffsetTime''' [IN] Offset the Key by a specified time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
− | + | ==== Returns ==== | |
− | + | :Success - RLPy.RStatus.Success | |
− | - | + | :Failure - RLPy.RStatus.Failure |
− | + | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
− | RLPy. | + | # move key |
+ | control = avatar.GetControl("Transform") | ||
+ | |||
+ | control.MoveKey(RLPy.RTime(0), RLPy.RTime(100)) | ||
+ | control.GetKeyAt(0, key1) | ||
+ | print(key1.GetTime().GetValue()) #100 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === RemoveKey ( self, kTime ) === | |
− | + | ||
− | ==== | + | Remove an animation key at a given time. |
− | + | ||
+ | See Also: [[#ClearKeys ( self )|ClearKeys]], [[#RemoveKeyAt ( self, nIndex )|RemoveKeyAt]] | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''kTime''' [IN] Specified time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
− | + | ==== Returns ==== | |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
− | + | # remove key | |
− | + | control = avatar.GetControl("Transform") | |
− | = | + | control.RemoveKey(RLPy.RTime(100)) |
− | + | print(control.GetKeyCount()) | |
− | RLPy. | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === RemoveKeyAt ( self, nIndex ) === | |
− | + | ||
− | === | + | |
− | + | ||
− | + | Remove an animation key by index. | |
− | ''' | + | See Also: [[#ClearKeys ( self )|ClearKeys]], [[#RemoveKey ( self, kTime )|RemoveKey]] |
− | + | ||
− | + | ==== Parameters ==== | |
− | === | + | :'''nIndex''' [IN] Key index (starts from 0) - int |
− | <syntaxhighlight lang=" | + | |
− | + | ==== Returns ==== | |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # remove key | ||
+ | control = avatar.GetControl("Transform") | ||
+ | control.RemoveKey(RLPy.RTime(100)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === SetKeyTransition ( self, kTime, eType, fStrength ) === | |
− | + | Set the transition type and strength of a key at a given time. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | See Also: [[#GetKeyTransitionType ( self, kTime )|GetKeyTransitionType]], [[#GetKeyTransitionStrength ( self, kTime )|GetKeyTransitionStrength]] | |
− | + | ||
− | + | ||
− | + | ||
− | ''' | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Specified time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''eType''' [IN] Transition Type. | ||
+ | :'''fStrength''' [IN] Transition strength (default: 50) - float [0,100] | ||
− | + | ==== Returns ==== | |
− | </ | + | :Success - RLPy.RStatus.Success |
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # set transition | ||
+ | control = avatar.GetControl("Transform") | ||
+ | control.SetKeyTransition(RLPy.RTime(1000), RLPy.ETransitionType_Step, 1.0) | ||
+ | </syntaxhighlight> |
Revision as of 22:29, 20 April 2020
Contents
- 1 Description
- 2 Member Functions
- 2.1 AddKey ( self, pKey, fFps )
- 2.2 ClearKeys ( self )
- 2.3 Clone ( self )
- 2.4 GetDataBlock ( self )
- 2.5 GetKeyCount ( self )
- 2.6 GetKeyIndex ( self, kTime, nIndex )
- 2.7 GetKeyTimeAt ( self, uIndex, kTime )
- 2.8 GetKeyTransitionStrength ( self, kTime )
- 2.9 GetKeyTransitionType ( self, kTime )
- 2.10 HasKeys ( self )
- 2.11 MaxControlTime ( self )
- 2.12 MoveKey ( self, kTime, kOffsetTime )
- 2.13 RemoveKey ( self, kTime )
- 2.14 RemoveKeyAt ( self, nIndex )
- 2.15 SetKeyTransition ( self, kTime, eType, fStrength )
- Main article: Modules.
- Last modified: 04/20/2020
Description
Controllers are used to manage animations and create animation effects, which will give a key value when fed a time. This is the base class for all controller related classes which are distinquished according to different data types that they record and deal with: RTransformControl dealing with transform data types and RFloatControl for float data types. Controllers mainly use keyframes to record animations and create keys; and has the ability to interpolate values between keys.
Use GetKeyCount, GetKeyIndex, GetKeyTimeAt, and MaxControlTime to retrieve key data within controllers. Use AddKey, ClearKeys, MoveKey, RemoveKey, and RemoveKeyAt to delete or change key data. Additional functions are available for managing key transition data.
See Also: RTransformControl, RFloatControl
Inheritance
RControl > RFloatControl | RTransformControl
Member Functions
AddKey ( self, pKey, fFps )
Create a new key data at the designated time. If a key already exists at the given time, then it is replaced.
See Also: ClearKeys, RemoveKey, RemoveKeyAt
Parameters
- pKey [IN] Data for the new Key - RKey
- fFps [IN] Frame per second - float
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # add key
2 control = avatar.GetControl("Transform")
3 key = RLPy.RTransformKey()
4 key.SetTime(RLPy.RTime(0))
5 key.SetTransform(RLPy.RTransform.IDENTITY)
6 control.AddKey(key, RLPy.RGlobal.GetFps())
ClearKeys ( self )
Remove all keys on this controller.
See Also: RemoveKey, RemoveKeyAt, AddKey
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # clear key
2 control = avatar.GetControl("Transform")
3 control.ClearKeys()
4 print(control.HasKeys()) # False
Clone ( self )
Copy this controller and return a duplicate.
Returns
- The duplicated controller - RLPy. RControl
1 # clone control
2 control = avatar.GetControl("Transform")
3 cloned_control = control.Clone()
GetDataBlock ( self )
Get the data block on this controller.
Returns
- The controller's data block - RDataBlock
1 # get datablock
2 control = avatar.GetControl("Transform")
3 datablock = control.GetDataBlock()
GetKeyCount ( self )
Get the total number of keys in this controller. To check for existence of a key use Haskey() instead.
See Also: HasKeys
Returns
- Total number of keys in this controller - int
1 # get key count
2 control = avatar.GetControl("Transform")
3 key_count = control.GetKeyCount();
GetKeyIndex ( self, kTime, nIndex )
Get the key index at a given time (starting from 0). If the controller does not contain key data or the corresponding key is not found then return RStatus.Failure.
See Also: GetKeyTimeAt
Parameters
- kTime [IN] The specified time - RTime
- nIdx [OUT] Returns the Key index - int
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # get key count
2 control = avatar.GetControl("Transform")
3 key_index = -1
4 ret_list = control.GetKeyIndex(RLPy.RTime(1000), key_index)
5 key_index = ret_list[1]
6 print(key_index)
GetKeyTimeAt ( self, uIndex, kTime )
Get the key time at a given key index.
See Also: GetKeyIndex
Parameters
- uIndex [IN] Key Index (Index value starts from zero) - int
- kTime [OUT] Return the Key’s time value - RTime
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # get key time
2 control = avatar.GetControl("Transform")
3 time = RLPy.RTime()
4 control.GetKeyTimeAt(1, time)
5 print(time.GetValue())
GetKeyTransitionStrength ( self, kTime )
Get the transition strength on this controller at a given time.
See Also: GetKeyTransitionStrength, RKey.SetTransitionStrength()
Parameters
- kTime [IN] Specified time - RTime
Returns
- Key transition strength (default:50) - float [0,100]
1 # get transition strength
2 control = avatar.GetControl("Transform")
3 Strength = control.GetKeyTransitionStrength(RLPy.RTime(0))
GetKeyTransitionType ( self, kTime )
Get the transition type on this controller at a given time.
See Also: SetKeyTransition, RKey.GetTransitionType()
Parameters
- kTime [IN] Specified time - RTime
Returns
- Returns the Transition type - RLPy.ETransitionType
1 # get transition type
2 control = avatar.GetControl("Transform")
3 transition_type = control.GetKeyTransitionType(RLPy.RTime(0))
4 if transition_type == RLPy.ETransitionType_Step:
5 print("Transition Type: Step")
HasKeys ( self )
Check if this controller has a key.
See Also: GetKeyCount
Returns
- True if the control has at least one key, else False.
1 # get transition strength
2 control = avatar.GetControl("Transform")
3 has_key = control.HasKeys();
MaxControlTime ( self )
Get this controller's final key time. If a key does not exist then return 0.
Returns
- The maximum time of the control - RTime
1 # get last key time
2 control = avatar.GetControl("Transform")
3 key_time = control.MaxControlTime();
MoveKey ( self, kTime, kOffsetTime )
Offset an animation key at a given time by a duration. The offset key will replace any existing key at the new position.
Parameters
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # move key
2 control = avatar.GetControl("Transform")
3
4 control.MoveKey(RLPy.RTime(0), RLPy.RTime(100))
5 control.GetKeyAt(0, key1)
6 print(key1.GetTime().GetValue()) #100
RemoveKey ( self, kTime )
Remove an animation key at a given time.
See Also: ClearKeys, RemoveKeyAt
Parameters
- kTime [IN] Specified time - RTime
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # remove key
2 control = avatar.GetControl("Transform")
3 control.RemoveKey(RLPy.RTime(100))
4 print(control.GetKeyCount())
RemoveKeyAt ( self, nIndex )
Remove an animation key by index.
See Also: ClearKeys, RemoveKey
Parameters
- nIndex [IN] Key index (starts from 0) - int
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # remove key
2 control = avatar.GetControl("Transform")
3 control.RemoveKey(RLPy.RTime(100))
SetKeyTransition ( self, kTime, eType, fStrength )
Set the transition type and strength of a key at a given time.
See Also: GetKeyTransitionType, GetKeyTransitionStrength
Parameters
- kTime [IN] Specified time - RTime
- eType [IN] Transition Type.
- fStrength [IN] Transition strength (default: 50) - float [0,100]
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # set transition
2 control = avatar.GetControl("Transform")
3 control.SetKeyTransition(RLPy.RTime(1000), RLPy.ETransitionType_Step, 1.0)