Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alicevision/meshroom.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCandice Bentéjac <candice.bentejac@gmail.com>2022-10-10 19:22:46 +0300
committerCandice Bentéjac <candice.bentejac@gmail.com>2022-10-10 19:22:46 +0300
commitff4620dc2fbe53e921684376d7095bcf6c82ad5b (patch)
tree4bef81175fc33478b62a0ba64ee7c76957078a07
parent243c278bccea56aaddbd7366b63fea6a4ce20456 (diff)
[ui] Viewer2D: Enable HDR viewer by default if it is available
If the HDR viewer is unavailable, load the classic 8bit image viewer, but do not allow the user to switch to it anymore if the HDR viewer is available unless a specific environment variable has been provided.
-rw-r--r--meshroom/ui/app.py5
-rw-r--r--meshroom/ui/qml/Viewer/Viewer2D.qml56
2 files changed, 48 insertions, 13 deletions
diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py
index 3a8c050a..3f9df1fa 100644
--- a/meshroom/ui/app.py
+++ b/meshroom/ui/app.py
@@ -344,8 +344,13 @@ class MeshroomApp(QApplication):
}
]
+ def _default8bitViewerEnabled(self):
+ return bool(os.environ.get("MESHROOM_USE_8BIT_VIEWER", False))
+
+
licensesModel = Property("QVariantList", _licensesModel, constant=True)
pipelineTemplateFilesChanged = Signal()
recentProjectFilesChanged = Signal()
pipelineTemplateFiles = Property("QVariantList", _pipelineTemplateFiles, notify=pipelineTemplateFilesChanged)
recentProjectFiles = Property("QVariantList", _recentProjectFiles, notify=recentProjectFilesChanged)
+ default8bitViewerEnabled = Property(bool, _default8bitViewerEnabled, constant=True)
diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml
index 8bd2ceb1..11a57d34 100644
--- a/meshroom/ui/qml/Viewer/Viewer2D.qml
+++ b/meshroom/ui/qml/Viewer/Viewer2D.qml
@@ -15,12 +15,13 @@ FocusScope {
property Component floatViewerComp: Qt.createComponent("FloatImage.qml")
property Component panoramaViewerComp: Qt.createComponent("PanoramaViewer.qml")
- property alias useFloatImageViewer: displayHDR.checked
+ property var useFloatImageViewer: displayHDR.checked
property alias useLensDistortionViewer: displayLensDistortionViewer.checked
property alias usePanoramaViewer: displayPanoramaViewer.checked
property var activeNodeFisheye: _reconstruction.activeNodes.get("PanoramaInit").node
property bool cropFisheye : activeNodeFisheye ? activeNodeFisheye.attribute("useFisheye").value : false
+ property bool enable8bitViewer: MeshroomApp.default8bitViewerEnabled
QtObject {
id: m
@@ -57,8 +58,10 @@ FocusScope {
readonly property bool oiioPluginAvailable: oiioPluginLoader.status === Component.Ready
Component.onCompleted: {
- if(!aliceVisionPluginAvailable)
+ if(!aliceVisionPluginAvailable) {
console.warn("Missing plugin qtAliceVision.")
+ displayHDR.checked = false
+ }
if(!oiioPluginAvailable)
console.warn("Missing plugin qtOIIO.")
}
@@ -254,12 +257,35 @@ FocusScope {
active: root.aliceVisionPluginAvailable && (root.useFloatImageViewer || root.useLensDistortionViewer) && !panoramaViewerLoader.active
visible: (floatImageViewerLoader.status === Loader.Ready) && active
anchors.centerIn: parent
+ property var fittedOnce: false
+ property var previousWidth: 0
+ property var previousHeight: 0
+ onHeightChanged: {
+ /* 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:
+ * - width = -1, height = -1
+ * - width = x, height = -1
+ * - width = x, height = y
+ * We want to do the auto-fit on the first display of an image from the group, and then keep its
+ * scale when displaying another image from the group, so we need to know if an image in the
+ * 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.status == Image.Ready && imgContainer.image.height > 0) ||
+ (fittedOnce && ((width > 1 && previousWidth != width) || (height > 1 && previousHeight != height)))) {
+ fit();
+ fittedOnce = true;
+ previousWidth = width;
+ previousHeight = height;
+ }
+ }
// handle rotation/position based on available metadata
rotation: {
var orientation = m.imgMetadata ? m.imgMetadata["Orientation"] : 0
- switch(orientation) {
+ switch (orientation) {
case "6": return 90;
case "8": return -90;
default: return 0;
@@ -267,7 +293,7 @@ FocusScope {
}
onActiveChanged: {
- if(active) {
+ if (active) {
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
// Note: It does not work to use previously created component, so we re-create it with setSource.
// floatViewerComp.createObject(floatImageViewerLoader, {
@@ -291,6 +317,7 @@ FocusScope {
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
+ fittedOnce = false
}
}
@@ -359,7 +386,6 @@ FocusScope {
}
}
-
property var image: {
if (floatImageViewerLoader.active)
floatImageViewerLoader.item
@@ -368,8 +394,8 @@ FocusScope {
else
qtImageViewerLoader.item
}
- width: image ? image.width : 1
- height: image ? image.height : 1
+ width: image ? (image.width > 0 ? image.width : 1) : 1
+ height: image ? (image.height > 0 ? image.height : 1) : 1
scale: 1.0
// FeatureViewer: display view extracted feature points
@@ -829,12 +855,14 @@ FocusScope {
padding: 0
Layout.minimumWidth: 0
checkable: true
- checked: false
+ checked: root.aliceVisionPluginAvailable
enabled: root.aliceVisionPluginAvailable
+ visible: root.enable8bitViewer
onCheckedChanged : {
- if(displayLensDistortionViewer.checked && checked){
+ if (displayLensDistortionViewer.checked && checked) {
displayLensDistortionViewer.checked = false;
}
+ root.useFloatImageViewer = !root.useFloatImageViewer
}
}
MaterialToolButton {
@@ -865,9 +893,11 @@ FocusScope {
checked: false
enabled: activeNode && isComputed
onCheckedChanged : {
- if((displayHDR.checked || displayPanoramaViewer.checked) && checked){
+ if ((displayHDR.checked || displayPanoramaViewer.checked) && checked) {
displayHDR.checked = false;
displayPanoramaViewer.checked = false;
+ } else if (!checked) {
+ displayHDR.checked = true;
}
}
}
@@ -897,15 +927,15 @@ FocusScope {
checked: false
enabled: activeNode && isComputed
onCheckedChanged : {
- if(displayLensDistortionViewer.checked && checked){
+ if (displayLensDistortionViewer.checked && checked) {
displayLensDistortionViewer.checked = false;
}
- if(displayFisheyeCircleLoader.checked && checked){
+ if (displayFisheyeCircleLoader.checked && checked) {
displayFisheyeCircleLoader.checked = false;
}
}
onEnabledChanged : {
- if(!enabled){
+ if (!enabled) {
checked = false;
}
}