PDA

View Full Version : How should I exit confirm Dialog and launch SaveSceneAs


DEVILSAN
07-24-2012, 12:25 PM
I encounter a strange problem

{
// create a confirm dialog with a yes and no button. Specif
$response = `confirmDialog -title "Confirm"
-message "Yes or No? It's your choice..."
-button "Yes"
-button "No"
-defaultButton "Yes"
-cancelButton "No"
-dismissString "No"`;

// check response
if( $response == "Yes" ) {
print("User says yes\n");
SaveSceneAs;
} else if( $response == "No" ) {
print("User says no\n");
}
}

according to above code if user press yes the confirm dialog should go away and SaveSceneAs should open, but instead the confirm Dialog box stays and SaveSceneAs opens behind my confirm Dialog box, whats strange if I exit by clickin on close on upper right corner of my confirm dialog box the response is printed No even though I pressed Yes which launched SaveSceneAs and then sometimes maya 2013 crashes...

NaughtyNathan
07-24-2012, 01:33 PM
your example code works fine and as expected on 2010, so they either "broke" something in the confirmDialog command or the SaveSceneAs RunTime funtionality in 2013.

try doing an evalDeferred on the SaveSceneAs and see if that helps. When I had to convert our tools from 2010 to 2012 I had to put loads of evalDeferred in things to avoid crashes and odd behaviour.
evalDeferred("SaveSceneAs");

DEVILSAN
07-24-2012, 02:22 PM
Thank you, that saves me..
I am ATM in process to update some of my old mel scritps .

How did you first learnt about evalDeffered(...)?

CGTalk Moderation
07-24-2012, 02:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.