tips mainly for Houdini

When plate of a shot is stored in a directory which doesn't include any other files

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)
タグ

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

管理人/副管理人のみ編集できます