Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new sequence player #2557

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meshroom/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def _default8bitViewerEnabled(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/ui/qml/Viewer/SequencePlayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ FloatingPane {
onPlayingChanged: {
if (!playing) {
updateReconstructionView()
} else if (playing && (frame + 1 >= frameRange + 1)) {
} else if (playing && (frame + 1 >= frameRange.max + 1)) {
frame = frameRange.min
}
viewer.playback(playing)
Expand Down
43 changes: 33 additions & 10 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -472,11 +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
onHeightChanged: {
property real resizeRatio: imgContainer.scale



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:
Expand All @@ -488,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()
}
}

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