123iamking
123iamking

Reputation: 2703

How to open Game Exporter with mel script?

I use Game Exporter to export my animation a lot. But I'm tired of selecting File > Game Exporter from the main menu.

Can I use mel script to open Game Exporter? Or even better, can I use the mel script to automatically generate the input for Game Exporter (For example: automatically input Export path, Animation name, Export selection only,...)?

Upvotes: 0

Views: 2412

Answers (2)

Danika Bird
Danika Bird

Reputation: 1

to refresh to get the animation clip names to update

from maya import cmds
from maya import mel as mm

# setting the animation clip name, this is 0 indexed    
cmds.setAttr('gameExporterPreset2.animClips[0].animClipName', 'clipNameHere', type='string')

# For changes to Animation clip Name only we need to close and reopen the window
if cmds.window("gameExporterWindow", exists=True):
    print 'exists'
    cmds.deleteUI("gameExporterWindow")

else:
    pass

mm.eval('gameFbxExporter;')

Upvotes: 0

123iamking
123iamking

Reputation: 2703

Can I use mel script to open Game Exporter?

Open game exporter

gameFbxExporter;

Or even better, can I use the mel script to automatically generate the input for Game Exporter (For example: automatically input Export path, Animation name, Export selection only,...)?

Export path

(Set to "E:/aaa")

setAttr -type "string" gameExporterPreset2.exportPath "E:/aaa";

Animation name

(Set to "aaa")

gameExp_SetUniqueAnimationClipName 0"aaa"gameExporterWindow|gameExporterTabFormLayout|gameExporterTabLayout|gameExporterAnimationTab|anim_gameExporterMainFormLayout|anim_gameExporterExportTypeFormLayout|formLayout344|anim_gameFbxExporterAnimClipFrameLayout|anim_gameFbxExporterAnimClipFormLayout|anim_gameFbxExporterScrollLayout|formLayout345|textField20;

But this is not really effective, because of the hard code: formLayout344|, formLayout345|textField20. Must find a way to make it dynamic.

So use this instead

setAttr -type "string" gameExporterPreset2.exportFilename "aaa";

Export selection only

setAttr("gameExporterPreset2.exportSetIndex") 2;
gameExp_CreateExportTypeUIComponents;

Here is how I figure it out: I check all the records of Mel.

Upvotes: 2

Related Questions