You can edit the MEL script invoked by the File > Optimize Scene Size command to add your own cleanup operations to the Optimize Scene Size Options (File > Optimize Scene Size > ). The script is called cleanUpScene.mel, and you can find it in the /scripts/startup directory.
When you open the script, notice that there is a set functions defined near the end of the script to help you add and manage your own scene cleanup operations.
This function registers a new user-defined cleanup operation. This routine can actually be found in the userCleanUp_AddUserCleanUp.mel script, found in the /scripts/startup directory.
Called to create the UI for user-defined cleanup operations. Each operation's UI consists of a checkbox to enable and disable the operation, and an Optimize Now button that can be used to execute only that operation.
Called when the option variables for cleanup operations are either being initialized from scratch (at startup), or reset to factory settings. You can retrieve the appropriate default values and set the option variables accordingly.
Called when the Optimize Scene Size Options dialog is created, to synchronize the check boxes in that dialog with the values of the corresponding optionVars.
Called when the current state of the checkboxes in the Optimize Scene Size Options dialog need to be saved as option variables.
Returns the number of user-defined cleanup operations that have been registered. They are identified by numbers from 0..n-1.
Returns the option variable associated with the specified user cleanup operation. The value of this variable indicates whether or not that particular operation will be performed the next time an Optimize Scene Size operation is invoked.
Returns the default value (on or off) of the specified user-defined cleanup operation.
Returns the name of the checkBox control group in the Optimize Scene Size Options dialog that is associated with the specified user cleanup operation. The state of this checkbox and the corresponding option variable (see userCleanUp_GetOptionVarName()) are synchronized when that dialog is created or destroyed.
Returns the text that should be used to label the specified user-defined cleanup operation in the Optimize Scene Size Options dialog.
Returns the command string that should be executed to perform the specified user-defined cleanup operation.
Prints a list of all registered user-defined cleanup operations.
Returns a list of all option variables associated with user-defined cleanup operations.
Performs the custom optimize scene operations that are currently enabled with optionVars. Returns the number of errors (if any) that occur when invoking the operation.