// =========================================================================== // 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: // AEdisplayLayerManagerNoScroll // // Description Name; // Creates the attribute editor controls for the displayLayerManager Node // // Input Value: // nodeName // // Output Value: // None // //====================================================================== // // Proc called when the current displayLayer was changed // global proc changeCurrentDisplayLayer ( string $current ) { string $currentValue = `optionMenuGrp -q -v displayLayerCurrentMenu`; int $id = `getAttr ($currentValue + ".id")`; setAttr $current $id; } //====================================================================== // // Handle Current Display Layer changes // global proc dlManagerCurrentNew ( string $current ) { dlManagerCurrentReplace( $current ); } global proc dlManagerCurrentReplace (string $current) { string $parent = `setParent -q`; rebuildDisplayLayerList $parent $current; // Get ready to update the popup when new entries are added // string $id = substitute("currentDisplayLayer", $current, "displayLayerId"); scriptJob -p $parent -rp -dri -alc -con $id ("rebuildDisplayLayerList "+$parent+" "+$id); optionMenuGrp -e -cc ("changeCurrentDisplayLayer " + $current) displayLayerCurrentMenu; // Update the popup when the attribute is set // scriptJob -p $parent -rp -attributeChange $current ("updateCurrentDisplayLayer "+$current); // Immediately update to initialize updateCurrentDisplayLayer $current; } //====================================================================== // // Rebuild the current displayLayer list // global proc rebuildDisplayLayerList (string $parent, string $attr) { setUITemplate -pst attributeEditorTemplate; // { int $i; int $size; if( `optionMenuGrp -exists ($parent + "|displayLayerCurrentMenu")` ) { deleteUI ($parent + "|displayLayerCurrentMenu"); } setParent $parent; // Make sure we can find the unique UI in this window string $g = `optionMenuGrp -label (uiRes("m_AEdisplayLayerManagerNoScroll.kCurrentLayer")) displayLayerCurrentMenu`; string $plug = substitute("currentDisplayLayer", $attr, "displayLayerId"); string $dstList[] =`listConnections $plug`; $size = size($dstList); for( $i=0; $i<$size; ++$i ) { menuItem -label $dstList[$i]; } // } setUITemplate -ppt; } //====================================================================== // // Refresh the current displayLayer // global proc updateCurrentDisplayLayer (string $current) { // Use the layer name and .cdl connectivity to ensure that the specified // current layer actually exists, and that the ID number can change // without causing problems. int $currentValue = `getAttr $current`; string $attr = substitute("currentDisplayLayer",$current,"displayLayerId"); string $layers[] = `listConnections -p on -s off $attr`; string $layer; for ( $layer in $layers ) { int $id = `getAttr $layer`; if( $id == $currentValue ) { string $name = substitute(".identification",$layer,""); optionMenuGrp -e -v $name displayLayerCurrentMenu; } } } //====================================================================== // // Create the AE for nodes of type displayLayerManager // global proc AEdisplayLayerManagerNoScroll ( string $nodeName ) { string $id = "displayLayerId"; string $curr = "currentDisplayLayer"; editorTemplate -callCustom "dlManagerCurrentNew" "dlManagerCurrentReplace" $curr; // suppressed attributes editorTemplate -suppress $id; // include/call base class/node attributes AEdependNodeTemplate $nodeName; }