Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #triangulate mesh so binormals and tangents can export
- pm.select(exportGroup,replace=True)
- TriangulateMeshesInGroup(exportGroup)
- #Export selection to FBX
- groupToExport = None
- if(mode=="RootExportGroup"):
- print("Selecting group: " + str(exportGroup) + " to export to FBX.")
- groupToExport = pm.select(exportGroup,replace=True)
- elif(mode=="exportSelection"):
- print("Selecting group: " + str(exportSelection) + " to export to FBX.")
- groupToExport = pm.select(exportSelection,replace=True)
- pm.parent(groupToExport,world=True) #move group to top of hierarchy
- print("FBXLoadExportPresetFile from path: " + str(presetPath))
- mel.eval('FBXLoadExportPresetFile -f "'+presetPath+'"')
- print("Exporting: " + fbxFilename + ".fbx")
- mel.eval('FBXExport -f "'+fbxFilename+'" -s') #-s = selected instead of export all
- print("Export complete.")
- except Exception as e:
- print("Error occured, export failed. Re-opening file to restore the originally saved file.")
- pm.openFile(mayaFilePath, force=True)
- print e.message, e.args
- promptResult = pm.confirmDialog(
- title='Error',
- message="Export Failed. File re-opened to restore original. \n Error Message: " + str(e.message) + ". \n Error Args: " + str(e.args),
- button=['OK'],
- defaultButton='OK')
- pm.error("Error on attempt to export.")
- #Force reopening of the file to restore the saved file with references
- print("Re-opening file to restore the originally saved file.")
- pm.openFile(mayaFilePath, force=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement