// =========================================================================== // 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. // =========================================================================== global proc toggleAEFilter( string $nodeType, int $allTypes, int $action ) // // Description: // A callback to toggle the AE filter for the given node type // $nodeType : node type to toggle; "" implies "other" type // $allTypes: if true, action applies to all types // $action: 0 - turn off // 1 - turn on // 2 - toggle // // { string $filterTypes[] = `optionVar -query activeAEShowFilterTypes`; int $numFilterTypes = size($filterTypes); if( $numFilterTypes == 0 ){ return; // No filtering, we're done } int $filterStates[]; if( `optionVar -exists activeAEShowFilterStates` ){ $filterStates = `optionVar -query activeAEShowFilterStates`; } int $numFilterStates = size($filterStates); // Remove old filter states // optionVar -remove activeAEShowFilterStates; // Do "other" first, since it's entry 0, and it's a special case // int $show = 1; // Default value is 1 (i.e., on) if( $numFilterStates > 0 ){ $show = $filterStates[0]; } if( $allTypes || ($nodeType == "") ){ if( $show != $action ){ $show = !$show; string $itemName = "OtherOnOff"; // Update UI if( `menuItem -exists $itemName` ) { menuItem -e -cb $show $itemName; } } } optionVar -iva activeAEShowFilterStates $show; // Now do the rest of the filters // int $filterIndex = 1; while( $filterIndex < $numFilterTypes ){ int $show = 1; // Default value is 1 (i.e., on) if( $filterIndex < $numFilterStates ){ $show = $filterStates[$filterIndex]; if( $allTypes || ( $filterTypes[$filterIndex] == $nodeType ) ){ if( $show != $action ){ $show = !$show; string $itemName = ($filterTypes[$filterIndex] + "OnOff"); // Update UI if( `menuItem -exists $itemName` ) { menuItem -e -cb $show $itemName; } } } } optionVar -iva activeAEShowFilterStates $show; $filterIndex++; } updateAEshowAllButton(); global string $gAEFocusNode; if( $gAEFocusNode != "" ){ updateAE $gAEFocusNode; } }