如何使用 MEL 获取或设定时间轴上的位置?

 
 
 

可以使用 currentTime 命令设定当前时间。

可以查询 currentTime 命令来以 currentUnit 命令控制的格式返回当前时间。

以下命令将以秒为单位的当前时间存储在 $time 变量中:

// Save the current time unit in a variable
string $timeFormat = `currentUnit -query -time`;
// Set the current time unit to seconds
currentUnit -time sec;
// Store the current time in $time
float $time = `currentTime -q`;
// Restore the original time unit we saved earlier
currentUnit -time $timeFormat;