import os import re import glob def getSeqNum(iterFile): num = re.findall(r'\d+', iterFile)[-1] return num def getSeqInfoUnderDir(plateDir): imageFiles = os.listdir(plateDir) imageFiles = sorted(imageFiles, key=getSeqNum) firstFrame = int(re.findall(r'\d+', imageFiles[0])[-1]) lastFrame = int(re.findall(r'\d+', imageFiles[-1])[-1]) duration = len(imageFiles) return firstFrame, lastFrame, duration ### e.g. ) /project/seq/shot/plate/***_0001.exr dir = "/project/seq/shot/plate" firstFrame, lastFrame, duration = getSeqInfoUnderDir(dir) print firstFrame, lastFrame, duration
and then, we can set new frame range and create global variables corresponding to the plate.
currentRange = hou.playbar.frameRange() hou.playbar.setFrameRange(firstFrame, lastFrame) hou.hscript("setenv START = " + str(firstFrame)) hou.hscript("setenv END = " + str(lastFrame)) if firstFrame > currentRange[1] or lastFrame < currentRange[0]: hou.playbar.setPlaybackRange(firstFrame, lastFrame)
タグ
コメントをかく