As of Maya 2016, there's an annoying bug:
- If you open a scene, and change its file type (from ma to mb or vice versa), it will lose the scene name.
- If you open a scene, save the scene, then change the filetype, the bug doesn't show up.
import maya.cmds as mc mc.file(r"C:/path/to/my/file.mb", open=True, force=True) fileType1 = mc.file(query=True, type=True) fileName1 = mc.file(query=True, sceneName=True) print fileType1, fileName1 ['mayaBinary'] C:/path/to/my/file.mb # Change the file type: mc.file(type='mayaAscii') fileType2 = mc.file(query=True, type=True) fileName2 = mc.file(query=True, sceneName=True) print fileType2, fileName2 [u'mayaAscii'] # !!!! no more filename, it is an empty string !!!!!!!Here is it not broken:
import maya.cmds as mc mc.file(r"C:/path/to/my/file.mb", open=True, force=True) fileType1 = mc.file(query=True, type=True) fileName1 = mc.file(query=True, sceneName=True) print fileType1, fileName1 ['mayaBinary'] C:/path/to/my/file.mb # Save the file mc.file(save=True, force=True) # Change the file type: mc.file(type='mayaAscii') fileType2 = mc.file(query=True, type=True) fileName2 = mc.file(query=True, sceneName=True) print fileType2, fileName2 [u'mayaAscii'] C:/path/to/my/file.ma