IC Python API:RLPy RControl

From Reallusion Wiki!
Revision as of 01:55, 28 March 2019 by 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...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: Modules.

Detailed Description

This class is the base class of all controllers. RControl is the class from which you may derive controller objects to control the animation result. Controllers come in different types based on the

type of data they control. For example, RTransformControl controls the RTS used to define the position of objects in the scene. RFloatControl controls simple floating point values.
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]

# add key
control = avatar.GetControl("Transform")
transform = RLPy.RTransform.IDENTITY
transform.T().x = 100
transform.T().y = 100
transform.T().z = 100
key = RLPy.RTransformKey()
key.SetTime(RLPy.RTime(0))
key.SetTransform(transform)
control.AddKey(key, RLPy.RGlobal.GetFps())

transform.T().x = 0
transform.T().y = 0
transform.T().z = 0
key = RLPy.RTransformKey()
key.SetTime(RLPy.RTime(1000))
key.SetTransform(transform)
control.AddKey(key, RLPy.RGlobal.GetFps())

print(control.HasKeys()) # true
print(control.GetKeyCount()) # 2
print(control.MaxControlTime().GetValue()) # 1000.0

# get transition type
type = control.GetKeyTransitionType(RLPy.RTime(1000))
print(type) #RLPy.ETransitionType_Linear

# change transition type
control.SetKeyTransition(RLPy.RTime(1000), RLPy.ETransitionType_Step, 1.0)

# get key time and index
time = RLPy.RTime()
control.GetKeyTimeAt(1, time)
print(time.GetValue()) # 1000

key_index = -1
ret_list = control.GetKeyIndex(RLPy.RTime(1000), key_index)
key_index = ret_list[1]
print(key_index) # 1

# get key by index
key1 = RLPy.RTransformKey().Clone()
ret_list = control.GetKeyAt(0, key1)
print(key1.GetTime().GetValue()) #0

# move key
control.MoveKey(RLPy.RTime(0), RLPy.RTime(100))
control.GetKeyAt(0, key1)
print(key1.GetTime().GetValue()) #100

# clear keys
control.RemoveKey(RLPy.RTime(1000))
print(control.GetKeyCount()) # 1
control.ClearKeys()
print(control.HasKeys()) # False

Member Functions

AddKey

RLPy.RControl.AddKey ( self, pKey, fFps )

Add one key.

Parameters

pKey [IN] The key to be added - RLPy.RKey

fFps [IN] Frame per second - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


ClearKeys

RLPy.RControl.ClearKeys ( self )

Clear (remove) all keys.

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


Clone

RLPy.RControl.Clone ( self )

Clone the control. Supports cloning, which creates a new instance of a class with the same value as an existing instance.

Returns

Pointer to RControl - RLPy. RControl

GetDataBlock

RLPy.RControl.GetDataBlock ( self )

Get data block from the control.

Returns

Pointer to data block of the control - RLPy.RDataBlock

GetKeyCount

RLPy.RControl.GetKeyCount ( self )

Get the number of keys of the control.

Returns

The number of keys of the control - int

GetKeyIndex

RLPy.RControl.GetKeyIndex ( self, kTime, nIdx )

Get key index by time.

Parameters

kTime [IN] Specifies the time to get key index - RLPy.RTime

nIdx [OUT] Index of the key - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


GetKeyTimeAt

RLPy.RControl.GetKeyTimeAt ( self, uIndex, kTime )

Get key's time by index.

Parameters

uIndex [IN] Index of the key. (starting from zero) - int

kTime [OUT] Time of the key specified by uIndex - RLPy.RTime

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


GetKeyTransitionStrength

RLPy.RControl.GetKeyTransitionStrength ( self, kTime )

Get transition strength of the key.

Parameters

kTime [IN] Specifies the time to get transition strength - RLPy.RTime

Returns

Transition strength of the key. The strength range is from 0 to 100, 50 is default value - float

GetKeyTransitionType

RLPy.RControl.GetKeyTransitionType ( self, kTime )

Get transition type of the key.

Parameters

kTime [IN] Specifies the time to get transition type - RLPy.RTime

Returns

Transition type of the key - RLPy.ETransitionType
  • RLPy.ETransitionType_Invalid Invalid value.
  • RLPy.ETransitionType_None None.
  • RLPy.ETransitionType_Linear Linear.
  • RLPy.ETransitionType_Step Step.
  • RLPy.ETransitionType_Ease_Out Ease out.
  • RLPy.ETransitionType_Ease_In Ease in.
  • RLPy.ETransitionType_Ease_Out_In Ease out in.
  • RLPy.ETransitionType_Ease_In_Out Ease in out.
  • 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 quad.
  • RLPy.ETransitionType_Ease_Out_Quad Ease out quad.
  • RLPy.ETransitionType_Ease_In_Out_Quad Ease in out quad.
  • RLPy.ETransitionType_Ease_In_Cubic Ease in cubic.
  • RLPy.ETransitionType_Ease_Out_Cubic Ease in out cubic.
  • RLPy.ETransitionType_Ease_In_Out_Cubic Ease in out cubic.
  • RLPy.ETransitionType_Ease_In_Quart Ease in quart.
  • RLPy.ETransitionType_Ease_Out_Quart Ease out quart.
  • RLPy.ETransitionType_Ease_In_Out_Quart Ease in out quart.
  • RLPy.ETransitionType_Ease_In_Quint Ease in quint.
  • RLPy.ETransitionType_Ease_Out_Quint Ease out quint.
  • RLPy.ETransitionType_Ease_In_Out_Quint Ease in out quint.
  • RLPy.ETransitionType_Ease_In_Expo Ease in expo.
  • RLPy.ETransitionType_Ease_Out_Expo Ease out expo.
  • RLPy.ETransitionType_Ease_In_Out_Expo Ease in out expo.
  • RLPy.ETransitionType_Ease_In_Circ Ease in circ.
  • RLPy.ETransitionType_Ease_Out_Circ Ease out circ.
  • RLPy.ETransitionType_Ease_In_Out_Circ Ease in out circ.
  • RLPy.ETransitionType_Ease_In_Back Ease in back.
  • RLPy.ETransitionType_Ease_Out_Back Ease out back.
  • RLPy.ETransitionType_Ease_In_Out_Back Ease in out back.
  • RLPy.ETransitionType_Ease_In_Elastic Ease in elastic.
  • RLPy.ETransitionType_Ease_Out_Elastic Ease out elastic.
  • RLPy.ETransitionType_Ease_In_Out_Elastic Ease in out elastic.
  • RLPy.ETransitionType_Ease_In_Bounce Ease in bounce.
  • RLPy.ETransitionType_Ease_Out_Bounce Ease out bounce.
  • RLPy.ETransitionType_Ease_In_Out_Bounce Ease in out bounce.
  • RLPy.ETransitionType_Last Last.
  • RLPy.ETransitionType_Count

HasKeys

RLPy.RControl.HasKeys ( self )

Check whether the control has key.

Return Values

true Control has at least one key.

false Control has no key.


MaxControlTime

RLPy.RControl.MaxControlTime ( self )

Get maximum time of the control.

Returns

The maximum time of the control - RLPy.RTime

MoveKey

RLPy.RControl.MoveKey ( self, kTime, kOffsetTime )

Move one key by an offset time. If there is a key in target time (kTime + kOffstTime) already, it will be replaced by the key in source time (kTime).

Parameters

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

kOffsetTime [IN] The offset time - RLPy.RTime

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


RemoveKey

RLPy.RControl.RemoveKey ( self, kTime )

Remove one key from the control by time.

Parameters

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

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


RemoveKeyAt

RLPy.RControl.RemoveKeyAt ( self, nIndex )

Remove one key by index.

Parameters

nIndex [IN] Index of the key. (starting from zero) - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


SetKeyTransition

RLPy.RControl.SetKeyTransition ( self, kTime, eType, fStrength )

Set transition type and strength of the key.

Parameters

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

eType [IN] Transition type of the key - RLPy.ETransitionType

  • RLPy.ETransitionType_Invalid Invalid value.
  • RLPy.ETransitionType_None None.
  • RLPy.ETransitionType_Linear Linear.
  • RLPy.ETransitionType_Step Step.
  • RLPy.ETransitionType_Ease_Out Ease out.
  • RLPy.ETransitionType_Ease_In Ease in.
  • RLPy.ETransitionType_Ease_Out_In Ease out in.
  • RLPy.ETransitionType_Ease_In_Out Ease in out.
  • 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 quad.
  • RLPy.ETransitionType_Ease_Out_Quad Ease out quad.
  • RLPy.ETransitionType_Ease_In_Out_Quad Ease in out quad.
  • RLPy.ETransitionType_Ease_In_Cubic Ease in cubic.
  • RLPy.ETransitionType_Ease_Out_Cubic Ease in out cubic.
  • RLPy.ETransitionType_Ease_In_Out_Cubic Ease in out cubic.
  • RLPy.ETransitionType_Ease_In_Quart Ease in quart.
  • RLPy.ETransitionType_Ease_Out_Quart Ease out quart.
  • RLPy.ETransitionType_Ease_In_Out_Quart Ease in out quart.
  • RLPy.ETransitionType_Ease_In_Quint Ease in quint.
  • RLPy.ETransitionType_Ease_Out_Quint Ease out quint.
  • RLPy.ETransitionType_Ease_In_Out_Quint Ease in out quint.
  • RLPy.ETransitionType_Ease_In_Expo Ease in expo.
  • RLPy.ETransitionType_Ease_Out_Expo Ease out expo.
  • RLPy.ETransitionType_Ease_In_Out_Expo Ease in out expo.
  • RLPy.ETransitionType_Ease_In_Circ Ease in circ.
  • RLPy.ETransitionType_Ease_Out_Circ Ease out circ.
  • RLPy.ETransitionType_Ease_In_Out_Circ Ease in out circ.
  • RLPy.ETransitionType_Ease_In_Back Ease in back.
  • RLPy.ETransitionType_Ease_Out_Back Ease out back.
  • RLPy.ETransitionType_Ease_In_Out_Back Ease in out back.
  • RLPy.ETransitionType_Ease_In_Elastic Ease in elastic.
  • RLPy.ETransitionType_Ease_Out_Elastic Ease out elastic.
  • RLPy.ETransitionType_Ease_In_Out_Elastic Ease in out elastic.
  • RLPy.ETransitionType_Ease_In_Bounce Ease in bounce.
  • RLPy.ETransitionType_Ease_Out_Bounce Ease out bounce.
  • RLPy.ETransitionType_Ease_In_Out_Bounce Ease in out bounce.
  • RLPy.ETransitionType_Last Last.
  • RLPy.ETransitionType_Count

fStrength [IN] Transition strength of the key. The strength range is from 0 to 100, 50 is default value - float

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail