Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

How can I get Maya's File -> Open dialog to open to the current directory?

$
0
0
Maya's File -> Open dialog never seems to open where I want it to. Ever. And normally I avoid hacking Maya's internal scripts, since you have to do it every new version that comes out. But currently this is worth it. It will change the behavior to open Maya's file dialog to the current directory of the current scene you have open.

Around line 482 in: (I was modifying Maya 2014)
C:\Program Files\Autodesk\Maya<20XX>\scripts\others\projectViewer.mel
Comment out this line like so:
        //$cmd += (" -startingDirectory \"" + $actionOptions[9] + "\"");
And replace the block around it with this mel:
    if ("" != $actionOptions[9]){
        //$cmd += (" -startingDirectory \"" + $actionOptions[9] + "\"");
        string $scene = `file -q -sn`;
        if(size($scene) > 0){
            string $dir = dirname($scene);
            $cmd += (" -startingDirectory \"" + $dir + "\"");
            }
        else
            $cmd += (" -startingDirectory \"" + $actionOptions[9] + "\"");
        }

Viewing all articles
Browse latest Browse all 610

Trending Articles