Save file dialog

1,377 views
Skip to first unread message

likage

unread,
Dec 23, 2014, 11:05:21 PM12/23/14
to python_in...@googlegroups.com
I have looked at the list of maya commands available but I am unable to find any dialogs that are similar to 'Save Scene as' and I chanced upon fileDialog and fileDialog2.

I can try using mel.eval('SaveSceneAs') but it does seems like a practical approach, maybe? And so, I am going to use fileDialog2 since it is mentioned that fileDialog is going to be deprecated but as I tried it out
import maya.cmds as cmds
cmds
.fileDialog2(ds=2, fileFilter="Maya Ascii (*.ma)")

my scene file was not saved at all. Am I doing it wrong somewhere?

Additonally, was wondering, if it is possible to prompt a popup window (like a Ok/Cancel), if user clicks on OK, the fileDialog2 will appears for them to save the file etc..

Eduardo Grana

unread,
Dec 24, 2014, 8:26:17 AM12/24/14
to python_in...@googlegroups.com
Hello Likage,
Be aware that the fileDialog2 command only gets a filename(or filenames)
then you need to rename the scene, and save it.

I dont have maya around to check it out,
but it should be something like this

import maya.cmds as cmds
name =  cmds
.fileDialog2(ds=2, fileFilter="Maya Ascii (*.ma)")

#not sure if fileDialog2 returns a single name or a list,
# in case it's a list use name[0]
cmds.file( rename=name  )
cmds.file( save=True, type='mayaAscii' )
Cheers,
Eduardo

--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/406df031-b91e-429a-944e-7ddc189e3287%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages