一半君的总结纸

听话只听一半君

#46 如何改变 Maya的编辑器里的浮点小数显示的精度 (比如Channel Box, Attribute Spreadsheet 和 Attribute Editor)?

Channel Box

Maya 把 main Channel Box 的名字存在一个全局变量(global string)里:

$gChannelBoxName

他的值一般情况下可能会是类似下面这样的:

"MayaWindow|mayaMainWindowForm|formLayout5|formLayout7|formLayout11|menuBarLayout1|frameLayout1|mainChannelBox"

所以, 可以使用下面的命令来修改Chanel Box的 ‘precision’ 属性:

global string $gChannelBoxName;
channelBox -e -precision 4 $gChannelBoxName;

Attribute Spreadsheet

Attibute Spreadsheet 没有相应的全局变量, 但是他可以通过下面的命令查询得到:

int $precision = 4;

// Get a list of all current Editors
string $editors[] = `lsUI -editors`;

for ( $ed in $editors )
{
  // If this one is a spreadSheetEditor, edit its 'precision' flag
  if ( `objectTypeUI $ed` == "TspreadSheetEditor" )
  {
    spreadSheetEditor -e -precision $precision $ed;
  }
}

Attribute Editor

Attribute Editor 就比较麻烦了,因为他是通过 AEtemplate scripts 和一些内部的functions来控制的. 虽然确实可以通过查询修改AE controls的精度, 但是这样做比你想的要复杂一些.

Caveats

不管你改了哪,效果都不是永久的. 只要你重启Maya, Channel Box 的精度设置会恢复默认, Attribute Spreadsheet 则是你重新打开他就会恢复默认.

如果你想让设置固定下来:

Channel Box

你可以把精度设置加到 userSetup.mel.

Attribute Spreadsheet

找到生成下面window的MEL script:

/others/SpreadSheetWindow.mel

然后修改创建spreadsheet的那一行:

  spreadSheetEditor
    -ln true
          -parent $formName
          -mlc SSEcon
         // Add Precision flag
          -precision 4
          $edName;

Related How-To’s

Wednesday, November 29, 2000

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