一半君的总结纸

听话只听一半君

#25 如何用MEL控制时间滑条上的红色竖线关键帧图示显示?

控制是否显示红色竖线( Key Ticks)的命令如下:

global string $gChannelBoxName;
global string $gPlayBackSlider;

// 没有 Key Ticks
timeControl -e -showKeys none $gPlayBackSlider;

// 所有的 Key Ticks
timeControl -e -showKeys active $gPlayBackSlider;

// 只显示 Channel Box的Key Ticks
timeControl -e -showKeys $gChannelBoxName $gPlayBackSlider;

下面把这些控制放在一个简单的控制窗口里:

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;
}

又或者, 你可以设置一个快捷键(hotkey)来打开Animation Timeline and Playback Preferences 窗口:

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 博主赞过: