一半君的总结纸

听话只听一半君

#25 How can I control the display of Key Ticks in the Time Slider via MEL?

The command syntax to control the display of the Key Ticks is as follows:

global string $gChannelBoxName;
global string $gPlayBackSlider;

// No Key Ticks
timeControl -e -showKeys none $gPlayBackSlider;

// Active Key Ticks
timeControl -e -showKeys active $gPlayBackSlider;

// Key Ticks from Channel Box
timeControl -e -showKeys $gChannelBoxName $gPlayBackSlider;

To demonstrate their use in the form of a simple control window:

keyticks
// showKeyTicks.mel  v1.0  (18 Feb 2000)
//
// MEL script for Maya
//
//    Bryan Ewert
//    http://www.ewertb.com

global proc eg_performShowKeyTicks( int $mode )
{
  // Name of Time Slider
  global string $gPlayBackSlider;

  // Name of Channel Box (for Channel Box mode)
  global string $gChannelBoxName;

  switch ( $mode )
  {
    case 0:
      // No Key Ticks
      timeControl -e -showKeys none $gPlayBackSlider;
      break;

    case 1:
      // Active Key Ticks
      timeControl -e -showKeys active $gPlayBackSlider;
      break;

    case 2:
      // Key Ticks from Channel Box
      timeControl -e -showKeys $gChannelBoxName $gPlayBackSlider;
      break;

  }
}

global proc showKeyTicks()
{
  if ( `window -exists eg_showKeyTicks` )
    deleteUI -window eg_showKeyTicks;

  window -title "Show Key Ticks" eg_showKeyTicks;
  columnLayout;

    radioCollection;
    radioButton -label "No Ticks"
      -onc "eg_performShowKeyTicks(0)";
    radioButton -label "Active Ticks"
      -onc "eg_performShowKeyTicks(1)";
    radioButton -label "Channel Box Ticks"
      -onc "eg_performShowKeyTicks(2)";

  showWindow;
}

Alternatively, you could just hotkey the command that brings up the Animation Timeline and Playback Preferences window:

preferencesWnd "timeline";
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 博主赞过: