Hi Joe,

I have tried out your code, pardon me, but I am not seeing much of a 
difference, other than the removal of brackets in the first if statement...
Even so, I am getting no dialog popup should for the second part of the 
confirmDialog...


On Wednesday, December 24, 2014 12:32:24 AM UTC+8, Joe Weidenbach wrote:
>
>  Hi again,
>
> So, given this code, The only mistake I see is indeed the parentheses.  
> Here's the code that works: http://pastebin.com/raw.php?i=i2N9JPAW
>
> A note, I added a call to reloadScene() at the end just to make it 
> functional as a button.
>
> Joe
>
> On 12/23/2014 2:34 AM, yann19 wrote:
>  
> This is my first attempt at converting mel code into python - 
> http://pastebin.com/raw.php?i=JwEtGJV6
>
> This is the code that I have done:
>
>  import maya.cmds as cmds
>
> def reloadScene():
>     recentFiles = []
>     
>     curFile = cmds.file(query = True, location = True)
>     
>     if (curFile == "unknown") :
>     
>         if cmds.optionVar( exists = 'RecentFilesList' ):
>             recentFiles = cmds.optionVar( query = 'RecentFilesList' )
>             
>             if cmds.confirmDialog(title = 'Reload Scene', message = ('Reload 
> Last Opened Scene?\n\n' + recentFiles[len(recentFiles)-1]), button = [
> 'Cancel','OK'], defaultButton = 'OK', cancelButton = 'Cancel', 
> dismissString = 'Cancel' ):
>                 cmds.file( str(recentFiles[len(recentFiles)-1]), force = 
> True, open = True)
>                 print "Opening Last Recent File - ", recentFiles[len(
> recentFiles)-1]
>                 
>             else:
>                 cmds.warning("No recent files found!")
>         else:
>             if cmds.confirmDialog(title = 'Reload Scene', message = ('Reload 
> Current Scene?\n\n'), button = ['Cancel','OK'], defaultButton = 'OK', 
> cancelButton = 'Cancel', dismissString = 'Cancel' ):
>                 curFileLoc = cmds.file(query = True, location = True)
>                 cmds.file( curFileLoc , force = True, open = True)
>                 print "Re-Opening current file - ", curFileLoc
>  
>
> But for some reasons, if I added in the curFile variables, my dialog is 
> not popping up and I have a very strong inkling that I have gotten the mel 
> part - 
>  
> *if(`file -q -loc` == "unknown")* wrong
> However, should I omit it, I am unable to get the second dialog working - 
> Reload Current Scene working.
>
> Any pointers are greatly appreciated!
>
>
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to python_inside_maya+unsubscr...@googlegroups.com <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/687fc019-66ef-4e67-bce2-e95dbeaab015%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/python_inside_maya/687fc019-66ef-4e67-bce2-e95dbeaab015%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> ------------------------------
>    <http://www.avast.com/>  
>
> This email is free from viruses and malware because avast! Antivirus 
> <http://www.avast.com/> protection is active. 
>   
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c619ecf9-dcb1-4fd5-b13c-6190d56d688f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to