[ui] Improve sequence display

- allows multiple "*" in the files search expression
- fix a bug if we only provide a folder
- keep the current frame if the frame range has not changed
This commit is contained in:
Fabien Castan 2024-08-16 17:22:21 +02:00
parent 53679485a9
commit 15c1ce16b5
2 changed files with 41 additions and 41 deletions

View file

@ -147,23 +147,19 @@ class FilepathHelper(QObject):
extension = ".*"
return [self.basename(f) for f in glob.glob(os.path.join(folderPath, f"*{extension}")) if os.path.isfile(f)]
@Slot(str, result="QVariantList")
def resolveSequence(self, path):
@Slot(str, bool, result="QVariantList")
def resolveSequence(self, path, includesSeqMissingFiles):
"""
Get id of each file in the sequence.
"""
# use of pyseq to get the sequences
seq = pyseq.get_sequences(self.asStr(path))
seqs = pyseq.get_sequences(self.asStr(path))
ids = [[s.start(), s.end()] for s in seq]
frameRanges = [[seq.start(), seq.end()] for seq in seqs]
folder = self.dirname(path)
missingFiles = [s.missing() for s in seq]
# create the resolved path for each sequence and if a frame is missing add a empty string
resolved = [[os.path.join(folder, s.head() + str(s.format("%p") % frame) + s.tail()) if frame not in missingFiles[seq.index(s)]
else "" for frame in range(ids[seq.index(s)][0], ids[seq.index(s)][1] + 1)] if s.frames()
else os.path.join(folder, s.head())
for s in seq]
return ids, resolved
# create the resolved path for each sequence
if includesSeqMissingFiles:
resolved = [[seq.format("%D%h%p%t") % frameNumber for frameNumber in range(seq.start(), seq.end() + 1)] for seq in seqs]
else:
resolved = [[fileItem.path for fileItem in seq] for seq in seqs]
return frameRanges, resolved