Maya Game Exporter Hax

I've been having some fun using the GameExporter that comes bundled with Maya. It's really nice to have a well featured exporter that you don't have to write yourself.

There is one thing that really bugs me about it though- I just can't find the button to suppress the "Replace files that already exist?" and "Success!" messages. Sure, I like the validation, but when I need to export 100+ files through a batch process it can get a bit tedious.

It doesn't feel as rewarding the 80th time...

Sooo... rather than doing anything fancy like finding the topmost window and deleting it or whatever, what if I just made it so the GameExporter just, you know, wouldn't do that, and just log to the script editor all nice like.

Enter global proc redefinition! Probably very familiar to anyone who uses MEL more than I do, you can redefine a gobal proc at any time, stomping it's previous behavior. (it's a bit more nuanced than that, but for my purposes, STOMP STOMP GOOD)

Anyway, you can probably see where this is going. I don't like the dialogue windows, and I would prefer them to just print to the log. Deep inside <InstallDir>\Maya2018\scripts\others are a bunch of scripts tellingly named "gameFbxExporter........mel".

Taking a browse through these I found three procedures that I happily made my own versions of:

global proc int gameExp_OverwriteExistingFile(string $path)
{
    print("Force overwriting files.\n");
    return 1;
}


global proc int gameExp_OverwriteExistingFiles(string $fileNameList[], int $overwriteListLimit)
{
    print("Force overwriting files.\n");
    return 1;
}

global proc gameExp_ShowMessage(string $message, int $msgType)
{
    print $message;
    print "\n";
}


Executing that through the script editor now logs my super helpful messages, but without the messy dialogue prompts.

Now, you might be thinking, it would be less destructive to have taken the whole original function and maybe, you know, added an option for suppressing the dialogue, and you would be right.

But STOMP STOMP GOOD. BATCH EXPORT GOOD. Also tired.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thank you ... thank you soooo much :)

    I was going crazy with those prompts every 10 seconds.
    I even made a formal feature request to Autodesk to make the prompting optional with a checkbox. Hopefully they will get around to it eventually. But for now this mod will do for me.

    These procedures can be found in: gameFbxExporterUtilities.mel specifically.

    If people in the future are reading this I can confirm this still works in Maya2020.1 and also in Maya LT.

    www.warby.de

    ReplyDelete

Comments?