Maya open file dialog

Is there a preference setting or option var that will tell the open file dialog to use the current file as the path for the dialog?

I don’t know of a way to have it use the current scene, but you can set the directory it will use as current with the function “retainWorkingDirectory”. The function that it calls to get the current directory to use is “setWorkingDirectory”, so you could override that to look for an optionVar and return the directory of the current scene. Not elegant though.

are you using maya commands or qt?
fileDialog2 has a -startingDirectory argument…

http://download.autodesk.com/global/docs/maya2014/en_us/CommandsPython/fileDialog2.html

1 Like

i’ll lookm into the retainworking dir approach.

@rgkovach: I meant just using maya open file menu. A lot of folks have their recent list populated with relevent file, so the go to one and then want to look for a file next to it, but they’ll stat at the rpoject root, then have to navigate back to the folder for the current file. Or something similar to that.

hmm… yea sounds like whichever you go, you’ll be overriding some aspect of maya’s native functionality.
I find the simplest approach is to copy the defaultRuntimeCommands.mel file to a custom script path and modify the File IO runtime commands. This way the menus, keyboard shortcuts, and any shelf buttons made from the menu all carry the changes.