Difference between revisions of "IC 8 Python API:Dealing With Custom FPS"
Chuck (RL) (Talk | contribs) (Created page with "iClone 8 supports custom FPS settings that users can adjust. The FPS value can be changed to suit the project in the '''Project''' settings (as shown below). In order to suppo...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
+ | {{TOC}} | ||
+ | |||
+ | {{Parent|IC_8_Python_API|iC8 Python API}} | ||
+ | |||
iClone 8 supports custom FPS settings that users can adjust. The FPS value can be changed to suit the project in the '''Project''' settings (as shown below). In order to support custom FPS, iClone 8 core has made many corresponding modifications. | iClone 8 supports custom FPS settings that users can adjust. The FPS value can be changed to suit the project in the '''Project''' settings (as shown below). In order to support custom FPS, iClone 8 core has made many corresponding modifications. | ||
Latest revision as of 18:55, 1 December 2022
- Main article: iC8 Python API.
iClone 8 supports custom FPS settings that users can adjust. The FPS value can be changed to suit the project in the Project settings (as shown below). In order to support custom FPS, iClone 8 core has made many corresponding modifications.
RTime is the class used by iClone to represent time. In order to realize the function of customizing FPS, iClone 8 adjusts the core 'tick value from "1000" to "6000", and the value of 1 tick equals 1/6000 seconds or 0.16666666 milliseconds.
Therefore in iClone 8, RTime is rewritten with the addition of two new classes: RTick and RFps:
1 time = RLPy.RTime.FromValue(6000) # create RTime from value
2 print( time.ToInt() ) # get value from RTime
RFps defines the current FPS supported by iClone (for example: RFps.Fps24, RFps.Fps60, RFps.Fps120..). When calling RLPy.RGlobal.GetFps() to get the FPS setting of the current Project, the function will also return the RFps object. Therefore, you will need to use the following code when you want to convert between the frame index and RTime:
1 fps = RLPy.RGlobal.GetFps() # return RFps
2 # convert to frame index
3 frame_index = RLPy.GetFrameIndex(current_time, fps)
4 # convert to RTime
5 current_time = RLPy.IndexedFrameTime(frame_index, fps)
6 # time on frame
7 frame_time = RLPy.RGlobal.GetFps().GetFrameTime( current_time )
RTick provides many time unit conversion functions, allowing you to convert from different time units to RTime, such as:
1 time1 = RLPy.RTick.FromMilliSecond(2000) # convert from millisecond
2 time2 = RLPy.RTick.FromSecond(2) # convert from second
In addition, when calling Control > AddKey() function, the FPS parameter is removed in iClone 8:
1 control = clone.GetControl("Transform")
2 control.AddKey(key)