一半君的总结纸

听话只听一半君

#27 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;
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: