// =========================================================================== // 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. // =========================================================================== // // // Creation Date: December 10, 1999 // // Description: // addRecentProject, used currently used by Project Viewer. // adds projects to the recent project list. // global proc addRecentProject( string $theProject ) { string $RecentProjectsList[]; int $i; int $nNum; int $maxNum; string $project = $theProject; // Strip off slash from the end if it's there (and not the only char) if ( size( $theProject ) > 1 && (gmatch($theProject, "*/") || gmatch($theProject, "*\\\\")) ) { $project = substitute( "/$", $theProject, "" ); } $maxNum = `optionVar -q "RecentProjectsMaxSize"`; if (!`optionVar -exists "RecentProjectsList"`) { if ( $maxNum > 0 ) optionVar -sva "RecentProjectsList" $project; return; } // get the list $RecentProjectsList = `optionVar -q "RecentProjectsList"`; $nNum = size($RecentProjectsList); // search for name in the list. for ($i = 0; $i < $nNum; $i++) { if ($RecentProjectsList[$i] == $project) { // move it to the top. optionVar -rfa "RecentProjectsList" $i; optionVar -sva "RecentProjectsList" $project; return; } } // not found, append at the end. optionVar -sva "RecentProjectsList" $project; $nNum = `optionVar -arraySize "RecentProjectsList"`; if ( $nNum > $maxNum ) // default maximum size { for ( $i = 0; $i < $nNum - $maxNum; $i++ ) { // remove the oldest one. optionVar -rfa "RecentProjectsList" 0; } } }