【maya】名前順で同じディレクトリの次のシーンを開く


また書くことになりそうなのでメモです。
実際にはmaファイルでソートした方がよい。

#coding:utf-8

import maya.cmds as cmds 
import glob
def main():
    filepath = cmds.file(q=True, sn=True)
    filename = os.path.basename(filepath)

    paths = sorted(glob.glob(filepath.replace(filename,"")+"*"))

    isOpen = False
    for lp in paths:
        lp = lp.replace("\\","/")
        if filepath == lp:
            isOpen = True
            continue

        if isOpen == True:
            cmds.file(lp,open =True,f=True)
            return
    else:
        cmds.warning(u"次のシーンは存在しません。")
main()