Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBX export selectedOnly

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
3472 Views, 14 Replies

FBX export selectedOnly

I'm using mel commands to export to FBX.  I just want to export only the selected objects, but even when I choose to export only the selected objects, it is exporting more than that.  Is there a way to have it export ONLY what I have selected?

Tags (3)
14 REPLIES 14
Message 2 of 15
g2m.agent
in reply to: Anonymous

try Render Setup layer, create a Collection, then a selector, add the ONLY object to this selector

 

this is Python API:

http://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=GUID-FFC3298A-9803-4EAF-B472-D13247319EB0

 

 

Message 3 of 15
g2m.agent
in reply to: Anonymous

simple way

Python script

import maya.mel as mel

mel.eval('FBXExport -f "f:/object.fbx" -s')
Message 4 of 15
Anonymous
in reply to: g2m.agent

Thanks - I will try this.  What is it doing differently?  What does that import statement do?

Message 5 of 15
Anonymous
in reply to: g2m.agent

Okay - I'll try it.  Spent all day yesterday beating my head against this.  It just kept exporting stuff that was not part of my selection.  Eventually I had to just delete all the objects that weren't part of my selection and then export.  But this would be better if it works...

Message 6 of 15
g2m.agent
in reply to: Anonymous

import is "import" maya mel command as python's module, so python can use mel.

you can just use eval in mel:

 

eval('FBXExport -f "f:/object.fbx" -s')

Message 7 of 15
Anonymous
in reply to: g2m.agent

So I don’t need the import if I’m using a mel script?

What does the ‘eval’ do? I was trying the FBXExport -s line by itself without the eval, and it did export, but it didn’t export only the selection like it was supposed to.

Message 8 of 15
mspeer
in reply to: Anonymous

Hi!

Use this MEL command:

 

file -typ "FBX export" -es "FILE_PATH";

and replace FILE_PATH with your file path.

Message 9 of 15
g2m.agent
in reply to: Anonymous

because fbx isnt built into maya, it's a plugin. FBXExport is an external command, eval is used to execute external commands.

Message 10 of 15
Anonymous
in reply to: g2m.agent

Hm - I was able to use that same FBXExport command without the eval.  And unfortunately, it does not export only what I have selected.  I'll try it with the eval to see if it makes a difference.

Message 11 of 15
mspeer
in reply to: Anonymous

Hi!

@Anonymous 

The commands offered by @g2m.agent  are for Python and not for MEL.

 

Have you tried my suggestion, does it work for you?

Message 12 of 15
Anonymous
in reply to: mspeer

@mspeer I won't be able to try it until Monday at work, unfortunately.

 

Is the key to your answer the '-es' option?  Because I have tried "-s" and that did not work.  I don't see '-es' even listed in the documentation here:

 

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/fil...

Message 13 of 15
Anonymous
in reply to: mspeer

@mspeer your suggestion unfortunately did not work.  It exports something, just not the exact things I selected.  

Message 14 of 15
mspeer
in reply to: Anonymous

Hi!

If it still does not work i guess the problem is related to your scene and/or a bug in Maya.

(I guess it does not work correct also when using the UI then).

 

Please provide an example scene where it does not work correct and specify the steps to reproduce the problem.

(What has to be selected and how before exporting?)

Message 15 of 15
Anonymous
in reply to: mspeer

Well - a big part of the problem was that I discovered I was using the wrong 'import' button in Unreal!

 

Once I used the correct one, I started seeing results more like what I expected.

 

However, I do notice that my FBX file is much larger than the one I get if I export using the UI.  It seems like when I use the mel commands, a lot of objects are being exported that don't eventually get imported.  I can get around that if I first delete everything that isn't selected before I call export.  But I don't want to do that if I can help it.  

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report