Home Coding, Scripting, Shaders

MEL is it possible to export a .fbx file and set the options explicitly?

Polycount Sponsor
Online / Send Message
malcolm Polycount Sponsor
Hi guys, so I'm looking to create a script that exports my selection as .fbx with some specific options, I've searched the help and I can't figure out how to set these options specifically. Basically I want to export the .fbx with these options turned off even if the user has turned them on in the GUI so I'm looking for a way to code this in MEL script. Can someone point me to where I could learn this, and I guess I'd need a browse button too so they can choose where to save the file.





Replies

  • Hwaet
    Offline / Send Message
    Hwaet null
    Yes! It's possible but oddly not exposed in the maya scripting docs. I stumbled over this until I discovered the "FBXProperties" mel command. (there is no python equivalent that I could find) If you run that command, you'll see a huge printout in the script editor that shows all the FBX settings. It'll include the areas you have highlighted in your screencap above.

    For example:
    // PATH: Export|IncludeGrp|Geometry|Triangulate    ( TYPE: Bool ) ( VALUE: "false" ) // 

    My workflow has been to run a series of the mel fbx commands here to set my settings, and then to export the fbx file afterwards with the FBXExport -f filename.fbx -s command. You can set that location with a generic maya prompt gui. For example:

    <p>$location = `fileDialog2 -ff "*.fbx"`;
    //write out according to the frame range in the time slide
    <span style="background-color: transparent; color: inherit; font-size: inherit;">
    <font face="open sans, sans-serif">FBXProperty Export|IncludeGrp|Animation -v true;
    </font></span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: &quot;open sans&quot;, sans-serif;">FBXExportBakeComplexAnimation -v true;
    </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: &quot;open sans&quot;, sans-serif;">$startTime = `playbackOptions -q -minTime`;
    </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: &quot;open sans&quot;, sans-serif;">$endTime = `playbackOptions -q -maxTime`;
    </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: &quot;open sans&quot;, sans-serif;">FBXProperty Export|AdvOptGrp|Fbx|AsciiFbx -v "ASCII";</span></p><p><span style="background-color: transparent; color: inherit; font-size: inherit;">
    <font face="open sans, sans-serif">//Export the anim!
    </font></span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: &quot;open sans&quot;, sans-serif;">FBXExport -f $location -s;</span></p>


    I think you can find more in their help docs below. But yeah, the scripting reference page comes up with nothing. 
    https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-F48E3B78-3E56-4869-9914-CE0FAB6E3116-htm.html
  • malcolm
    Online / Send Message
    malcolm Polycount Sponsor
    That's perfect, thanks a lot for this, this is exactly what I was looking for.
  • SBliznitsov
    Offline / Send Message
    SBliznitsov polycounter lvl 3
    Hi!
    Could you tell me please which MEL command I should use to open the "Export Selection" window?

    Thanks for any help!
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 10
    Its just ExportSelection(); i believe
  • SBliznitsov
    Offline / Send Message
    SBliznitsov polycounter lvl 3
    That's right, thanks. Already figured it out.
Sign In or Register to comment.