From 457b640002c9623cec918a9f71f5f5fe282aee9c Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Mon, 21 Oct 2024 16:40:11 +0200 Subject: [PATCH] enable sequence player by default --- meshroom/ui/app.py | 2 +- meshroom/ui/qml/Viewer/Viewer2D.qml | 41 ++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index d8a25b8b..0a2de795 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -587,7 +587,7 @@ class MeshroomApp(QApplication): return bool(os.environ.get("MESHROOM_USE_8BIT_VIEWER", False)) def _defaultSequencePlayerEnabled(self): - return bool(os.environ.get("MESHROOM_USE_SEQUENCE_PLAYER", False)) + return bool(os.environ.get("MESHROOM_USE_SEQUENCE_PLAYER", True)) activeProjectChanged = Signal() activeProject = Property(Variant, lambda self: self._activeProject, notify=activeProjectChanged) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index be2e22e5..26361a21 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -36,6 +36,10 @@ FocusScope { property alias currentFrame: sequencePlayer.frameId property alias frameRange: sequencePlayer.frameRange + property bool fittedOnce: false + property int previousWidth: -1 + property int previousHeight: -1 + QtObject { id: m property variant viewpointMetadata: { @@ -472,12 +476,13 @@ FocusScope { orientationTag: imgContainer.orientationTag xOrigin: imgContainer.width / 2 yOrigin: imgContainer.height / 2 - property bool fittedOnce: false - property int previousWidth: 0 - property int previousHeight: 0 + property real targetSize: Math.max(width, height) * imgContainer.scale property real resizeRatio: imgContainer.scale - onHeightChanged: { + + + + function sizeChanged() { /* Image size is not updated through a single signal with the floatImage viewer, unlike * the simple QML image viewer: instead of updating straight away the width and height to x and * y, the emitted signals look like: @@ -489,13 +494,29 @@ FocusScope { * group has already been auto-fitted. If we change the group of images (when another project is * opened, for example, and the images have a different size), then another auto-fit needs to be * performed */ - if ((!fittedOnce && imgContainer.image && imgContainer.image.height > 0) || - (fittedOnce && ((width > 1 && previousWidth != width) || - (height > 1 && previousHeight != height)))) { + + var sizeValid = (width > 0) && (height > 0) + var layoutValid = (root.width > 50) && (root.height > 50) + var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height) + var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height) + + if ((!root.fittedOnce && imgContainer.image && sizeValid && layoutValid) || + (root.fittedOnce && sizeChanged && sizeValid && layoutValid)) { fit() - fittedOnce = true - previousWidth = width - previousHeight = height + root.fittedOnce = true + root.previousWidth = width + root.previousHeight = height + } + } + + onHeightChanged : { + floatImageViewerLoader.sizeChanged(); + } + + Connections { + target: root + function onHeightChanged() { + floatImageViewerLoader.sizeChanged() } }