Home Coding, Scripting, Shaders

example of using 'FBXProperties' mel command to query all properties?

Hi! This feels like a really dumb question, sorry in advance, but i've not been able to figure it out.

I'm a python user and mel noob trying to write a custom fbx export script in Maya. I need to access some of the FBX export properties that aren't available through the standard mel fbx export commands.

The official docs say i can query what all of these properties are using the "FBXProperties" command. So in MEL i've tried things like:

FBXProperties;

and

string $properties = `FBXProperties -q`;
print($properties);

and

string $props[] = `FBXProperties -q`;
for($i = 0; $i< size($props); ++$i) {
  print($props[$i]);
}


THEN, ran across someone mentioning a python-friendly cmds version and tried that

testing = cmds.FBXProperties()
print(testing)


but no dice. I tried a few other variations of the same kind of stuff, with and without the -q flag, and the (``) quotes, but all it returns is None. I see lots of examples of how to change specific FBXProperties, but can't find any examples of how exactly to do the general query.

Is this how it's supposed to be used? Probably missing something really basic, but i'm stumped at the moment 😅

Replies

  • retonym

    Update -- found this guy's amazing script, fbx_properties.py

    "Take the output from the cmds.FBXProperties() command and convert it into useable cmds code. This will allow you to quickly set attrs that you want in the FBX export ui and get the results back in code."

    https://gist.github.com/JustinPedersen?direction=desc&sort=updated


    i ran that script in my maya python window, and the output was a huuuuge list of useable cmds.FbxProperty commands! I believe it scrapes every option available in file - export selection - (select fbx export in dropdown) - edit preset and converts it into a python command.

    i was able to convert my mel fbx export settings 1:1 into python fbx export settings this way :')

    just gonna paste the whole output here in case someone else ever googles how to do this and one of these options is at least a useful starting point for em!


    cmds.FBXProperty('Import|PlugInGrp|PlugInUIWidth', '-v', 500)

    cmds.FBXProperty('Import|PlugInGrp|PlugInUIHeight', '-v', 500)

    cmds.FBXProperty('Import|PlugInGrp|PlugInUIXpos', '-v', 100)

    cmds.FBXProperty('Import|PlugInGrp|PlugInUIYpos', '-v', 100)

    cmds.FBXProperty('Import|PlugInGrp|UILIndex', '-v', 'ENU')

    cmds.FBXProperty('Import|IncludeGrp|MergeMode', '-v', 'Add and update animation')

    cmds.FBXProperty('Import|IncludeGrp|Geometry|UnlockNormals', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Geometry|HardEdges', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Geometry|BlindData', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|Take', '-v', 'No Animation')

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|TimeLine', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|BakeAnimationLayers', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|Markers', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|Quaternion', '-v', 'Resample As Euler Interpolation')

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|ProtectDrivenKeys', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|DeformNullsAsJoints', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|NullsToPivot', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ExtraGrp|PointCache', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|Deformation', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|Deformation|Skins', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|Deformation|Shape', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Animation|Deformation|ForceWeightNormalize', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|SamplingPanel|SamplingRateSelector', '-v', 'Scene')

    cmds.FBXProperty('Import|IncludeGrp|Animation|SamplingPanel|CurveFilterSamplingRate', '-v', 30.0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|CurveFilter', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ConstraintsGrp|Constraint', '-v', 0)

    cmds.FBXProperty('Import|IncludeGrp|Animation|ConstraintsGrp|CharacterType', '-v', 'HumanIK')

    cmds.FBXProperty('Import|IncludeGrp|CameraGrp|Camera', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|LightGrp|Light', '-v', 1)

    cmds.FBXProperty('Import|IncludeGrp|Audio', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|UnitsGrp|DynamicScaleConversion', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|UnitsGrp|UnitsSelector', '-v', 'Millimeters')

    cmds.FBXProperty('Import|AdvOptGrp|AxisConvGrp|AxisConversion', '-v', 0)

    cmds.FBXProperty('Import|AdvOptGrp|AxisConvGrp|UpAxis', '-v', 'Y')

    cmds.FBXProperty('Import|AdvOptGrp|UI|ShowWarningsManager', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|UI|GenerateLogData', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Obj|ReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|ReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Texture', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Material', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Animation', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Mesh', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Light', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Camera', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|AmbientLight', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Rescaling', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Filter', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Max_3ds|Smoothgroup', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionFrameCount', '-v', 0)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionFrameRate', '-v', 0.0)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionActorPrefix', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionRenameDuplicateNames', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionExactZeroAsOccluded', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionSetOccludedToLastValidPos', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionAsOpticalSegments', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionASFSceneOwned', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Motion_Base|MotionUpAxisUsedInFile', '-v', 3)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Biovision_BVH|MotionCreateReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|MotionAnalysis_HTR|MotionCreateReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|MotionAnalysis_HTR|MotionBaseTInOffset', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|MotionAnalysis_HTR|MotionBaseRInPrerotation', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_ASF|MotionCreateReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_ASF|MotionDummyNodes', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_ASF|MotionLimits', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_ASF|MotionBaseTInOffset', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_ASF|MotionBaseRInPrerotation', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_AMC|MotionCreateReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_AMC|MotionDummyNodes', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_AMC|MotionLimits', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_AMC|MotionBaseTInOffset', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|FileFormat|Acclaim_AMC|MotionBaseRInPrerotation', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|Dxf|WeldVertices', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|Dxf|ObjectDerivation', '-v', 'By layer')

    cmds.FBXProperty('Import|AdvOptGrp|Dxf|ReferenceNode', '-v', 1)

    cmds.FBXProperty('Import|AdvOptGrp|Performance|RemoveBadPolysFromMesh', '-v', 1)

    cmds.FBXProperty('Export|PlugInGrp|PlugInUIWidth', '-v', 500)

    cmds.FBXProperty('Export|PlugInGrp|PlugInUIHeight', '-v', 500)

    cmds.FBXProperty('Export|PlugInGrp|PlugInUIXpos', '-v', 100)

    cmds.FBXProperty('Export|PlugInGrp|PlugInUIYpos', '-v', 100)

    cmds.FBXProperty('Export|PlugInGrp|UILIndex', '-v', 'ENU')

    cmds.FBXProperty('Export|IncludeGrp|Geometry|SmoothingGroups', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|expHardEdges', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|TangentsandBinormals', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|SmoothMesh', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|SelectionSet', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|BlindData', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|AnimationOnly', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|Instances', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|ContainerObjects', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|Triangulate', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Geometry|GeometryNurbsSurfaceAs', '-v', 'NURBS')

    cmds.FBXProperty('Export|IncludeGrp|Animation', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|ExtraGrp|UseSceneName', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|ExtraGrp|RemoveSingleKey', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|ExtraGrp|Quaternion', '-v', 'Resample As Euler Interpolation')

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation|BakeFrameStart', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation|BakeFrameEnd', '-v', 200)

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation|BakeFrameStep', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation|ResampleAnimationCurves', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|BakeComplexAnimation|HideComplexAnimationBakedWarning', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|Deformation', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|Deformation|Skins', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|Deformation|Shape', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|Deformation|ShapeAttributes', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|Deformation|ShapeAttributes|ShapeAttributesValues', '-v', 'Relative')

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed|CurveFilterCstKeyRedTPrec', '-v', 0.0001)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed|CurveFilterCstKeyRedRPrec', '-v', 0.009)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed|CurveFilterCstKeyRedSPrec', '-v', 0.004)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed|CurveFilterCstKeyRedOPrec', '-v', 0.009)

    cmds.FBXProperty('Export|IncludeGrp|Animation|CurveFilter|CurveFilterApplyCstKeyRed|AutoTangentsOnly', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|Animation|PointCache', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|PointCache|SelectionSetNameAsPointCache', '-v', ' ')

    cmds.FBXProperty('Export|IncludeGrp|Animation|ConstraintsGrp|Constraint', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Animation|ConstraintsGrp|Character', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|CameraGrp|Camera', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|LightGrp|Light', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|Audio', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|EmbedTextureGrp|EmbedTexture', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|BindPose', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|PivotToNulls', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|BypassRrsInheritance', '-v', 0)

    cmds.FBXProperty('Export|IncludeGrp|InputConnectionsGrp|IncludeChildren', '-v', 1)

    cmds.FBXProperty('Export|IncludeGrp|InputConnectionsGrp|InputConnections', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|UnitsGrp|DynamicScaleConversion', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|UnitsGrp|UnitsSelector', '-v', 'Centimeters')

    cmds.FBXProperty('Export|AdvOptGrp|AxisConvGrp|UpAxis', '-v', 'Y')

    cmds.FBXProperty('Export|AdvOptGrp|UI|ShowWarningsManager', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|UI|GenerateLogData', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Obj|Triangulate', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Obj|Deformation', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionFrameCount', '-v', 0)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionFromGlobalPosition', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionFrameRate', '-v', 30.0)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionGapsAsValidData', '-v', 0)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionC3DRealFormat', '-v', 0)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Motion_Base|MotionASFSceneOwned', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Biovision_BVH|MotionTranslation', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_ASF|MotionTranslation', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_ASF|MotionFrameRateUsed', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_ASF|MotionFrameRange', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_ASF|MotionWriteDefaultAsBaseTR', '-v', 0)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_AMC|MotionTranslation', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_AMC|MotionFrameRateUsed', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_AMC|MotionFrameRange', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|FileFormat|Acclaim_AMC|MotionWriteDefaultAsBaseTR', '-v', 0)

    cmds.FBXProperty('Export|AdvOptGrp|Fbx|AsciiFbx', '-v', 'Binary')

    cmds.FBXProperty('Export|AdvOptGrp|Fbx|ExportFileVersion', '-v', 'FBX202000')

    cmds.FBXProperty('Export|AdvOptGrp|Dxf|Deformation', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|Dxf|Triangulate', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|Collada|Triangulate', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|Collada|SingleMatrix', '-v', 1)

    cmds.FBXProperty('Export|AdvOptGrp|Collada|FrameRate', '-v', 24.0)

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter

    I seem to remember being able to load an fbx export preset from either python or Mel which would save an awful lot of code.


    I'd probably try that

  • foxagon
    Offline / Send Message
    foxagon polycounter lvl 10
    you can just use the commands directly e.g.
    cmds.FBXExportHardEdges("-v", False)
    cmds.FBXExportInAscii("-v", False)
    cmds.FBXExportSmoothingGroups("-v", False)
    cmds.FBXExportSmoothMesh("-v", False)
    cmds.FBXExportTangents("-v", False)
    cmds.FBXExportTriangulate("-v", False)
    cmds.FBXExport("-file", "c:/temp/example.fbx", "-s")

Sign In or Register to comment.