March 2019: ewertb.soundlinker.com is getting relocated to ewertb.mayasound.com, please update your bookmarks.

MEL How-To #27

Back · Previous · Next Maya

How do I query/set the Time Slider and Range Slider?

To query the highlighted range of the Time Slider:

global string $gPlayBackSlider;
float $rangeArray[2];
$rangeArray = `timeControl -q -rangeArray $gPlayBackSlider`;
// Result: 1 2 //

To set the highlighted range of the Time Slider:

As far as I know, you can't. My attempts to do so (at least with the ‘timeControl’ command) have only yielded errors (as of MayaNT v2.5.1).

global string $gPlayBackSlider;

string $range = `timeControl -q -range $gPlayBackSlider`;
// Result: "93:229" //
timeControl -e -range $range $gPlayBackSlider;
// Error: line 1: Too many arguments.  Expected 1, found 2. //

float $rangeArray[2] = `timeControl -q -rangeArray $gPlayBackSlider`;
// Result: 93 229 //
timeControl -e -rangeArray $rangeArray $gPlayBackSlider;
// Error: line 1: Invalid object or value:  //

To query the Range Slider:

float $minTime = `playbackOptions -q -minTime`;
// Result: 1 //
float $maxTime = `playbackOptions -q -maxTime`;
// Result: 30 //

To set the Range Slider:

float $minTime = 12.0;
float $maxTime = 18.5;
playbackOptions -minTime $minTime -maxTime $maxTime;