mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
Merge pull request #1793 from alicevision/dev/defaultHdrViewer
[ui] Viewer 2D: enable the HDR viewer by default
This commit is contained in:
commit
aa5e8564e0
2 changed files with 50 additions and 15 deletions
|
@ -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)
|
licensesModel = Property("QVariantList", _licensesModel, constant=True)
|
||||||
pipelineTemplateFilesChanged = Signal()
|
pipelineTemplateFilesChanged = Signal()
|
||||||
recentProjectFilesChanged = Signal()
|
recentProjectFilesChanged = Signal()
|
||||||
pipelineTemplateFiles = Property("QVariantList", _pipelineTemplateFiles, notify=pipelineTemplateFilesChanged)
|
pipelineTemplateFiles = Property("QVariantList", _pipelineTemplateFiles, notify=pipelineTemplateFilesChanged)
|
||||||
recentProjectFiles = Property("QVariantList", _recentProjectFiles, notify=recentProjectFilesChanged)
|
recentProjectFiles = Property("QVariantList", _recentProjectFiles, notify=recentProjectFilesChanged)
|
||||||
|
default8bitViewerEnabled = Property(bool, _default8bitViewerEnabled, constant=True)
|
||||||
|
|
|
@ -20,12 +20,13 @@ FocusScope {
|
||||||
|
|
||||||
property Component floatViewerComp: Qt.createComponent("FloatImage.qml")
|
property Component floatViewerComp: Qt.createComponent("FloatImage.qml")
|
||||||
property Component panoramaViewerComp: Qt.createComponent("PanoramaViewer.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 useLensDistortionViewer: displayLensDistortionViewer.checked
|
||||||
property alias usePanoramaViewer: displayPanoramaViewer.checked
|
property alias usePanoramaViewer: displayPanoramaViewer.checked
|
||||||
|
|
||||||
property var activeNodeFisheye: _reconstruction.activeNodes.get("PanoramaInit").node
|
property var activeNodeFisheye: _reconstruction.activeNodes.get("PanoramaInit").node
|
||||||
property bool cropFisheye : activeNodeFisheye ? activeNodeFisheye.attribute("useFisheye").value : false
|
property bool cropFisheye : activeNodeFisheye ? activeNodeFisheye.attribute("useFisheye").value : false
|
||||||
|
property bool enable8bitViewer: MeshroomApp.default8bitViewerEnabled
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: m
|
id: m
|
||||||
|
@ -62,8 +63,10 @@ FocusScope {
|
||||||
readonly property bool oiioPluginAvailable: oiioPluginLoader.status === Component.Ready
|
readonly property bool oiioPluginAvailable: oiioPluginLoader.status === Component.Ready
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if(!aliceVisionPluginAvailable)
|
if(!aliceVisionPluginAvailable) {
|
||||||
console.warn("Missing plugin qtAliceVision.")
|
console.warn("Missing plugin qtAliceVision.")
|
||||||
|
displayHDR.checked = false
|
||||||
|
}
|
||||||
if(!oiioPluginAvailable)
|
if(!oiioPluginAvailable)
|
||||||
console.warn("Missing plugin qtOIIO.")
|
console.warn("Missing plugin qtOIIO.")
|
||||||
}
|
}
|
||||||
|
@ -96,7 +99,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
if(msfmDataLoader.status === Loader.Ready)
|
if(msfmDataLoader.status === Loader.Ready)
|
||||||
{
|
{
|
||||||
if(msfmDataLoader.item.status === MSfMData.Loading)
|
if(msfmDataLoader.item != null && msfmDataLoader.item.status === MSfMData.Loading)
|
||||||
{
|
{
|
||||||
res += " SfMData";
|
res += " SfMData";
|
||||||
}
|
}
|
||||||
|
@ -370,12 +373,35 @@ FocusScope {
|
||||||
active: root.aliceVisionPluginAvailable && (root.useFloatImageViewer || root.useLensDistortionViewer) && !panoramaViewerLoader.active
|
active: root.aliceVisionPluginAvailable && (root.useFloatImageViewer || root.useLensDistortionViewer) && !panoramaViewerLoader.active
|
||||||
visible: (floatImageViewerLoader.status === Loader.Ready) && active
|
visible: (floatImageViewerLoader.status === Loader.Ready) && active
|
||||||
anchors.centerIn: parent
|
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
|
// handle rotation/position based on available metadata
|
||||||
rotation: {
|
rotation: {
|
||||||
var orientation = m.imgMetadata ? m.imgMetadata["Orientation"] : 0
|
var orientation = m.imgMetadata ? m.imgMetadata["Orientation"] : 0
|
||||||
|
|
||||||
switch(orientation) {
|
switch (orientation) {
|
||||||
case "6": return 90;
|
case "6": return 90;
|
||||||
case "8": return -90;
|
case "8": return -90;
|
||||||
default: return 0;
|
default: return 0;
|
||||||
|
@ -383,7 +409,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if(active) {
|
if (active) {
|
||||||
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
|
// 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.
|
// Note: It does not work to use previously created component, so we re-create it with setSource.
|
||||||
// floatViewerComp.createObject(floatImageViewerLoader, {
|
// floatViewerComp.createObject(floatImageViewerLoader, {
|
||||||
|
@ -399,7 +425,7 @@ FocusScope {
|
||||||
'surface.subdivisions' : Qt.binding(function(){ return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue;}),
|
'surface.subdivisions' : Qt.binding(function(){ return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue;}),
|
||||||
'viewerTypeString': Qt.binding(function(){ return displayLensDistortionViewer.checked ? "distortion" : "hdr";}),
|
'viewerTypeString': Qt.binding(function(){ return displayLensDistortionViewer.checked ? "distortion" : "hdr";}),
|
||||||
'sfmRequired': Qt.binding(function(){ return displayLensDistortionViewer.checked ? true : false;}),
|
'sfmRequired': Qt.binding(function(){ return displayLensDistortionViewer.checked ? true : false;}),
|
||||||
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }),
|
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }),
|
||||||
'canBeHovered': false,
|
'canBeHovered': false,
|
||||||
'idView': Qt.binding(function() { return _reconstruction.selectedViewId; }),
|
'idView': Qt.binding(function() { return _reconstruction.selectedViewId; }),
|
||||||
'cropFisheye': false
|
'cropFisheye': false
|
||||||
|
@ -407,6 +433,7 @@ FocusScope {
|
||||||
} else {
|
} else {
|
||||||
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
|
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
|
||||||
setSource("", {})
|
setSource("", {})
|
||||||
|
fittedOnce = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +502,6 @@ FocusScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
property var image: {
|
property var image: {
|
||||||
if (floatImageViewerLoader.active)
|
if (floatImageViewerLoader.active)
|
||||||
floatImageViewerLoader.item
|
floatImageViewerLoader.item
|
||||||
|
@ -484,8 +510,8 @@ FocusScope {
|
||||||
else
|
else
|
||||||
qtImageViewerLoader.item
|
qtImageViewerLoader.item
|
||||||
}
|
}
|
||||||
width: image ? image.width : 1
|
width: image ? (image.width > 0 ? image.width : 1) : 1
|
||||||
height: image ? image.height : 1
|
height: image ? (image.height > 0 ? image.height : 1) : 1
|
||||||
scale: 1.0
|
scale: 1.0
|
||||||
|
|
||||||
// FeatureViewer: display view extracted feature points
|
// FeatureViewer: display view extracted feature points
|
||||||
|
@ -954,12 +980,14 @@ FocusScope {
|
||||||
padding: 0
|
padding: 0
|
||||||
Layout.minimumWidth: 0
|
Layout.minimumWidth: 0
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: false
|
checked: root.aliceVisionPluginAvailable
|
||||||
enabled: root.aliceVisionPluginAvailable
|
enabled: root.aliceVisionPluginAvailable
|
||||||
|
visible: root.enable8bitViewer
|
||||||
onCheckedChanged : {
|
onCheckedChanged : {
|
||||||
if(displayLensDistortionViewer.checked && checked){
|
if (displayLensDistortionViewer.checked && checked) {
|
||||||
displayLensDistortionViewer.checked = false;
|
displayLensDistortionViewer.checked = false;
|
||||||
}
|
}
|
||||||
|
root.useFloatImageViewer = !root.useFloatImageViewer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
|
@ -990,9 +1018,11 @@ FocusScope {
|
||||||
checked: false
|
checked: false
|
||||||
enabled: activeNode && isComputed
|
enabled: activeNode && isComputed
|
||||||
onCheckedChanged : {
|
onCheckedChanged : {
|
||||||
if((displayHDR.checked || displayPanoramaViewer.checked) && checked){
|
if ((displayHDR.checked || displayPanoramaViewer.checked) && checked) {
|
||||||
displayHDR.checked = false;
|
displayHDR.checked = false;
|
||||||
displayPanoramaViewer.checked = false;
|
displayPanoramaViewer.checked = false;
|
||||||
|
} else if (!checked) {
|
||||||
|
displayHDR.checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1022,15 +1052,15 @@ FocusScope {
|
||||||
checked: false
|
checked: false
|
||||||
enabled: activeNode && isComputed
|
enabled: activeNode && isComputed
|
||||||
onCheckedChanged : {
|
onCheckedChanged : {
|
||||||
if(displayLensDistortionViewer.checked && checked){
|
if (displayLensDistortionViewer.checked && checked) {
|
||||||
displayLensDistortionViewer.checked = false;
|
displayLensDistortionViewer.checked = false;
|
||||||
}
|
}
|
||||||
if(displayFisheyeCircleLoader.checked && checked){
|
if (displayFisheyeCircleLoader.checked && checked) {
|
||||||
displayFisheyeCircleLoader.checked = false;
|
displayFisheyeCircleLoader.checked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged : {
|
onEnabledChanged : {
|
||||||
if(!enabled){
|
if (!enabled) {
|
||||||
checked = false;
|
checked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue