// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure Name: // AEdisplayLayerNoScroll // // Description Name; // Creates the attribute editor controls for the displayLayer Node // // Input Value: // nodeName // // Output Value: // None // global proc changeDisplayLayerNumber ( string $parent, string $id ) { int $idValue = `intFieldGrp -q -v1 displayLayerNumberField`; // If this layer is connected to the display layer manager, which all // layers should be, then that is the field we want to edit. (It is // not available in the display layer manager attribute editor.) // // This hides the implementation of the id from the user. // string $cmd = ("listConnections -d on -p on " + $id); string $srcList[] = `eval $cmd`; if( size($srcList) > 0 ) { if( catch(`setAttr $srcList[0] $idValue`) ) { updateDisplayLayerNumber( $parent, $id ); } } else { // If no connection then try to set it directly // if( catch(`setAttr $id $idValue`) ) { updateDisplayLayerNumber( $parent, $id ); } } } global proc updateDisplayLayerNumber (string $parent, string $id) { intFieldGrp -e -v1 `getAttr $id` ($parent + "|displayLayerNumberField"); } // // Procedure Name: // displayLayerNumberNew // global proc displayLayerNumberNew ( string $id ) { setUITemplate -pst attributeEditorTemplate; intFieldGrp -label (uiRes("m_AEdisplayLayerNoScroll.kNumber")) -v1 0 -cc ("changeDisplayLayerNumber " + $id) displayLayerNumberField; setUITemplate -ppt; displayLayerNumberReplace $id; } // // Procedure Name: // displayLayerNumberReplace // // global proc displayLayerNumberReplace (string $id) { string $parent = `setParent -q`; intFieldGrp -e -cc ("changeDisplayLayerNumber " + $parent + " " + $id) displayLayerNumberField; scriptJob -p $parent -rp -attributeChange $id ("updateDisplayLayerNumber "+$parent+" "+$id); updateDisplayLayerNumber( $parent, $id ); // Disable the number for the default layer. It is not allowed to change. // int $value = 1; string $mgr[] = `ls -type displayLayerManager`; if( size($mgr) > 0 ) { string $def[]=`listConnections -p on ($mgr[0] + ".displayLayerId[0]")`; if( (size($def) > 0) && ($def[0] == $id) ) { $value = 0; } } intFieldGrp -e -en ($value) displayLayerNumberField; } // // Procedure Name: // AEdisplayLayerTemplate // global proc AEdisplayLayerNoScroll ( string $nodeName ) { editorTemplate -beginLayout (uiRes("m_AEdisplayLayerNoScroll.kDrawingOverrideOptions")) -collapse 0; AEdrawInfo "displayType" "levelOfDetail" "shading" "texturing" "playback" "enabled" "visibility" "overrideRGBColors" "color" "overrideColorRGB"; editorTemplate -callCustom "displayLayerNumberNew" "displayLayerNumberReplace" "identification"; editorTemplate -endLayout; // suppressed attributes editorTemplate -suppress "drawInfo"; // include/call base class/node attributes AEdependNodeTemplate $nodeName; }