FBX Import MEL commands

The following MEL commands are used to emulate import options in the FBX importer user interface.

Tip:

If you are writing a script and want to prevent the FBX UI from appearing each time a file is imported, use the following command to suppress the FBX UI on import:

FBXImport -file "c:/myfile.fbx";
FBXImport

FBXImport -f [filename] -t [take index];

Imports the file specified in [filename] and the take specified in [take index].

The file imported is the one accessible for take querying after the execution of the command.

Specify the appropriate take number to load the corresponding take. If you specify 0, the plug-in imports no animation. (This is the same as if you select No Animation from the menu in the Maya FBX plug-in user interface.)

If you specify -1, the plug-in retrieves the last take in the take array. The plug-in considers any number of takes greater than the amount of takes contained in the file or any negative value less than -1 to be invalid. If this occurs, a No such take error displays.
Note: Do not open FBX files with the Python File(...) command. Instead, use the FBXImport(...) command.
FBXImportAxisConversionEnable

FBXImportAxisConversionEnable -v [true|false];

FBXImportAxisConversionEnable -q;

This command is the script version of the Axis conversion option in the FBX Importer. See Axis conversion for more information.

FBXImportCacheFile

FBXImportCacheFile -v [true|false];

FBXImportCacheFile -q;

This command is the script version of the Import geometry Cache file(s) option in the FBX Importer. See Geometry cache file(s) for more information.

FBXImportCameras

FBXImportCameras -v [true|false];

FBXImportCameras -q;

Use this script to either import or exclude cameras with your FBX file. See Cameras for more information.

Note: This function is on by default.
FBXImportConstraints

FBXImportConstraints -v [true|false];

FBXImportConstraints -q;

Causes all constraints defined in the FBX file to be ignored by the importing process and excluded from the Maya scene. See Constraints for more information.

FBXImportConvertDeformingNullsToJoint

FBXImportConvertDeformingNullsToJoint -v [true|false];

FBXImportConvertDeformingNullsToJoint -q;

Converts deforming elements into Maya joints.

True
Transforms all deforming elements into joint nodes.
Note: This option was originally provided because Maya did not support locator elements (that is, transform nodes that are not joints,) within a bone hierarchy. While Maya now supports this, in some cases this option improves the skinning behavior.

See Deforming elements to joints for more information.

FBXImportConvertUnitString

FBXImportConvertUnitString [mm|dm|cm|m|km|In|ft|yd|mi];

This command returns the Scale Factor required to convert one centimeter to the specified unit and is the script version of the File Units Converted To menu in the FBX Exporter and Importer windows. See File units converted to for more information.

FBXImportDxfWeldVertice

FBXImportDxfWeldVertice [true|false];

FBXImportDxfWeldVertice -q;

Note: This command is for the Macintosh and Linux platforms only.
FBXImportDxfReferenceNode

FBXImportDxfReferenceNode [true|false];

FBXImportDxfReferenceNode -q;

Note: This command is for the Macintosh and Linux platforms only.
FBXImportDxfObjectDerivation

FBXImportDxfObjectDerivation [layer|entity|block];

FBXImportDxfObjectDerivation -q;

Note: This command is for the Macintosh and Linux platforms only.
FBXImportFillTimeline

FBXImportFillTimeline -v [true|false];

FBXImportFillTimeline -q;

Fills the scene timeline on import (instead of using the Maya default).

FBXImportForcedFileAxis

FBXImportForcedFileAxis [y|z];

FBXImportForcedFileAxis -q;

Use this command to "force" the FBX plug-in to consider the data in the file as if it is natively generated with the user-specified axis. There is no UI equivalent to the FBXImportForcedFileAxis command, and it can produce unexpected results as the command changes only the incoming file axis in the global settings.

For example, a plane created in 3ds Max's Z-up world would have the following vertex coordinates: (0,0,0) - (1,0,0) - (1,0,1) - (0,0,1). (This plane would look like a sheet of paper on a table, with the table being the XY plane at Z = 0 elevation.) On import into Maya, using the FBXImportUpAxis option, the plane would rotate so that the it would appear to be in the same position in Maya as it is in 3ds Max. Therefore, in Maya, the plane is on the XZ plane with the Y = 0 elevation. (Provided Maya is set to the default Y-Up axis.)

If you use FBXImportForcedFileAxis to force the axis to Y-up on import, the Maya plug-in will NOT apply any conversion to the axis. This is because, with this command, the plug-in treats the File and the System axis both as Y-Up, making the plane becomes perpendicular to the table, on the XY plane with Z = 0 depth.

Note: If you have configured Maya to a Z-Up axis while the "forced" axis is Y-Up, the FBX plug-in stills perform the conversion from Y-Up (set in the incoming FBX file) to Z-Up (imported into Maya).
FBXImportGenerateLog

FBXImportGenerateLog -v [true|false];

FBXImportGenerateLog -q;

Use this command to generate a log file on export. See Generate Log Data for more information.

FBXImportHardEdges

FBXImportHardEdges -v [true|false];

FBXImportHardEdges -q;

Merges back all vertices located at the same exact position as a unique vertex. The Maya FBX plug-in then determines if the edges connected to each vertex are hard edges or smooth edges, based on their normals.

Use this function when FBXExportHardEdges is set to True on export.

This command is the script version of the Combine per-vertex Normals option in the FBX Importer. See Combine per-vertex Normals for more information.

FBXImportLights

FBXImportLights -v [true|false];

FBXImportLights -q;

Use this function to either include or exclude lights from the import process. See Lights for more information.

FBXImportMergeBackNullPivots

FBXImportMergeBackNullPivots -v [true|false];

FBXImportMergeBackNullPivots -q;

True
Assigns the rotation transformation of the null (or joints) elements in the hierarchy that are used as pre-rotation and post- rotation to the joint orient and the rotate axis of the original node.

The pre-rotation and post-rotation nodes are then deleted.

The look-up is done by name as the pre-rotation node's name contains the “__Pre_ “suffix, while the post-rotation node's name has a “__Post_” suffix.

Note: When the import mode is set to Update animation or Add and Update animation this option is automatically set to True.
FBXImportMergeAnimationLayers

FBXImportMergeAnimationLayers -v [true|false];

FBXImportMergeAnimationLayers -q;

Activate Bake animation layers to bake (or Plot) animation layers contained in the incoming file.

FBXImportMode

FBXImportMode -v [exmerge|add|merge;]

FBXImportMode -q;

This command has three possible states:

Exmerge
Merges the imported FBX file to the current scene in the following way:

Nodes of the same name and nature have only their animation curve replaced. No new nodes are created. This command is the same as the Update animation option in the plug-in UI.

Add
Adds the content to the current scene content. This command is the same as the Add option in the plug-in UI.
Merge
Merges the imported FBX file to the current scene in the following way: any node without its equivalent in the scene is created. Nodes with the same name but not of the same nature, for example, sphere and bone, are replaced. Nodes with the same name and nature only have their animation replaced. This command is the same as the Add and Update animation in the UI.
Note: To view these in the UI, see File Content.
FBXImportProtectDrivenKeys

FBXImportProtectDrivenKeys -v [true|false];

FBXImportProtectDrivenKeys -q;

Use this script to prevent any incoming animation from overwriting channels with driven keys.

If set to True, the driven keys are protected and no incoming animation is applied to the driven channels.

If set to False, the driven keys are discarded and the incoming animation is applied to the driven channels. See Protect Driven Keys for more information.

FBXImportQuaternion

FBXImportQuaternion -v [quaternion|euler|resample] ;

FBXImportQuaternion -q;

Lets you specify how quaternion rotations should be treated on import into Maya. This option compensates for differences between Maya and MotionBuilder quaternions. This command is the equivalent of the Quaternion interpolation mode settings. See Quaternoin interpolation mode for more information.

FBXImportResamplingRateSource

FBXImportResamplingRateSource -v [Scene|File|Custom];

FBXImportResamplingRateSource -q;

This command lets you set the rate that the FBX Importer uses to produce keyframes when it needs to resample data. Use Scene to use Maya's current working units (See Working Units in the Preferences window Settings area), File to use the sampling rate defined by the FBX file, or Custom to specify a self-defined value.

Resampling is used when the interpolation of the Maya animation curve cannot be accurately represented by curves in MotionBuilder.

FBXImportScaleFactorEnable

FBXImportScaleFactorEnable [true|false];

FBXImportScaleFactorEnable -q;

This command is the script version of the Scale Factor option of the FBX Importer. See Scale factor for more information.
FBXImportScaleFactor

FBXImportScaleFactor [float];

FBXImportScaleFactor -q;

This command is the script version of the Scale Factor menu in the FBX Importer. See Scale factor for more information.
FBXImportSetMayaFrameRate

FBXImportSetMayaFrameRate -v [true|false];

FBXImportSetMayaFrameRate -q;

This command lets you import the frame rate from the FBX file. This overwrites the rate used in Maya.

FBXImportSetLockedAttribute

FBXImportSetLockedAttribute -v [true|false];

FBXImportSetLockedAttribute -q;

This command is the scripting equivalent of the UI dialog box Keep all locked or unlock all options. Use this command when you import an FBX file that contains animation onto an object that has locked channels.

When you use the UI, the Maya FBX plug-in prompts you to either keep all the channels locked or unlock the locked channels, which imports the animation correctly. This had created problems for users who tried to do this without working in the UI.

False
Unlocks all channels.
True
Channels remain locked.
Example code

FBXImportSetLockedAttribute -v False;

FBXImport -f "C:/myFile.fbx";

FBXImportShapes

FBXImportShapes -v [true|false];

FBXImportShapes -q;

Use this script to import or exclude shapes from your FBX file. See Deformed models for more information.

FBXImportSkeletonType

FBXImportSkeletonType -v [none|fbik|humanik];

FBXImportSkeletonType -q;

Use this function to either import or exclude Skeleton definitions with your FBX file. See Skeleton Definitions As for more information.

Note: This command is the same as the deprecated FBXImportCharacterType command.
FBXImportSkins

FBXImportSkins -v [true|false];

FBXImportSkins -q;

Use this function to import or exclude skin deformations from your FBX file. See Deformed models for more information.

FBXImportUnlockNormals

FBXImportUnlockNormals -v true|false;

FBXImportUnlockNormals -q;

Overrides the default Maya locking of normals.

True
Recomputes the normals on the objects using Maya internal algorithms.
FBXImportUpAxis

FBXImportUpAxis [y|z];

FBXImportUpAxis -q;

This command is the script version of the Axis conversion option in the FBX Importer but is not available in the plug-in UI. See Axis conversion.
Note: The FBXImportUpAxis command adds pre-rotations to your scene objects to orient them from one product's world axis to the other. If this is not what you want, experiment with the FBXImportForcedFileAxis command, but read the description of the FBXImportForcedFileAxis command as it changes the interpretation of the incoming data.