PyMel FBXExport method?

7,552 views
Skip to first unread message

Eric Thivierge

unread,
Sep 15, 2014, 4:59:55 PM9/15/14
to python_in...@googlegroups.com
Looking around in the PyMel docs not finding too much info on FBXExports
via PyMel. Anyone got any info?

Thanks in advance,
Eric T.

Eric Thivierge

unread,
Sep 15, 2014, 5:55:22 PM9/15/14
to python_in...@googlegroups.com, Geordie Martinez
Awesome thanks.

On Monday, September 15, 2014 5:54:22 PM, Geordie Martinez wrote:
> there is no pymel api for FBX to my knowledge, BUT
> you can python-ify your calls by using pm.mel
> then the mel command is python. try it.
>
> import pymel.core as pm
> pm.loadPlugin("fbxmaya") # LOAD PLUGIN
>
> # EXAMPLE SYNTAX
> # pm.*mel*.FBXCommand(args)
>
> #for example
> pm.mel.FBXExport(f="FILENAME")
> pm.mel.FBXImport(f="FILENAME",t="TAKE")
> --
> You received this message because you are subscribed to the Google
> Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to python_inside_ma...@googlegroups.com
> <mailto:python_inside_maya%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/__msgid/python_inside_maya/__5417533C.8050801%40hybride.com
> <https://groups.google.com/d/msgid/python_inside_maya/5417533C.8050801%40hybride.com>__.
> For more options, visit https://groups.google.com/d/__optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python_inside_m...@googlegroups.com
> <mailto:python_inside_m...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CABPXW4h48ZBiHY%3Dxhc3QnchnEGgtGBBfFyGzE7bb4dJRWSJZ4Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CABPXW4h48ZBiHY%3Dxhc3QnchnEGgtGBBfFyGzE7bb4dJRWSJZ4Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Yi Liang Siew

unread,
Sep 15, 2014, 6:17:19 PM9/15/14
to python_in...@googlegroups.com
Been doing a ton of stuff with FBXExport lately. I recommend just going
through mel.eval(). I've experienced a lot of weird stuff when trying to
do it through pymel.
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Geordie Martinez

unread,
Sep 15, 2014, 6:23:39 PM9/15/14
to python_inside_maya
What kind of weirdness? do you have any stack traces or examples? I'd like to see if it's an unknown bug or if there are problems like having an argument called "import" or something that will break python.
behind the scenes pm.mel is doing mel.eval so there shouldn't any weirdness.


<mailto:python_inside_maya%2Bunsu...@googlegroups.com>.
    To view this discussion on the web visit
https://groups.google.com/d/__msgid/python_inside_maya/__5417533C.8050801%40hybride.com
<https://groups.google.com/d/msgid/python_inside_maya/5417533C.8050801%40hybride.com>__.
    For more options, visit https://groups.google.com/d/__optout
    <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/54176505.9070205%40gmail.com.

Yi Liang Siew

unread,
Sep 15, 2014, 6:37:28 PM9/15/14
to python_in...@googlegroups.com
Most of it was back when I was dealing with passing arguments to FBXExport; a lot of what I remember getting was TypeErrors and I was sick of dealing with it (since I had a Qt Gui and was already doing a couple of type conversions here and there), so what I ended up doing was just writing my own method to take in simple bool args and return the correct FBXExport strings to be evaluated.

Also some FBXExport methods that don't work between versions of Maya, if I use mel.eval, it's easier for me to catch them too. (e.g. FBXExportReferencedAssetsContent is 2014-specific)

I don't really have any isolated code samples on hand unfortunately...
    send an email to python_inside_ma...@googlegroups.com

<mailto:python_inside_maya%2Bunsu...@googlegroups.com>.
    To view this discussion on the web visit
https://groups.google.com/d/__msgid/python_inside_maya/__5417533C.8050801%40hybride.com
<https://groups.google.com/d/msgid/python_inside_maya/5417533C.8050801%40hybride.com>__.
    For more options, visit https://groups.google.com/d/__optout
    <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABPXW4icfM%3DAkY2C%2BevTTv%2BXwoA_KJqqKCWtPG6x3Hy%2BDQJWXQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Eric Thivierge

unread,
Sep 17, 2014, 10:40:41 AM9/17/14
to python_in...@googlegroups.com, Yi Liang Siew
Just as a follow up, how does one suppress the warning messages that
may appear? I'm trying to run a script that batch converts a list of
Maya files to fbx and any time a warning pops up it freezes the
process. Most warnings I don't care about...
>> <mailto:ethiv...@hybride.com
>> <mailto:ethiv...@hybride.com>>> wrote:
>>
>> Looking around in the PyMel docs not finding too much
>> info on
>> FBXExports via PyMel. Anyone got any info?
>>
>> Thanks in advance,
>> Eric T.
>>
>> --
>> You received this message because you are subscribed
>> to the Google
>> Groups "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving
>> emails from it,
>> send an email to
>> python_inside_ma...@googlegroups.com
>> <mailto:python_inside_maya%2B__uns...@googlegroups.com>
>> <mailto:python_inside_maya%2Bunsu...@googlegroups.com
>> <mailto:python_inside_maya%252Buns...@googlegroups.com>>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/__msgid/python_inside_maya/__5417533C.8050801%40hybride.com
>> <https://groups.google.com/d/msgid/python_inside_maya/5417533C.8050801%40hybride.com>__.
>> For more options, visit
>> https://groups.google.com/d/__optout
>> <https://groups.google.com/d/optout>.
>>
>>
>> --
>> You received this message because you are subscribed to
>> the Google
>> Groups "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails
>> from it, send
>> an email to
>> python_inside_m...@googlegroups.com
>> <mailto:python_inside_maya%2Bunsu...@googlegroups.com>
>> <mailto:python_inside_m...@googlegroups.com
>> <mailto:python_inside_maya%2Bunsu...@googlegroups.com>>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CABPXW4h48ZBiHY%3Dxhc3QnchnEGgtGBBfFyGzE7bb4dJRWSJZ4Q%40mail.gmail.com
>>
>> <https://groups.google.com/d/msgid/python_inside_maya/CABPXW4h48ZBiHY%3Dxhc3QnchnEGgtGBBfFyGzE7bb4dJRWSJZ4Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> ---
>> This email is free from viruses and malware because avast!
>> Antivirus protection is active.
>> http://www.avast.com
>>
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to python_inside_m...@googlegroups.com
>> <mailto:python_inside_maya%2Bunsu...@googlegroups.com>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/54176505.9070205%40gmail.com.
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to python_inside_m...@googlegroups.com
>> <mailto:python_inside_m...@googlegroups.com>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CABPXW4icfM%3DAkY2C%2BevTTv%2BXwoA_KJqqKCWtPG6x3Hy%2BDQJWXQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CABPXW4icfM%3DAkY2C%2BevTTv%2BXwoA_KJqqKCWtPG6x3Hy%2BDQJWXQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> ------------------------------------------------------------------------
> <http://www.avast.com/>
>
> This email is free from viruses and malware because avast! Antivirus
> <http://www.avast.com/> protection is active.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python_inside_m...@googlegroups.com
> <mailto:python_inside_m...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/541769BE.4000108%40gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/541769BE.4000108%40gmail.com?utm_medium=email&utm_source=footer>.

Lee Dunham

unread,
Jan 15, 2015, 5:18:05 PM1/15/15
to python_in...@googlegroups.com, son...@gmail.com, ethiv...@hybride.com
This should help.


Store state on batch execute, disable, then re-apply stored state on batch complete.

Eric Thivierge

unread,
Jan 15, 2015, 5:26:42 PM1/15/15
to Lee Dunham, son...@gmail.com, python_in...@googlegroups.com
Thanks Lee.

On Thursday, January 15, 2015 5:18:05 PM, Lee Dunham wrote:
> This should help.
>
> file -prompt
> <http://download.autodesk.com/us/maya/2011help/Commands/file.html#flagprompt>

Geordie Martinez

unread,
Sep 15, 2014, 5:54:26 PM9/15/14
to python_inside_maya
there is no pymel api for FBX to my knowledge, BUT
you can python-ify your calls by using pm.mel
then the mel command is python. try it.

import pymel.core as pm
pm.loadPlugin("fbxmaya") # LOAD PLUGIN

# EXAMPLE SYNTAX
# pm.mel.FBXCommand(args)

#for example
pm.mel.FBXExport(f="FILENAME")
pm.mel.FBXImport(f="FILENAME",t="TAKE")
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5417533C.8050801%40hybride.com.

juta...@gmail.com

unread,
Nov 16, 2016, 7:02:05 PM11/16/16
to Python Programming for Autodesk Maya
The issue here ultimately boils down to the FBX* commands not using the standard Maya ArgParser syntax and just reading the Args directly out of the command. So that's not super epic.

An option for this if you don't want to use PyMEL in your pipeline is to either call the MEL commands with maya.mel.eval()... or otherwise check out this excellent Blog post suggesting a nicely Python-wrapped workaround for these kinds of offending plugins:

http://techartsurvival.blogspot.com/2014/10/laziness-and-cleanliness-and-mel-oh-my.html

ziet...@gmail.com

unread,
Nov 13, 2019, 7:25:11 PM11/13/19
to Python Programming for Autodesk Maya
Thank you so much. I have been going literally insane trying to get this to work


On Monday, September 15, 2014 at 2:54:26 PM UTC-7, Geordie Martinez wrote:
there is no pymel api for FBX to my knowledge, BUT
you can python-ify your calls by using pm.mel
then the mel command is python. try it.

import pymel.core as pm
pm.loadPlugin("fbxmaya") # LOAD PLUGIN

# EXAMPLE SYNTAX
# pm.mel.FBXCommand(args) #for example pm.mel.FBXExport(f="FILENAME") pm.mel.FBXImport(f="FILENAME",t="TAKE")

On Mon, Sep 15, 2014 at 1:59 PM, Eric Thivierge <ethiv...@hybride.com> wrote:
Looking around in the PyMel docs not finding too much info on FBXExports via PyMel. Anyone got any info?

Thanks in advance,
Eric T.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages