Exiting and Resetting 3ds Max

The quitMAX() function lets you exit 3ds Max under script control. This function is typically used in batch processing or render scripts. The function has the form:

   

quitMAX [ #noPrompt ] 	 

If the #noPrompt optional argument is not specified and there are unsaved changes in the scene, 3ds Max will prompt with its standard save changes dialog.

Additionally, you can control the scene save and undo states in 3ds Max with the following functions:

setSaveRequired <boolean>   

lets you set the 3ds Max system "dirty" flag. If this flag is set or there are entries in the Undo buffer, the user is asked if they want to save the scene file on a File > New or File > Reset.

   

getSaveRequired() 

returns true if the 3ds Max system "dirty" flag is set to true or if the Undo buffer is not empty. If the Undo buffer if not empty, this function will still return true , even if you just called setSaveRequired false .

   

clearUndoBuffer() 

empties the Undo buffer, both providing a way to reset the undo state and another way to control the save-changes requester.

Normally, if there are entries in the Undo buffer when the scene is closed, 3ds Max will prompt with a save-changes requester. In some cases, where you are controlling undo in MAXScript, you may want to force the need for a save-changes prompt.

The resetMAXFile() function lets you reset 3ds Max under script control. This function is typically used in batch processing or render scripts. The function has the form:

resetMaxFile() [#noPrompt] 

If the #noPrompt optional argument is not specified, 3ds Max will prompt with its standard dialog "Do you really want to reset".

NOTE:In order to check for unsaved changes before resetting the scene, you should use checkForSave() . See 3ds Max File Loading and Saving

FOR EXAMPLE:

 --CheckForSave checks whether the scene has been modified 
--and issues the standard "Do you want to save your changes" dialog. 
--If the user presses Yes or No, the function returns true and 
--resetMaxFile will be called. 
--If the user presses Cancel, the function returns false and 
--resetMaxFile will not be called. 
if checkForSave() do resetMaxFile()

See Also