From 8a3daed543bae174f67dbced7ac9ce8195506ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Mon, 17 Apr 2023 18:23:45 +0200 Subject: [PATCH] [ui] sequence player: draw cached frames indicator --- meshroom/ui/qml/Viewer/SequencePlayer.qml | 28 +++++++++++++++++++++++ meshroom/ui/qml/Viewer/Viewer2D.qml | 4 +++- meshroom/ui/reconstruction.py | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/meshroom/ui/qml/Viewer/SequencePlayer.qml b/meshroom/ui/qml/Viewer/SequencePlayer.qml index e582fd92..26dbd6bc 100644 --- a/meshroom/ui/qml/Viewer/SequencePlayer.qml +++ b/meshroom/ui/qml/Viewer/SequencePlayer.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3 import Controls 1.0 import MaterialIcons 2.2 +import Utils 1.0 /** * The Sequence Player is a UI for manipulating @@ -60,6 +61,9 @@ FloatingPane { } } + // Exposed properties + property var viewer: null + // Update the frame property // when the selected view ID is changed externally Connections { @@ -181,6 +185,30 @@ FloatingPane { frameSlider.value = m.frame; } } + + property real frameLength: m.sortedViewIds.length > 0 ? width / m.sortedViewIds.length : 0 + + background: Rectangle { + x: frameSlider.leftPadding + y: frameSlider.topPadding + frameSlider.height / 2 - height / 2 + width: frameSlider.availableWidth + height: 4 + radius: 2 + color: Colors.grey + + Repeater { + model: viewer ? viewer.cachedFrames : [] + + Rectangle { + x: modelData * frameSlider.frameLength + y: 0 + width: frameSlider.frameLength + height: 4 + radius: 2 + color: Colors.blue + } + } + } } RowLayout { diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 17fa0972..d1a77659 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -434,7 +434,8 @@ FocusScope { 'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }), 'canBeHovered': false, 'idView': Qt.binding(function() { return (_reconstruction ? _reconstruction.selectedViewId : -1); }), - 'cropFisheye': false + 'cropFisheye': false, + 'sequence': Qt.binding(function() { return ((_reconstruction && _reconstruction.viewpoints) ? _reconstruction.allImagePaths() : []) }) }) } else { // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 @@ -1301,6 +1302,7 @@ FocusScope { id: sequencePlayer anchors.margins: 0 Layout.fillWidth: true + viewer: floatImageViewerLoader.status === Loader.Ready ? floatImageViewerLoader.item : null } } } diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index 29fec43d..8a7cf1ac 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -696,6 +696,7 @@ class Reconstruction(UIGraph): self.sfmAugmented.emit(first, last) return sfm[0], sfm[-1] + @Slot(result="QVariantList") def allImagePaths(self): """ Get all image paths in the reconstruction. """ return [vp.path.value for node in self._cameraInits for vp in node.viewpoints.value]