Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #triangulate mesh so binormals and tangents can export
  2. pm.select(exportGroup,replace=True)
  3. TriangulateMeshesInGroup(exportGroup)
  4.  
  5. #Export selection to FBX
  6. groupToExport = None
  7. if(mode=="RootExportGroup"):
  8. print("Selecting group: " + str(exportGroup) + " to export to FBX.")
  9. groupToExport = pm.select(exportGroup,replace=True)
  10. elif(mode=="exportSelection"):
  11. print("Selecting group: " + str(exportSelection) + " to export to FBX.")
  12. groupToExport = pm.select(exportSelection,replace=True)
  13. pm.parent(groupToExport,world=True) #move group to top of hierarchy
  14.  
  15. print("FBXLoadExportPresetFile from path: " + str(presetPath))
  16. mel.eval('FBXLoadExportPresetFile -f "'+presetPath+'"')
  17. print("Exporting: " + fbxFilename + ".fbx")
  18. mel.eval('FBXExport -f "'+fbxFilename+'" -s') #-s = selected instead of export all
  19. print("Export complete.")
  20. except Exception as e:
  21. print("Error occured, export failed. Re-opening file to restore the originally saved file.")
  22. pm.openFile(mayaFilePath, force=True)
  23. print e.message, e.args
  24. promptResult = pm.confirmDialog(
  25. title='Error',
  26. message="Export Failed. File re-opened to restore original. \n Error Message: " + str(e.message) + ". \n Error Args: " + str(e.args),
  27. button=['OK'],
  28. defaultButton='OK')
  29. pm.error("Error on attempt to export.")
  30.  
  31. #Force reopening of the file to restore the saved file with references
  32. print("Re-opening file to restore the originally saved file.")
  33. pm.openFile(mayaFilePath, force=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement