Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Disable Dialog on MSceneMessage.kBeforeSaveCheck Callback

Disable Dialog on MSceneMessage.kBeforeSaveCheck Callback

AronDurkin
Enthusiast Enthusiast
394 Views
2 Replies
Message 1 of 3

Disable Dialog on MSceneMessage.kBeforeSaveCheck Callback

AronDurkin
Enthusiast
Enthusiast

hello!

 

Does anyone know how to disable this dialog when using om2.MSceneMessage.addCheckCallback(om2.MSceneMessage.kBeforeSaveCheck, before_save_check). OR does any one know another way i can run code on save, check stuff and stop it saving should I need to? (if the answer is, override SaveScene and SaveSceneAs in defaultRunTimeCommands.mel, then sure, but I need this on a shared script path, and thus, can i set maya version specific scripts on a shared path? guess I'd need to setup that up on startup getting the version?)

 

I know how to change the text in this dialog, but would love to disable it and show my own / do whatever i want.

 

kBeforeSaveCheck.png

 

thanks

395 Views
2 Replies
Replies (2)
Message 2 of 3

FirespriteNate
Advocate
Advocate

In the docs it says kBeforeSaveCheck is explicitly to allow users to confirm something (i.e. "allows user to cancel action" - which presumably necessitates a dialog). If you want the same behaviour without the dialog, isn't kBeforeSave a better choice for that?

0 Likes
Message 3 of 3

AronDurkin
Enthusiast
Enthusiast

Correct me if I’m wrong but in my testing kBeforeSave doesn't allow you to abort the save. You can throw an error in the function given to that callback but ultimately the file will still save. Ideally I would not let the user save under certain conditions.