FBX export selectedOnly

Anonymous

FBX export selectedOnly

Anonymous
Not applicable

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?

0 Likes
Reply
3,454 Views
14 Replies
Replies (14)

g2m.agent
Collaborator
Collaborator

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

 

 

0 Likes

g2m.agent
Collaborator
Collaborator

simple way

Python script

import maya.mel as mel

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

Anonymous
Not applicable

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

0 Likes

Anonymous
Not applicable

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...

0 Likes

g2m.agent
Collaborator
Collaborator

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')

0 Likes

Anonymous
Not applicable
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.

0 Likes

mspeer
Consultant
Consultant

Hi!

Use this MEL command:

 

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

and replace FILE_PATH with your file path.

0 Likes

g2m.agent
Collaborator
Collaborator

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

0 Likes

Anonymous
Not applicable

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.

0 Likes

mspeer
Consultant
Consultant

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?

0 Likes

Anonymous
Not applicable

@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...

0 Likes

Anonymous
Not applicable

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

0 Likes

mspeer
Consultant
Consultant

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?)

0 Likes

Anonymous
Not applicable

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.  

 

0 Likes