【问题标题】:Attribute template in MayaMaya 中的属性模板
【发布时间】:2017-06-22 13:25:41
【问题描述】:

我在 Maya 2014 中工作。我的自定义属性显示在 Channels Box 中。我现在正试图在Attribute Editor 中显示我的自定义属性。我有一个名为 AECamera_OrthoTemplate.mel 的 AETemplate 文件,代码如下:

global proc AECamera_OrthoTemplate( string $nodeName ) {    

    editorTemplate -beginScrollLayout ;
    editorTemplate -beginLayout "Camera" -collapse 0 ;
    editorTemplate -label "Always Show Frustrum" -addControl "boolAttr" ;
    editorTemplate -label "Frustrum NearZ" -addControl "numAttr" ;
    editorTemplate -label "Frustrum FarZ" -addControl "numAttr" ;
    editorTemplate -label "Frustrum Width" -addControl "numAttr" ;
    editorTemplate -label "Frustrum Height" -addControl "numAttr" ;
    editorTemplate -endLayout ;

    // Currently editing values on the shape object,
    // so drag in the shape attributes as well
    AEshapeTemplate $nodeName ;

    editorTemplate -addExtraControls ; 
    editorTemplate -endScrollLayout ;
}

查看Attribute Editor 并选择了我的自定义相机形状时,我看到打开的Camera 布局里面没有任何内容,并且所有控件似乎都放置在底部的Extra Attributes 布局部分中。我想看看那些嵌套在Camera 部分的控件。

如果能帮助我克服这个障碍,我们将不胜感激,

谢谢。

【问题讨论】:

    标签: scripting attributes maya mel


    【解决方案1】:

    我误解了 -addControl 标志,它需要属性的名称而不是要创建的控件的类型。

    当它被识别时,它会自动从属性中神奇地推断出控件类型。

    控件最终出现在额外属性部分的原因是 Maya 很聪明,会将任何未知属性放入该部分。

    希望这对其他人有帮助。

    【讨论】:

    • 确实,您的所有发现都是正确的——如果我早点找到这个问题,我会回答的。您不妨将自己的答案标记为“答案”。
    猜你喜欢
    • 1970-01-01
    • 2016-08-26
    • 1970-01-01
    • 2019-07-28
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多