// =========================================================================== // 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: January 16, 2003 // // Procedure Name: // cleanUp_AddUserCleanUp // // Description: // // Adds a new cleanup operation to the Optimize Scene Size dialog // box. If enabled, this operation will run when the user clicks // Optimize Scene. // // Input Arguments: // // $name - a string that will be used to uniquely identify this // operation (should have no spaced in it) // $label - user-friendly label that will appear in the Optimize // Scene Size dialog // $default - 1 if the optimization should be enabled by default // $cmd - MEL command string to execute when the optimization is // to be run. // // Return Value: None. // // Related Functions: // // For progress reporting and interruptability, user-defined cleanup // steps might want to make use of the following utility functions: // // cleanUp_StartProgress() - called before an operation begins // cleanUp_SetProgress() - called as the operation is running, to // update the progress bar. // cleanUp_EndProgress() - called to signal that the operation is // finished. // cleanUp_CheckInterrupt() - called between cleanup operations to // detect when a previous operation has // been interrupted. // cleanUp_Summary() - called to report the results of cleanup // operations. // //----------------------------------------------------------------------- global proc cleanUp_AddUserCleanUp( string $name, string $label, int $default, string $cmd ) { // global variable that stores user-defined cleanup operation // information // global string $gUserSceneCleanUps[]; // see if this optimization is already registered // int $len = size($gUserSceneCleanUps)/4; int $i; int $foundIndex = $len; for( $i = 0; $i < $len; $i++ ) { if( $gUserSceneCleanUps[4*$i] == $name ) { $foundIndex = $i; break; } } // store the relevant information for this optimization in // the array // $gUserSceneCleanUps[4*$foundIndex] = $name; $gUserSceneCleanUps[4*$foundIndex+1] = $label; $gUserSceneCleanUps[4*$foundIndex+2] = $default; $gUserSceneCleanUps[4*$foundIndex+3] = $cmd; }