Difference between revisions of "IC Python API:RLPy RKey"
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Detailed Description== This is the base class for keys. This class stores the time of the key. Can be inserted int...") |
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}} |
− | + | ||
− | + | == Description == | |
− | == | + | |
− | === | + | Keyframes are used to record transition points in an animation. Keyframe values are called "keys". These keys mainly record time and transition data and are managed by controls which are responsible for changing and deleting key values. |
− | <syntaxhighlight lang=" | + | |
− | RLPy.RKey. | + | [[File:Rlpy_rkey_description_01.png| This box object's PositionX animation is controlled by [[IC_Python_API:RLPy_RFloatControl|RFloatControl]]. Thus, this object's timeline transitions are recorded in [[IC_Python_API:RLPy_RFloatKey|RFloatKey]]]] |
+ | |||
+ | See also: [[IC_Python_API:RLPy_RFloatControl|RFloatControl]], [[IC_Python_API:RLPy_RTransformControl|RTransformControl]]. | ||
+ | |||
+ | === Inheritance === | ||
+ | |||
+ | [[IC_Python_API:RLPy_RKey|RKey]] > [[IC_Python_API:RLPy_RFloatKey|RFloatKey]] | [[IC_Python_API:RLPy_RTransformKey|RTransformKey]] | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | control = box.GetControl("Transform") | ||
+ | key = RLPy.RTransformKey() | ||
+ | key.SetTime(RLPy.RTime(0)) | ||
+ | key.SetTran(transform) | ||
+ | key.SetTransitionType(RLPy.ETransitionType_Ease_Out) | ||
+ | key.SetTransitionStrength(90) | ||
+ | control.AddKey(key, RLPy.RGlobal.GetFps()) | ||
+ | |||
+ | # use RKey to set specular color of the material | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | material_component = avatar_list [0].GetMaterialComponent() | ||
+ | mesh_list = avatar_list[0].GetMeshNames() | ||
+ | mesh_name = mesh_list[0] | ||
+ | material_list = material_component.GetMaterialNames(mesh_name) | ||
+ | material_name = material_list[0] | ||
+ | |||
+ | result = self.material_component.AddSpecularKey(RLPy.RKey(), mesh_name, material_name, RLPy.RRgb.BLUE) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | == Related Enumerations == | |
− | + | ||
− | == | + | === RLPy.ETransitionType === |
− | === | + | |
− | <syntaxhighlight lang=" | + | {| class="wikitable" |
− | RLPy. | + | !Transition Type |
+ | !Description | ||
+ | !UI Name | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Invalid | ||
+ | |Invalid | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType__None | ||
+ | |None | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Linear | ||
+ | |Linear | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Step | ||
+ | |Step | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out | ||
+ | |Ease Out (strength can be set) | ||
+ | |Decelerate | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In | ||
+ | |Ease In (strength can be set) | ||
+ | |Accelerate | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_In | ||
+ | |Ease Out_In (strength can be set) | ||
+ | |Pause and Move | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out | ||
+ | |Ease In Out (strength can be set) | ||
+ | |Smooth | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Sine | ||
+ | |Ease In Sine | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Sine | ||
+ | |Ease Out Sine | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Sine | ||
+ | |Ease In Out Sine | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Quad | ||
+ | |Ease In Quadratic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Quad | ||
+ | |Ease Out Quadratic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Quad | ||
+ | |Ease In Out Quadratic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Cubic | ||
+ | |Ease In Cubic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Cubic | ||
+ | |Ease Out Cubic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Cubic | ||
+ | |Ease In Out Cubic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Quart | ||
+ | |Ease In Quartic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Quart | ||
+ | |Ease Out Quartic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Quart | ||
+ | |Ease In Out Quartic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Quint | ||
+ | |Ease In Quintic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Quint | ||
+ | |Ease Out Quintic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Quint | ||
+ | |Ease In Out Quintic | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Expo | ||
+ | |Ease In Exponential | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Expo | ||
+ | |Ease Out Exponential | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Expo | ||
+ | |Ease In Out Exponential | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Circ | ||
+ | |Ease In Circular | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Circ | ||
+ | |Ease Out Circular | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Circ | ||
+ | |Ease In Out Circular | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Back | ||
+ | |Ease In Back | ||
+ | |Gain Momentum before Move | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Back | ||
+ | |Ease Out Back | ||
+ | |Damping | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Back | ||
+ | |Ease In Out Back | ||
+ | |Gain Momentum and Damp | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Elastic | ||
+ | |Ease In Elastic | ||
+ | |Elastic Start and Sudden End | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Elastic | ||
+ | |Ease Out Elastic | ||
+ | |Sudden Start with Elastic End | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Elastic | ||
+ | |Ease In Out Elastic | ||
+ | |Elastic Start and End | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Bounce | ||
+ | |Ease In Bounce | ||
+ | |Stutter Start | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_Out_Bounce | ||
+ | |Ease Out Bounce | ||
+ | |End in a Bounce | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Ease_In_Out_Bounce | ||
+ | |Ease In Out Bounce | ||
+ | |Stuttering Start and End | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Last | ||
+ | |Last | ||
+ | | | ||
+ | |- | ||
+ | |RLPy.ETransitionType_Count | ||
+ | |Count | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == Constructor == | ||
+ | |||
+ | === __init__ (self, args) === | ||
+ | |||
+ | Create a new [[IC_Python_API:RLPy_RKey|RKey]] object using an existing [[IC_Python_API:RLPy_RKey|RKey]] object. | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''kRhs''' [IN] An existing [[IC_Python_API:RLPy_RKey|RKey]] object - [[IC_Python_API:RLPy_RKey|RKey]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | key = RLPy.RTransformKey(key1) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | + | == Member Functions == | |
− | + | ||
− | === | + | === Clone ( self ) === |
− | <syntaxhighlight lang=" | + | |
− | + | Copy this key's data and return a new [[IC_Python_API:RLPy_RKey|RKey]] object. | |
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetTime ( self ) === |
− | + | ||
− | + | Get this key's time value. | |
− | + | ||
− | + | ==== Returns ==== | |
− | <syntaxhighlight lang=" | + | :The time value of this key - [[IC_Python_API:RLPy_RTime|RTime]] |
− | + | ||
+ | <syntaxhighlight lang="python" line='line'> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get transition strength | + | |
− | ====Returns==== | + | === GetTransitionStrength ( self ) === |
− | + | ||
− | + | Get this key's transition strength. This value lies between 1 and 100 (default: 50). This function will only take effect when the transition type for this key is '''ETransitionType_EASE_OUT''', '''ETransitionType_EASE_IN''', '''ETransitionType_EASE_OUT_IN''' or '''ETransitionType_EASE_IN_OUT'''. | |
− | + | ||
− | + | See Also: [[#SetTransitionStrength ( self, fTransitionStrength )|SetTransitionStrength]] | |
− | <syntaxhighlight lang=" | + | |
− | + | ==== Returns ==== | |
+ | :Transition strength of this key - float | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | strength = key.GetTransitionStrength() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get transition type | + | |
− | ====Returns==== | + | === GetTransitionType ( self ) === |
− | + | ||
− | + | Get this key's transition type. | |
− | + | ||
− | + | See Also: [[#SetTransitionType ( self, eTransitionType )|SetTransitionType]] | |
− | + | ||
− | + | ==== Returns ==== | |
− | + | :This key's transition type - [[#RLPy.ETransitionType|RLPy.ETransitionType]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | type = key.GetTransitionType() | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | <syntaxhighlight lang=" | + | |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | '''kTime''' [IN] Time | + | === SetTime ( self, kTime ) === |
− | + | ||
− | + | Set the time value for this key. | |
− | + | ||
− | <syntaxhighlight lang=" | + | ==== Parameters ==== |
− | RLPy. | + | :'''kTime''' [IN] Time value for the Key - [[IC_Python_API:RLPy_RTime|RTime]] |
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | key.SetTime(RLPy.RTime(0)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | ''' | + | === SetTransitionStrength ( self, fTransitionStrength ) === |
− | + | ||
− | + | Set the key's transition strength from 1 to 100 (default: 50). This function will only take effect when the transition type for this key is '''ETransitionType_EASE_OUT''', '''ETransitionType_EASE_IN''', '''ETransitionType_EASE_OUT_IN''' or '''ETransitionType_EASE_IN_OUT'''. | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See Also: [[#GetTransitionStrength ( self )|GetTransitionStrength]], [[#RLPy.ETransitionType|RLPy.ETransitionType]] |
− | + | ||
+ | ==== Parameters ==== | ||
+ | :'''fTransitionStrength''' [IN] The key's transition strength - float | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | key.SetTransitionStrength(90) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | '''eTransitionType''' [IN] Transition type of the key - RLPy.ETransitionType | + | === SetTransitionType ( self, eTransitionType ) === |
− | + | ||
− | + | Set the key's transition type. | |
− | + | ||
− | + | ==== Parameters ==== | |
− | + | :'''eTransitionType''' [IN] Transition type of the key - [[#RLPy.ETransitionType|RLPy.ETransitionType]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | key.SetTransitionType(RLPy.ETransitionType_Ease_In) | |
− | + | </syntaxhighlight> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | </ | + |
Latest revision as of 22:29, 15 April 2020
Contents
- 1 Description
- 2 Related Enumerations
- 3 Constructor
- 4 Member Functions
- Main article: Modules.
- Last modified: 04/15/2020
Description
Keyframes are used to record transition points in an animation. Keyframe values are called "keys". These keys mainly record time and transition data and are managed by controls which are responsible for changing and deleting key values.
See also: RFloatControl, RTransformControl.
Inheritance
RKey > RFloatKey | RTransformKey
Examples
1 control = box.GetControl("Transform")
2 key = RLPy.RTransformKey()
3 key.SetTime(RLPy.RTime(0))
4 key.SetTran(transform)
5 key.SetTransitionType(RLPy.ETransitionType_Ease_Out)
6 key.SetTransitionStrength(90)
7 control.AddKey(key, RLPy.RGlobal.GetFps())
8
9 # use RKey to set specular color of the material
10 avatar_list = RLPy.RScene.GetAvatars()
11 material_component = avatar_list [0].GetMaterialComponent()
12 mesh_list = avatar_list[0].GetMeshNames()
13 mesh_name = mesh_list[0]
14 material_list = material_component.GetMaterialNames(mesh_name)
15 material_name = material_list[0]
16
17 result = self.material_component.AddSpecularKey(RLPy.RKey(), mesh_name, material_name, RLPy.RRgb.BLUE)
Related Enumerations
RLPy.ETransitionType
Transition Type | Description | UI Name |
---|---|---|
RLPy.ETransitionType_Invalid | Invalid | |
RLPy.ETransitionType__None | None | |
RLPy.ETransitionType_Linear | Linear | |
RLPy.ETransitionType_Step | Step | |
RLPy.ETransitionType_Ease_Out | Ease Out (strength can be set) | Decelerate |
RLPy.ETransitionType_Ease_In | Ease In (strength can be set) | Accelerate |
RLPy.ETransitionType_Ease_Out_In | Ease Out_In (strength can be set) | Pause and Move |
RLPy.ETransitionType_Ease_In_Out | Ease In Out (strength can be set) | Smooth |
RLPy.ETransitionType_Ease_In_Sine | Ease In Sine | |
RLPy.ETransitionType_Ease_Out_Sine | Ease Out Sine | |
RLPy.ETransitionType_Ease_In_Out_Sine | Ease In Out Sine | |
RLPy.ETransitionType_Ease_In_Quad | Ease In Quadratic | |
RLPy.ETransitionType_Ease_Out_Quad | Ease Out Quadratic | |
RLPy.ETransitionType_Ease_In_Out_Quad | Ease In Out Quadratic | |
RLPy.ETransitionType_Ease_In_Cubic | Ease In Cubic | |
RLPy.ETransitionType_Ease_Out_Cubic | Ease Out Cubic | |
RLPy.ETransitionType_Ease_In_Out_Cubic | Ease In Out Cubic | |
RLPy.ETransitionType_Ease_In_Quart | Ease In Quartic | |
RLPy.ETransitionType_Ease_Out_Quart | Ease Out Quartic | |
RLPy.ETransitionType_Ease_In_Out_Quart | Ease In Out Quartic | |
RLPy.ETransitionType_Ease_In_Quint | Ease In Quintic | |
RLPy.ETransitionType_Ease_Out_Quint | Ease Out Quintic | |
RLPy.ETransitionType_Ease_In_Out_Quint | Ease In Out Quintic | |
RLPy.ETransitionType_Ease_In_Expo | Ease In Exponential | |
RLPy.ETransitionType_Ease_Out_Expo | Ease Out Exponential | |
RLPy.ETransitionType_Ease_In_Out_Expo | Ease In Out Exponential | |
RLPy.ETransitionType_Ease_In_Circ | Ease In Circular | |
RLPy.ETransitionType_Ease_Out_Circ | Ease Out Circular | |
RLPy.ETransitionType_Ease_In_Out_Circ | Ease In Out Circular | |
RLPy.ETransitionType_Ease_In_Back | Ease In Back | Gain Momentum before Move |
RLPy.ETransitionType_Ease_Out_Back | Ease Out Back | Damping |
RLPy.ETransitionType_Ease_In_Out_Back | Ease In Out Back | Gain Momentum and Damp |
RLPy.ETransitionType_Ease_In_Elastic | Ease In Elastic | Elastic Start and Sudden End |
RLPy.ETransitionType_Ease_Out_Elastic | Ease Out Elastic | Sudden Start with Elastic End |
RLPy.ETransitionType_Ease_In_Out_Elastic | Ease In Out Elastic | Elastic Start and End |
RLPy.ETransitionType_Ease_In_Bounce | Ease In Bounce | Stutter Start |
RLPy.ETransitionType_Ease_Out_Bounce | Ease Out Bounce | End in a Bounce |
RLPy.ETransitionType_Ease_In_Out_Bounce | Ease In Out Bounce | Stuttering Start and End |
RLPy.ETransitionType_Last | Last | |
RLPy.ETransitionType_Count | Count |
Constructor
__init__ (self, args)
Create a new RKey object using an existing RKey object.
Parameters
- kRhs [IN] An existing RKey object - RKey
1 key = RLPy.RTransformKey(key1)
Member Functions
Clone ( self )
Copy this key's data and return a new RKey object.
1
GetTime ( self )
Get this key's time value.
Returns
- The time value of this key - RTime
1
GetTransitionStrength ( self )
Get this key's transition strength. This value lies between 1 and 100 (default: 50). This function will only take effect when the transition type for this key is ETransitionType_EASE_OUT, ETransitionType_EASE_IN, ETransitionType_EASE_OUT_IN or ETransitionType_EASE_IN_OUT.
See Also: SetTransitionStrength
Returns
- Transition strength of this key - float
1 strength = key.GetTransitionStrength()
GetTransitionType ( self )
Get this key's transition type.
See Also: SetTransitionType
Returns
- This key's transition type - RLPy.ETransitionType
1 type = key.GetTransitionType()
SetTime ( self, kTime )
Set the time value for this key.
Parameters
- kTime [IN] Time value for the Key - RTime
1 key.SetTime(RLPy.RTime(0))
SetTransitionStrength ( self, fTransitionStrength )
Set the key's transition strength from 1 to 100 (default: 50). This function will only take effect when the transition type for this key is ETransitionType_EASE_OUT, ETransitionType_EASE_IN, ETransitionType_EASE_OUT_IN or ETransitionType_EASE_IN_OUT.
See Also: GetTransitionStrength, RLPy.ETransitionType
Parameters
- fTransitionStrength [IN] The key's transition strength - float
1 key.SetTransitionStrength(90)
SetTransitionType ( self, eTransitionType )
Set the key's transition type.
Parameters
- eTransitionType [IN] Transition type of the key - RLPy.ETransitionType
1 key.SetTransitionType(RLPy.ETransitionType_Ease_In)