script (MEL) |
Only available in MEL |
incrementAndSaveScene |
In categories: System, Files |
Go to: Synopsis. Return value. MEL examples.
incrementAndSaveScene( int $force )
Called when the scene is saved and the "File" -> "Increment & Save"
menu item is clicked or hotkey "Ctrl+Alt+S" is pressed .
Performs a non-destructive save of the current scene by taking the
version of the scene that was last saved to disk, incrementing the version
and putting it into the current scene folder.
If the current scene has never been saved, the regular "Save As..." dialog will be opened.
Otherwise, the version in the current file name is incremented, and the file is saved with this new name.
If the new file name is an existing file, the user will be prompted to confirm that the file will be replaced.
After saving, the current Maya scene will be the renamed file. The original file will be unchanged.
How the file version is incremented:
Maya will look at the end of the root file name for a period followed by a string of digits [0-9].
If this pattern is not found, then Maya will append ".0001" to the root file name.
If the pattern is found, then the string of digits will be incremented, adding a digit only if necessary.
Examples:
MyFile.mb ---> MyFile.0001.mb
MyFile.01.mb ---> MyFile.02.mb
MyFile.99.mb --> MyFile.100.mb
MyFile01.mb --> MyFile01.0001.mb
MyFile.0043.mb --> MyFile.0044.mb
MyFile.00a22.mb --> MyFile.00a22.0001.mb
None
Arguments
Variable Name |
Variable Type |
Description |
$force | int | When the argument is non-zero, the user will not be prompted for confirmation
before the file is written in the event that the file already exists.
|
// User will be prompted for confirmation if the file already exists.
incrementAndSaveScene 0;
// User will NOT be prompted for confirmation if the file already exists. The existing file gets overwritten.
incrementAndSaveScene 1;