Skip to content

Commit 6c00826

Browse files
authored
Merge pull request #2557 from alicevision/dev/sequencePlayer
[ui] Use the improved Sequence Player and enable it by default
2 parents 554f9c0 + 457b640 commit 6c00826

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

meshroom/ui/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def _default8bitViewerEnabled(self):
587587
return bool(os.environ.get("MESHROOM_USE_8BIT_VIEWER", False))
588588

589589
def _defaultSequencePlayerEnabled(self):
590-
return bool(os.environ.get("MESHROOM_USE_SEQUENCE_PLAYER", False))
590+
return bool(os.environ.get("MESHROOM_USE_SEQUENCE_PLAYER", True))
591591

592592
activeProjectChanged = Signal()
593593
activeProject = Property(Variant, lambda self: self._activeProject, notify=activeProjectChanged)

meshroom/ui/qml/Viewer/SequencePlayer.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ FloatingPane {
8282
onPlayingChanged: {
8383
if (!playing) {
8484
updateReconstructionView()
85-
} else if (playing && (frame + 1 >= frameRange + 1)) {
85+
} else if (playing && (frame + 1 >= frameRange.max + 1)) {
8686
frame = frameRange.min
8787
}
8888
viewer.playback(playing)

meshroom/ui/qml/Viewer/Viewer2D.qml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ FocusScope {
3636
property alias currentFrame: sequencePlayer.frameId
3737
property alias frameRange: sequencePlayer.frameRange
3838

39+
property bool fittedOnce: false
40+
property int previousWidth: -1
41+
property int previousHeight: -1
42+
3943
QtObject {
4044
id: m
4145
property variant viewpointMetadata: {
@@ -472,11 +476,13 @@ FocusScope {
472476
orientationTag: imgContainer.orientationTag
473477
xOrigin: imgContainer.width / 2
474478
yOrigin: imgContainer.height / 2
475-
property bool fittedOnce: false
476-
property int previousWidth: 0
477-
property int previousHeight: 0
479+
478480
property real targetSize: Math.max(width, height) * imgContainer.scale
479-
onHeightChanged: {
481+
property real resizeRatio: imgContainer.scale
482+
483+
484+
485+
function sizeChanged() {
480486
/* Image size is not updated through a single signal with the floatImage viewer, unlike
481487
* the simple QML image viewer: instead of updating straight away the width and height to x and
482488
* y, the emitted signals look like:
@@ -488,13 +494,29 @@ FocusScope {
488494
* group has already been auto-fitted. If we change the group of images (when another project is
489495
* opened, for example, and the images have a different size), then another auto-fit needs to be
490496
* performed */
491-
if ((!fittedOnce && imgContainer.image && imgContainer.image.height > 0) ||
492-
(fittedOnce && ((width > 1 && previousWidth != width) ||
493-
(height > 1 && previousHeight != height)))) {
497+
498+
var sizeValid = (width > 0) && (height > 0)
499+
var layoutValid = (root.width > 50) && (root.height > 50)
500+
var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height)
501+
var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height)
502+
503+
if ((!root.fittedOnce && imgContainer.image && sizeValid && layoutValid) ||
504+
(root.fittedOnce && sizeChanged && sizeValid && layoutValid)) {
494505
fit()
495-
fittedOnce = true
496-
previousWidth = width
497-
previousHeight = height
506+
root.fittedOnce = true
507+
root.previousWidth = width
508+
root.previousHeight = height
509+
}
510+
}
511+
512+
onHeightChanged : {
513+
floatImageViewerLoader.sizeChanged();
514+
}
515+
516+
Connections {
517+
target: root
518+
function onHeightChanged() {
519+
floatImageViewerLoader.sizeChanged()
498520
}
499521
}
500522

@@ -519,6 +541,7 @@ FocusScope {
519541
'idView': Qt.binding(function() { return ((root.displayedNode && !root.displayedNode.hasSequenceOutput && _reconstruction) ? _reconstruction.selectedViewId : -1) }),
520542
'cropFisheye': false,
521543
'sequence': Qt.binding(function() { return ((root.enableSequencePlayer && (_reconstruction || (root.displayedNode && root.displayedNode.hasSequenceOutput))) ? getSequence() : []) }),
544+
'resizeRatio': Qt.binding(function() { return floatImageViewerLoader.resizeRatio }),
522545
'targetSize': Qt.binding(function() { return floatImageViewerLoader.targetSize }),
523546
'useSequence': Qt.binding(function() {
524547
return (root.enableSequencePlayer && !useExternal && (_reconstruction || (root.displayedNode && root.displayedNode.hasSequenceOutput && (displayedAttr.desc.semantic === "imageList" || displayedAttr.desc.semantic === "sequence"))))

0 commit comments

Comments
 (0)