// =========================================================================== // 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. // =========================================================================== // // Description: // This procedure creates the DG traversal RMB stuff // proc fillOutSection( string $chain[], string $itemsMenu[], int $maxItems ) { string $item, $each, $label; string $list[]; int $n, $cntr, $lineCntr; int $moreSubs = 0; int $subs = 0; $cntr = size($itemsMenu); $lineCntr = $cntr; for( $item in $chain ) { if( $lineCntr > $maxItems){ $moreSubs += 1; menuItem -label (uiRes("m_dgHistoryPopupFill.kMore")) -subMenu true -to true -aob true ("SESMM" + string($moreSubs)); $lineCntr = 0; } tokenize( $item, "|", $list ); $n = size($list); if( 1 == $n ) { $label = $item; string $menu = `menuItem -subMenu true -aob true -label $label`; menu -e -pmc ("createTraversalMenuItems \"" + $menu + "\" " + $item ) $menu; setParent -menu ..; $itemsMenu[$cntr] = $menu; $cntr += 1; $lineCntr += 1; } else if( $n > 0 ) { string $cbi = "select -add"; string $lab = ($item + "..."); string $cbo = ("showEditor " + $list[0] + ";"); for( $each in $list ) { $cbi = $cbi + " " + $each; } $itemsMenu[$cntr] = `menuItem -c $cbi -label $lab`; menuItem -optionBox true -c $cbo; $cntr += 1; $lineCntr += 1; } } for( $i=0; $i<$moreSubs; $i+=1 ) { setParent -menu ..; } } global proc dgHistoryPopupFill( string $nameItem, int $future ) // // Description: // Creates the DG Traversal history RMB popup based on selection // { int $maxItemsPerScreen = 25; string $chainFalse2[]; string $chainTrue2[]; string $itemsMenu[]; string $transforms[]; if( "" == $nameItem ) { menuItem -label (uiRes("m_dgHistoryPopupFill.kNoSelection")) noSelectionItem; } else { $transforms = `ls -typ transform $nameItem`; if( size($transforms) > 0 ) { $chainFalse2 = `listHistory -lf false -bf -lv 1 -f $future -af $nameItem`; } $chainTrue2 = `listHistory -lf true -bf -lv 1 -f $future -af $nameItem`; // Remove duplicates // string $nameItems[] = { $nameItem }; string $moreStuff[] = stringArrayRemove( $chainFalse2, $chainTrue2 ); string $combined[] = stringArrayCatenate( $chainFalse2, $moreStuff ); string $noDupes[] = stringArrayRemove( $nameItems, $combined ); // Remove nodes in black box containers // // Add a dummy entry, since we have no original node that must be // included. // $noDupes[size($noDupes)] = ""; string $final[] = filterBlackBoxNodes( $noDupes, false ); if( size($final) > 0 ) { string $label; if( $future ){ $label = (uiRes("m_dgHistoryPopupFill.kFutureNodes")); } else { $label = (uiRes("m_dgHistoryPopupFill.kHistoryNodes")); } menuItem -d true; menuItem -label $label; fillOutSection( $final, $itemsMenu, $maxItemsPerScreen ); } } }