mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 18:27:23 +02:00
[ui] Use of pyseq for getting sequences
[ui] To squash
This commit is contained in:
parent
1168ccaacb
commit
cc2099534b
4 changed files with 23 additions and 17 deletions
|
@ -150,3 +150,4 @@ def setupEnvironment(backend=Backend.STANDALONE):
|
||||||
|
|
||||||
|
|
||||||
os.environ["QML_XHR_ALLOW_FILE_READ"] = '1'
|
os.environ["QML_XHR_ALLOW_FILE_READ"] = '1'
|
||||||
|
os.environ["PYSEQ_STRICT_PAD"] = '1'
|
||||||
|
|
|
@ -5,7 +5,7 @@ from PySide2.QtCore import QObject, Slot
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import re
|
import pyseq
|
||||||
|
|
||||||
|
|
||||||
class FilepathHelper(QObject):
|
class FilepathHelper(QObject):
|
||||||
|
@ -152,19 +152,18 @@ class FilepathHelper(QObject):
|
||||||
"""
|
"""
|
||||||
Get id of each file in the sequence.
|
Get id of each file in the sequence.
|
||||||
"""
|
"""
|
||||||
replacements = self.getFilenamesFromFolder(self.dirname(path), self.extension(path))
|
# use of pyseq to get the sequences
|
||||||
|
seq = pyseq.get_sequences(self.asStr(path))
|
||||||
|
|
||||||
ids = []
|
ids = [[s.start(), s.end()] for s in seq]
|
||||||
for i in replacements:
|
|
||||||
# convert basename to regex
|
|
||||||
splitBefore = self.basename(path).split("(")
|
|
||||||
splitAfter = splitBefore[1].split(")")
|
|
||||||
id = re.search("["+splitBefore[0]+"]("+splitAfter[0]+")["+splitAfter[1]+"]", i)
|
|
||||||
if id:
|
|
||||||
# put id in replacements as key of replacements[i]
|
|
||||||
ids.append(id[1])
|
|
||||||
|
|
||||||
ids.sort()
|
folder = self.dirname(path)
|
||||||
|
|
||||||
resolved = [path.replace(self.basename(path), replacement) for replacement in replacements]
|
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
|
return ids, resolved
|
||||||
|
|
|
@ -39,7 +39,7 @@ FloatingPane {
|
||||||
function updateReconstructionView() {
|
function updateReconstructionView() {
|
||||||
if (isOutputSequence)
|
if (isOutputSequence)
|
||||||
return
|
return
|
||||||
if (_reconstruction && m.frame >= 0 && m.frame < sortedViewIds.length) {
|
if (_reconstruction && m.frame >= frameRange.min && m.frame < frameRange.max+1) {
|
||||||
if (!m.playing && !frameSlider.pressed) {
|
if (!m.playing && !frameSlider.pressed) {
|
||||||
_reconstruction.selectedViewId = sortedViewIds[m.frame];
|
_reconstruction.selectedViewId = sortedViewIds[m.frame];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -268,20 +268,26 @@ FocusScope {
|
||||||
let ids = sequence[0]
|
let ids = sequence[0]
|
||||||
let resolved = sequence[1]
|
let resolved = sequence[1]
|
||||||
|
|
||||||
//order by path
|
|
||||||
resolved.sort()
|
|
||||||
// reset current frame to 0 if it is imageList but not sequence
|
// reset current frame to 0 if it is imageList but not sequence
|
||||||
if (attr.desc.semantic === "imageList") {
|
if (attr.desc.semantic === "imageList") {
|
||||||
|
// concat in one array all sequences in resolved
|
||||||
|
resolved = [].concat.apply([], resolved)
|
||||||
frameRange.min = 0
|
frameRange.min = 0
|
||||||
frameRange.max = resolved.length-1
|
frameRange.max = resolved.length-1
|
||||||
currentFrame = 0
|
currentFrame = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr.desc.semantic === "sequence") {
|
if (attr.desc.semantic === "sequence") {
|
||||||
|
// if there is several sequences, take the first one
|
||||||
|
resolved = resolved[0]
|
||||||
|
ids = ids[0]
|
||||||
frameRange.min = ids[0]
|
frameRange.min = ids[0]
|
||||||
frameRange.max = ids[ids.length-1]
|
frameRange.max = ids[ids.length-1]
|
||||||
currentFrame = frameRange.min
|
currentFrame = frameRange.min
|
||||||
}
|
}
|
||||||
|
//order by path
|
||||||
|
resolved.sort()
|
||||||
|
|
||||||
return resolved
|
return resolved
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < _reconstruction.viewpoints.count; i++) {
|
for (let i = 0; i < _reconstruction.viewpoints.count; i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue