我正在尝试使用 re 参数创建目录搜索。当一个位置被搜索到一个想要的列表时,它被排序在一个列表中,用作下拉菜单。供用户访问信息并进行选择(我想这在我的案例中是软件绑定的 nuke.Panel)
当用户选择它时,它应该进入在所选目录中搜索的第 2 阶段。
我遇到的问题是,我似乎无法将其取回,因为我可以查看它,例如查看已拾取内容的列表,并让我可以选择一个并继续
import nukescripts
import nuke
import re
import os
from glob import glob
## Based on folder structure : sequence/sq010(sqXXX)/sh120(shXXX)/comp(cleanup, key, roto)
os.environ['sequence'] = '/Volumes/postergren/Projects/TD/assetmanagerTest/sequence'
os.environ['SEQ'] = ''
os.environ['SHOT'] = ''
os.environ['DEP'] = ''
# Check to see if ENV set already
env_check = os.environ.get('sequence')
myPanel = nuke.Panel("Asset Manager - Setup")
myPanel.setWidth(350)
## SEQ FOLDER
seqPath = os.path.join(os.getenv('sequence'))
seqPathDirs = [os.path.join(seqPath, dir) for dir in os.listdir(seqPath) if os.path.isdir(os.path.join(seqPath, dir))]
seqPattern = re.compile('sq(\d+)')
for i in seqPathDirs:
thisDir = os.path.split(i)[1]
if seqPattern.match(thisDir):
os.environ['SEQ'] = (i)
# Panel
myPanel.addEnumerationPulldown("Sequence: ", os.environ['SEQ'])
if myPanel.show():
os.environ['SEQ'] = myPanel.value("Sequence: ")
nuke.tprint(os.environ['SEQ'])
## SHOT FOLDER
shotPath = os.path.join(os.getenv('sequence') + os.getenv('SEQ'))
shotPathDirs = [os.path.join(seqPath, dir) for dir in os.listdir(seqPath) if os.path.isdir(os.path.join(seqPath, dir))]
shotPattern = re.compile('sh(\d+)')
for i in shotPathDirs:
thisDir = os.path.split(i)[1]
if seqPattern.match(thisDir):
os.environ['SHOT'] = (i)
# Panel
myPanel.addEnumerationPulldown("Shot: ", os.environ['SHOT'][:])
if myPanel.show():
os.environ['SHOT'] = myPanel.value("Shot: ")
## END SHOT FOLDER
nuke.tprint(os.environ['SHOT'])