0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

また書くことになりそうなのでメモです。
実際には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()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?