2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

python maya export fbx

Last updated at Posted at 2023-05-11
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)
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?