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?
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
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...
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')
because fbx isnt built into maya, it's a plugin. FBXExport is an external command, eval is used to execute external commands.
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.
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?
@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:
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?)
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.