import pymel.core as pm
import maya.mel as mel
from maya import cmds
def ExportFbx(file_path):
if not cmds.pluginInfo('fbxmaya', q=True, loaded=True):
pm.loadPlugin("fbxmaya")
mel.eval("FBXProperty Export|IncludeGrp|Geometry|BlindData -v false")
fbx_export_options = [
("-s",), # Selection Only
("-v", "FBX201400"), # FBX Version
("-f", "MotionBuilder.fbx"), # File Name
# ("-es",), # Embed Textures
# ("-ea",), # Embed Media
("-fr", "30"), # Frame Rate
("-q",), # Quiet Mode
("-p", "256"), # Optimization Level
# ("-axisUp", "y"), # Up Axis
# ("-axisFront", "z"), # Front Axis
("-a", "model", "camera"), # Animation Only (Model and Camera)
("-enablePointCache",), # Point Cache
("-enableSampling",), # Animation Sampling
("-stripNamespaces",), # Strip Namespace
("-filterType", "AnimCurve"), # Filter Type
# ("-fcp", "0"), # Bake Start Time
# ("-fcp", "0"), # Bake End Time
("-tp", "0"), # Use Default Take
("-simplify", "1"), # Simplify Animation Curves
]
# Export the FBX file with the options
cmds.file(file_path, force=True, options=";".join([str(opt) for opt in fbx_export_options]), type="FBX export", exportSelected=True)
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme