From 8fa7f18c54ea36c0a3bc51d2cda2085f5915a46a Mon Sep 17 00:00:00 2001 From: Thomas Zorroche Date: Wed, 3 Mar 2021 08:54:00 +0100 Subject: [PATCH] [Panorama Viewer] ensure it fits in RAM memory --- meshroom/ui/qml/Viewer/FloatImage.qml | 12 +++++++--- meshroom/ui/qml/Viewer/PanoramaToolbar.qml | 8 +++++-- meshroom/ui/qml/Viewer/PanoramaViewer.qml | 27 ++++++++++++++-------- meshroom/ui/qml/Viewer/Viewer2D.qml | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/meshroom/ui/qml/Viewer/FloatImage.qml b/meshroom/ui/qml/Viewer/FloatImage.qml index e34f5b3d..204f7e37 100644 --- a/meshroom/ui/qml/Viewer/FloatImage.qml +++ b/meshroom/ui/qml/Viewer/FloatImage.qml @@ -31,7 +31,8 @@ AliceVision.FloatImageViewer { root.updateSubdivisions(12) } else{ - root.updateSubdivisions(1) + root.updateSubdivisions(1); + root.downscaleLevel = -1; } } @@ -61,9 +62,14 @@ AliceVision.FloatImageViewer { property string sfmPath: "" - function updateSfmPath() { - console.warn("SFM UPDATE - Float IV") + property int downscaleLevel: 0 + onDownscaleLevelChanged: { + root.setDownscale(downscaleLevel) + console.warn("VALUE CHANGGGEEEEEEEEEEEEED " + downscaleLevel) + } + + function updateSfmPath() { var activeNode = _reconstruction.activeNodes.get('SfMTransform').node; if(!activeNode) diff --git a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml index 064a4c2b..dfb99885 100644 --- a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml +++ b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml @@ -16,7 +16,7 @@ FloatingPane { property bool displayGrid: displayGrid.checked property int downscaleValue: downscaleSpinBox.value - property int downscaleDefaultValue: 2 + property int downscaleDefaultValue: 3 property int subdivisionsDefaultValue: 24 property int subdivisionsValue: subdivisionsCtrl.value @@ -25,6 +25,10 @@ FloatingPane { background: Rectangle { color: root.palette.window } + function updateDownscaleValue(level) { + downscaleSpinBox.value = level; + } + DoubleValidator { id: doubleValidator locale: 'C' // use '.' decimal separator disregarding of the system locale @@ -154,7 +158,7 @@ FloatingPane { SpinBox { id: downscaleSpinBox from: 0 - value: 2 + value: downscaleDefaultValue to: 3 stepSize: 1 Layout.fillWidth: false diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index e2779da5..ac0052f6 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -20,7 +20,11 @@ AliceVision.PanoramaViewer { property int paintedHeight: textureSize.height property var status: Image.Null - property int downscaleValue: 2 + // Value from ui button + property int downscaleValueQML: 0 + + // Value from cpp at initialisation + property int downscaleValueCpp: 0 property int subdivisionsPano: 12 @@ -35,6 +39,7 @@ AliceVision.PanoramaViewer { for (var i = 0; i < repeater.model; i++) { repeater.itemAt(i).item.onChangedHighlightState(isHighlightable); } + var activeNode = _reconstruction.activeNodes.get('SfMTransform').node; } onSubdivisionsPanoChanged:{ @@ -43,9 +48,11 @@ AliceVision.PanoramaViewer { } } - onDownscaleValueChanged: { + onDownscaleValueQMLChanged: { + console.warn("Downscale") + for (var i = 0; i < repeater.model; i++) { - repeater.itemAt(i).item.setDownscale(downscaleValue); + repeater.itemAt(i).item.downscaleLevel = downscaleValueQML; } } @@ -68,7 +75,7 @@ AliceVision.PanoramaViewer { onYawNodeChanged: { if (!isRotating) { for (var i = 0; i < repeater.model; i++) { - repeater.itemAt(i).item.rotatePanoramaDegrees(yawNode, pitchNode); + repeater.itemAt(i).item.rotatePanoramaDegrees(yawNode, pitchNod); } } } @@ -176,7 +183,6 @@ AliceVision.PanoramaViewer { property string sfmPath: "" function updateSfmPath() { - console.warn("SFM UPDATE - PANO") var activeNode = _reconstruction.activeNodes.get('SfMTransform').node; if(!activeNode) @@ -212,6 +218,7 @@ AliceVision.PanoramaViewer { if(active) { setSource("FloatImage.qml", { 'isPanoViewer' : true, + 'downscaleLevel' : root.downscaleValueCpp, 'source': Qt.binding(function() { return cSource; }), 'index' : index, 'idView': Qt.binding(function() { return cId; }), @@ -235,16 +242,18 @@ AliceVision.PanoramaViewer { onImagesDataChanged: { //We receive the map from C++ //Resetting arrays to avoid problem with push - pathList = [] - idList = [] //Iterating through the map for (var path in imagesData) { - console.warn("Object item:", path, "=", imagesData[path]) + if (path === "lvl") { + root.downscaleValueCpp = imagesData[path]; + panoramaViewerToolbar.updateDownscaleValue(root.downscaleValueCpp) + continue; + } + root.pathList.push(path) root.idList.push(imagesData[path]) } - console.warn(root.pathList.length) //Changing the repeater model (number of elements) panoImages.updateRepeater() diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 6f0a00f9..71b6c43c 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -262,9 +262,9 @@ FocusScope { onActiveChanged: { if(active) { setSource("PanoramaViewer.qml", { + 'downscaleValueQML': Qt.binding(function(){return panoramaViewerToolbar.downscaleValue;}), 'isEditable': Qt.binding(function(){ return panoramaViewerToolbar.enableEdit;}), 'isHighlightable': Qt.binding(function(){ return panoramaViewerToolbar.enableHover;}), - 'downscaleValue': Qt.binding(function(){return panoramaViewerToolbar.downscaleValue;}), 'subdivisionsPano': Qt.binding(function(){ return panoramaViewerToolbar.subdivisionsValue;}), 'displayGridPano': Qt.binding(function(){ return panoramaViewerToolbar.displayGrid;}), 'mouseMultiplier': Qt.binding(function(){ return panoramaViewerToolbar.mouseSpeed;})