Maya中的属性模板

时间:2014-09-22 18:24:14

标签: scripting attributes maya mel

我在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部分。

任何有助于我超越这一障碍的帮助将不胜感激,

感谢。

1 个答案:

答案 0 :(得分:2)

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

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

控件最终出现在额外属性部分的原因是由于Maya很聪明并且将任何未知属性放入此部分。

希望这对其他人有帮助。