From f07c92472b86f69e3d3b57329ddc84a497a38b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 11:53:34 +0200 Subject: [PATCH 01/64] [requirements] Update requirement for PySide to PySide 6.6.3.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 02a51415..5eed81ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # runtime psutil>=5.6.7 -PySide2==5.15.2.1 +PySide6==6.6.3.1 markdown==2.6.11 requests==2.32.0 pyseq==0.6.1 From 579371fd7cfe3b5f48a3eac2415ab28d1e26d851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:18:17 +0200 Subject: [PATCH 02/64] [qt6] Replace all `PySide2/shiboken2` imports by `PySide6/shiboken6` --- COPYING.md | 2 +- meshroom/common/qt.py | 6 +++--- meshroom/ui/app.py | 10 +++++----- meshroom/ui/commands.py | 4 ++-- meshroom/ui/components/__init__.py | 2 +- meshroom/ui/components/clipboard.py | 4 ++-- meshroom/ui/components/csvData.py | 4 ++-- meshroom/ui/components/edge.py | 6 +++--- meshroom/ui/components/filepath.py | 4 ++-- meshroom/ui/components/scene3D.py | 8 ++++---- meshroom/ui/components/scriptEditor.py | 2 +- meshroom/ui/components/thumbnail.py | 4 ++-- meshroom/ui/graph.py | 2 +- meshroom/ui/palette.py | 6 +++--- meshroom/ui/reconstruction.py | 4 ++-- meshroom/ui/utils.py | 10 +++++----- tests/test_model.py | 2 +- 17 files changed, 40 insertions(+), 40 deletions(-) diff --git a/COPYING.md b/COPYING.md index d0144329..6a168fc6 100644 --- a/COPYING.md +++ b/COPYING.md @@ -15,7 +15,7 @@ Meshroom is licensed under the [MPL2 license](LICENSE-MPL2.md). Copyright (c) 2001-2018 Python Software Foundation. Distributed under the [PSFL V2 license](https://www.python.org/download/releases/2.7/license/). - * __Qt/PySide2__ + * __Qt/PySide6__ [https://www.qt.io](https://www.qt.io) Copyright (C) 2018 The Qt Company Ltd and other contributors. Distributed under the [LGPL V3 license](https://opensource.org/licenses/LGPL-3.0). diff --git a/meshroom/common/qt.py b/meshroom/common/qt.py index 438a7537..80a09504 100644 --- a/meshroom/common/qt.py +++ b/meshroom/common/qt.py @@ -1,5 +1,5 @@ -from PySide2 import QtCore, QtQml -import shiboken2 +from PySide6 import QtCore, QtQml +import shiboken6 class QObjectListModel(QtCore.QAbstractListModel): @@ -285,7 +285,7 @@ class QObjectListModel(QtCore.QAbstractListModel): def _dereferenceItem(self, item): # Ask for object deletion if parented to the model - if shiboken2.isValid(item) and item.parent() == self: + if shiboken6.isValid(item) and item.parent() == self: # delay deletion until the next event loop # This avoids warnings when the QML engine tries to evaluate (but should not) # an object that has already been deleted diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index 0a2de795..f9bc827c 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -4,10 +4,10 @@ import re import argparse import json -from PySide2 import QtCore -from PySide2.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings -from PySide2.QtGui import QIcon -from PySide2.QtWidgets import QApplication +from PySide6 import QtCore +from PySide6.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings +from PySide6.QtGui import QIcon +from PySide6.QtWidgets import QApplication import meshroom from meshroom.core import nodesDesc @@ -188,7 +188,7 @@ class MeshroomApp(QApplication): def __init__(self, args): meshroom.core.initPipelines() - QtArgs = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default + QtArgs = [args[0], '-style', 'Fusion'] + args[1:] # force Fusion style by default args = createMeshroomParser(args) diff --git a/meshroom/ui/commands.py b/meshroom/ui/commands.py index 95a54025..47be0a33 100755 --- a/meshroom/ui/commands.py +++ b/meshroom/ui/commands.py @@ -2,8 +2,8 @@ import logging import traceback from contextlib import contextmanager -from PySide2.QtWidgets import QUndoCommand, QUndoStack -from PySide2.QtCore import Property, Signal +from PySide6.QtGui import QUndoCommand, QUndoStack +from PySide6.QtCore import Property, Signal from meshroom.core.attribute import ListAttribute, Attribute from meshroom.core.graph import GraphModification diff --git a/meshroom/ui/components/__init__.py b/meshroom/ui/components/__init__.py index 260acb04..59c77618 100755 --- a/meshroom/ui/components/__init__.py +++ b/meshroom/ui/components/__init__.py @@ -1,6 +1,6 @@ def registerTypes(): - from PySide2.QtQml import qmlRegisterType + from PySide6.QtQml import qmlRegisterType from meshroom.ui.components.clipboard import ClipboardHelper from meshroom.ui.components.edge import EdgeMouseArea from meshroom.ui.components.filepath import FilepathHelper diff --git a/meshroom/ui/components/clipboard.py b/meshroom/ui/components/clipboard.py index ab95d70c..aaee965a 100644 --- a/meshroom/ui/components/clipboard.py +++ b/meshroom/ui/components/clipboard.py @@ -1,5 +1,5 @@ -from PySide2.QtCore import Slot, QObject -from PySide2.QtGui import QClipboard +from PySide6.QtCore import Slot, QObject +from PySide6.QtGui import QClipboard class ClipboardHelper(QObject): diff --git a/meshroom/ui/components/csvData.py b/meshroom/ui/components/csvData.py index c9ecef2f..f52cabe9 100644 --- a/meshroom/ui/components/csvData.py +++ b/meshroom/ui/components/csvData.py @@ -1,7 +1,7 @@ from meshroom.common.qt import QObjectListModel -from PySide2.QtCore import QObject, Slot, Signal, Property -from PySide2.QtCharts import QtCharts +from PySide6.QtCore import QObject, Slot, Signal, Property +from PySide6 import QtCharts import csv import os diff --git a/meshroom/ui/components/edge.py b/meshroom/ui/components/edge.py index 64a9f0e3..d802d5b6 100755 --- a/meshroom/ui/components/edge.py +++ b/meshroom/ui/components/edge.py @@ -1,6 +1,6 @@ -from PySide2.QtCore import Signal, Property, QPointF, Qt, QObject -from PySide2.QtGui import QPainterPath, QVector2D -from PySide2.QtQuick import QQuickItem +from PySide6.QtCore import Signal, Property, QPointF, Qt, QObject +from PySide6.QtGui import QPainterPath, QVector2D +from PySide6.QtQuick import QQuickItem class MouseEvent(QObject): diff --git a/meshroom/ui/components/filepath.py b/meshroom/ui/components/filepath.py index 411eaf72..ae8124be 100644 --- a/meshroom/ui/components/filepath.py +++ b/meshroom/ui/components/filepath.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding:utf-8 -from PySide2.QtCore import QUrl, QFileInfo -from PySide2.QtCore import QObject, Slot +from PySide6.QtCore import QUrl, QFileInfo +from PySide6.QtCore import QObject, Slot import os import glob diff --git a/meshroom/ui/components/scene3D.py b/meshroom/ui/components/scene3D.py index d39ea6f6..7187110a 100644 --- a/meshroom/ui/components/scene3D.py +++ b/meshroom/ui/components/scene3D.py @@ -1,9 +1,9 @@ from math import acos, pi, sqrt, atan2, cos, sin, asin -from PySide2.QtCore import QObject, Slot, QSize, Signal, QPointF -from PySide2.Qt3DCore import Qt3DCore -from PySide2.Qt3DRender import Qt3DRender -from PySide2.QtGui import QVector3D, QQuaternion, QVector2D, QVector4D, QMatrix4x4 +from PySide6.QtCore import QObject, Slot, QSize, Signal, QPointF +from PySide6.Qt3DCore import Qt3DCore +from PySide6.Qt3DRender import Qt3DRender +from PySide6.QtGui import QVector3D, QQuaternion, QVector2D, QVector4D, QMatrix4x4 from meshroom.ui.utils import makeProperty diff --git a/meshroom/ui/components/scriptEditor.py b/meshroom/ui/components/scriptEditor.py index a8326080..da3731ad 100644 --- a/meshroom/ui/components/scriptEditor.py +++ b/meshroom/ui/components/scriptEditor.py @@ -1,4 +1,4 @@ -from PySide2.QtCore import QObject, Slot +from PySide6.QtCore import QObject, Slot from io import StringIO from contextlib import redirect_stdout diff --git a/meshroom/ui/components/thumbnail.py b/meshroom/ui/components/thumbnail.py index 86864593..acfd1591 100644 --- a/meshroom/ui/components/thumbnail.py +++ b/meshroom/ui/components/thumbnail.py @@ -1,7 +1,7 @@ from meshroom.common import Signal -from PySide2.QtCore import QObject, Slot, QSize, QUrl, Qt, QStandardPaths -from PySide2.QtGui import QImageReader, QImageWriter +from PySide6.QtCore import QObject, Slot, QSize, QUrl, Qt, QStandardPaths +from PySide6.QtGui import QImageReader, QImageWriter import os from pathlib import Path diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index 448f2548..3fd8b9ff 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -8,7 +8,7 @@ from enum import Enum from threading import Thread, Event, Lock from multiprocessing.pool import ThreadPool -from PySide2.QtCore import Slot, QJsonValue, QObject, QUrl, Property, Signal, QPoint +from PySide6.QtCore import Slot, QJsonValue, QObject, QUrl, Property, Signal, QPoint from meshroom.core import sessionUid from meshroom.common.qt import QObjectListModel diff --git a/meshroom/ui/palette.py b/meshroom/ui/palette.py index 0d87ec21..4d968709 100644 --- a/meshroom/ui/palette.py +++ b/meshroom/ui/palette.py @@ -1,6 +1,6 @@ -from PySide2.QtCore import QObject, Qt, Slot, Property, Signal -from PySide2.QtGui import QPalette, QColor -from PySide2.QtWidgets import QApplication +from PySide6.QtCore import QObject, Qt, Slot, Property, Signal +from PySide6.QtGui import QPalette, QColor +from PySide6.QtWidgets import QApplication class PaletteManager(QObject): diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index e1aaaa5f..3f1acb6c 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -6,8 +6,8 @@ from collections.abc import Iterable from multiprocessing.pool import ThreadPool from threading import Thread -from PySide2.QtCore import QObject, Slot, Property, Signal, QUrl, QSizeF, QPoint -from PySide2.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVector2D +from PySide6.QtCore import QObject, Slot, Property, Signal, QUrl, QSizeF, QPoint +from PySide6.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVector2D import meshroom.core import meshroom.common diff --git a/meshroom/ui/utils.py b/meshroom/ui/utils.py index e09408ea..5e6339ec 100755 --- a/meshroom/ui/utils.py +++ b/meshroom/ui/utils.py @@ -1,12 +1,12 @@ import os import time -from PySide2.QtCore import QFileSystemWatcher, QUrl, Slot, QTimer, Property, QObject -from PySide2.QtQml import QQmlApplicationEngine +from PySide6.QtCore import QFileSystemWatcher, QUrl, Slot, QTimer, Property, QObject +from PySide6.QtQml import QQmlApplicationEngine try: - from PySide2 import shiboken2 + from PySide6 import shiboken6 except Exception: - import shiboken2 + import shiboken6 class QmlInstantEngine(QQmlApplicationEngine): @@ -237,7 +237,7 @@ def makeProperty(T, attributeName, notify=None, resetOnDestroy=False): setattr(instance, resetCallbackName, lambda self=instance, *args: setter(self, None)) resetCallback = getattr(instance, resetCallbackName, None) - if resetCallback and currentValue and shiboken2.isValid(currentValue): + if resetCallback and currentValue and shiboken6.isValid(currentValue): currentValue.destroyed.disconnect(resetCallback) setattr(instance, attributeName, value) if resetCallback and value: diff --git a/tests/test_model.py b/tests/test_model.py index 1c05c3ca..b7ddc2fe 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -1,6 +1,6 @@ import pytest -from PySide2.QtCore import QObject, Property +from PySide6.QtCore import QObject, Property from meshroom.common.core import CoreDictModel from meshroom.common.qt import QObjectListModel, QTypedObjectListModel From 96a70c04ff8b872eac69f008b428018e42fbf8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:20:27 +0200 Subject: [PATCH 03/64] [qt6] Remove imports of QML modules that do not exist anymore with Qt6.6 --- meshroom/ui/qml/Application.qml | 2 +- meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml | 2 +- meshroom/ui/qml/GraphEditor/Node.qml | 2 +- meshroom/ui/qml/GraphEditor/ScriptEditor.qml | 2 +- meshroom/ui/qml/main.qml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index 147bd0fe..f58289b8 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -5,7 +5,7 @@ import QtQuick.Window 2.15 import QtQml.Models 2.15 import Qt.labs.platform 1.0 as Platform -import QtQuick.Dialogs 1.3 +import QtQuick.Dialogs import Qt.labs.settings 1.0 import GraphEditor 1.0 diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index d0942e2c..0b189210 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -1,7 +1,7 @@ import QtQuick 2.9 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 -import QtQuick.Dialogs 1.3 +import QtQuick.Dialogs import MaterialIcons 2.2 import Utils 1.0 import Controls 1.0 diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 9a8bb05a..536eb0ca 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -1,7 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.11 -import QtGraphicalEffects 1.12 +import Qt5Compat.GraphicalEffects import Utils 1.0 import MaterialIcons 2.2 diff --git a/meshroom/ui/qml/GraphEditor/ScriptEditor.qml b/meshroom/ui/qml/GraphEditor/ScriptEditor.qml index 35c5a85b..55fd4c84 100644 --- a/meshroom/ui/qml/GraphEditor/ScriptEditor.qml +++ b/meshroom/ui/qml/GraphEditor/ScriptEditor.qml @@ -6,7 +6,7 @@ import Utils 1.0 import MaterialIcons 2.2 import Qt.labs.platform 1.0 as Platform -import QtQuick.Dialogs 1.3 +import QtQuick.Dialogs Item { id: root diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index f0113264..f5ce231e 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -1,7 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Window 2.15 -import QtQuick.Dialogs 1.3 +import QtQuick.Dialogs import Qt.labs.platform 1.0 as Platform import Qt.labs.settings 1.0 From 02be73df65c6ecbb8e259c4da4671fd07d5d976e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:23:26 +0200 Subject: [PATCH 04/64] [qt6] Remove properties that do not exist anymore in Qt6.6 --- meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml | 2 +- meshroom/ui/qml/GraphEditor/NodeLog.qml | 4 ++-- meshroom/ui/qml/GraphEditor/NodeStatistics.qml | 4 ++-- meshroom/ui/qml/GraphEditor/NodeStatus.qml | 4 ++-- meshroom/ui/qml/Viewer3D/BoundingBox.qml | 1 - meshroom/ui/qml/Viewer3D/Grid3D.qml | 1 - meshroom/ui/qml/Viewer3D/Locator3D.qml | 2 -- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index 0b189210..3620a942 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -444,7 +444,7 @@ RowLayout { ColorDialog { id: colorDialog title: "Please choose a color" - color: attribute.value + selectedColor: attribute.value onAccepted: { colorText.text = color // Artificially trigger change of attribute value diff --git a/meshroom/ui/qml/GraphEditor/NodeLog.qml b/meshroom/ui/qml/GraphEditor/NodeLog.qml index 0477d4f6..444f54c7 100644 --- a/meshroom/ui/qml/GraphEditor/NodeLog.qml +++ b/meshroom/ui/qml/GraphEditor/NodeLog.qml @@ -29,7 +29,7 @@ FocusScope { anchors.fill: parent property string currentFile: (root.currentChunkIndex >= 0 && root.currentChunk) ? root.currentChunk["logFile"] : "" - property url source: Filepath.stringToUrl(currentFile) + property url sourceFile: Filepath.stringToUrl(currentFile) sourceComponent: textFileViewerComponent } @@ -40,7 +40,7 @@ FocusScope { TextFileViewer { id: textFileViewer anchors.fill: parent - source: componentLoader.source + source: componentLoader.sourceFile autoReload: root.currentChunk !== undefined && root.currentChunk.statusName === "RUNNING" // source is set in fileSelector } diff --git a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml index 34a43ba0..77eb255d 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml @@ -27,7 +27,7 @@ FocusScope { clip: true anchors.fill: parent property string currentFile: currentChunk ? currentChunk["statisticsFile"] : "" - property url source: Filepath.stringToUrl(currentFile) + property url sourceFile: Filepath.stringToUrl(currentFile) sourceComponent: chunksLV.chunksSummary ? statViewerComponent : chunkStatViewerComponent } @@ -37,7 +37,7 @@ FocusScope { StatViewer { id: statViewer anchors.fill: parent - source: componentLoader.source + source: componentLoader.sourceFile } } diff --git a/meshroom/ui/qml/GraphEditor/NodeStatus.qml b/meshroom/ui/qml/GraphEditor/NodeStatus.qml index 36111f8f..db487c09 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatus.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatus.qml @@ -26,7 +26,7 @@ FocusScope { anchors.fill: parent property string currentFile: (root.currentChunkIndex >= 0) ? root.currentChunk["statusFile"] : "" - property url source: Filepath.stringToUrl(currentFile) + property url sourceFile: Filepath.stringToUrl(currentFile) sourceComponent: statViewerComponent } @@ -35,7 +35,7 @@ FocusScope { id: statViewerComponent Item { id: statusViewer - property url source: componentLoader.source + property url source: componentLoader.sourceFile property var lastModified: undefined onSourceChanged: { diff --git a/meshroom/ui/qml/Viewer3D/BoundingBox.qml b/meshroom/ui/qml/Viewer3D/BoundingBox.qml index e2784a57..ceef931f 100644 --- a/meshroom/ui/qml/Viewer3D/BoundingBox.qml +++ b/meshroom/ui/qml/Viewer3D/BoundingBox.qml @@ -56,7 +56,6 @@ Entity { count: 24 name: defaultPositionAttributeName buffer: Buffer { - type: Buffer.VertexBuffer data: new Float32Array([ 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, diff --git a/meshroom/ui/qml/Viewer3D/Grid3D.qml b/meshroom/ui/qml/Viewer3D/Grid3D.qml index 1d6ddfc3..bc9a3db8 100644 --- a/meshroom/ui/qml/Viewer3D/Grid3D.qml +++ b/meshroom/ui/qml/Viewer3D/Grid3D.qml @@ -18,7 +18,6 @@ Entity { count: 0 name: defaultPositionAttributeName buffer: Buffer { - type: Buffer.VertexBuffer data: { function buildGrid(first, last, offset, attribute) { var vertexCount = (((last-first)/offset)+1)*4; diff --git a/meshroom/ui/qml/Viewer3D/Locator3D.qml b/meshroom/ui/qml/Viewer3D/Locator3D.qml index f9bb1fb4..c7dfb217 100644 --- a/meshroom/ui/qml/Viewer3D/Locator3D.qml +++ b/meshroom/ui/qml/Viewer3D/Locator3D.qml @@ -19,7 +19,6 @@ Entity { count: 6 name: defaultPositionAttributeName buffer: Buffer { - type: Buffer.VertexBuffer data: new Float32Array([ 0.0, 0.001, 0.0, 1.0, 0.001, 0.0, @@ -37,7 +36,6 @@ Entity { count: 6 name: defaultColorAttributeName buffer: Buffer { - type: Buffer.VertexBuffer data: new Float32Array([ Colors.red.r, Colors.red.g, Colors.red.b, Colors.red.r, Colors.red.g, Colors.red.b, From 9923980041b9dc0501f442e330c286c81f8e2556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:26:49 +0200 Subject: [PATCH 05/64] [qt6] Use exec() instead of deprecated exec_() in __main__.py --- meshroom/ui/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/__main__.py b/meshroom/ui/__main__.py index f3da61c9..9c75e6ec 100644 --- a/meshroom/ui/__main__.py +++ b/meshroom/ui/__main__.py @@ -10,4 +10,4 @@ import meshroom.ui import meshroom.ui.app meshroom.ui.uiInstance = meshroom.ui.app.MeshroomApp(sys.argv) -meshroom.ui.uiInstance.exec_() +meshroom.ui.uiInstance.exec() From d5cfdb1e854a6ab794946eac07e7b81da82b75bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:35:54 +0200 Subject: [PATCH 06/64] [qt6] Re-enable alternative base and keyboard shortcut to switch to it --- meshroom/ui/qml/main.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index f5ce231e..a3f00821 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -36,8 +36,6 @@ ApplicationWindow { palette: _PaletteManager.palette - // TODO: uncomment for Qt6, which correctly supports palette for disabled elements AND an alternate base - /* // QPalette is not convertible to QML palette (anymore) Component.onCompleted: { palette.alternateBase = _PaletteManager.alternateBase @@ -60,7 +58,7 @@ ApplicationWindow { palette.disabled.highlightedText = _PaletteManager.disabledHighlightedText palette.disabled.text = _PaletteManager.disabledText palette.disabled.windowText = _PaletteManager.disabledWindowText - } */ + } SystemPalette { id: activePalette } SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled } @@ -157,12 +155,11 @@ ApplicationWindow { } - // TODO: uncomment for Qt6 to re-enable the alternative palette (the alternative palette and the disabled items currently cannot both be supported) - /* Action { + Action { shortcut: "Ctrl+Shift+P" onTriggered: _PaletteManager.togglePalette() - } */ + } StackView { id: mainStack From 1b9e75cd4fa36d9ea67a8001b62798783d04e869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 12:38:42 +0200 Subject: [PATCH 07/64] [qt6] Replace Qt.labs.settings with QtCore.Settings --- meshroom/ui/qml/Application.qml | 5 +++-- meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml | 2 +- meshroom/ui/qml/Viewer/SequencePlayer.qml | 3 ++- meshroom/ui/qml/main.qml | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index f58289b8..03014027 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -1,3 +1,5 @@ +import QtCore + import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.11 @@ -7,7 +9,6 @@ import QtQml.Models 2.15 import Qt.labs.platform 1.0 as Platform import QtQuick.Dialogs -import Qt.labs.settings 1.0 import GraphEditor 1.0 import MaterialIcons 2.2 import Utils 1.0 @@ -22,7 +23,7 @@ Page { Settings { id: settingsUILayout - category: 'UILayout' + category: "UILayout" property alias showLiveReconstruction: liveSfMVisibilityCB.checked property alias showGraphEditor: graphEditorVisibilityCB.checked property alias showImageViewer: imageViewerVisibilityCB.checked diff --git a/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml b/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml index 188ae81d..9013c4ee 100644 --- a/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml @@ -1,5 +1,5 @@ pragma Singleton -import Qt.labs.settings 1.0 +import QtCore /** diff --git a/meshroom/ui/qml/Viewer/SequencePlayer.qml b/meshroom/ui/qml/Viewer/SequencePlayer.qml index 915d0447..3e08b740 100644 --- a/meshroom/ui/qml/Viewer/SequencePlayer.qml +++ b/meshroom/ui/qml/Viewer/SequencePlayer.qml @@ -1,11 +1,12 @@ +import QtCore import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.11 + import Controls 1.0 import MaterialIcons 2.2 import Utils 1.0 -import Qt.labs.settings 1.0 /** * The Sequence Player is a UI for manipulating diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index a3f00821..218616a3 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -1,10 +1,11 @@ +import QtCore + import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Window 2.15 import QtQuick.Dialogs import Qt.labs.platform 1.0 as Platform -import Qt.labs.settings 1.0 ApplicationWindow { id: _window @@ -65,7 +66,7 @@ ApplicationWindow { Settings { id: settingsGeneral - category: 'General' + category: "General" property int windowWidth: 1280 property int windowHeight: 720 } From 6d845376eb58e9054bcd19766a95674ef0d382f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 13:14:18 +0200 Subject: [PATCH 08/64] [qt6] Use JS functions format to declare explicit parameters in slots This fixes all the "Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead." warnings. --- meshroom/ui/qml/Application.qml | 10 ++--- .../qml/GraphEditor/AttributeItemDelegate.qml | 8 ++-- meshroom/ui/qml/GraphEditor/AttributePin.qml | 14 +++--- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 45 ++++++++++++------- meshroom/ui/qml/GraphEditor/Node.qml | 26 +++++------ .../ui/qml/ImageGallery/ImageDelegate.qml | 2 +- meshroom/ui/qml/ImageGallery/ImageGallery.qml | 6 +-- meshroom/ui/qml/Viewer/Viewer2D.qml | 20 ++++----- .../qml/Viewer3D/DefaultCameraController.qml | 24 +++++----- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 4 +- meshroom/ui/qml/WorkspaceView.qml | 10 +++-- meshroom/ui/qml/main.qml | 2 +- 12 files changed, 94 insertions(+), 77 deletions(-) diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index 03014027..fdbd411e 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -522,8 +522,8 @@ Page { text: "Load Template" onTriggered: { ensureSaved(function() { - initFileDialogFolder(loadTemplateDialog); - loadTemplateDialog.open(); + initFileDialogFolder(loadTemplateDialog) + loadTemplateDialog.open() }) } } @@ -1159,15 +1159,15 @@ Page { uigraph: _reconstruction nodeTypesModel: _nodeTypes - onNodeDoubleClicked: { + onNodeDoubleClicked: function(mouse, node) { _reconstruction.setActiveNode(node); workspaceView.viewNode(node, mouse); } - onComputeRequest: { + onComputeRequest: function(nodes) { _reconstruction.forceNodesStatusUpdate(); computeManager.compute(nodes) } - onSubmitRequest: { + onSubmitRequest: function(nodes) { _reconstruction.forceNodesStatusUpdate(); computeManager.submit(nodes) } diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index 3620a942..ad63ee3e 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -152,7 +152,7 @@ RowLayout { } } - onClicked: { + onClicked: function(mouse) { forceActiveFocus() if (mouse.button == Qt.RightButton) { var menu = menuComp.createObject(parameterLabel) @@ -268,7 +268,7 @@ RowLayout { setTextFieldAttribute(text) parameterLabel.forceActiveFocus() } - Keys.onPressed: (event)=> { + Keys.onPressed: function(event) { if ((event.key == Qt.Key_Escape)) { event.accepted = true parameterLabel.forceActiveFocus() @@ -281,7 +281,7 @@ RowLayout { DropArea { enabled: root.editable anchors.fill: parent - onDropped: { + onDropped: function(drop) { if (drop.hasUrls) setTextFieldAttribute(Filepath.urlToString(drop.urls[0])) else if (drop.hasText && drop.text != '') @@ -291,7 +291,7 @@ RowLayout { MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton - onClicked: (mouse)=> { + onClicked: function(mouse) { // Do not loose the selection during the right click textField.persistentSelection = true // We store the status of the activeFocus before opening the popup diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index a4e71082..624f7044 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -57,8 +57,8 @@ RowLayout { Repeater { id: childrenRepeater model: isList && !attribute.isLink ? attribute.value : 0 - onItemAdded: childPinCreated(item.childAttribute, item) - onItemRemoved: childPinDeleted(item.childAttribute, item) + onItemAdded: function(item) { childPinCreated(item.childAttribute, item) } + onItemRemoved: function(item) { childPinDeleted(item.childAttribute, item) } delegate: Item { property var childAttribute: object } @@ -102,7 +102,7 @@ RowLayout { anchors.rightMargin: -root.width * 0.3 keys: [inputDragTarget.objectName] - onEntered: { + onEntered: function(drag) { // Check if attributes are compatible to create a valid connection if (root.readOnly // cannot connect on a read-only attribute || drag.source.objectName != inputDragTarget.objectName // not an edge connector @@ -164,7 +164,7 @@ RowLayout { anchors.margins: inputDropArea.anchors.margins anchors.leftMargin: inputDropArea.anchors.leftMargin anchors.rightMargin: inputDropArea.anchors.rightMargin - onPressed: { + onPressed: function(mouse) { root.pressed(mouse) } onReleased: { @@ -255,7 +255,7 @@ RowLayout { anchors.leftMargin: -root.width * 0.2 keys: [outputDragTarget.objectName] - onEntered: { + onEntered: function(drag) { // Check if attributes are compatible to create a valid connection if (drag.source.objectName != outputDragTarget.objectName // not an edge connector || drag.source.baseType !== outputDragTarget.baseType // not the same base type @@ -276,7 +276,7 @@ RowLayout { acceptableDrop = false } - onDropped: { + onDropped: function(drag) { root.edgeAboutToBeRemoved(undefined) _reconstruction.addEdge(outputDragTarget.attribute, drag.source.attribute) } @@ -314,7 +314,7 @@ RowLayout { anchors.leftMargin: outputDropArea.anchors.leftMargin anchors.rightMargin: outputDropArea.anchors.rightMargin - onPressed: root.pressed(mouse) + onPressed: function(mouse) { root.pressed(mouse) } onReleased: outputDragTarget.Drag.drop() hoverEnabled: true diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index c55ca2e2..96e8ff07 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -132,7 +132,7 @@ Item { return mapToItem(draggable, mouseArea.width / 2, mouseArea.height / 2) } - Keys.onPressed: { + Keys.onPressed: function(event) { if (event.key === Qt.Key_F) { fit() } else if (event.key === Qt.Key_Delete) { @@ -172,7 +172,7 @@ Item { drag.threshold: 0 cursorShape: drag.target == draggable ? Qt.ClosedHandCursor : Qt.ArrowCursor - onWheel: { + onWheel: function(wheel) { var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor var scale = draggable.scale * zoomFactor scale = Math.min(Math.max(minZoom, scale), maxZoom) @@ -185,7 +185,7 @@ Item { workspaceMoved() } - onPressed: { + onPressed: function(mouse) { if (mouse.button != Qt.MiddleButton && mouse.modifiers == Qt.NoModifier) { uigraph.clearNodeSelection() } @@ -200,17 +200,19 @@ Item { drag.target = draggable // start drag } } + onReleased: { drag.target = undefined // stop drag root.forceActiveFocus() workspaceClicked() } + onPositionChanged: { if (drag.active) workspaceMoved() } - onClicked: { + onClicked: function(mouse) { if (mouse.button == Qt.RightButton) { // store mouse click position in 'draggable' coordinates as new node spawn position newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouse.x, mouse.y) @@ -335,7 +337,7 @@ Item { id: nodeMenuRepeater model: searchBar.text !== "" ? Object.values(newNodeMenu.menuKeys) : undefined - // create Menu items from available items + // Create Menu items from available items delegate: menuItemDelegateComponent } @@ -343,8 +345,13 @@ Item { Instantiator { id: instantiator model: (searchBar.text === "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined - onObjectAdded: newNodeMenu.insertMenu(index + 1, object ) // add sub-menu under the search bar - onObjectRemoved: newNodeMenu.removeMenu(object) + onObjectAdded: function(index, object) { + // Add sub-menu under the search bar + newNodeMenu.insertMenu(index + 1, object) + } + onObjectRemoved: function(index, object) { + newNodeMenu.removeMenu(object) + } delegate: Menu { title: modelData @@ -352,8 +359,12 @@ Item { Instantiator { model: newNodeMenu.visible ? newNodeMenu.parseCategories()[modelData] : undefined - onObjectAdded: newNodeSubMenu.insertItem(index, object) - onObjectRemoved: newNodeSubMenu.removeItem(object) + onObjectAdded: function(index, object) { + newNodeSubMenu.insertItem(index, object) + } + onObjectRemoved: function(index, object) { + newNodeSubMenu.removeItem(object) + } delegate: menuItemDelegateComponent } } @@ -505,7 +516,7 @@ Item { point1y: isValidEdge ? src.globalY + src.outputAnchorPos.y : 0 point2x: isValidEdge ? dst.globalX + dst.inputAnchorPos.x : 0 point2y: isValidEdge ? dst.globalY + dst.inputAnchorPos.y : 0 - onPressed: { + onPressed: function(event) { const canEdit = !edge.dst.node.locked if (event.button) { @@ -823,14 +834,14 @@ Item { selected: uigraph.selectedNodes.contains(node) hovered: uigraph.hoveredNode === node - onAttributePinCreated: registerAttributePin(attribute, pin) - onAttributePinDeleted: unregisterAttributePin(attribute, pin) + onAttributePinCreated: function(attribute, pin) { registerAttributePin(attribute, pin) } + onAttributePinDeleted: function(attribute, pin) { unregisterAttributePin(attribute, pin) } - onPressed: { + onPressed: function(mouse) { if (mouse.button === Qt.LeftButton) { if (mouse.modifiers & Qt.ControlModifier && !(mouse.modifiers & Qt.AltModifier)) { if (mainSelected && selected) { - // left clicking a selected node twice with control will deselect it + // Left clicking a selected node twice with control will deselect it uigraph.selectedNodes.remove(node) uigraph.selectedNodesChanged() selectNode(null) @@ -854,14 +865,14 @@ Item { selectNode(node) } - onDoubleClicked: root.nodeDoubleClicked(mouse, node) + onDoubleClicked: function(mouse) { root.nodeDoubleClicked(mouse, node) } - onMoved: uigraph.moveNode(node, position, uigraph.selectedNodes) + onMoved: function(position) { uigraph.moveNode(node, position, uigraph.selectedNodes) } onEntered: uigraph.hoveredNode = node onExited: uigraph.hoveredNode = null - onEdgeAboutToBeRemoved: { + onEdgeAboutToBeRemoved: function(input) { /* Sometimes the signals are not in the right order because of weird Qt/QML update order (next DropArea diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 536eb0ca..8214dc98 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -121,12 +121,12 @@ Item { width: parent.width height: body.height drag.target: root - // small drag threshold to avoid moving the node by mistake + // Small drag threshold to avoid moving the node by mistake drag.threshold: 2 hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: root.pressed(mouse) - onDoubleClicked: root.doubleClicked(mouse) + onPressed: function(mouse) { root.pressed(mouse) } + onDoubleClicked: function(mouse) { root.doubleClicked(mouse) } onEntered: root.entered() onExited: root.exited() drag.onActiveChanged: { @@ -412,8 +412,8 @@ Item { property real globalX: root.x + nodeAttributes.x + outputs.x + outputLoader.x + outPin.x property real globalY: root.y + nodeAttributes.y + outputs.y + outputLoader.y + outPin.y - onPressed: root.pressed(mouse) - onEdgeAboutToBeRemoved: root.edgeAboutToBeRemoved(input) + onPressed: function(mouse) { root.pressed(mouse) } + onEdgeAboutToBeRemoved: function(input) { root.edgeAboutToBeRemoved(input) } Component.onCompleted: attributePinCreated(attribute, outPin) onChildPinCreated: attributePinCreated(childAttribute, outPin) @@ -449,10 +449,10 @@ Item { readOnly: root.readOnly || object.isReadOnly Component.onCompleted: attributePinCreated(attribute, inPin) Component.onDestruction: attributePinDeleted(attribute, inPin) - onPressed: root.pressed(mouse) - onEdgeAboutToBeRemoved: root.edgeAboutToBeRemoved(input) - onChildPinCreated: attributePinCreated(childAttribute, inPin) - onChildPinDeleted: attributePinDeleted(childAttribute, inPin) + onPressed: function(mouse) { root.pressed(mouse) } + onEdgeAboutToBeRemoved: function(input) { root.edgeAboutToBeRemoved(input) } + onChildPinCreated: function(childAttribute, inPin) { attributePinCreated(childAttribute, inPin) } + onChildPinDeleted: function(childAttribute, inPin) { attributePinDeleted(childAttribute, inPin) } } } } @@ -512,10 +512,10 @@ Item { readOnly: Boolean(root.readOnly || object.isReadOnly) Component.onCompleted: attributePinCreated(attribute, inParamsPin) Component.onDestruction: attributePinDeleted(attribute, inParamsPin) - onPressed: root.pressed(mouse) - onEdgeAboutToBeRemoved: root.edgeAboutToBeRemoved(input) - onChildPinCreated: attributePinCreated(childAttribute, inParamsPin) - onChildPinDeleted: attributePinDeleted(childAttribute, inParamsPin) + onPressed: function(mouse) { root.pressed(mouse) } + onEdgeAboutToBeRemoved: function(input) { root.edgeAboutToBeRemoved(input) } + onChildPinCreated: function(childAttribute, inParamsPin) { attributePinCreated(childAttribute, inParamsPin) } + onChildPinDeleted: function(childAttribute, inParamsPin) { attributePinDeleted(childAttribute, inParamsPin) } } } } diff --git a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml index 0f5ddf2f..1558202b 100644 --- a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml @@ -60,7 +60,7 @@ Item { anchors.margins: 6 hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { + onPressed: function(mouse) { if (mouse.button == Qt.RightButton) imageMenu.popup() root.pressed(mouse) diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index 2e975471..63560135 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -305,7 +305,7 @@ Panel { } onRemoveRequest: sendRemoveRequest() - Keys.onPressed: (event) => { + Keys.onPressed: function(event) { if (event.key === Qt.Key_Delete && event.modifiers === Qt.ShiftModifier) { removeAllImages() } else if (event.key === Qt.Key_Delete) { @@ -375,7 +375,7 @@ Panel { // Keyboard shortcut to change current image group Keys.priority: Keys.BeforeItem - Keys.onPressed: { + Keys.onPressed: function(event) { if (event.modifiers & Qt.AltModifier) { if (event.key === Qt.Key_Right) { _reconstruction.cameraInitIndex = Math.min(root.cameraInits.count - 1, root.cameraInitIndex + 1) @@ -529,7 +529,7 @@ Panel { MouseArea { anchors.fill: parent - onPressed: { + onPressed: function(mouse) { if (mouse.button == Qt.LeftButton) grid.forceActiveFocus() mouse.accepted = false diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 26361a21..5618cb8f 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -105,29 +105,29 @@ FocusScope { } function clear() { - source = '' + source = "" } - // slots - Keys.onPressed: { + // Slots + Keys.onPressed: function(event) { if (event.key === Qt.Key_F) { root.fit() event.accepted = true } } - // mouse area + // Mouse area MouseArea { anchors.fill: parent property double factor: 1.2 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onPressed: { + onPressed: function(mouse) { imgContainer.forceActiveFocus() if (mouse.button & Qt.MiddleButton || (mouse.button & Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier)) - drag.target = imgContainer // start drag + drag.target = imgContainer // Start drag } - onReleased: { - drag.target = undefined // stop drag + onReleased: function(mouse) { + drag.target = undefined // Stop drag if (mouse.button & Qt.RightButton) { var menu = contextMenu.createObject(root) menu.x = mouse.x @@ -135,7 +135,7 @@ FocusScope { menu.open() } } - onWheel: { + onWheel: function(wheel) { var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor if (Math.min(imgContainer.width, imgContainer.image.height) * imgContainer.scale * zoomFactor < 10) @@ -1178,7 +1178,7 @@ FocusScope { MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { + onClicked: function(mouse) { if (mouse.button & Qt.LeftButton) { fit() } else if (mouse.button & Qt.RightButton) { diff --git a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml index 1466b545..9f51f000 100644 --- a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml +++ b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml @@ -47,26 +47,26 @@ Entity { property point currentPosition property bool hasMoved sourceDevice: loseMouseFocus ? null : mouseSourceDevice - onPressed: { + onPressed: function(mouse) { _pressed = true currentPosition.x = lastPosition.x = mouse.x currentPosition.y = lastPosition.y = mouse.y hasMoved = false mousePressed(mouse) } - onReleased: { + onReleased: function(mouse) { _pressed = false mouseReleased(mouse, hasMoved) } - onClicked: mouseClicked(mouse) - onPositionChanged: { + onClicked: function(mouse) { mouseClicked(mouse) } + onPositionChanged: function(mouse) { currentPosition.x = mouse.x currentPosition.y = mouse.y const dt = 0.02 var d - if (panning) { // translate + if (panning) { // Translate d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03 var tx = axisMX.value * root.translateSpeed * d var ty = axisMY.value * root.translateSpeed * d @@ -74,13 +74,13 @@ Entity { root.camera.translate(Qt.vector3d(-tx, -ty, 0).times(dt)) return } - if (moving){ // trackball rotation + if (moving){ // Trackball rotation trackball.rotate(mouseHandler.lastPosition, mouseHandler.currentPosition, dt) mouseHandler.lastPosition = mouseHandler.currentPosition mouseHandler.hasMoved = true return } - if (zooming) { // zoom with alt + RMD + if (zooming) { // Zoom with alt + RMD mouseHandler.hasMoved = true d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position var zoomPower = 0.2 @@ -100,8 +100,8 @@ Entity { } } - onDoubleClicked: mouseDoubleClicked(mouse) - onWheel: { + onDoubleClicked: function(mouse) { mouseDoubleClicked(mouse) } + onWheel: function(wheel) { var d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position var zoomPower = 0.2 var angleStep = 120 // wheel.angleDelta.y = +- 120 * number of wheel rotations @@ -117,6 +117,7 @@ Entity { if (tz > 0 && tz <= tzThreshold) { return } + root.camera.translate(Qt.vector3d(0, 0, tz), Camera.DontTranslateViewCenter) } } @@ -130,7 +131,10 @@ Entity { // stays active, even when it's released. // Handle this issue manually by keeping an additional _pressed state // which is cleared when focus changes (used for 'pickingActive' property). - onFocusChanged: if (!focus) _pressed = false + onFocusChanged: function(focus) { + if (!focus) + _pressed = false + } onPressed: _pressed = true onReleased: _pressed = false } diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 82c917c4..d2eea168 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -154,7 +154,7 @@ FocusScope { camera: mainCamera focus: scene3D.activeFocus - onMousePressed: { + onMousePressed: function(mouse) { scene3D.forceActiveFocus() if (mouse.button === Qt.LeftButton) { if (!doubleClickTimer.running) @@ -162,7 +162,7 @@ FocusScope { } else doubleClickTimer.stop() } - onMouseReleased: { + onMouseReleased: function(mouse, moved) { if (moving) return if (!moved && mouse.button === Qt.RightButton) { diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index a2fd9ce2..c512e101 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -80,8 +80,8 @@ Item { cameraInit: reconstruction ? reconstruction.cameraInit : null tempCameraInit: reconstruction ? reconstruction.tempCameraInit : null cameraInitIndex: reconstruction ? reconstruction.cameraInitIndex : -1 - onRemoveImageRequest: reconstruction.removeImage(attribute) - onAllViewpointsCleared: { reconstruction.selectedViewId = "-1" } + onRemoveImageRequest: function(attribute) { reconstruction.removeImage(attribute) } + onAllViewpointsCleared: reconstruction.selectedViewId = "-1" onFilesDropped: { if (drop["meshroomScenes"].length == 1) { ensureSaved(function() { @@ -226,8 +226,10 @@ Item { DropArea { anchors.fill: parent keys: ["text/uri-list"] - onDropped: { - drop.urls.forEach(function(url){ load3DMedia(url); }); + onDropped: function(drop) { + drop.urls.forEach(function(url) { + load3DMedia(url) + }) } } diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index 218616a3..f6f7e6e3 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -26,7 +26,7 @@ ApplicationWindow { return t } - onClosing: { + onClosing: function(close) { // Make sure document is saved before exiting application close.accepted = false if (!ensureNotComputing()) From 0e71f2a52005b5fa5d71555a3bd7191bd9eac4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 14:21:15 +0200 Subject: [PATCH 09/64] [qt6] Update versions for all the imported modules Qt3D.Extras cannot be updated to 2.6 yet, otherwise there are errors. --- meshroom/ui/qml/AboutDialog.qml | 6 ++--- meshroom/ui/qml/Application.qml | 10 ++++----- meshroom/ui/qml/Charts/ChartViewCheckBox.qml | 4 ++-- meshroom/ui/qml/Charts/ChartViewLegend.qml | 6 ++--- .../ui/qml/Charts/InteractiveChartView.qml | 15 ++++++------- meshroom/ui/qml/Controls/ColorChart.qml | 4 ++-- .../ui/qml/Controls/ExifOrientedViewer.qml | 3 ++- meshroom/ui/qml/Controls/ExpandableGroup.qml | 7 +++--- meshroom/ui/qml/Controls/FilterComboBox.qml | 5 +++-- meshroom/ui/qml/Controls/FloatingPane.qml | 6 ++--- meshroom/ui/qml/Controls/Group.qml | 7 +++--- meshroom/ui/qml/Controls/IntSelector.qml | 7 +++--- meshroom/ui/qml/Controls/KeyValue.qml | 7 +++--- meshroom/ui/qml/Controls/MScrollBar.qml | 5 +++-- meshroom/ui/qml/Controls/MSplitView.qml | 4 ++-- meshroom/ui/qml/Controls/MessageDialog.qml | 7 +++--- meshroom/ui/qml/Controls/Panel.qml | 6 ++--- meshroom/ui/qml/Controls/SearchBar.qml | 7 +++--- meshroom/ui/qml/Controls/TabPanel.qml | 6 ++--- meshroom/ui/qml/Controls/TextFileViewer.qml | 8 +++---- meshroom/ui/qml/DialogsFactory.qml | 2 +- .../ui/qml/GraphEditor/AttributeEditor.qml | 7 +++--- .../qml/GraphEditor/AttributeItemDelegate.qml | 7 +++--- meshroom/ui/qml/GraphEditor/AttributePin.qml | 7 +++--- .../ui/qml/GraphEditor/ChunksListView.qml | 7 +++--- .../ui/qml/GraphEditor/CompatibilityBadge.qml | 7 +++--- .../qml/GraphEditor/CompatibilityManager.qml | 7 +++--- meshroom/ui/qml/GraphEditor/Edge.qml | 7 +++--- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 9 ++++---- meshroom/ui/qml/GraphEditor/Node.qml | 8 +++---- meshroom/ui/qml/GraphEditor/NodeChunks.qml | 3 ++- .../ui/qml/GraphEditor/NodeDocumentation.qml | 7 +++--- meshroom/ui/qml/GraphEditor/NodeEditor.qml | 9 ++++---- meshroom/ui/qml/GraphEditor/NodeLog.qml | 9 ++++---- .../ui/qml/GraphEditor/NodeStatistics.qml | 9 ++++---- meshroom/ui/qml/GraphEditor/NodeStatus.qml | 9 ++++---- meshroom/ui/qml/GraphEditor/ScriptEditor.qml | 11 +++++----- meshroom/ui/qml/GraphEditor/StatViewer.qml | 11 +++++----- meshroom/ui/qml/GraphEditor/TaskManager.qml | 9 ++++---- meshroom/ui/qml/Homepage.qml | 7 +++--- meshroom/ui/qml/ImageGallery/ImageBadge.qml | 3 ++- .../ui/qml/ImageGallery/ImageDelegate.qml | 7 +++--- meshroom/ui/qml/ImageGallery/ImageGallery.qml | 10 ++++----- .../ImageGallery/IntrinsicDisplayDelegate.qml | 7 +++--- .../qml/ImageGallery/IntrinsicsIndicator.qml | 5 +++-- .../ui/qml/ImageGallery/SensorDBDialog.qml | 6 ++--- meshroom/ui/qml/LiveSfmView.qml | 7 +++--- meshroom/ui/qml/MaterialIcons/MLabel.qml | 4 ++-- .../ui/qml/MaterialIcons/MaterialIcons.qml | 2 +- .../ui/qml/MaterialIcons/MaterialLabel.qml | 4 ++-- .../qml/MaterialIcons/MaterialToolButton.qml | 6 ++--- .../qml/MaterialIcons/MaterialToolLabel.qml | 6 ++--- .../MaterialIcons/MaterialToolLabelButton.qml | 6 ++--- meshroom/ui/qml/Utils/Colors.qml | 4 ++-- meshroom/ui/qml/Utils/ExifOrientation.qml | 2 +- .../ui/qml/Utils/SortFilterDelegateModel.qml | 6 ++--- .../ui/qml/Viewer/CameraResponseGraph.qml | 19 ++++++++-------- meshroom/ui/qml/Viewer/CircleGizmo.qml | 2 +- meshroom/ui/qml/Viewer/ColorCheckerEntity.qml | 2 +- meshroom/ui/qml/Viewer/ColorCheckerPane.qml | 4 ++-- meshroom/ui/qml/Viewer/ColorCheckerViewer.qml | 2 +- .../ui/qml/Viewer/FeaturesInfoOverlay.qml | 10 ++++----- meshroom/ui/qml/Viewer/FeaturesViewer.qml | 4 ++-- meshroom/ui/qml/Viewer/FloatImage.qml | 4 ++-- meshroom/ui/qml/Viewer/HdrImageToolbar.qml | 9 ++++---- meshroom/ui/qml/Viewer/ImageMetadataView.qml | 13 ++++++----- .../ui/qml/Viewer/LensDistortionToolbar.qml | 9 ++++---- meshroom/ui/qml/Viewer/MFeatures.qml | 3 ++- meshroom/ui/qml/Viewer/MSfMData.qml | 3 ++- meshroom/ui/qml/Viewer/MTracks.qml | 3 ++- meshroom/ui/qml/Viewer/PanoramaToolbar.qml | 9 ++++---- meshroom/ui/qml/Viewer/PanoramaViewer.qml | 4 ++-- meshroom/ui/qml/Viewer/SequencePlayer.qml | 7 +++--- meshroom/ui/qml/Viewer/SfmGlobalStats.qml | 21 +++++++++--------- meshroom/ui/qml/Viewer/SfmStatsView.qml | 22 +++++++++---------- .../ui/qml/Viewer/TestAliceVisionPlugin.qml | 3 ++- meshroom/ui/qml/Viewer/Viewer2D.qml | 9 ++++---- meshroom/ui/qml/Viewer3D/BoundingBox.qml | 8 +++---- .../qml/Viewer3D/DefaultCameraController.qml | 12 +++++----- meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml | 10 ++++----- .../ui/qml/Viewer3D/EnvironmentMapEntity.qml | 6 ++--- meshroom/ui/qml/Viewer3D/Grid3D.qml | 6 ++--- meshroom/ui/qml/Viewer3D/ImageOverlay.qml | 4 ++-- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 13 ++++++----- meshroom/ui/qml/Viewer3D/Locator3D.qml | 7 +++--- meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml | 9 ++++---- .../Materials/SphericalHarmonicsEffect.qml | 4 ++-- .../Materials/SphericalHarmonicsMaterial.qml | 5 +++-- .../Viewer3D/Materials/WireframeEffect.qml | 4 ++-- .../Viewer3D/Materials/WireframeMaterial.qml | 4 ++-- meshroom/ui/qml/Viewer3D/MediaCache.qml | 6 ++--- meshroom/ui/qml/Viewer3D/MediaLibrary.qml | 7 +++--- meshroom/ui/qml/Viewer3D/MediaLoader.qml | 9 ++++---- .../ui/qml/Viewer3D/MediaLoaderEntity.qml | 4 ++-- .../ui/qml/Viewer3D/MeshingBoundingBox.qml | 8 +++---- .../ui/qml/Viewer3D/SfMTransformGizmo.qml | 9 ++++---- meshroom/ui/qml/Viewer3D/SfmDataLoader.qml | 9 ++++---- meshroom/ui/qml/Viewer3D/TrackballGizmo.qml | 8 +++---- meshroom/ui/qml/Viewer3D/TransformGizmo.qml | 13 ++++++----- .../ui/qml/Viewer3D/TransformGizmoPicker.qml | 10 ++++----- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 19 ++++++++-------- meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 3 ++- meshroom/ui/qml/Viewer3D/ViewpointCamera.qml | 6 ++--- meshroom/ui/qml/WorkspaceView.qml | 8 ++++--- meshroom/ui/qml/main.qml | 6 ++--- 105 files changed, 397 insertions(+), 349 deletions(-) diff --git a/meshroom/ui/qml/AboutDialog.qml b/meshroom/ui/qml/AboutDialog.qml index 67bdf008..d455b703 100644 --- a/meshroom/ui/qml/AboutDialog.qml +++ b/meshroom/ui/qml/AboutDialog.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import Utils 1.0 import MaterialIcons 2.2 diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index fdbd411e..a2ff70f8 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -1,10 +1,10 @@ import QtCore -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import QtQuick.Window 2.15 -import QtQml.Models 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Window +import QtQml.Models import Qt.labs.platform 1.0 as Platform import QtQuick.Dialogs diff --git a/meshroom/ui/qml/Charts/ChartViewCheckBox.qml b/meshroom/ui/qml/Charts/ChartViewCheckBox.qml index c678e0f2..34c5e0ac 100644 --- a/meshroom/ui/qml/Charts/ChartViewCheckBox.qml +++ b/meshroom/ui/qml/Charts/ChartViewCheckBox.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls /** diff --git a/meshroom/ui/qml/Charts/ChartViewLegend.qml b/meshroom/ui/qml/Charts/ChartViewLegend.qml index 572b51a8..f5a58214 100644 --- a/meshroom/ui/qml/Charts/ChartViewLegend.qml +++ b/meshroom/ui/qml/Charts/ChartViewLegend.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtCharts 2.15 +import QtQuick +import QtQuick.Controls +import QtCharts /** diff --git a/meshroom/ui/qml/Charts/InteractiveChartView.qml b/meshroom/ui/qml/Charts/InteractiveChartView.qml index e569ef45..1ad222b1 100644 --- a/meshroom/ui/qml/Charts/InteractiveChartView.qml +++ b/meshroom/ui/qml/Charts/InteractiveChartView.qml @@ -1,13 +1,12 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtPositioning 5.15 -import QtLocation 5.15 - -import QtCharts 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtPositioning 6.6 +import QtLocation 6.6 +import QtCharts import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/Controls/ColorChart.qml b/meshroom/ui/qml/Controls/ColorChart.qml index fe75a47c..f6f38774 100644 --- a/meshroom/ui/qml/Controls/ColorChart.qml +++ b/meshroom/ui/qml/Controls/ColorChart.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls import Utils 1.0 diff --git a/meshroom/ui/qml/Controls/ExifOrientedViewer.qml b/meshroom/ui/qml/Controls/ExifOrientedViewer.qml index 86d713ab..72e9b89c 100644 --- a/meshroom/ui/qml/Controls/ExifOrientedViewer.qml +++ b/meshroom/ui/qml/Controls/ExifOrientedViewer.qml @@ -1,4 +1,5 @@ -import QtQuick 2.11 +import QtQuick + import Utils 1.0 /** diff --git a/meshroom/ui/qml/Controls/ExpandableGroup.qml b/meshroom/ui/qml/Controls/ExpandableGroup.qml index afd4459c..acaca5ba 100644 --- a/meshroom/ui/qml/Controls/ExpandableGroup.qml +++ b/meshroom/ui/qml/Controls/ExpandableGroup.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 /** diff --git a/meshroom/ui/qml/Controls/FilterComboBox.qml b/meshroom/ui/qml/Controls/FilterComboBox.qml index 0a3a13ee..6af29ce1 100644 --- a/meshroom/ui/qml/Controls/FilterComboBox.qml +++ b/meshroom/ui/qml/Controls/FilterComboBox.qml @@ -1,5 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls + import Utils 1.0 /** diff --git a/meshroom/ui/qml/Controls/FloatingPane.qml b/meshroom/ui/qml/Controls/FloatingPane.qml index 905c2630..6f3d28ed 100644 --- a/meshroom/ui/qml/Controls/FloatingPane.qml +++ b/meshroom/ui/qml/Controls/FloatingPane.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts /** * FloatingPane provides a Pane with a slightly transparent default background diff --git a/meshroom/ui/qml/Controls/Group.qml b/meshroom/ui/qml/Controls/Group.qml index 39d676a0..42de2898 100644 --- a/meshroom/ui/qml/Controls/Group.qml +++ b/meshroom/ui/qml/Controls/Group.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 /** diff --git a/meshroom/ui/qml/Controls/IntSelector.qml b/meshroom/ui/qml/Controls/IntSelector.qml index d61cba26..46eb1ca7 100644 --- a/meshroom/ui/qml/Controls/IntSelector.qml +++ b/meshroom/ui/qml/Controls/IntSelector.qml @@ -1,7 +1,8 @@ -import QtQuick 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 /* * IntSelector with arrows and a text input to select a number diff --git a/meshroom/ui/qml/Controls/KeyValue.qml b/meshroom/ui/qml/Controls/KeyValue.qml index e58b9ac7..55a01c2e 100644 --- a/meshroom/ui/qml/Controls/KeyValue.qml +++ b/meshroom/ui/qml/Controls/KeyValue.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 /** diff --git a/meshroom/ui/qml/Controls/MScrollBar.qml b/meshroom/ui/qml/Controls/MScrollBar.qml index 798a0258..71bc04b5 100644 --- a/meshroom/ui/qml/Controls/MScrollBar.qml +++ b/meshroom/ui/qml/Controls/MScrollBar.qml @@ -1,5 +1,6 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick +import QtQuick.Controls + /** * MScrollBar is a custom scrollbar implementation. * It is a vertical scrollbar that can be used to scroll a ListView. diff --git a/meshroom/ui/qml/Controls/MSplitView.qml b/meshroom/ui/qml/Controls/MSplitView.qml index 25dd5853..af4621e8 100644 --- a/meshroom/ui/qml/Controls/MSplitView.qml +++ b/meshroom/ui/qml/Controls/MSplitView.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls SplitView { id: splitView diff --git a/meshroom/ui/qml/Controls/MessageDialog.qml b/meshroom/ui/qml/Controls/MessageDialog.qml index 46595760..d70d47bd 100644 --- a/meshroom/ui/qml/Controls/MessageDialog.qml +++ b/meshroom/ui/qml/Controls/MessageDialog.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 Dialog { diff --git a/meshroom/ui/qml/Controls/Panel.qml b/meshroom/ui/qml/Controls/Panel.qml index 649e8bd2..c1ff38ad 100644 --- a/meshroom/ui/qml/Controls/Panel.qml +++ b/meshroom/ui/qml/Controls/Panel.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts /** diff --git a/meshroom/ui/qml/Controls/SearchBar.qml b/meshroom/ui/qml/Controls/SearchBar.qml index de126e6f..9adb0155 100644 --- a/meshroom/ui/qml/Controls/SearchBar.qml +++ b/meshroom/ui/qml/Controls/SearchBar.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 diff --git a/meshroom/ui/qml/Controls/TabPanel.qml b/meshroom/ui/qml/Controls/TabPanel.qml index b33d0857..69acbe79 100644 --- a/meshroom/ui/qml/Controls/TabPanel.qml +++ b/meshroom/ui/qml/Controls/TabPanel.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Page { id: root diff --git a/meshroom/ui/qml/Controls/TextFileViewer.qml b/meshroom/ui/qml/Controls/TextFileViewer.qml index 2e022856..1de42b41 100644 --- a/meshroom/ui/qml/Controls/TextFileViewer.qml +++ b/meshroom/ui/qml/Controls/TextFileViewer.qml @@ -1,8 +1,8 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import MaterialIcons 2.2 import Utils 1.0 /** diff --git a/meshroom/ui/qml/DialogsFactory.qml b/meshroom/ui/qml/DialogsFactory.qml index c7256afa..58d0f22e 100644 --- a/meshroom/ui/qml/DialogsFactory.qml +++ b/meshroom/ui/qml/DialogsFactory.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick import MaterialIcons 2.2 import Controls 1.0 diff --git a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml index 03cbc244..67978256 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + import MaterialIcons 2.2 import Utils 1.0 import Controls 1.0 diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index ad63ee3e..9dae059e 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -1,7 +1,8 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls import QtQuick.Dialogs + import MaterialIcons 2.2 import Utils 1.0 import Controls 1.0 diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index 624f7044..cf008822 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/ChunksListView.qml index aadcb383..3feb5532 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/ChunksListView.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 import Controls 1.0 diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml index 396eeae9..dd96c6b8 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml index 25d97479..66c63bdf 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 import Controls 1.0 import Utils 1.0 diff --git a/meshroom/ui/qml/GraphEditor/Edge.qml b/meshroom/ui/qml/GraphEditor/Edge.qml index 768bcffc..f490cc23 100644 --- a/meshroom/ui/qml/GraphEditor/Edge.qml +++ b/meshroom/ui/qml/GraphEditor/Edge.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Shapes 1.6 + import GraphEditor 1.0 -import QtQuick.Shapes 1.15 import MaterialIcons 2.2 -import QtQuick.Controls 2.15 /** A cubic spline representing an edge, going from point1 to point2, providing mouse interaction. diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 96e8ff07..0c986929 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -1,9 +1,10 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 -import Utils 1.0 import MaterialIcons 2.2 +import Utils 1.0 /** A component displaying a Graph (nodes, attributes and edges). diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 8214dc98..7748749a 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -1,10 +1,10 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Utils 1.0 import MaterialIcons 2.2 +import Utils 1.0 /** diff --git a/meshroom/ui/qml/GraphEditor/NodeChunks.qml b/meshroom/ui/qml/GraphEditor/NodeChunks.qml index a87d1c3c..023baf49 100644 --- a/meshroom/ui/qml/GraphEditor/NodeChunks.qml +++ b/meshroom/ui/qml/GraphEditor/NodeChunks.qml @@ -1,4 +1,5 @@ -import QtQuick 2.15 +import QtQuick + import Utils 1.0 //import "common.js" as Common diff --git a/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml index 65b466d5..13e9296b 100644 --- a/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml +++ b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 import "common.js" as Common diff --git a/meshroom/ui/qml/GraphEditor/NodeEditor.qml b/meshroom/ui/qml/GraphEditor/NodeEditor.qml index 9ffd302c..9122fb76 100644 --- a/meshroom/ui/qml/GraphEditor/NodeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditor.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/GraphEditor/NodeLog.qml b/meshroom/ui/qml/GraphEditor/NodeLog.qml index 444f54c7..d9bf37df 100644 --- a/meshroom/ui/qml/GraphEditor/NodeLog.qml +++ b/meshroom/ui/qml/GraphEditor/NodeLog.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import "common.js" as Common diff --git a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml index 77eb255d..07a6ad54 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 import "common.js" as Common diff --git a/meshroom/ui/qml/GraphEditor/NodeStatus.qml b/meshroom/ui/qml/GraphEditor/NodeStatus.qml index db487c09..0d46cc40 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatus.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatus.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import "common.js" as Common diff --git a/meshroom/ui/qml/GraphEditor/ScriptEditor.qml b/meshroom/ui/qml/GraphEditor/ScriptEditor.qml index 55fd4c84..91de7bd1 100644 --- a/meshroom/ui/qml/GraphEditor/ScriptEditor.qml +++ b/meshroom/ui/qml/GraphEditor/ScriptEditor.qml @@ -1,12 +1,13 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts + import Controls 1.0 -import Utils 1.0 import MaterialIcons 2.2 +import Utils 1.0 import Qt.labs.platform 1.0 as Platform -import QtQuick.Dialogs Item { id: root diff --git a/meshroom/ui/qml/GraphEditor/StatViewer.qml b/meshroom/ui/qml/GraphEditor/StatViewer.qml index 1431117b..03bf8ce3 100644 --- a/meshroom/ui/qml/GraphEditor/StatViewer.qml +++ b/meshroom/ui/qml/GraphEditor/StatViewer.qml @@ -1,10 +1,11 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtCharts 2.15 -import QtQuick.Layouts 1.11 -import Utils 1.0 +import QtCharts +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Charts 1.0 import MaterialIcons 2.2 +import Utils 1.0 Item { diff --git a/meshroom/ui/qml/GraphEditor/TaskManager.qml b/meshroom/ui/qml/GraphEditor/TaskManager.qml index 78745254..971076cf 100644 --- a/meshroom/ui/qml/GraphEditor/TaskManager.qml +++ b/meshroom/ui/qml/GraphEditor/TaskManager.qml @@ -1,9 +1,10 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 -import Utils 1.0 import MaterialIcons 2.2 +import Utils 1.0 Item { id: root diff --git a/meshroom/ui/qml/Homepage.qml b/meshroom/ui/qml/Homepage.qml index f036d7f3..a102af70 100644 --- a/meshroom/ui/qml/Homepage.qml +++ b/meshroom/ui/qml/Homepage.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Utils 1.0 import MaterialIcons 2.2 import Controls 1.0 diff --git a/meshroom/ui/qml/ImageGallery/ImageBadge.qml b/meshroom/ui/qml/ImageGallery/ImageBadge.qml index 3a655f28..d5d768a0 100644 --- a/meshroom/ui/qml/ImageGallery/ImageBadge.qml +++ b/meshroom/ui/qml/ImageGallery/ImageBadge.qml @@ -1,4 +1,5 @@ -import QtQuick 2.15 +import QtQuick + import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml index 1558202b..523f4d0f 100644 --- a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Utils 1.0 diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index 63560135..f90b23d5 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -1,11 +1,11 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtQml.Models 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQml.Models import Qt.labs.qmlmodels 1.0 import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 /** diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml index 334f3380..30a05ebc 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml b/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml index c36492a2..2bf5ba77 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml @@ -1,5 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls + import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml b/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml index 3af6d731..585404fc 100644 --- a/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml +++ b/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import MaterialIcons 2.2 import Controls 1.0 diff --git a/meshroom/ui/qml/LiveSfmView.qml b/meshroom/ui/qml/LiveSfmView.qml index b4d2bf40..1d6560f4 100644 --- a/meshroom/ui/qml/LiveSfmView.qml +++ b/meshroom/ui/qml/LiveSfmView.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import MaterialIcons 2.2 import Qt.labs.platform 1.0 as Platform // for FileDialog diff --git a/meshroom/ui/qml/MaterialIcons/MLabel.qml b/meshroom/ui/qml/MaterialIcons/MLabel.qml index e7c0e66b..4854b5c5 100644 --- a/meshroom/ui/qml/MaterialIcons/MLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MLabel.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls /** diff --git a/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml b/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml index beff1c52..c6012a7d 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml @@ -1,5 +1,5 @@ pragma Singleton -import QtQuick 2.15 +import QtQuick QtObject { property FontLoader fl: FontLoader { diff --git a/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml b/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml index 8fcce115..587a0ec6 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls /** diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml index 6f3d466d..ac87699b 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts /** diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml index 7931c92e..afd08949 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts /** diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml index 071fb9d3..7a1238dc 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts /** diff --git a/meshroom/ui/qml/Utils/Colors.qml b/meshroom/ui/qml/Utils/Colors.qml index 51af70e2..beb9cfa6 100644 --- a/meshroom/ui/qml/Utils/Colors.qml +++ b/meshroom/ui/qml/Utils/Colors.qml @@ -1,6 +1,6 @@ pragma Singleton -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls /** * Singleton that gathers useful colors, shades and system palettes. diff --git a/meshroom/ui/qml/Utils/ExifOrientation.qml b/meshroom/ui/qml/Utils/ExifOrientation.qml index baef5562..1475cad9 100644 --- a/meshroom/ui/qml/Utils/ExifOrientation.qml +++ b/meshroom/ui/qml/Utils/ExifOrientation.qml @@ -1,5 +1,5 @@ pragma Singleton -import QtQuick 2.11 +import QtQuick /** * Singleton that defines utility functions for supporting exif orientation tags. diff --git a/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml b/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml index 6b3a4457..9168e75e 100644 --- a/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml +++ b/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQml.Models 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQml.Models +import QtQuick.Controls /** * SortFilderDelegateModel adds sorting and filtering capabilities on a source model. diff --git a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml index 1ee86c78..e97d9cb2 100644 --- a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml +++ b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml @@ -1,15 +1,16 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtPositioning 5.15 -import QtLocation 5.15 -import QtCharts 2.15 -import Charts 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtPositioning 6.6 +import QtLocation 6.6 +import QtCharts + +import Charts 1.0 import Controls 1.0 -import Utils 1.0 import DataObjects 1.0 +import MaterialIcons 2.2 +import Utils 1.0 FloatingPane { id: root diff --git a/meshroom/ui/qml/Viewer/CircleGizmo.qml b/meshroom/ui/qml/Viewer/CircleGizmo.qml index 7a13cedd..b9e1cacb 100644 --- a/meshroom/ui/qml/Viewer/CircleGizmo.qml +++ b/meshroom/ui/qml/Viewer/CircleGizmo.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick Item { id: root diff --git a/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml b/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml index 214a84c8..b3e1eb00 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick Item { id: root diff --git a/meshroom/ui/qml/Viewer/ColorCheckerPane.qml b/meshroom/ui/qml/Viewer/ColorCheckerPane.qml index 16420006..a5336491 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerPane.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerPane.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Layouts import Controls 1.0 diff --git a/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml b/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml index 151339f7..622ec2b8 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick Item { id: root diff --git a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml index a649df11..f8749a66 100644 --- a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml +++ b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml @@ -1,10 +1,10 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Utils 1.0 import Controls 1.0 +import MaterialIcons 2.2 +import Utils 1.0 /** * FeaturesInfoOverlay is an overlay that displays info and diff --git a/meshroom/ui/qml/Viewer/FeaturesViewer.qml b/meshroom/ui/qml/Viewer/FeaturesViewer.qml index b602f4dc..a1acd4d4 100644 --- a/meshroom/ui/qml/Viewer/FeaturesViewer.qml +++ b/meshroom/ui/qml/Viewer/FeaturesViewer.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import AliceVision 1.0 as AliceVision +import QtQuick +import AliceVision 1.0 as AliceVision import Utils 1.0 /** diff --git a/meshroom/ui/qml/Viewer/FloatImage.qml b/meshroom/ui/qml/Viewer/FloatImage.qml index e7bfa0a5..711e6798 100644 --- a/meshroom/ui/qml/Viewer/FloatImage.qml +++ b/meshroom/ui/qml/Viewer/FloatImage.qml @@ -1,7 +1,7 @@ -import QtQuick 2.15 -import Utils 1.0 +import QtQuick import AliceVision 1.0 as AliceVision +import Utils 1.0 /** * FloatImage displays an Image with gamma / offset / channel controls diff --git a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml index f962c285..018d3541 100644 --- a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml +++ b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 FloatingPane { id: root diff --git a/meshroom/ui/qml/Viewer/ImageMetadataView.qml b/meshroom/ui/qml/Viewer/ImageMetadataView.qml index e951a84e..384627e3 100644 --- a/meshroom/ui/qml/Viewer/ImageMetadataView.qml +++ b/meshroom/ui/qml/Viewer/ImageMetadataView.qml @@ -1,11 +1,12 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtPositioning 5.15 -import QtLocation 5.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import QtPositioning 6.6 +import QtLocation 6.6 import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 /** diff --git a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml index 10c783e9..d724bb30 100644 --- a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml +++ b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer/MFeatures.qml b/meshroom/ui/qml/Viewer/MFeatures.qml index 2473c139..81260f42 100644 --- a/meshroom/ui/qml/Viewer/MFeatures.qml +++ b/meshroom/ui/qml/Viewer/MFeatures.qml @@ -1,4 +1,5 @@ -import QtQuick 2.15 +import QtQuick + import AliceVision 1.0 as AliceVision // Data from the View / Features. diff --git a/meshroom/ui/qml/Viewer/MSfMData.qml b/meshroom/ui/qml/Viewer/MSfMData.qml index 2f6c3483..c6869784 100644 --- a/meshroom/ui/qml/Viewer/MSfMData.qml +++ b/meshroom/ui/qml/Viewer/MSfMData.qml @@ -1,4 +1,5 @@ -import QtQuick 2.15 +import QtQuick + import AliceVision 1.0 as AliceVision // Data from the SfM diff --git a/meshroom/ui/qml/Viewer/MTracks.qml b/meshroom/ui/qml/Viewer/MTracks.qml index eb594aed..75d03621 100644 --- a/meshroom/ui/qml/Viewer/MTracks.qml +++ b/meshroom/ui/qml/Viewer/MTracks.qml @@ -1,4 +1,5 @@ -import QtQuick 2.15 +import QtQuick + import AliceVision 1.0 as AliceVision AliceVision.MTracks { diff --git a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml index 2ef67715..bbebba1a 100644 --- a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml +++ b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index 87fad409..bd9ccf2b 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -1,7 +1,7 @@ -import QtQuick 2.15 -import Utils 1.0 +import QtQuick import AliceVision 1.0 as AliceVision +import Utils 1.0 /** * PanoramaViwer displays a list of Float Images diff --git a/meshroom/ui/qml/Viewer/SequencePlayer.qml b/meshroom/ui/qml/Viewer/SequencePlayer.qml index 3e08b740..3eefcda9 100644 --- a/meshroom/ui/qml/Viewer/SequencePlayer.qml +++ b/meshroom/ui/qml/Viewer/SequencePlayer.qml @@ -1,8 +1,7 @@ import QtCore -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 - +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import Controls 1.0 import MaterialIcons 2.2 diff --git a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml index 6a99a430..0b8e3511 100644 --- a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml +++ b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml @@ -1,16 +1,15 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtPositioning 5.15 -import QtLocation 5.15 -import QtCharts 2.15 -import Charts 1.0 - -import Controls 1.0 -import Utils 1.0 +import QtCharts +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtPositioning 6.6 +import QtLocation 6.6 import AliceVision 1.0 as AliceVision +import Charts 1.0 +import Controls 1.0 +import MaterialIcons 2.2 +import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer/SfmStatsView.qml b/meshroom/ui/qml/Viewer/SfmStatsView.qml index 86d89ece..ce3ff783 100644 --- a/meshroom/ui/qml/Viewer/SfmStatsView.qml +++ b/meshroom/ui/qml/Viewer/SfmStatsView.qml @@ -1,17 +1,15 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import QtPositioning 5.15 -import QtLocation 5.15 -import QtCharts 2.15 -import Charts 1.0 - -import Controls 1.0 -import Utils 1.0 +import QtCharts +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtPositioning 6.6 +import QtLocation 6.6 import AliceVision 1.0 as AliceVision - +import Charts 1.0 +import Controls 1.0 +import MaterialIcons 2.2 +import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml b/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml index 17045c04..809930ae 100644 --- a/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml +++ b/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml @@ -1,5 +1,6 @@ +import QtQuick + import AliceVision 1.0 -import QtQuick 2.15 /** * To evaluate if the QtAliceVision plugin is available. diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 5618cb8f..7f5494a8 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 FocusScope { diff --git a/meshroom/ui/qml/Viewer3D/BoundingBox.qml b/meshroom/ui/qml/Viewer3D/BoundingBox.qml index ceef931f..95bf01bb 100644 --- a/meshroom/ui/qml/Viewer3D/BoundingBox.qml +++ b/meshroom/ui/qml/Viewer3D/BoundingBox.qml @@ -1,8 +1,8 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 +import QtQuick Entity { id: root diff --git a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml index 9f51f000..4c9d26d9 100644 --- a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml +++ b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml @@ -1,9 +1,9 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 -import Qt3D.Logic 2.15 -import QtQml 2.2 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 +import Qt3D.Logic 2.6 +import QtQml import Meshroom.Helpers 1.0 diff --git a/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml b/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml index fe485d19..2b1bae7d 100644 --- a/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml @@ -1,9 +1,9 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 -import Qt3D.Logic 2.15 +import Qt3D.Logic 2.6 +import QtQuick /** * Wrapper for TransformGizmo. diff --git a/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml b/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml index fa0394e1..034371cd 100644 --- a/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml +++ b/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 diff --git a/meshroom/ui/qml/Viewer3D/Grid3D.qml b/meshroom/ui/qml/Viewer3D/Grid3D.qml index bc9a3db8..25e57123 100644 --- a/meshroom/ui/qml/Viewer3D/Grid3D.qml +++ b/meshroom/ui/qml/Viewer3D/Grid3D.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 // Grid diff --git a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml index 9ccd0cb4..f203a8f9 100644 --- a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml +++ b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.12 +import QtQuick +import QtQuick.Layouts /** * ImageOverlay enables to display a Viewpoint image on top of a 3D View. diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index cbb64dd2..7d000ec7 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -1,11 +1,12 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import MaterialIcons 2.2 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import QtQuick.Controls import QtQuick.Controls.Material 2.12 +import QtQuick.Layouts +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 + import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer3D/Locator3D.qml b/meshroom/ui/qml/Viewer3D/Locator3D.qml index c7dfb217..f08a92b2 100644 --- a/meshroom/ui/qml/Viewer3D/Locator3D.qml +++ b/meshroom/ui/qml/Viewer3D/Locator3D.qml @@ -1,7 +1,8 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 + import Utils 1.0 // Locator diff --git a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml index 9c451e62..9061b228 100644 --- a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml @@ -1,8 +1,9 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 +import QtQuick + import Utils 1.0 import "Materials" diff --git a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml index 265d9c8e..a205c14f 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml @@ -1,5 +1,5 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 Effect { id: root diff --git a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml index 00f7af0d..96d9f5b7 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml @@ -1,5 +1,6 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 + import Utils 1.0 Material { diff --git a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml index 0e37b2a3..80ee5778 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml @@ -1,5 +1,5 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 Effect { id: root diff --git a/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml b/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml index bfe090a9..37dc534c 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml @@ -1,5 +1,5 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 Material { id: root diff --git a/meshroom/ui/qml/Viewer3D/MediaCache.qml b/meshroom/ui/qml/Viewer3D/MediaCache.qml index 131b1613..bd620e30 100644 --- a/meshroom/ui/qml/Viewer3D/MediaCache.qml +++ b/meshroom/ui/qml/Viewer3D/MediaCache.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Utils 1.0 diff --git a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml index 503de089..9e02a99b 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml @@ -1,6 +1,7 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 + import Utils 1.0 diff --git a/meshroom/ui/qml/Viewer3D/MediaLoader.qml b/meshroom/ui/qml/Viewer3D/MediaLoader.qml index 669781fb..9919c6f7 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoader.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoader.qml @@ -1,8 +1,9 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 -import QtQuick.Scene3D 2.15 +import QtQuick.Scene3D 2.6 + import "Materials" import Utils 1.0 diff --git a/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml b/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml index 90170240..f64efdb5 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 +import QtQuick +import Qt3D.Core 2.6 /** diff --git a/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml b/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml index 3f9e0b7a..82ddfa5e 100644 --- a/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml +++ b/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml @@ -1,8 +1,8 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 +import QtQuick /** * BoundingBox entity for Meshing node. Used to define the area to reconstruct. diff --git a/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml b/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml index c40bcccd..c8c89841 100644 --- a/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml @@ -1,8 +1,9 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 + +import QtQuick /** * Gizmo for SfMTransform node. diff --git a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml index 77b44dce..e4a94969 100644 --- a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml +++ b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml @@ -1,9 +1,10 @@ -import SfmDataEntity 1.0 -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 +import SfmDataEntity 1.0 + /** * Support for SfMData files in Qt3D. * Create this component dynamically to test for SfmDataEntity plugin availability. diff --git a/meshroom/ui/qml/Viewer3D/TrackballGizmo.qml b/meshroom/ui/qml/Viewer3D/TrackballGizmo.qml index 123a2b42..dd2779fa 100644 --- a/meshroom/ui/qml/Viewer3D/TrackballGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/TrackballGizmo.qml @@ -1,8 +1,8 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 +import QtQuick Entity { id: root diff --git a/meshroom/ui/qml/Viewer3D/TransformGizmo.qml b/meshroom/ui/qml/Viewer3D/TransformGizmo.qml index 78c78376..cb98aa43 100644 --- a/meshroom/ui/qml/Viewer3D/TransformGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/TransformGizmo.qml @@ -1,10 +1,11 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 -import Qt3D.Logic 2.15 -import QtQuick.Controls 2.15 +import Qt3D.Logic 2.6 +import QtQuick +import QtQuick.Controls + import Utils 1.0 diff --git a/meshroom/ui/qml/Viewer3D/TransformGizmoPicker.qml b/meshroom/ui/qml/Viewer3D/TransformGizmoPicker.qml index 1d87cfec..b3d9d800 100644 --- a/meshroom/ui/qml/Viewer3D/TransformGizmoPicker.qml +++ b/meshroom/ui/qml/Viewer3D/TransformGizmoPicker.qml @@ -1,9 +1,9 @@ -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.15 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 +import Qt3D.Input 2.6 import Qt3D.Extras 2.15 -import QtQuick 2.15 -import Qt3D.Logic 2.15 +import Qt3D.Logic 2.6 +import QtQuick ObjectPicker { id: root diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index d2eea168..8086201d 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -1,16 +1,15 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 -import QtQml.Models 2.15 -import QtQuick.Scene3D 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQml.Models +import QtQuick.Scene3D 2.6 +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 import Qt3D.Extras 2.15 -import Qt3D.Input 2.15 as Qt3DInput // to avoid clash with Controls2 Action - -import MaterialIcons 2.2 +import Qt3D.Input 2.6 as Qt3DInput // to avoid clash with Controls2 Action import Controls 1.0 +import MaterialIcons 2.2 import Utils 1.0 diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index 084b9979..1ac2a4ad 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -1,5 +1,6 @@ pragma Singleton -import QtQuick 2.15 +import QtQuick + import MaterialIcons 2.2 /** diff --git a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml index b4af917f..df1328c4 100644 --- a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml +++ b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 +import QtQuick +import Qt3D.Core 2.6 +import Qt3D.Render 2.6 /** diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index c512e101..4edb9959 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -1,7 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.11 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + import Qt.labs.platform 1.0 as Platform + import ImageGallery 1.0 import Viewer 1.0 import Viewer3D 1.0 diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index f6f7e6e3..de8044d1 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -1,8 +1,8 @@ import QtCore -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Window 2.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Window import QtQuick.Dialogs import Qt.labs.platform 1.0 as Platform From b9ec8fe3b725b6c2ec85c31f6d36c2569048f71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 14:27:33 +0200 Subject: [PATCH 10/64] [qt6][GraphEditor] Rename identifiers for attribute items --- .../qml/GraphEditor/AttributeItemDelegate.qml | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index 9dae059e..74ef2da0 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -199,37 +199,37 @@ RowLayout { sourceComponent: { // PushButtonParam always has value == undefined, so it needs to be excluded from this check if (attribute.type != "PushButtonParam" && attribute.value === undefined) { - return notComputed_component + return notComputedComponent } switch (attribute.type) { case "PushButtonParam": - return pushButton_component + return pushButtonComponent case "ChoiceParam": - return attribute.desc.exclusive ? comboBox_component : multiChoice_component - case "IntParam": return slider_component + return attribute.desc.exclusive ? comboBoxComponent : multiChoiceComponent + case "IntParam": return sliderComponent case "FloatParam": if (attribute.desc.semantic === 'color/hue') - return color_hue_component - return slider_component + return colorHueComponent + return sliderComponent case "BoolParam": - return checkbox_component + return checkboxComponent case "ListAttribute": - return listAttribute_component + return listAttributeComponent case "GroupAttribute": - return groupAttribute_component + return groupAttributeComponent case "StringParam": if (attribute.desc.semantic.includes('multiline')) - return textArea_component - return textField_component + return textAreaComponent + return textFieldComponent case "ColorParam": - return color_component + return colorComponent default: - return textField_component + return textFieldComponent } } Component { - id: notComputed_component + id: notComputedComponent Label { anchors.fill: parent text: MaterialIcons.do_not_disturb_alt @@ -245,7 +245,7 @@ RowLayout { } Component { - id: pushButton_component + id: pushButtonComponent Button { text: attribute.label enabled: root.editable @@ -256,7 +256,7 @@ RowLayout { } Component { - id: textField_component + id: textFieldComponent TextField { id: textField readOnly: !root.editable @@ -347,7 +347,7 @@ RowLayout { } Component { - id: textArea_component + id: textAreaComponent Rectangle { // Fixed background for the flickable object @@ -396,10 +396,10 @@ RowLayout { } Component { - id: color_component + id: colorComponent RowLayout { CheckBox { - id: color_checkbox + id: colorCheckbox Layout.alignment: Qt.AlignLeft checked: node && node.color === "" ? false : true checkable: root.editable @@ -416,9 +416,9 @@ RowLayout { id: colorText Layout.alignment: Qt.AlignLeft implicitWidth: 100 - enabled: color_checkbox.checked && root.editable - visible: color_checkbox.checked - text: color_checkbox.checked ? attribute.value : "" + enabled: colorCheckbox.checked && root.editable + visible: colorCheckbox.checked + text: colorCheckbox.checked ? attribute.value : "" selectByMouse: true onEditingFinished: setTextFieldAttribute(text) onAccepted: setTextFieldAttribute(text) @@ -432,8 +432,8 @@ RowLayout { height: colorText.height width: colorText.width / 2 Layout.alignment: Qt.AlignLeft - visible: color_checkbox.checked - color: color_checkbox.checked ? attribute.value : "" + visible: colorCheckbox.checked + color: colorCheckbox.checked ? attribute.value : "" MouseArea { enabled: root.editable @@ -462,7 +462,7 @@ RowLayout { } Component { - id: comboBox_component + id: comboBoxComponent FilterComboBox { inputModel: attribute.values @@ -504,10 +504,10 @@ RowLayout { } Component { - id: multiChoice_component + id: multiChoiceComponent Flow { Repeater { - id: checkbox_repeater + id: checkboxRepeater model: attribute.values delegate: CheckBox { enabled: root.editable @@ -528,7 +528,7 @@ RowLayout { } Component { - id: slider_component + id: sliderComponent RowLayout { TextField { IntValidator { @@ -595,7 +595,7 @@ RowLayout { } Component { - id: checkbox_component + id: checkboxComponent Row { CheckBox { enabled: root.editable @@ -606,17 +606,17 @@ RowLayout { } Component { - id: listAttribute_component + id: listAttributeComponent ColumnLayout { - id: listAttribute_layout + id: listAttributeLayout width: parent.width property bool expanded: false RowLayout { spacing: 4 ToolButton { - text: listAttribute_layout.expanded ? MaterialIcons.keyboard_arrow_down : MaterialIcons.keyboard_arrow_right + text: listAttributeLayout.expanded ? MaterialIcons.keyboard_arrow_down : MaterialIcons.keyboard_arrow_right font.family: MaterialIcons.fontFamily - onClicked: listAttribute_layout.expanded = !listAttribute_layout.expanded + onClicked: listAttributeLayout.expanded = !listAttributeLayout.expanded } Label { Layout.alignment: Qt.AlignVCenter @@ -633,7 +633,7 @@ RowLayout { } ListView { id: lv - model: listAttribute_layout.expanded ? attribute.value : undefined + model: listAttributeLayout.expanded ? attribute.value : undefined visible: model !== undefined && count > 0 implicitHeight: Math.min(contentHeight, 300) Layout.fillWidth: true @@ -684,7 +684,7 @@ RowLayout { } Component { - id: groupAttribute_component + id: groupAttributeComponent ColumnLayout { id: groupItem Component.onCompleted: { @@ -704,7 +704,7 @@ RowLayout { } Component { - id: color_hue_component + id: colorHueComponent RowLayout { TextField { implicitWidth: 100 From a62bed08eb320537e166eac5ac0d6c891edb9783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 14:30:48 +0200 Subject: [PATCH 11/64] [qt6][GraphEditor] Fix `ColorDialog` selection --- meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index 74ef2da0..e18e3ced 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -406,7 +406,10 @@ RowLayout { text: "Custom Color" onClicked: { if (checked) { - _reconstruction.setAttribute(attribute, "#0000FF") + if (colorText.text == "") + _reconstruction.setAttribute(attribute, "#0000FF") + else + _reconstruction.setAttribute(attribute, colorText.text) } else { _reconstruction.setAttribute(attribute, "") } @@ -433,7 +436,7 @@ RowLayout { width: colorText.width / 2 Layout.alignment: Qt.AlignLeft visible: colorCheckbox.checked - color: colorCheckbox.checked ? attribute.value : "" + color: colorCheckbox.checked ? colorDialog.selectedColor : "" MouseArea { enabled: root.editable @@ -445,9 +448,9 @@ RowLayout { ColorDialog { id: colorDialog title: "Please choose a color" - selectedColor: attribute.value + selectedColor: colorText.text onAccepted: { - colorText.text = color + colorText.text = colorDialog.selectedColor // Artificially trigger change of attribute value colorText.editingFinished() close() From 595e8f6c7a09652338122735a98ed195f0200845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 14:32:26 +0200 Subject: [PATCH 12/64] [qt6][qml] Do not explicitly set a Palette value with a QPalette --- meshroom/ui/qml/main.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index de8044d1..d6e49f0d 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -35,8 +35,6 @@ ApplicationWindow { ensureSaved(function() { Qt.quit() }) } - palette: _PaletteManager.palette - // QPalette is not convertible to QML palette (anymore) Component.onCompleted: { palette.alternateBase = _PaletteManager.alternateBase From d5b5163828a617045d22d9e7c51a0ece961d47ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 14:33:57 +0200 Subject: [PATCH 13/64] [qt6] Remove shaders from Meshroom and move them to QtAliceVision --- .../qml/GraphEditor/AttributeItemDelegate.qml | 11 +------- meshroom/ui/qml/Viewer3D/ImageOverlay.qml | 26 +------------------ 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index e18e3ced..a6d212b5 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -752,16 +752,7 @@ RowLayout { width: control.availableWidth height: control.availableHeight blending: false - fragmentShader: " - varying mediump vec2 qt_TexCoord0; - vec3 hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); - } - void main() { - gl_FragColor = vec4(hsv2rgb(vec3(qt_TexCoord0.x, 1.0, 1.0)), 1.0); - }" + fragmentShader: "qrc:/shaders/AttributeItemDelegate.frag.qsb" } } } diff --git a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml index f203a8f9..e4b2d48c 100644 --- a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml +++ b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml @@ -70,30 +70,6 @@ Item { property variant src: image property variant uvCenterOffset - vertexShader: " - #version 330 core - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - out highp vec2 coord; - void main() { - coord = qt_MultiTexCoord0; - gl_Position = qt_Matrix * qt_Vertex; - }" - fragmentShader: " - #version 330 core - in highp vec2 coord; - uniform sampler2D src; - uniform lowp vec2 uvCenterOffset; - uniform lowp float qt_Opacity; - out vec4 fragColor; - void main() { - vec2 xy = coord + uvCenterOffset; - fragColor = texture2D(src, xy); - fragColor.rgb *= qt_Opacity; - fragColor.a = qt_Opacity; - // remove undistortion black pixels - fragColor.a *= step(0.001, fragColor.r + fragColor.g + fragColor.b); - }" + fragmentShader: "qrc:/shaders/ImageOverlay.frag.qsb" } } From b65197e23ec31f485062b0c30ff1352bb86fbd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 15:40:06 +0200 Subject: [PATCH 14/64] [qt6] Set the RHI backend to "opengl" --- meshroom/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meshroom/__init__.py b/meshroom/__init__.py index dfe9f616..b9f080eb 100644 --- a/meshroom/__init__.py +++ b/meshroom/__init__.py @@ -157,3 +157,4 @@ def setupEnvironment(backend=Backend.STANDALONE): os.environ["QML_XHR_ALLOW_FILE_READ"] = '1' os.environ["QML_XHR_ALLOW_FILE_WRITE"] = '1' os.environ["PYSEQ_STRICT_PAD"] = '1' +os.environ["QSG_RHI_BACKEND"] = "opengl" From 138cc188643bd40791b27b6108710d7aa5a71219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 15:43:37 +0200 Subject: [PATCH 15/64] [qt6][Materials] Use correct graphics API and update SH shaders With Qt6, OpenGL is not used directly anymore, and we thus must use the RHI backend, set to version 1.0. The SphericalHarmonics shaders, which were previously written in OpenGL, need to be updated accordingly. --- .../Materials/SphericalHarmonicsEffect.qml | 6 +-- .../Viewer3D/Materials/WireframeEffect.qml | 6 +-- .../Materials/shaders/SphericalHarmonics.frag | 40 ++++++++++++++++--- .../Materials/shaders/SphericalHarmonics.vert | 40 +++++++++++++++---- 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml index a205c14f..1ecb3be0 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsEffect.qml @@ -13,10 +13,10 @@ Effect { techniques: [ Technique { graphicsApiFilter { - api: GraphicsApiFilter.OpenGL + api: GraphicsApiFilter.RHI profile: GraphicsApiFilter.CoreProfile - majorVersion: 3 - minorVersion: 1 + majorVersion: 1 + minorVersion: 0 } diff --git a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml index 80ee5778..f3a888c4 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml @@ -14,10 +14,10 @@ Effect { techniques: [ Technique { graphicsApiFilter { - api: GraphicsApiFilter.OpenGL + api: GraphicsApiFilter.RHI profile: GraphicsApiFilter.CoreProfile - majorVersion: 3 - minorVersion: 1 + majorVersion: 1 + minorVersion: 0 } filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ] diff --git a/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.frag b/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.frag index ecc5d730..2c97b367 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.frag +++ b/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.frag @@ -1,10 +1,40 @@ -#version 330 core +#version 450 core -in vec3 normal; -out vec4 fragColor; +layout(location = 0) in vec3 normal; +layout(location = 0) out vec4 fragColor; -uniform vec3 shCoeffs[9]; -uniform bool displayNormals = false; +layout(std140, binding = 0) uniform qt3d_render_view_uniforms { + mat4 viewMatrix; + mat4 projectionMatrix; + mat4 uncorrectedProjectionMatrix; + mat4 clipCorrectionMatrix; + mat4 viewProjectionMatrix; + mat4 inverseViewMatrix; + mat4 inverseProjectionMatrix; + mat4 inverseViewProjectionMatrix; + mat4 viewportMatrix; + mat4 inverseViewportMatrix; + vec4 textureTransformMatrix; + vec3 eyePosition; + float aspectRatio; + float gamma; + float exposure; + float time; +}; +layout(std140, binding = 1) uniform qt3d_command_uniforms { + mat4 modelMatrix; + mat4 inverseModelMatrix; + mat4 modelViewMatrix; + mat3 modelNormalMatrix; + mat4 inverseModelViewMatrix; + mat4 mvp; + mat4 inverseModelViewProjectionMatrix; +}; + +layout(std140, binding = 2) uniform input_uniforms { + vec3 shCoeffs[9]; + bool displayNormals; +}; vec3 resolveSH_Opt(vec3 premulCoefficients[9], vec3 dir) { diff --git a/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.vert b/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.vert index 79d44323..fea3b3d0 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.vert +++ b/meshroom/ui/qml/Viewer3D/Materials/shaders/SphericalHarmonics.vert @@ -1,16 +1,40 @@ -#version 330 core +#version 450 core -in vec3 vertexPosition; -in vec3 vertexNormal; +layout(location = 0) in vec3 vertexPosition; +layout(location = 1) in vec3 vertexNormal; -out vec3 normal; +layout(location = 0) out vec3 normal; -uniform mat4 modelView; -uniform mat3 modelViewNormal; -uniform mat4 mvp; +layout(std140, binding = 0) uniform qt3d_render_view_uniforms { + mat4 viewMatrix; + mat4 projectionMatrix; + mat4 uncorrectedProjectionMatrix; + mat4 clipCorrectionMatrix; + mat4 viewProjectionMatrix; + mat4 inverseViewMatrix; + mat4 inverseProjectionMatrix; + mat4 inverseViewProjectionMatrix; + mat4 viewportMatrix; + mat4 inverseViewportMatrix; + vec4 textureTransformMatrix; + vec3 eyePosition; + float aspectRatio; + float gamma; + float exposure; + float time; +}; +layout(std140, binding = 1) uniform qt3d_command_uniforms { + mat4 modelMatrix; + mat4 inverseModelMatrix; + mat4 modelViewMatrix; + mat3 modelNormalMatrix; + mat4 inverseModelViewMatrix; + mat4 mvp; + mat4 inverseModelViewProjectionMatrix; +}; void main() { normal = vertexNormal; - gl_Position = mvp * vec4( vertexPosition, 1.0 ); + gl_Position = mvp * vec4(vertexPosition, 1.0); } From 2a7844480b47dca91bef28a9057effaef2b32f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:35:20 +0200 Subject: [PATCH 16/64] [qt6][components] Update Scene3DHelper and TrackballController Call the `QGeometry` objects from the correct module, and initialize correctly the Camera object upon the construction of the TrackballController object. --- meshroom/ui/components/scene3D.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/meshroom/ui/components/scene3D.py b/meshroom/ui/components/scene3D.py index 7187110a..58890fea 100644 --- a/meshroom/ui/components/scene3D.py +++ b/meshroom/ui/components/scene3D.py @@ -41,14 +41,14 @@ class Scene3DHelper(QObject): def faceCount(self, entity): """ Returns face count based on children QGeometry buffers size.""" count = 0 - for geo in entity.findChildren(Qt3DRender.QGeometry): + for geo in entity.findChildren(Qt3DCore.QGeometry): count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"]) return count / 3 @Slot(Qt3DCore.QEntity, result=int) def vertexColorCount(self, entity): count = 0 - for geo in entity.findChildren(Qt3DRender.QGeometry): + for geo in entity.findChildren(Qt3DCore.QGeometry): count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexColor"]) return count @@ -59,10 +59,12 @@ class TrackballController(QObject): Based on the C++ version from https://github.com/cjmdaixi/Qt3DTrackball """ - _windowSize = QSize() - _camera = None - _trackballSize = 1.0 - _rotationSpeed = 5.0 + def __init__(self, parent=None): + super().__init__(parent) + self._windowSize = QSize() + self._camera = None + self._trackballSize = 1.0 + self._rotationSpeed = 5.0 def projectToTrackball(self, screenCoords): sx = screenCoords.x() @@ -98,7 +100,7 @@ class TrackballController(QObject): windowSizeChanged = Signal() windowSize = makeProperty(QSize, '_windowSize', windowSizeChanged) cameraChanged = Signal() - camera = makeProperty(Qt3DRender.QCamera, '_camera', cameraChanged) + camera = makeProperty(QObject, '_camera', cameraChanged) trackballSizeChanged = Signal() trackballSize = makeProperty(float, '_trackballSize', trackballSizeChanged) rotationSpeedChanged = Signal() From e1ef8acadc8683e54dd485a1c2fd1b8df9db9b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:42:18 +0200 Subject: [PATCH 17/64] [qt6][Viewer3D] MediaLibrary: Fix loading medias from attributes Additionally harmonize comments and explicitly declare parameters for slots that need them. --- meshroom/ui/qml/Viewer3D/MediaLibrary.qml | 84 +++++++++++------------ 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml index 9e02a99b..b06dbcfb 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml @@ -93,17 +93,18 @@ Entity { console.warn("Media Error: File " + pathStr + " does not exist.") return } - // file already loaded, return + // File already loaded, return if (m.sourceToEntity[pathStr]) { ensureVisible(pathStr) return } - // add file to the internal ListModel - m.mediaModel.append(makeElement({ - "source": pathStr, - "label": label ? label : Filepath.basename(pathStr), - "section": "External" + // Add file to the internal ListModel + m.mediaModel.append( + makeElement({ + "source": pathStr, + "label": label ? label : Filepath.basename(pathStr), + "section": "External" })) } @@ -115,16 +116,17 @@ Entity { var attrLabel = attribute.isOutput ? "" : attribute.fullName.replace(attribute.node.name, "") var section = attribute.node.label - // add file to the internal ListModel - m.mediaModel.append(makeElement({ + // Add file to the internal ListModel + m.mediaModel.append( + makeElement({ "label": section + attrLabel, "section": section, - "attribute": attribute, + "attribute": attribute })) } function remove(index) { - // remove corresponding entry from model + // Remove corresponding entry from model m.mediaModel.remove(index) } @@ -189,7 +191,7 @@ Entity { MediaLoader { id: mediaLoader - // whether MediaLoader has been fully instantiated by the NodeInstantiator + // Whether MediaLoader has been fully instantiated by the NodeInstantiator property bool fullyInstantiated: false // explicitly store some attached model properties for outside use and ease binding @@ -198,23 +200,23 @@ Entity { readonly property var modelSource: attribute || model.source readonly property bool visible: model.visible - // multi-step binding to ensure MediaLoader source is properly + // Multi-step binding to ensure MediaLoader source is properly // updated when needed, whether raw source is valid or not - // raw source path + // Raw source path property string rawSource: attribute ? attribute.value : model.source - // whether dependencies are statified (applies for output/connected input attributes only) + // Whether dependencies are statified (applies for output/connected input attributes only) readonly property bool dependencyReady: { if (attribute) { const rootAttribute = attribute.isLink ? attribute.rootLinkParam : attribute if (rootAttribute.isOutput) return rootAttribute.node.globalStatus === "SUCCESS" } - return true // is an input param without link (so no dependency) or an external file + return true // Is an input param without link (so no dependency) or an external file } - // source based on raw source + dependency status + // Source based on raw source + dependency status property string currentSource: dependencyReady ? rawSource : "" - // source based on currentSource + "requested" property + // Source based on currentSource + "requested" property property string finalSource: model.requested ? currentSource : "" // To use only if we want to draw the input source and not the current node output (Warning: to use with caution) @@ -229,14 +231,6 @@ Entity { renderMode: root.renderMode enabled: visible - // QObject.destroyed signal is not accessible - // Use the object as NodeInstantiator model to be notified of its deletion - NodeInstantiator { - model: attribute - delegate: Entity { objectName: "DestructionWatcher [" + model.toString() + "]" } - onObjectRemoved: remove(index) - } - property bool alive: attribute ? attribute.node.alive : false onAliveChanged: { if (!alive && index >= 0) @@ -245,19 +239,19 @@ Entity { // 'visible' property drives media loading request onVisibleChanged: { - // always request media loading if visible + // Always request media loading if visible if (model.visible) model.requested = true - // only cancel loading request if media is not valid + // Only cancel loading request if media is not valid // (a media won't be unloaded if already loaded, only hidden) else if (!model.valid) model.requested = false } function updateCacheAndModel(forceRequest) { - // don't cache explicitly unloaded media + // Don't cache explicitly unloaded media if (model.requested && object && dependencyReady) { - // cache current object + // Cache current object if (cache.add(Filepath.urlToString(mediaLoader.source), object)) object = null } @@ -265,21 +259,21 @@ Entity { } function updateModel(forceRequest) { - // update model's source path if input is an attribute + // Update model's source path if input is an attribute if (attribute) { model.source = rawSource } - // auto-restore entity if raw source is in cache + // Auto-restore entity if raw source is in cache model.requested = forceRequest || (!model.valid && model.requested) || cache.contains(rawSource) model.valid = Filepath.exists(rawSource) && dependencyReady } Component.onCompleted: { - // keep 'source' -> 'entity' reference + // Keep 'source' -> 'entity' reference m.sourceToEntity[modelSource] = instantiatedEntity - // always request media loading when delegate has been created + // Always request media loading when delegate has been created updateModel(true) - // if external media failed to open, remove element from model + // If external media failed to open, remove element from model if (!attribute && !object) remove(index) } @@ -293,7 +287,7 @@ Entity { } onFinalSourceChanged: { - // update media visibility + // Update media visibility // (useful if media was explicitly unloaded or hidden but loaded back from cache) model.visible = model.requested @@ -301,7 +295,7 @@ Entity { cached = cachedObject !== undefined if (cached) { object = cachedObject - // only change cached object parent if mediaLoader has been fully instantiated + // Only change cached object parent if mediaLoader has been fully instantiated // by the NodeInstantiator; otherwise re-parenting will fail silently and the object will disappear... // see "onFullyInstantiatedChanged" and parent NodeInstantiator's "onObjectAdded" if (fullyInstantiated) { @@ -310,28 +304,28 @@ Entity { } mediaLoader.source = Filepath.stringToUrl(finalSource) if (object) { - // bind media info to corresponding model roles + // Bind media info to corresponding model roles // (test for object validity to avoid error messages right after object has been deleted) var boundProperties = ["vertexCount", "faceCount", "cameraCount", "textureCount", "resectionIdCount", "resectionId", "resectionGroups"] boundProperties.forEach(function(prop) { model[prop] = Qt.binding(function() { return object ? object[prop] : 0 }) }) } else if (finalSource && status === Component.Ready) { - // source was valid but no loader was created, remove element - // check if component is ready to avoid removing element from the model before adding instance to the node + // Source was valid but no loader was created, remove element + // Check if component is ready to avoid removing element from the model before adding instance to the node remove(index) } } onFullyInstantiatedChanged: { - // delayed reparenting of object coming from the cache + // Delayed reparenting of object coming from the cache if (object) object.parent = mediaLoader } onStatusChanged: { model.status = status - // remove model entry for external media that failed to load + // Remove model entry for external media that failed to load if (status === SceneLoader.Error && !model.attribute) remove(index) } @@ -340,7 +334,7 @@ Entity { ObjectPicker { enabled: mediaLoader.enabled && pickingEnabled hoverEnabled: false - onPressed: root.pressed(pick) + onPressed: function(pick) { root.pressed(pick) } } ] } @@ -384,12 +378,12 @@ Entity { } } - onObjectAdded: { - // notify object that it is now fully instantiated + onObjectAdded: function(index, object) { + // Notify object that it is now fully instantiated object.fullyInstantiated = true } - onObjectRemoved: { + onObjectRemoved: function(index, object) { if (m.sourceToEntity[object.modelSource]) delete m.sourceToEntity[object.modelSource] } From 60eaced5ead9269a2eeb8ded5b11943ebd131fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:43:17 +0200 Subject: [PATCH 18/64] [qt6] Update setup script with the correct version of PySide --- setup.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 6d37da5c..f07c67c6 100644 --- a/setup.py +++ b/setup.py @@ -130,12 +130,7 @@ executables = [ setup( name="Meshroom", description="Meshroom", - install_requires=['psutil', 'pytest', 'PySide2', 'markdown'], - extras_require={ - ':python_version < "3.4"': [ - 'enum34', - ], - }, + install_requires=['psutil', 'pytest', 'PySide6', 'markdown'], setup_requires=[ 'cx_Freeze' ], From 3ff279d99ae4e515e2165ee192ee32e2986601b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:51:45 +0200 Subject: [PATCH 19/64] [qt6] Use JS functions format to declare explicit parameters in slots --- meshroom/ui/qml/Charts/ChartViewLegend.qml | 2 +- meshroom/ui/qml/GraphEditor/AttributeEditor.qml | 4 +++- meshroom/ui/qml/Viewer/CircleGizmo.qml | 4 ++-- meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml | 4 +++- meshroom/ui/qml/Viewer/LensDistortionToolbar.qml | 2 +- meshroom/ui/qml/Viewer/PanoramaViewer.qml | 6 +++--- meshroom/ui/qml/Viewer/Viewer2D.qml | 4 ++-- .../ui/qml/Viewer3D/DefaultCameraController.qml | 4 +++- meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml | 8 ++++---- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 15 +++++++++++---- meshroom/ui/qml/Viewer3D/MediaLoader.qml | 2 +- meshroom/ui/qml/Viewer3D/SfmDataLoader.qml | 4 ++-- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 2 +- 13 files changed, 37 insertions(+), 24 deletions(-) diff --git a/meshroom/ui/qml/Charts/ChartViewLegend.qml b/meshroom/ui/qml/Charts/ChartViewLegend.qml index f5a58214..bc1e836d 100644 --- a/meshroom/ui/qml/Charts/ChartViewLegend.qml +++ b/meshroom/ui/qml/Charts/ChartViewLegend.qml @@ -84,7 +84,7 @@ Flow { MouseArea { anchors.fill: parent - onClicked: { + onClicked: function(mouse) { if (mouse.modifiers & Qt.ControlModifier) root.soloSeries(index) else diff --git a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml index 67978256..a0c568c2 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml @@ -43,7 +43,9 @@ ListView { filterText: root.filterText objectsHideable: root.objectsHideable attribute: object - onDoubleClicked: root.attributeDoubleClicked(mouse, attr) + onDoubleClicked: function(mouse, attr) { + root.attributeDoubleClicked(mouse, attr) + } } onActiveChanged: height = active ? item.implicitHeight : -spacing diff --git a/meshroom/ui/qml/Viewer/CircleGizmo.qml b/meshroom/ui/qml/Viewer/CircleGizmo.qml index b9e1cacb..b61a0809 100644 --- a/meshroom/ui/qml/Viewer/CircleGizmo.qml +++ b/meshroom/ui/qml/Viewer/CircleGizmo.qml @@ -49,7 +49,7 @@ Item { propagateComposedEvents: true property bool controlModifierEnabled: false - onPositionChanged: { + onPositionChanged: function(mouse) { mArea.controlModifierEnabled = (mouse.modifiers & Qt.ControlModifier) mouse.accepted = false } @@ -65,7 +65,7 @@ Item { onPressed: { forceActiveFocus() } - onWheel: { + onWheel: function(wheel) { mArea.controlModifierEnabled = (wheel.modifiers & Qt.ControlModifier) if (wheel.modifiers & Qt.ControlModifier) { root.incrementRadius(wheel.angleDelta.y / 120.0) diff --git a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml index f8749a66..63de169d 100644 --- a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml +++ b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml @@ -261,7 +261,9 @@ FloatingPane { colors: root.featuresViewer.colors currentIndex: featureType.viewer.colorIndex // offset featuresViewer color set when changing the color of one feature type - onColorPicked: featureType.viewer.colorOffset = colorIndex - index + onColorPicked: function(colorIndex) { + featureType.viewer.colorOffset = colorIndex - index + } } // Feature type name Label { diff --git a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml index d724bb30..c8dd87af 100644 --- a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml +++ b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml @@ -63,7 +63,7 @@ FloatingPane { padding : 10 colors: root.colors currentIndex: root.colorIndex - onColorPicked: root.colorOffset = colorIndex + onColorPicked: function(colorIndex) { root.colorOffset = colorIndex } } // Grid opacity slider diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index bd9ccf2b..a890c9ce 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -121,7 +121,7 @@ AliceVision.PanoramaViewer { if (isEditable) isRotating ? Qt.ClosedHandCursor : Qt.OpenHandCursor } - onPositionChanged: { + onPositionChanged: function(mouse) { // Send Mouse Coordinates to Float Images Viewers idSelected = -1 for (var i = 0; i < repeater.model && isHighlightable; ++i) { @@ -171,7 +171,7 @@ AliceVision.PanoramaViewer { } } - onPressed:{ + onPressed: function(mouse) { _reconstruction.beginModification("Panorama Manual Rotation") isRotating = true lastX = mouse.x @@ -185,7 +185,7 @@ AliceVision.PanoramaViewer { previous_roll = roll } - onReleased: { + onReleased: function(mouse) { _reconstruction.endModification() isRotating = false lastX = 0 diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 7f5494a8..47ba04de 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -692,7 +692,7 @@ FocusScope { circleRadius: useAuto ? fisheyeAutoParams.z : ((imgContainer.image ? Math.min(imgContainer.image.width, imgContainer.image.height) : 1.0) * 0.5 * (userFisheyeRadius * 0.01)) circleBorder.width: Math.max(1, (3.0 / imgContainer.scale)) - onMoved: { + onMoved: function(xoffset, yoffset) { if (!useAuto) { _reconstruction.setAttribute( activeNode.attribute("fisheyeCenterOffset"), @@ -700,7 +700,7 @@ FocusScope { ) } } - onIncrementRadius: { + onIncrementRadius: function(radiusOffset) { if (!useAuto) { _reconstruction.setAttribute(activeNode.attribute("fisheyeRadius"), activeNode.attribute("fisheyeRadius").value + radiusOffset) } diff --git a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml index 4c9d26d9..24e6bd8a 100644 --- a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml +++ b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml @@ -58,7 +58,9 @@ Entity { _pressed = false mouseReleased(mouse, hasMoved) } - onClicked: function(mouse) { mouseClicked(mouse) } + onClicked: function(mouse) { + mouseClicked(mouse) + } onPositionChanged: function(mouse) { currentPosition.x = mouse.x currentPosition.y = mouse.y diff --git a/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml b/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml index 2b1bae7d..5a3affd4 100644 --- a/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/EntityWithGizmo.qml @@ -17,7 +17,7 @@ Entity { property DefaultCameraController sceneCameraController property Layer frontLayerComponent property var window - property alias uniformScale: transformGizmo.uniformScale // By default, if not set, the value is: false + property alias uniformScale: transformGizmo.uniformScale // By default, if not set, the value is: false property TransformGizmo transformGizmo: TransformGizmo { id: transformGizmo camera: root.camera @@ -25,12 +25,12 @@ Entity { frontLayerComponent: root.frontLayerComponent window: root.window - onPickedChanged: { - sceneCameraController.loseMouseFocus = pressed // Notify the camera if the transform takes/releases the focus + onPickedChanged: function(pressed) { + sceneCameraController.loseMouseFocus = pressed // Notify the camera if the transform takes/releases the focus } } readonly property Camera camera : sceneCameraController.camera readonly property var windowSize: sceneCameraController.windowSize - readonly property alias objectTransform : transformGizmo.objectTransform // The Transform the object should use + readonly property alias objectTransform : transformGizmo.objectTransform // The Transform the object should use } \ No newline at end of file diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index 7d000ec7..02ea8d6f 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -26,7 +26,12 @@ FloatingPane { padding: 0 - MouseArea { anchors.fill: parent; onWheel: wheel.accepted = true } + MouseArea { + anchors.fill: parent + onWheel: function(wheel) { + wheel.accepted = true + } + } ColumnLayout { anchors.fill: parent @@ -382,7 +387,7 @@ FloatingPane { if (model.attribute) uigraph.hoveredNode = null } - onClicked: { + onClicked: function(mouse) { if (model.attribute) uigraph.selectedNode = model.attribute.node else @@ -457,9 +462,11 @@ FloatingPane { property int modifiers anchors.fill: parent hoverEnabled: true - onPositionChanged: modifiers = mouse.modifiers + onPositionChanged: function(mouse) { + modifiers = mouse.modifiers + } onExited: modifiers = Qt.NoModifier - onPressed: { + onPressed: function(mouse) { modifiers = mouse.modifiers; mouse.accepted = false; } diff --git a/meshroom/ui/qml/Viewer3D/MediaLoader.qml b/meshroom/ui/qml/Viewer3D/MediaLoader.qml index 9919c6f7..b386815b 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoader.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoader.qml @@ -90,7 +90,7 @@ import Utils 1.0 components: [ SceneLoader { source: parent.source - onStatusChanged: { + onStatusChanged: function(status) { if (status == SceneLoader.Ready) { textureCount = sceneLoaderPostProcess(sceneLoaderEntity) faceCount = Scene3DHelper.faceCount(sceneLoaderEntity) diff --git a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml index e4a94969..d8471ffc 100644 --- a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml +++ b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml @@ -108,11 +108,11 @@ SfmDataEntity { ObjectPicker { id: cameraPicker property point pos - onPressed: { + onPressed: function(pick) { pos = pick.position; pick.accepted = (pick.buttons & Qt.LeftButton) && cameraPickingEnabled } - onReleased: { + onReleased: function(pick) { const delta = Qt.point(Math.abs(pos.x - pick.position.x), Math.abs(pos.y - pick.position.y)); // only trigger picking when mouse has not moved between press and release if (delta.x + delta.y < 4) diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 8086201d..54388f3b 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -84,7 +84,7 @@ FocusScope { } ] - Keys.onPressed: { + Keys.onPressed: function(event) { if (event.key === Qt.Key_F) { resetCameraPosition(); } else if (Qt.Key_1 <= event.key && event.key < Qt.Key_1 + Viewer3DSettings.renderModes.length) { From 570d88e040346aff8c4ac79104d9f6232b8a3220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:52:15 +0200 Subject: [PATCH 20/64] [qt6] Stop enabling HighDpiScaling which is now deprecated --- meshroom/ui/app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index f9bc827c..56809b44 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -202,8 +202,6 @@ class MeshroomApp(QApplication): } logging.getLogger().setLevel(logStringToPython[args.verbose]) - QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) - super(MeshroomApp, self).__init__(QtArgs) self.setOrganizationName('AliceVision') From f6a9e5d59c0b3705096391d2b65f7aca792688f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:53:09 +0200 Subject: [PATCH 21/64] [qt6][Viewer3D] Remove `PointSize` render state `PointSize` is not supported by RHI. --- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 54388f3b..c451cca9 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -197,10 +197,6 @@ FocusScope { buffers : ClearBuffers.ColorDepthBuffer RenderStateSet { renderStates: [ - PointSize { - sizeMode: Viewer3DSettings.fixedPointSize ? PointSize.Fixed : PointSize.Programmable - value: Viewer3DSettings.pointSize - }, DepthTest { depthFunction: DepthTest.Less } ] } From 2b569c1fd8432776bb81cb9e322b5b369d27a4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:03:56 +0200 Subject: [PATCH 22/64] [qt6][Viewer3D] Inspector3D: Set color for labels in Inspector --- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 38 +++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index 02ea8d6f..ab40c6d3 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -238,7 +238,8 @@ FloatingPane { label: { var id = undefined // Ensure there are entries in resectionGroups and a valid resectionId before accessing anything - if (Viewer3DSettings.resectionId !== undefined && Viewer3DSettings.resectionGroups.length > 0) + if (Viewer3DSettings.resectionId !== undefined && Viewer3DSettings.resectionGroups && + Viewer3DSettings.resectionGroups.length > 0) id = Math.min(Viewer3DSettings.resectionId, Viewer3DSettings.resectionIdCount) if (id !== undefined && Viewer3DSettings.resectionGroups[id] !== undefined) return Viewer3DSettings.resectionGroups[id] @@ -253,9 +254,11 @@ FloatingPane { iconText: MaterialIcons.auto_awesome_motion label: { let currentCameras = 0 - for (let i = 0; i <= Viewer3DSettings.resectionIdCount; i++) { - if (i <= Viewer3DSettings.resectionId) - currentCameras += Viewer3DSettings.resectionGroups[i] + if (Viewer3DSettings.resectionGroups) { + for (let i = 0; i <= Viewer3DSettings.resectionIdCount; i++) { + if (i <= Viewer3DSettings.resectionId) + currentCameras += Viewer3DSettings.resectionGroups[i] + } } return currentCameras @@ -268,8 +271,10 @@ FloatingPane { iconText: MaterialIcons.videocam label: { let totalCameras = 0 - for (let i = 0; i <= Viewer3DSettings.resectionIdCount; i++) { - totalCameras += Viewer3DSettings.resectionGroups[i] + if (Viewer3DSettings.resectionGroups) { + for (let i = 0; i <= Viewer3DSettings.resectionIdCount; i++) { + totalCameras += Viewer3DSettings.resectionGroups[i] + } } return totalCameras @@ -523,6 +528,7 @@ FloatingPane { topPadding: 3 bottomPadding: topPadding text: model.label + color: palette.text opacity: model.valid ? 1.0 : 0.6 elide: Text.ElideMiddle font.weight: mediaListView.currentIndex === index ? Font.DemiBold : Font.Normal @@ -554,25 +560,37 @@ FloatingPane { spacing: 1 visible: model.vertexCount MaterialLabel { text: MaterialIcons.grain } - Label { text: Format.intToString(model.vertexCount) } + Label { + text: Format.intToString(model.vertexCount) + color: palette.text + } } RowLayout { spacing: 1 visible: model.faceCount MaterialLabel { text: MaterialIcons.details; rotation: -180 } - Label { text: Format.intToString(model.faceCount) } + Label { + text: Format.intToString(model.faceCount) + color: palette.text + } } RowLayout { spacing: 1 visible: model.cameraCount MaterialLabel { text: MaterialIcons.videocam } - Label { text: model.cameraCount } + Label { + text: model.cameraCount + color: palette.text + } } RowLayout { spacing: 1 visible: model.textureCount MaterialLabel { text: MaterialIcons.texture } - Label { text: model.textureCount } + Label { + text: model.textureCount + color: palette.text + } } } } From 05e7d9eaee1259c6196af52bea3108fdba9a1654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:12:25 +0200 Subject: [PATCH 23/64] [qt6] Use JS functions format to declare explicit parameters in slots --- meshroom/ui/qml/GraphEditor/AttributePin.qml | 14 +++++++------- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 6 +++--- meshroom/ui/qml/ImageGallery/ImageGallery.qml | 4 ++-- meshroom/ui/qml/WorkspaceView.qml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index cf008822..0a68fa20 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -114,20 +114,20 @@ RowLayout { ) { // Refuse attributes connection drag.accepted = false - } else if (inputDragTarget.attribute.isLink) { // already connected attribute + } else if (inputDragTarget.attribute.isLink) { // Already connected attribute root.edgeAboutToBeRemoved(inputDragTarget.attribute) } inputDropArea.acceptableDrop = drag.accepted } onExited: { - if (inputDragTarget.attribute.isLink) { // already connected attribute + if (inputDragTarget.attribute.isLink) { // Already connected attribute root.edgeAboutToBeRemoved(undefined) } acceptableDrop = false drag.source.dropAccepted = false } - onDropped: { + onDropped: function(drop) { root.edgeAboutToBeRemoved(undefined) _reconstruction.addEdge(drag.source.attribute, inputDragTarget.attribute) } @@ -249,10 +249,10 @@ RowLayout { property bool acceptableDrop: false - // add negative margins for DropArea to make the connection zone easier to reach + // Add negative margins for DropArea to make the connection zone easier to reach anchors.fill: parent anchors.margins: -2 - // add horizontal negative margins according to the current layout + // Add horizontal negative margins according to the current layout anchors.leftMargin: -root.width * 0.2 keys: [outputDragTarget.objectName] @@ -267,7 +267,7 @@ RowLayout { ) { // Refuse attributes connection drag.accepted = false - } else if (drag.source.attribute.isLink) { // already connected attribute + } else if (drag.source.attribute.isLink) { // Already connected attribute root.edgeAboutToBeRemoved(drag.source.attribute) } outputDropArea.acceptableDrop = drag.accepted @@ -277,7 +277,7 @@ RowLayout { acceptableDrop = false } - onDropped: function(drag) { + onDropped: function(drop) { root.edgeAboutToBeRemoved(undefined) _reconstruction.addEdge(outputDragTarget.attribute, drag.source.attribute) } diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 0c986929..b027a950 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -968,12 +968,12 @@ Item { }) } - onDropped: { + onDropped: function(drop) { if (nbMeshroomScenes == nbDraggedFiles || nbMeshroomScenes == 0) { - // retrieve mouse position and convert coordinate system + // Retrieve mouse position and convert coordinate system // from pixel values to graph reference system var mousePosition = mapToItem(draggable, drag.x, drag.y) - // send the list of files, + // Send the list of files, // to create the corresponding nodes or open another scene filesDropped(drop, mousePosition) } else { diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index f90b23d5..03242168 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -442,12 +442,12 @@ Panel { anchors.fill: parent enabled: !m.readOnly && !intrinsicsFilterButton.checked keys: ["text/uri-list"] - onEntered: { + onEntered: function(drag) { nbDraggedFiles = drag.urls.length filesByType = _reconstruction.getFilesByTypeFromDrop(drag.urls) nbMeshroomScenes = filesByType["meshroomScenes"].length } - onDropped: { + onDropped: function(drop) { var augmentSfm = augmentArea.hovered if (nbMeshroomScenes == nbDraggedFiles || nbMeshroomScenes == 0) { root.filesDropped(filesByType, augmentSfm) diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index 4edb9959..3d9c31d4 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -178,7 +178,7 @@ Item { DropArea { anchors.fill: parent keys: ["text/uri-list"] - onDropped: { + onDropped: function(drop) { viewer2D.loadExternal(drop.urls[0]); } } From 77bd2a71453368b454ebf6d7e8ec4b76f6253702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:19:11 +0200 Subject: [PATCH 24/64] [qt6][Viewer] Viewer2D: Trigger auto-fit() on correct events The fit must be automatically triggered when the size of the image changes. In case the image size remains the same but the orientation tag is updated, this means that the displayed size of the image has changed (with the orientation taken into account, the width and height might end up being inverted), so the fit should also be triggered. --- meshroom/ui/qml/Viewer/Viewer2D.qml | 46 +++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 47ba04de..6fc13b3b 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -40,6 +40,7 @@ FocusScope { property bool fittedOnce: false property int previousWidth: -1 property int previousHeight: -1 + property int previousOrientationTag: 1 QtObject { id: m @@ -57,7 +58,7 @@ FocusScope { property variant imgMetadata: { // Metadata from FloatImage viewer // Directly read from the image file on disk - if (floatImageViewerLoader.active) { + if (floatImageViewerLoader.active && floatImageViewerLoader.item) { return floatImageViewerLoader.item.metadata } // Use viewpoint metadata for the special case of the 8-bit viewer @@ -154,27 +155,30 @@ FocusScope { } } - // functions + // Functions function fit() { - // make sure the image is ready for use - if (!imgContainer.image) - return + // Make sure the image is ready for use + if (!imgContainer.image || imgContainer.orientationTag == undefined) { + return false + } - // for Exif orientation tags 5 to 8, a 90 degrees rotation is applied + // For Exif orientation tags 5 to 8, a 90 degrees rotation is applied // therefore image dimensions must be inverted let dimensionsInverted = ["5", "6", "7", "8"].includes(imgContainer.orientationTag) let orientedWidth = dimensionsInverted ? imgContainer.image.height : imgContainer.image.width let orientedHeight = dimensionsInverted ? imgContainer.image.width : imgContainer.image.height - // fit oriented image + // Fit oriented image imgContainer.scale = Math.min(imgLayout.width / orientedWidth, root.height / orientedHeight) imgContainer.x = Math.max((imgLayout.width - orientedWidth * imgContainer.scale) * 0.5, 0) imgContainer.y = Math.max((imgLayout.height - orientedHeight * imgContainer.scale) * 0.5, 0) - // correct position when image dimensions are inverted + // Correct position when image dimensions are inverted // so that container center corresponds to image center imgContainer.x += (orientedWidth - imgContainer.image.width) * 0.5 * imgContainer.scale imgContainer.y += (orientedHeight - imgContainer.image.height) * 0.5 * imgContainer.scale + + return true } function tryLoadNode(node) { @@ -477,12 +481,10 @@ FocusScope { orientationTag: imgContainer.orientationTag xOrigin: imgContainer.width / 2 yOrigin: imgContainer.height / 2 - + property real targetSize: Math.max(width, height) * imgContainer.scale 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 @@ -499,14 +501,17 @@ FocusScope { 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() + var ret = fit() + if (!ret) + return root.fittedOnce = true root.previousWidth = width root.previousHeight = height + if (orientationTag != undefined) + root.previousOrientationTag = orientationTag } } @@ -521,6 +526,21 @@ FocusScope { } } + onOrientationTagChanged: { + /* For images of the same width and height but with different orientations, the auto-fit + * will not be triggered by the "widthChanged()" signal, so it needs to be triggered upon + * either a change in the image's size or in its orientation. */ + if (orientationTag != undefined && root.previousOrientationTag != orientationTag) { + var ret = fit() + if (!ret) + return + root.fittedOnce = true + root.previousWidth = width + root.previousHeight = height + root.previousOrientationTag = orientationTag + } + } + onActiveChanged: { if (active) { // Instantiate and initialize a FloatImage component dynamically using Loader.setSource From 240188c0b42cd7f59e3dd95bf386056482934d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:22:08 +0200 Subject: [PATCH 25/64] [qt6][Viewer3D] Disable wireframe mode Disable and hide the wireframe mode as the shaders need to be updated for RHI. --- meshroom/ui/qml/Viewer3D/DepthMapLoader.qml | 4 ++-- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 2 +- meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml | 8 ++++---- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 10 +++++++--- meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 4 ++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml index 0f07ff91..8ec7b0d4 100644 --- a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml +++ b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml @@ -9,6 +9,6 @@ DepthMapEntity { pointSize: Viewer3DSettings.pointSize * (Viewer3DSettings.fixedPointSize ? 1.0 : 0.001) // map render modes to custom visualization modes - displayMode: Viewer3DSettings.renderMode == 1 ? DepthMapEntity.Points : DepthMapEntity.Triangles - displayColor: Viewer3DSettings.renderMode == 2 + displayMode: Viewer3DSettings.renderMode == 0 ? DepthMapEntity.Points : DepthMapEntity.Triangles + displayColor: Viewer3DSettings.renderMode == 1 } diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index ab40c6d3..aa2ea093 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -14,7 +14,7 @@ FloatingPane { implicitWidth: 200 - property int renderMode: 2 + property int renderMode: 1 property Grid3D grid: null property MediaLibrary mediaLibrary property Camera camera diff --git a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml index 9061b228..a6baeb8e 100644 --- a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml @@ -56,10 +56,10 @@ Entity { name: "Solid" PropertyChanges { target: m; material: solid } }, - State { + /* State { name: "Wireframe" PropertyChanges { target: m; material: wireframe } - }, + }, */ State { name: "Textured" PropertyChanges { @@ -106,7 +106,7 @@ Entity { } } - WireframeMaterial { + /* WireframeMaterial { id: wireframe objectName: "WireframeMaterial" effect: WireframeEffect {} @@ -114,7 +114,7 @@ Entity { diffuse: root.diffuseColor shininess: 0 specular: root.specular - } + } */ SphericalHarmonicsMaterial { id: shMaterial diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index c451cca9..d2d636c1 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -16,7 +16,7 @@ import Utils 1.0 FocusScope { id: root - property int renderMode: 2 + property int renderMode: 1 readonly property alias library: mediaLibrary readonly property alias mainCamera: mainCamera @@ -284,13 +284,17 @@ FocusScope { } FloatingPane { - visible: Viewer3DSettings.renderMode == 3 + visible: Viewer3DSettings.renderMode == 2 anchors.bottom: renderModesPanel.top GridLayout { columns: 2 rowSpacing: 0 - RadioButton { text: "SHL File"; autoExclusive: true; checked: true } + RadioButton { + text: "SHL File" + autoExclusive: true + checked: true + } TextField { text: Viewer3DSettings.shlFile selectByMouse: true diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index 1ac2a4ad..8e946a21 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -29,12 +29,12 @@ Item { // Available render modes readonly property var renderModes: [ // Can't use ListModel because of MaterialIcons expressions {"name": "Solid", "icon": MaterialIcons.crop_din }, - {"name": "Wireframe", "icon": MaterialIcons.details }, + /* {"name": "Wireframe", "icon": MaterialIcons.details }, */ {"name": "Textured", "icon": MaterialIcons.texture }, {"name": "Spherical Harmonics", "icon": MaterialIcons.brightness_7} ] // Current render mode - property int renderMode: 2 + property int renderMode: 1 // Spherical Harmonics file property string shlFile: "" From 92e56673ed8970ffc55a7769d1552754cf40f2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:23:22 +0200 Subject: [PATCH 26/64] [qt6] Use JS functions format to declare explicit parameters in slots --- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 2 +- meshroom/ui/qml/WorkspaceView.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index d2d636c1..7c314152 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -239,7 +239,7 @@ FocusScope { } ] - onPressed: { + onPressed: function(pick) { if (pick.button === Qt.LeftButton) { mainCamera.viewCenter = pick.worldIntersection } diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index 3d9c31d4..22b602ea 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -84,7 +84,7 @@ Item { cameraInitIndex: reconstruction ? reconstruction.cameraInitIndex : -1 onRemoveImageRequest: function(attribute) { reconstruction.removeImage(attribute) } onAllViewpointsCleared: reconstruction.selectedViewId = "-1" - onFilesDropped: { + onFilesDropped: function(drop, augmentSfm) { if (drop["meshroomScenes"].length == 1) { ensureSaved(function() { if (reconstruction.handleFilesUrl(drop, augmentSfm ? null : cameraInit)) { From fb5a8820749bc21ef301ad5d9c4c6ddda81c1844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:24:48 +0200 Subject: [PATCH 27/64] [qt6][core] Don't store `SignalInstance` in dict for node computations When converting the `StatusData` to a dictionary, only data attributes should be stored in said dictionary. With Qt6, the `objectNameChanged` signal, of type `SignalInstance`, is added to the dictionary. It needs to be removed manually as it is not JSON-serializable. Otherwise, the nodes cannot be computed anymore. --- meshroom/core/node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index f6b4a85f..5ee0676b 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -116,8 +116,11 @@ class StatusData(BaseObject): def toDict(self): d = self.__dict__.copy() - d.pop('destroyed', None) # skip non data attributes from BaseObject d["elapsedTimeStr"] = self.elapsedTimeStr + + # Skip non data attributes from BaseObject + d.pop("destroyed", None) + d.pop("objectNameChanged", None) return d def fromDict(self, d): From 9867773953380778dd2211bb0c29dc1efbadec83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:28:02 +0200 Subject: [PATCH 28/64] [qt6][GraphEditor] Check for object's existence before accessing it --- meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index a6d212b5..edbf1523 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -43,7 +43,7 @@ RowLayout { Pane { background: Rectangle { id: background - color: object.validValue ? Qt.darker(parent.palette.window, 1.1) : Qt.darker(Colors.red, 1.5) + color: object != undefined && object.validValue ? Qt.darker(parent.palette.window, 1.1) : Qt.darker(Colors.red, 1.5) } padding: 0 Layout.preferredWidth: labelWidth || implicitWidth @@ -67,8 +67,10 @@ RowLayout { text: object.label color: { - if ((object.hasOutputConnections || object.isLink) && !object.enabled) return Colors.lightgrey - else return palette.text + if (object != undefined && (object.hasOutputConnections || object.isLink) && !object.enabled) + return Colors.lightgrey + else + return palette.text } // Tooltip hint with attribute's description From 66c39633b4bca07b9110df87167ece4792856d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:29:13 +0200 Subject: [PATCH 29/64] [qt6][Viewer3D] Use `DiffuseMapMaterial` for texture display Replace `DiffuseSpecularMaterial`, which does not seem to support correctly textures anymore, with `DiffuseMapMaterial`. --- meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml index a6baeb8e..78d4174b 100644 --- a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml @@ -93,7 +93,7 @@ Entity { objectName: "VertexColorMaterial" } - DiffuseSpecularMaterial { + DiffuseMapMaterial { id: textured objectName: "TexturedMaterial" ambient: root.ambient From fbe72a0ad6022aa39d0a5f2dd685b91bc58dc63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:35:48 +0200 Subject: [PATCH 30/64] [qt6][GraphEditor] Correctly detect clicks on edges --- meshroom/ui/qml/GraphEditor/Edge.qml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/Edge.qml b/meshroom/ui/qml/GraphEditor/Edge.qml index f490cc23..ef21e06a 100644 --- a/meshroom/ui/qml/GraphEditor/Edge.qml +++ b/meshroom/ui/qml/GraphEditor/Edge.qml @@ -133,10 +133,14 @@ Item { EdgeMouseArea { id: edgeArea anchors.fill: parent - curveScale: cubic.ctrlPtDist / root.width // normalize by width + curveScale: cubic.ctrlPtDist / root.width // Normalize by width acceptedButtons: Qt.LeftButton | Qt.RightButton thickness: root.thickness + 4 - onPressed: root.pressed(arguments[0]) // can't get named args, use arguments array - onReleased: root.released(arguments[0]) + onPressed: function(event) { + root.pressed(event) + } + onReleased: function(event) { + root.released(event) + } } } From 8007bc51e82a96b2871bea3a61b687ddbfc6e3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:38:46 +0200 Subject: [PATCH 31/64] [qt6][GraphEditor] Set preferred size for the list of chunks --- meshroom/ui/qml/GraphEditor/ChunksListView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/ChunksListView.qml index 3feb5532..d1ba17f2 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/ChunksListView.qml @@ -79,7 +79,7 @@ ColumnLayout { id: chunkDelegate property var chunk: object text: index - width: parent ? parent.width : 0 + width: ListView.view.width leftPadding: 8 onClicked: { chunksLV.forceActiveFocus() From 9fb8ea83fb8007cd7e8a247d7dc80844de517933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:40:50 +0200 Subject: [PATCH 32/64] [qt6][Viewer] Fix display of metadata --- meshroom/ui/qml/Viewer/ImageMetadataView.qml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/meshroom/ui/qml/Viewer/ImageMetadataView.qml b/meshroom/ui/qml/Viewer/ImageMetadataView.qml index 384627e3..412f02db 100644 --- a/meshroom/ui/qml/Viewer/ImageMetadataView.qml +++ b/meshroom/ui/qml/Viewer/ImageMetadataView.qml @@ -32,11 +32,11 @@ FloatingPane { var values = value.split(",") var result = 0 for (var i = 0; i < values.length; ++i) { - // divide each component by the corresponding power of 60 + // Divide each component by the corresponding power of 60 // 1 for degree, 60 for minutes, 3600 for seconds result += Number(values[i]) / Math.pow(60, i) } - // handle opposite reference: South (latitude) or West (longitude) + // Handle opposite reference: South (latitude) or West (longitude) return (ref === "S" || ref === "W") ? -result : result } @@ -63,14 +63,14 @@ FloatingPane { id: metadataModel property var metadata: ({}) - // reset model when metadata changes + // Reset model when metadata changes onMetadataChanged: { metadataModel.clear() var entries = [] - // prepare data to populate the model from the input metadata object + // Prepare data to populate the model from the input metadata object for (var key in metadata) { var entry = {} - // split on ":" to get group and key + // Split on ":" to get group and key var i = key.lastIndexOf(":") if (i === -1) { i = key.lastIndexOf("/") @@ -80,7 +80,7 @@ FloatingPane { entry["group"] = key.substr(0, i) entry["key"] = key.substr(i+1) } else { - // set default group to something convenient for sorting + // Set default group to something convenient for sorting entry["group"] = "-" entry["key"] = key } @@ -104,7 +104,7 @@ FloatingPane { MouseArea { anchors.fill: parent acceptedButtons: Qt.MiddleButton - onWheel: wheel.accepted = true + onWheel: function(wheel) { wheel.accepted = true } } // Main Layout @@ -175,7 +175,7 @@ FloatingPane { sortRole: "raw" filters: [{role: "raw", value: searchBar.text}] delegate: RowLayout { - width: parent ? parent.width : 0 + width: ListView.view.width Label { text: key leftPadding: 6 From f06c5a266380f8818cdf5e47bd3a5c38a2b15af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:41:57 +0200 Subject: [PATCH 33/64] [qt6][MaterialIcons] Fix disabled buttons' behaviour when interacted with --- meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml | 2 +- meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml index ac87699b..287069bc 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml @@ -19,7 +19,7 @@ ToolButton { } background: Rectangle { color: { - if (pressed || checked || hovered) { + if (enabled && (pressed || checked || hovered)) { if (pressed || checked) return Qt.darker(parent.palette.base, 1.3) if (hovered) diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml index 7a1238dc..5ec9ecc7 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml @@ -41,7 +41,7 @@ ToolButton { } background: Rectangle { color: { - if (pressed || checked || hovered) { + if (enabled && (pressed || checked || hovered)) { if (pressed || checked) return Qt.darker(parent.palette.base, 1.3) if (hovered) From 645b822e563ad2527f8525b1fd802f1301a8c2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:42:44 +0200 Subject: [PATCH 34/64] [qt6][GraphEditor] Fix the width for the TaskManager's list --- meshroom/ui/qml/GraphEditor/TaskManager.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/qml/GraphEditor/TaskManager.qml b/meshroom/ui/qml/GraphEditor/TaskManager.qml index 971076cf..c82229b3 100644 --- a/meshroom/ui/qml/GraphEditor/TaskManager.qml +++ b/meshroom/ui/qml/GraphEditor/TaskManager.qml @@ -134,7 +134,7 @@ Item { } delegate: RowLayout { - width: parent != null ? parent.width : undefined + width: ListView.view.width height: 18 spacing: 3 From e97575a901dda016c0bda0f05109c46fff601820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:45:03 +0200 Subject: [PATCH 35/64] [qt6][qml] Remove `QtQuick.Window` imports `QtQuick.Window` does not exist anymore with Qt6. QQuickWindow is now directly part of the QtQuick module. --- meshroom/ui/qml/Application.qml | 1 - meshroom/ui/qml/main.qml | 1 - 2 files changed, 2 deletions(-) diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index a2ff70f8..d547b9a9 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -3,7 +3,6 @@ import QtCore import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtQuick.Window import QtQml.Models import Qt.labs.platform 1.0 as Platform diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index d6e49f0d..f7174446 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -2,7 +2,6 @@ import QtCore import QtQuick import QtQuick.Controls -import QtQuick.Window import QtQuick.Dialogs import Qt.labs.platform 1.0 as Platform From ec139defb7545628a3c4b808f1375678625f25fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 17:48:49 +0200 Subject: [PATCH 36/64] [qt6][ImageGallery] IntrinsicDisplay: Harmonize naming of components --- .../ImageGallery/IntrinsicDisplayDelegate.qml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml index 30a05ebc..55ff3b35 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml @@ -50,11 +50,11 @@ RowLayout { if (!attribute) return undefined switch (attribute.type) { - case "ChoiceParam": return choice_component - case "IntParam": return int_component - case "FloatParam": return float_component - case "BoolParam": return bool_component - case "StringParam": return textField_component + case "ChoiceParam": return choiceComponent + case "IntParam": return intComponent + case "FloatParam": return floatComponent + case "BoolParam": return boolComponent + case "StringParam": return textFieldComponent default: return undefined } } @@ -63,7 +63,7 @@ RowLayout { } Component { - id: textField_component + id: textFieldComponent TextInput { text: attribute.value width: intrinsicModel.columnWidths[columnIndex] @@ -82,14 +82,14 @@ RowLayout { _reconstruction.setAttribute(attribute, text) } Component.onDestruction: { - if(activeFocus) + if (activeFocus) _reconstruction.setAttribute(attribute, text) } } } Component { - id: int_component + id: intComponent TextInput { text: model.display.value @@ -122,7 +122,7 @@ RowLayout { } Component { - id: choice_component + id: choiceComponent ComboBox { id: combo model: attribute.desc !== undefined ? attribute.desc.values : undefined @@ -147,7 +147,7 @@ RowLayout { } Component { - id: bool_component + id: boolComponent CheckBox { checked: attribute ? attribute.value : false padding: 12 @@ -157,7 +157,7 @@ RowLayout { } Component { - id: float_component + id: floatComponent TextInput { readonly property real formattedValue: attribute.value.toFixed(2) property string displayValue: String(formattedValue) @@ -180,9 +180,9 @@ RowLayout { autoScroll: activeFocus - //Use this function to ensure the left part is visible - //while keeping the trick for formatting the text - //Timing issues otherwise + // Use this function to ensure the left part is visible + // while keeping the trick for formatting the text + // Timing issues otherwise onActiveFocusChanged: { if (activeFocus) text = String(attribute.value) From de966e38e57c11810d9cc4a60312219a07c5ae3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 2 Oct 2024 17:46:29 +0200 Subject: [PATCH 37/64] [qt6][ui] AboutDialog: Display PySide's version --- meshroom/ui/app.py | 4 +++- meshroom/ui/qml/AboutDialog.qml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index 56809b44..7725bd18 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -4,6 +4,7 @@ import re import argparse import json +from PySide6 import __version__ as PySideVersion from PySide6 import QtCore from PySide6.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings from PySide6.QtGui import QIcon @@ -537,7 +538,8 @@ class MeshroomApp(QApplication): import sys return { 'platform': '{} {}'.format(platform.system(), platform.release()), - 'python': 'Python {}'.format(sys.version.split(" ")[0]) + 'python': 'Python {}'.format(sys.version.split(" ")[0]), + 'pyside': 'PySide6 {}'.format(PySideVersion) } systemInfo = Property(QJsonValue, _systemInfo, constant=True) diff --git a/meshroom/ui/qml/AboutDialog.qml b/meshroom/ui/qml/AboutDialog.qml index d455b703..449df27f 100644 --- a/meshroom/ui/qml/AboutDialog.qml +++ b/meshroom/ui/qml/AboutDialog.qml @@ -56,7 +56,8 @@ Dialog { selectByMouse: true text: "Version " + Qt.application.version + "\n" + MeshroomApp.systemInfo["platform"] + " \n" - + MeshroomApp.systemInfo["python"] + + MeshroomApp.systemInfo["python"] + "\n" + + MeshroomApp.systemInfo["pyside"] } } From 54b59d0c5e34dcbd7f3387aa5a23a37aed318c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 2 Oct 2024 17:49:17 +0200 Subject: [PATCH 38/64] [qt6][qml] Push `Application` on the stack before loading the project This prevents crashes when the project is done loading but `Application` is not yet ready. --- meshroom/ui/qml/Homepage.qml | 4 ++-- meshroom/ui/qml/main.qml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meshroom/ui/qml/Homepage.qml b/meshroom/ui/qml/Homepage.qml index a102af70..71163f58 100644 --- a/meshroom/ui/qml/Homepage.qml +++ b/meshroom/ui/qml/Homepage.qml @@ -373,10 +373,10 @@ Page { Connections { target: projectDelegate function onClicked() { - if (!modelData["path"]){ + if (!modelData["path"]) { initFileDialogFolder(openFileDialog) openFileDialog.open() - } else{ + } else { // Open project mainStack.push("Application.qml") if (_reconstruction.loadUrl(modelData["path"])) { diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index f7174446..2772ffa8 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -119,12 +119,12 @@ ApplicationWindow { title: "Open File" nameFilters: ["Meshroom Graphs (*.mg)"] onAccepted: { - if (_reconstruction.loadUrl(currentFile)) { - MeshroomApp.addRecentProjectFile(currentFile.toString()) - } if (mainStack.currentItem instanceof Homepage) { mainStack.push("Application.qml") } + if (_reconstruction.loadUrl(currentFile)) { + MeshroomApp.addRecentProjectFile(currentFile.toString()) + } } } From 8eebe5ecb92be2af2dca366c0ace9658a9cdb0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 2 Oct 2024 19:22:07 +0200 Subject: [PATCH 39/64] [qt6][qml] Homepage: Improve minimum width --- meshroom/ui/qml/Homepage.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/meshroom/ui/qml/Homepage.qml b/meshroom/ui/qml/Homepage.qml index 71163f58..39380a03 100644 --- a/meshroom/ui/qml/Homepage.qml +++ b/meshroom/ui/qml/Homepage.qml @@ -22,7 +22,6 @@ Page { anchors.fill: parent Item { - SplitView.minimumWidth: 250 SplitView.preferredWidth: 330 SplitView.maximumWidth: 500 From 49a3fcb72fb8129f1c487c2871721f1d24d0245c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 3 Oct 2024 11:29:41 +0200 Subject: [PATCH 40/64] [qt6][Viewer] Viewer2D: Remove outdated `sfmRequired` property --- meshroom/ui/qml/Viewer/Viewer2D.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 6fc13b3b..658eff98 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -556,7 +556,6 @@ FocusScope { 'surface.gridColor': Qt.binding(function() { return lensDistortionImageToolbar.color }), 'surface.subdivisions': Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }), 'viewerTypeString': Qt.binding(function() { return displayLensDistortionViewer.checked ? "distortion" : "hdr" }), - 'sfmRequired': Qt.binding(function() { return displayLensDistortionViewer.checked ? true : false }), 'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }), 'canBeHovered': false, 'idView': Qt.binding(function() { return ((root.displayedNode && !root.displayedNode.hasSequenceOutput && _reconstruction) ? _reconstruction.selectedViewId : -1) }), From 4933911f0bf2f441e8dc9d109dd7ebe38f21adff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 8 Oct 2024 11:37:46 +0200 Subject: [PATCH 41/64] [components] Edge: Remove use of deprecated functions QMouseEvent::x() and QMouseEvent::y() have been marked as deprecated and should be replaced with QMouseEvent::position().x() and QMouseEvent::position().y(). --- meshroom/ui/components/edge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/components/edge.py b/meshroom/ui/components/edge.py index d802d5b6..4108fc6a 100755 --- a/meshroom/ui/components/edge.py +++ b/meshroom/ui/components/edge.py @@ -9,8 +9,8 @@ class MouseEvent(QObject): """ def __init__(self, evt): super(MouseEvent, self).__init__() - self._x = evt.x() - self._y = evt.y() + self._x = evt.position().x() + self._y = evt.position().y() self._button = evt.button() self._modifiers = evt.modifiers() From 52444ef0ad0bd8e745470746896e0bbfeeb2d82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 8 Oct 2024 17:23:38 +0200 Subject: [PATCH 42/64] =?UTF-8?q?[GraphEditor]=C2=A0Edge:=20Set=20curve=20?= =?UTF-8?q?scale=20after=20initializing=20`EdgeMouseArea`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The curve scale of the mouse area for an edge used to be defined when initializing the `EdgeMouseArea` for that edge. Setting it triggers a chain of event that allow the mouse area to be active, thus correctly detecting when it is being hovered or clicked on. With Qt6, these events unfolded before the `EdgeMouseArea` had finished initializing, which then caused it to not be active until the edge's shape was modified (and the chain of events triggered again). It is now set once the component has been created, so all the events can happen in an environment where they are taken into account. --- meshroom/ui/qml/GraphEditor/Edge.qml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/Edge.qml b/meshroom/ui/qml/GraphEditor/Edge.qml index ef21e06a..cccb1e70 100644 --- a/meshroom/ui/qml/GraphEditor/Edge.qml +++ b/meshroom/ui/qml/GraphEditor/Edge.qml @@ -41,7 +41,7 @@ Item { Shape { anchors.fill: parent - // cause rendering artifacts when enabled (and don't support hot reload really well) + // Cause rendering artifacts when enabled (and don't support hot reload really well) vendorExtensionsEnabled: false opacity: 0.7 @@ -54,7 +54,7 @@ Item { strokeColor: "#3E3E3E" strokeStyle: edge !== undefined && ((edge.src !== undefined && edge.src.isOutput) || edge.dst === undefined) ? ShapePath.SolidLine : ShapePath.DashLine strokeWidth: 1 - // final visual width of this path (never below 1) + // Final visual width of this path (never below 1) readonly property real visualWidth: Math.max(strokeWidth, 1) dashPattern: [6 / visualWidth, 4 / visualWidth] capStyle: ShapePath.RoundCap @@ -81,7 +81,7 @@ Item { strokeColor: root.isForLoop ? root.color : "transparent" strokeStyle: edge !== undefined && ((edge.src !== undefined && edge.src.isOutput) || edge.dst === undefined) ? ShapePath.SolidLine : ShapePath.DashLine strokeWidth: root.thickness - // final visual width of this path (never below 1) + // Final visual width of this path (never below 1) readonly property real visualWidth: Math.max(strokeWidth, 1) dashPattern: [6 / visualWidth, 4 / visualWidth] capStyle: ShapePath.RoundCap @@ -99,7 +99,7 @@ Item { } } Item { - // place the label at the middle of the edge + // Place the label at the middle of the edge x: (root.startX + root.endX) / 2 y: (root.startY + root.endY) / 2 visible: root.isForLoop @@ -127,13 +127,11 @@ Item { onClicked: root.pressed(arguments[0]) } } - } EdgeMouseArea { id: edgeArea anchors.fill: parent - curveScale: cubic.ctrlPtDist / root.width // Normalize by width acceptedButtons: Qt.LeftButton | Qt.RightButton thickness: root.thickness + 4 onPressed: function(event) { @@ -142,5 +140,12 @@ Item { onReleased: function(event) { root.released(event) } + + Component.onCompleted: { + /* The curve scale must be set only once the component has been fully created, so + * that all the events following the update of the curve scale can be taken into + * account */ + curveScale = cubic.ctrlPtDist / root.width // Normalize by width + } } } From 039504782f55de3593ba05f4c5c6d7e3649967b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 10 Oct 2024 19:31:56 +0200 Subject: [PATCH 43/64] [qt6][GraphEditor] Fix connections to `ListAttribute` pins The callbacks of `childrenRepeater` (which was used to "fill" `ListAttributes` with children) were not correctly set. Their prototypes were missing the `index` argument, meaning that instead of being provided with the child attribute that was added or deleted, they were provided with its index in the model. The added children attributes were also instatiated as empty attribute pins that were still visible, thus increasing indirectly the spacing of the initial pin. --- meshroom/ui/qml/GraphEditor/AttributePin.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index 0a68fa20..fafc0142 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -58,10 +58,11 @@ RowLayout { Repeater { id: childrenRepeater model: isList && !attribute.isLink ? attribute.value : 0 - onItemAdded: function(item) { childPinCreated(item.childAttribute, item) } - onItemRemoved: function(item) { childPinDeleted(item.childAttribute, item) } + onItemAdded: function(index, item) { childPinCreated(item.childAttribute, root) } + onItemRemoved: function(index, item) { childPinDeleted(item.childAttribute, root) } delegate: Item { property var childAttribute: object + visible: false } } From c5be7e7cd44e5bb3915a8a57081ba750774ae069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 10 Oct 2024 20:26:27 +0200 Subject: [PATCH 44/64] [qt6][Charts] InteractiveChartView: Remove dead code and useless imports --- .../ui/qml/Charts/InteractiveChartView.qml | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/meshroom/ui/qml/Charts/InteractiveChartView.qml b/meshroom/ui/qml/Charts/InteractiveChartView.qml index 1ad222b1..2434c0cb 100644 --- a/meshroom/ui/qml/Charts/InteractiveChartView.qml +++ b/meshroom/ui/qml/Charts/InteractiveChartView.qml @@ -1,15 +1,7 @@ import QtQuick -import QtQuick.Controls import QtQuick.Layouts -import QtPositioning 6.6 -import QtLocation 6.6 import QtCharts -import Controls 1.0 -import MaterialIcons 2.2 -import Utils 1.0 - - ChartView { id: root antialiasing: true @@ -25,32 +17,11 @@ ChartView { MouseArea { anchors.fill: parent - property double degreeToScale: 1.0 / 120.0 // default mouse scroll is 15 degree + property double degreeToScale: 1.0 / 120.0 // Default mouse scroll is 15 degree acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - // onWheel: { - // console.warn("root.plotArea before: " + root.plotArea) - // var zoomFactor = wheel.angleDelta.y > 0 ? 1.0 / (1.0 + wheel.angleDelta.y * degreeToScale) : (1.0 + Math.abs(wheel.angleDelta.y) * degreeToScale) - - // // var mouse_screen = Qt.point(wheel.x, wheel.y) - // var mouse_screen = mapToItem(root, wheel.x, wheel.y) - // var mouse_normalized = Qt.point(mouse_screen.x / plotZone.width, mouse_screen.y / plotZone.height) - // var mouse_plot = Qt.point(mouse_normalized.x * plotZone.width, mouse_normalized.y * plotZone.height) - - // // var p = mapToValue(mouse_screen, root.series(0)) - // // var pMin = mapToValue(mouse_screen, Qt.point(root.axisX().min, root.axisY().min)) - // // var pMax = mapToValue(mouse_screen, Qt.point(root.axisX().max, root.axisY().max)) - // // console.warn("p: " + p) - - // // Qt.rect() - // var r = Qt.rect(mouse_plot.x, mouse_plot.y, plotZone.width * zoomFactor, plotZone.height * zoomFactor) - // //var r = Qt.rect(pMin.x, pMin.y, (pMax.x-pMin.x) / 2, (pMax.y-pMin.y) / 2) - // root.zoomIn(r) - // } onClicked: { root.zoomReset() } } } - - } From b12d1fed06068479f345f8dd802e5157e0b4d523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 11 Oct 2024 12:08:49 +0200 Subject: [PATCH 45/64] [qt6][qml] Remove unnecessary module imports --- meshroom/ui/qml/Controls/Group.qml | 2 -- meshroom/ui/qml/Controls/KeyValue.qml | 4 +--- meshroom/ui/qml/DialogsFactory.qml | 1 - meshroom/ui/qml/GraphEditor/AttributeEditor.qml | 3 --- meshroom/ui/qml/GraphEditor/AttributePin.qml | 1 - meshroom/ui/qml/GraphEditor/ChunksListView.qml | 3 --- meshroom/ui/qml/GraphEditor/NodeLog.qml | 3 --- meshroom/ui/qml/GraphEditor/NodeStatistics.qml | 4 ---- meshroom/ui/qml/GraphEditor/NodeStatus.qml | 5 ----- meshroom/ui/qml/GraphEditor/TaskManager.qml | 1 - .../ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml | 3 --- meshroom/ui/qml/Viewer/CameraResponseGraph.qml | 4 ---- meshroom/ui/qml/Viewer/HdrImageToolbar.qml | 1 - meshroom/ui/qml/Viewer/SfmGlobalStats.qml | 6 ------ meshroom/ui/qml/Viewer/SfmStatsView.qml | 5 ----- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 1 - meshroom/ui/qml/WorkspaceView.qml | 9 +++------ 17 files changed, 4 insertions(+), 52 deletions(-) diff --git a/meshroom/ui/qml/Controls/Group.qml b/meshroom/ui/qml/Controls/Group.qml index 42de2898..988bc357 100644 --- a/meshroom/ui/qml/Controls/Group.qml +++ b/meshroom/ui/qml/Controls/Group.qml @@ -2,8 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import MaterialIcons 2.2 - /** * A custom GroupBox with predefined header. */ diff --git a/meshroom/ui/qml/Controls/KeyValue.qml b/meshroom/ui/qml/Controls/KeyValue.qml index 55a01c2e..51743e1f 100644 --- a/meshroom/ui/qml/Controls/KeyValue.qml +++ b/meshroom/ui/qml/Controls/KeyValue.qml @@ -2,8 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import MaterialIcons 2.2 - /** * KeyValue allows to create a list of key/value, like a table. */ @@ -50,4 +48,4 @@ Rectangle { background: Rectangle { anchors.fill: parent; color: Qt.darker(activePalette.window, 1.05) } } } -} \ No newline at end of file +} diff --git a/meshroom/ui/qml/DialogsFactory.qml b/meshroom/ui/qml/DialogsFactory.qml index 58d0f22e..10290840 100644 --- a/meshroom/ui/qml/DialogsFactory.qml +++ b/meshroom/ui/qml/DialogsFactory.qml @@ -1,5 +1,4 @@ import QtQuick -import MaterialIcons 2.2 import Controls 1.0 /** diff --git a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml index a0c568c2..15c187b0 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml @@ -1,9 +1,6 @@ import QtQuick -import QtQuick.Layouts import QtQuick.Controls -import MaterialIcons 2.2 -import Utils 1.0 import Controls 1.0 /** diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index fafc0142..b768ef52 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import MaterialIcons 2.2 import Utils 1.0 /** diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/ChunksListView.qml index d1ba17f2..fdac5274 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/ChunksListView.qml @@ -2,9 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import MaterialIcons 2.2 -import Controls 1.0 - import "common.js" as Common /** diff --git a/meshroom/ui/qml/GraphEditor/NodeLog.qml b/meshroom/ui/qml/GraphEditor/NodeLog.qml index d9bf37df..4678cd0b 100644 --- a/meshroom/ui/qml/GraphEditor/NodeLog.qml +++ b/meshroom/ui/qml/GraphEditor/NodeLog.qml @@ -3,9 +3,6 @@ import QtQuick.Controls import QtQuick.Layouts import Controls 1.0 -import MaterialIcons 2.2 - -import "common.js" as Common /** * NodeLog displays log and statistics data of Node's chunks (NodeChunks) diff --git a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml index 07a6ad54..559af662 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml @@ -3,10 +3,6 @@ import QtQuick.Controls import QtQuick.Layouts import Controls 1.0 -import MaterialIcons 2.2 -import Utils 1.0 - -import "common.js" as Common /** * NodeLog displays log and statistics data of Node's chunks (NodeChunks) diff --git a/meshroom/ui/qml/GraphEditor/NodeStatus.qml b/meshroom/ui/qml/GraphEditor/NodeStatus.qml index 0d46cc40..7596e832 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatus.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatus.qml @@ -2,11 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Controls 1.0 -import MaterialIcons 2.2 - -import "common.js" as Common - /** * NodeLog displays log and statistics data of Node's chunks (NodeChunks) * diff --git a/meshroom/ui/qml/GraphEditor/TaskManager.qml b/meshroom/ui/qml/GraphEditor/TaskManager.qml index c82229b3..d9e3ca33 100644 --- a/meshroom/ui/qml/GraphEditor/TaskManager.qml +++ b/meshroom/ui/qml/GraphEditor/TaskManager.qml @@ -3,7 +3,6 @@ import QtQuick.Controls import QtQuick.Layouts import Controls 1.0 -import MaterialIcons 2.2 import Utils 1.0 Item { diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml index 55ff3b35..97d1b63f 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml @@ -2,9 +2,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls -import MaterialIcons 2.2 -import Utils 1.0 - RowLayout { id: root diff --git a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml index e97d9cb2..b9015edd 100644 --- a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml +++ b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml @@ -2,15 +2,11 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtPositioning 6.6 -import QtLocation 6.6 import QtCharts import Charts 1.0 import Controls 1.0 import DataObjects 1.0 -import MaterialIcons 2.2 -import Utils 1.0 FloatingPane { id: root diff --git a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml index 018d3541..5ef3f14c 100644 --- a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml +++ b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml @@ -3,7 +3,6 @@ import QtQuick.Controls import QtQuick.Layouts import Controls 1.0 -import MaterialIcons 2.2 FloatingPane { id: root diff --git a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml index 0b8e3511..be0e11b1 100644 --- a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml +++ b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml @@ -2,15 +2,9 @@ import QtCharts import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtPositioning 6.6 -import QtLocation 6.6 import AliceVision 1.0 as AliceVision import Charts 1.0 -import Controls 1.0 -import MaterialIcons 2.2 -import Utils 1.0 - FloatingPane { id: root diff --git a/meshroom/ui/qml/Viewer/SfmStatsView.qml b/meshroom/ui/qml/Viewer/SfmStatsView.qml index ce3ff783..e2d697ce 100644 --- a/meshroom/ui/qml/Viewer/SfmStatsView.qml +++ b/meshroom/ui/qml/Viewer/SfmStatsView.qml @@ -2,14 +2,9 @@ import QtCharts import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtPositioning 6.6 -import QtLocation 6.6 import AliceVision 1.0 as AliceVision import Charts 1.0 -import Controls 1.0 -import MaterialIcons 2.2 -import Utils 1.0 FloatingPane { diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 7c314152..9c24caeb 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtQml.Models import QtQuick.Scene3D 2.6 import Qt3D.Core 2.6 import Qt3D.Render 2.6 diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index 22b602ea..9cd36bd4 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -2,21 +2,18 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Qt.labs.platform 1.0 as Platform - +import Controls 1.0 +import MaterialIcons 2.2 import ImageGallery 1.0 import Viewer 1.0 import Viewer3D 1.0 -import MaterialIcons 2.2 -import Controls 1.0 -import Utils 1.0 - /** * WorkspaceView is an aggregation of Meshroom's main modules. * * It contains an ImageGallery, a 2D and a 3D viewer to manipulate and visualize reconstruction data. */ + Item { id: root From 5a0b1c0c9547b0d00f3f10fae6994d6d8ea0b45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 10 Oct 2024 20:18:51 +0200 Subject: [PATCH 46/64] [qt6][qml] Clean-up code and harmonize comments --- meshroom/ui/qml/AboutDialog.qml | 13 +- meshroom/ui/qml/Charts/ChartViewCheckBox.qml | 2 +- meshroom/ui/qml/Charts/ChartViewLegend.qml | 5 +- meshroom/ui/qml/Controls/ColorChart.qml | 9 +- meshroom/ui/qml/Controls/FloatingPane.qml | 7 +- meshroom/ui/qml/Controls/Group.qml | 6 +- meshroom/ui/qml/Controls/KeyValue.qml | 7 +- meshroom/ui/qml/Controls/MessageDialog.qml | 4 +- meshroom/ui/qml/Controls/Panel.qml | 2 +- meshroom/ui/qml/Controls/SearchBar.qml | 4 +- meshroom/ui/qml/Controls/TabPanel.qml | 22 +- meshroom/ui/qml/Controls/TextFileViewer.qml | 23 +- meshroom/ui/qml/DialogsFactory.qml | 1 + .../ui/qml/GraphEditor/AttributeEditor.qml | 4 +- .../qml/GraphEditor/AttributeItemDelegate.qml | 43 ++-- meshroom/ui/qml/GraphEditor/AttributePin.qml | 51 ++-- .../ui/qml/GraphEditor/ChunksListView.qml | 1 + .../ui/qml/GraphEditor/CompatibilityBadge.qml | 7 +- .../qml/GraphEditor/CompatibilityManager.qml | 13 +- meshroom/ui/qml/GraphEditor/Edge.qml | 10 +- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 70 +++--- .../qml/GraphEditor/GraphEditorSettings.qml | 2 +- meshroom/ui/qml/GraphEditor/Node.qml | 2 +- meshroom/ui/qml/GraphEditor/NodeChunks.qml | 9 +- .../ui/qml/GraphEditor/NodeDocumentation.qml | 1 + meshroom/ui/qml/GraphEditor/NodeEditor.qml | 16 +- meshroom/ui/qml/GraphEditor/NodeLog.qml | 4 +- .../ui/qml/GraphEditor/NodeStatistics.qml | 3 +- meshroom/ui/qml/GraphEditor/NodeStatus.qml | 13 +- meshroom/ui/qml/GraphEditor/StatViewer.qml | 36 ++- meshroom/ui/qml/GraphEditor/TaskManager.qml | 1 - meshroom/ui/qml/GraphEditor/common.js | 1 - meshroom/ui/qml/ImageGallery/ImageBadge.qml | 7 +- .../ui/qml/ImageGallery/ImageDelegate.qml | 9 +- meshroom/ui/qml/ImageGallery/ImageGallery.qml | 17 +- .../ImageGallery/IntrinsicDisplayDelegate.qml | 2 +- .../qml/ImageGallery/IntrinsicsIndicator.qml | 8 +- .../ui/qml/ImageGallery/SensorDBDialog.qml | 1 - meshroom/ui/qml/LiveSfmView.qml | 3 +- meshroom/ui/qml/MaterialIcons/MLabel.qml | 2 +- .../ui/qml/MaterialIcons/MaterialLabel.qml | 2 +- .../qml/MaterialIcons/MaterialToolButton.qml | 2 +- .../qml/MaterialIcons/MaterialToolLabel.qml | 2 +- .../MaterialIcons/MaterialToolLabelButton.qml | 2 +- meshroom/ui/qml/Utils/Clipboard.qml | 1 + meshroom/ui/qml/Utils/Colors.qml | 1 + meshroom/ui/qml/Utils/Scene3DHelper.qml | 1 - .../ui/qml/Utils/SortFilterDelegateModel.qml | 45 ++-- .../ui/qml/Utils/Transformations3DHelper.qml | 3 +- meshroom/ui/qml/Utils/format.js | 14 +- .../ui/qml/Viewer/CameraResponseGraph.qml | 8 +- meshroom/ui/qml/Viewer/ColorCheckerEntity.qml | 9 +- meshroom/ui/qml/Viewer/ColorCheckerPane.qml | 3 - meshroom/ui/qml/Viewer/ColorCheckerViewer.qml | 7 +- .../ui/qml/Viewer/FeaturesInfoOverlay.qml | 14 +- meshroom/ui/qml/Viewer/FeaturesViewer.qml | 3 +- meshroom/ui/qml/Viewer/FloatImage.qml | 1 - meshroom/ui/qml/Viewer/HdrImageToolbar.qml | 13 +- meshroom/ui/qml/Viewer/ImageMetadataView.qml | 3 +- .../ui/qml/Viewer/LensDistortionToolbar.qml | 5 +- meshroom/ui/qml/Viewer/PanoramaToolbar.qml | 6 +- meshroom/ui/qml/Viewer/PanoramaViewer.qml | 48 ++-- meshroom/ui/qml/Viewer/SfmGlobalStats.qml | 2 - meshroom/ui/qml/Viewer/SfmStatsView.qml | 2 - .../ui/qml/Viewer/TestAliceVisionPlugin.qml | 1 + meshroom/ui/qml/Viewer/Viewer2D.qml | 228 ++++++++++-------- meshroom/ui/qml/Viewer3D/BoundingBox.qml | 4 +- .../qml/Viewer3D/DefaultCameraController.qml | 15 +- meshroom/ui/qml/Viewer3D/DepthMapLoader.qml | 3 +- .../ui/qml/Viewer3D/EnvironmentMapEntity.qml | 2 +- meshroom/ui/qml/Viewer3D/Grid3D.qml | 37 ++- meshroom/ui/qml/Viewer3D/ImageOverlay.qml | 10 +- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 2 +- meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml | 7 +- .../Materials/SphericalHarmonicsMaterial.qml | 12 +- meshroom/ui/qml/Viewer3D/MediaCache.qml | 6 +- meshroom/ui/qml/Viewer3D/MediaLibrary.qml | 23 +- meshroom/ui/qml/Viewer3D/MediaLoader.qml | 52 ++-- .../ui/qml/Viewer3D/MediaLoaderEntity.qml | 2 +- .../ui/qml/Viewer3D/SfMTransformGizmo.qml | 3 +- meshroom/ui/qml/Viewer3D/TransformGizmo.qml | 33 +-- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 14 +- meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 15 +- meshroom/ui/qml/Viewer3D/ViewpointCamera.qml | 3 +- meshroom/ui/qml/main.qml | 3 +- 85 files changed, 575 insertions(+), 538 deletions(-) diff --git a/meshroom/ui/qml/AboutDialog.qml b/meshroom/ui/qml/AboutDialog.qml index 449df27f..ed25fde0 100644 --- a/meshroom/ui/qml/AboutDialog.qml +++ b/meshroom/ui/qml/AboutDialog.qml @@ -5,7 +5,10 @@ import Utils 1.0 import MaterialIcons 2.2 -/// Meshroom "About" window +/** + * Meshroom "About" window + */ + Dialog { id: root @@ -24,7 +27,7 @@ Dialog { modal: true closePolicy: Dialog.CloseOnEscape | Dialog.CloseOnPressOutside padding: 30 - topPadding: 0 // header provides top padding + topPadding: 0 // Header provides top padding header: Pane { background: Item {} @@ -175,16 +178,16 @@ Dialog { sourceComponent: ScrollView { Component.onCompleted: { - // try to load the local file + // Try to load the local file var url = Filepath.stringToUrl(modelData.localUrl) - // fallback to the online url if file is not found + // Fallback to the online url if file is not found if (!Filepath.exists(url)) url = modelData.onlineUrl Request.get(url, function(xhr) { if (xhr.readyState === XMLHttpRequest.DONE) { - // status is OK + // Status is OK if (xhr.status === 200) textArea.text = MeshroomApp.markdownToHtml(xhr.responseText) else diff --git a/meshroom/ui/qml/Charts/ChartViewCheckBox.qml b/meshroom/ui/qml/Charts/ChartViewCheckBox.qml index 34c5e0ac..e3af3345 100644 --- a/meshroom/ui/qml/Charts/ChartViewCheckBox.qml +++ b/meshroom/ui/qml/Charts/ChartViewCheckBox.qml @@ -1,10 +1,10 @@ import QtQuick import QtQuick.Controls - /** * A custom CheckBox designed to be used in ChartView's legend. */ + CheckBox { id: root diff --git a/meshroom/ui/qml/Charts/ChartViewLegend.qml b/meshroom/ui/qml/Charts/ChartViewLegend.qml index bc1e836d..66cb9f24 100644 --- a/meshroom/ui/qml/Charts/ChartViewLegend.qml +++ b/meshroom/ui/qml/Charts/ChartViewLegend.qml @@ -2,12 +2,12 @@ import QtQuick import QtQuick.Controls import QtCharts - /** * ChartViewLegend is an interactive legend component for ChartViews. * It provides a CheckBox for each series that can control its visibility, * and highlight on hovering. */ + Flow { id: root @@ -49,7 +49,6 @@ Flow { } Repeater { - // ChartView series can't be accessed directly as a model. // Use an intermediate ListModel populated with those series. model: ListModel { @@ -70,7 +69,7 @@ Flow { root.hoveredSeries = null } - // hovered serie properties override + // Hovered serie properties override states: [ State { when: series && root.hoveredSeries === series diff --git a/meshroom/ui/qml/Controls/ColorChart.qml b/meshroom/ui/qml/Controls/ColorChart.qml index f6f38774..e2ebb028 100644 --- a/meshroom/ui/qml/Controls/ColorChart.qml +++ b/meshroom/ui/qml/Controls/ColorChart.qml @@ -7,6 +7,7 @@ import Utils 1.0 * ColorChart is a color picker based on a set of predefined colors. * It takes the form of a ToolButton that pops-up its palette when pressed. */ + ToolButton { id: root @@ -28,10 +29,10 @@ ToolButton { id: palettePopup padding: 4 - // content width is missing side padding (hence the + padding*2) + // Content width is missing side padding (hence the + padding*2) implicitWidth: colorChart.contentItem.width + padding * 2 - // center the current color + // Center the current color y: -(root.height - padding) / 2 x: -colorChart.currentItem.x - padding @@ -44,14 +45,14 @@ ToolButton { spacing: 2 currentIndex: root.currentIndex model: root.colors - // display each color as a ToolButton with a custom background + // Display each color as a ToolButton with a custom background delegate: ToolButton { padding: 0 width: root.width height: root.height background: Rectangle { color: modelData - // display border of current/selected item + // Display border of current/selected item border.width: hovered || index === colorChart.currentIndex ? 1 : 0 border.color: Colors.sysPalette.midlight } diff --git a/meshroom/ui/qml/Controls/FloatingPane.qml b/meshroom/ui/qml/Controls/FloatingPane.qml index 6f3d28ed..3b83d4da 100644 --- a/meshroom/ui/qml/Controls/FloatingPane.qml +++ b/meshroom/ui/qml/Controls/FloatingPane.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts * FloatingPane provides a Pane with a slightly transparent default background * using palette.base as color. Useful to create floating toolbar/overlays. */ + Pane { id: root @@ -14,5 +15,9 @@ Pane { padding: 6 anchors.margins: 2 - background: Rectangle { color: root.palette.base; opacity: opaque ? 1.0 : 0.7; radius: root.radius } + background: Rectangle { + color: root.palette.base + opacity: opaque ? 1.0 : 0.7 + radius: root.radius + } } diff --git a/meshroom/ui/qml/Controls/Group.qml b/meshroom/ui/qml/Controls/Group.qml index 988bc357..554c6ea2 100644 --- a/meshroom/ui/qml/Controls/Group.qml +++ b/meshroom/ui/qml/Controls/Group.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts /** * A custom GroupBox with predefined header. */ + GroupBox { id: root @@ -20,13 +21,14 @@ GroupBox { background: Item {} label: Pane { + padding: 2 + width: root.width background: Rectangle { id: labelBg color: palette.base opacity: 0.8 } - padding: 2 - width: root.width + RowLayout { width: parent.width Label { diff --git a/meshroom/ui/qml/Controls/KeyValue.qml b/meshroom/ui/qml/Controls/KeyValue.qml index 51743e1f..fe60c289 100644 --- a/meshroom/ui/qml/Controls/KeyValue.qml +++ b/meshroom/ui/qml/Controls/KeyValue.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts /** * KeyValue allows to create a list of key/value, like a table. */ + Rectangle { property alias key: keyLabel.text property alias value: valueText.text @@ -19,7 +20,6 @@ Rectangle { Rectangle { anchors.margins: 2 color: Qt.darker(activePalette.window, 1.1) - // Layout.preferredWidth: sizeHandle.x Layout.minimumWidth: 10.0 * Qt.application.font.pixelSize Layout.maximumWidth: 15.0 * Qt.application.font.pixelSize Layout.fillWidth: false @@ -45,7 +45,10 @@ Rectangle { readOnly: true selectByMouse: true - background: Rectangle { anchors.fill: parent; color: Qt.darker(activePalette.window, 1.05) } + background: Rectangle { + anchors.fill: parent + color: Qt.darker(activePalette.window, 1.05) + } } } } diff --git a/meshroom/ui/qml/Controls/MessageDialog.qml b/meshroom/ui/qml/Controls/MessageDialog.qml index d70d47bd..0213854f 100644 --- a/meshroom/ui/qml/Controls/MessageDialog.qml +++ b/meshroom/ui/qml/Controls/MessageDialog.qml @@ -16,7 +16,7 @@ Dialog { default property alias children: layout.children - // the content of this MessageDialog as a string + // The content of this MessageDialog as a string readonly property string asString: titleLabel.text + "\n\n" + text + "\n" + detailedText + "\n" + helperText + "\n" /// Return the text content of this dialog as a simple string. @@ -40,7 +40,7 @@ Dialog { rightPadding: leftPadding background: Item { - // hidden text edit to perform copy in clipboard + // Hidden text edit to perform copy in clipboard TextEdit { id: textContent visible: false diff --git a/meshroom/ui/qml/Controls/Panel.qml b/meshroom/ui/qml/Controls/Panel.qml index c1ff38ad..f280cbce 100644 --- a/meshroom/ui/qml/Controls/Panel.qml +++ b/meshroom/ui/qml/Controls/Panel.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - /** * Panel is a container control with preconfigured header/footer. * @@ -12,6 +11,7 @@ import QtQuick.Layouts * * The footer is empty (and not visible) by default. It does not provided any layout. */ + Page { id: root diff --git a/meshroom/ui/qml/Controls/SearchBar.qml b/meshroom/ui/qml/Controls/SearchBar.qml index 9adb0155..1ba6923e 100644 --- a/meshroom/ui/qml/Controls/SearchBar.qml +++ b/meshroom/ui/qml/Controls/SearchBar.qml @@ -4,10 +4,10 @@ import QtQuick.Layouts import MaterialIcons 2.2 - /** * Basic SearchBar component with an appropriate icon and a TextField. */ + FocusScope { property alias textField: field property alias text: field.text @@ -36,7 +36,7 @@ FocusScope { Layout.fillWidth: true selectByMouse: true - // ensure the field has focus when the text is modified + // Ensure the field has focus when the text is modified onTextChanged: { forceActiveFocus() } diff --git a/meshroom/ui/qml/Controls/TabPanel.qml b/meshroom/ui/qml/Controls/TabPanel.qml index 69acbe79..60e813a4 100644 --- a/meshroom/ui/qml/Controls/TabPanel.qml +++ b/meshroom/ui/qml/Controls/TabPanel.qml @@ -47,16 +47,16 @@ Page { } Rectangle { - property bool commonBorder : false + property bool commonBorder: false - property int lBorderwidth : index === mainTabBar.currentIndex ? 2 : 1 - property int rBorderwidth : index === mainTabBar.currentIndex ? 2 : 1 - property int tBorderwidth : index === mainTabBar.currentIndex ? 2 : 1 - property int bBorderwidth : 0 + property int lBorderwidth: index === mainTabBar.currentIndex ? 2 : 1 + property int rBorderwidth: index === mainTabBar.currentIndex ? 2 : 1 + property int tBorderwidth: index === mainTabBar.currentIndex ? 2 : 1 + property int bBorderwidth: 0 - property int commonBorderWidth : 1 + property int commonBorderWidth: 1 - z : -1 + z: -1 color: Qt.darker(root.palette.window, 1.50) @@ -66,10 +66,10 @@ Page { top: parent.top bottom: parent.bottom - topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth - bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth - leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth - rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth + topMargin: commonBorder ? -commonBorderWidth : -tBorderwidth + bottomMargin: commonBorder ? -commonBorderWidth : -bBorderwidth + leftMargin: commonBorder ? -commonBorderWidth : -lBorderwidth + rightMargin: commonBorder ? -commonBorderWidth : -rBorderwidth } } } diff --git a/meshroom/ui/qml/Controls/TextFileViewer.qml b/meshroom/ui/qml/Controls/TextFileViewer.qml index 1de42b41..e5f8f809 100644 --- a/meshroom/ui/qml/Controls/TextFileViewer.qml +++ b/meshroom/ui/qml/Controls/TextFileViewer.qml @@ -9,6 +9,7 @@ import Utils 1.0 * Text file viewer with auto-reload feature. * Uses a ListView with one delegate by line instead of a TextArea for performance reasons. */ + Item { id: root @@ -115,7 +116,7 @@ Item { clip: true focus: true - // custom key navigation handling + // Custom key navigation handling keyNavigationEnabled: false highlightFollowsCurrentItem: true highlightMoveDuration: 0 @@ -145,14 +146,14 @@ Item { } function setText(value) { - // store current first index + // Store current first index var topIndex = firstVisibleIndex() - // store whether autoscroll to bottom is active + // Store whether autoscroll to bottom is active var scrollToBottom = atYEnd && autoscroll.checked - // replace text + // Replace text text = value - // restore content position by either: + // Restore content position by either: // - autoscrolling to bottom if (scrollToBottom) positionViewAtEnd() @@ -183,7 +184,7 @@ Item { // TextMetrics for textual progress bar TextMetrics { id: progressMetrics - // total number of character in textual progress bar + // Total number of character in textual progress bar property int count: 51 property string character: '*' text: character.repeat(count) @@ -230,15 +231,15 @@ Item { Loader { id: delegateLoader Layout.fillWidth: true - // default line delegate + // Default line delegate sourceComponent: line_component - // line delegate selector based on content + // Line delegate selector based on content StateGroup { states: [ State { name: "progressBar" - // detect textual progressbar (non empty line with only progressbar character) + // Detect textual progressbar (non-empty line with only progressbar character) when: logLine.line.trim().length && logLine.line.split(progressMetrics.character).length - 1 === logLine.line.trim().length PropertyChanges { @@ -281,7 +282,7 @@ Item { Keys.forwardTo: [textView] color: { - // color line according to log level + // Color line according to log level if (text.indexOf("[warning]") >= 0) return Colors.orange else if(text.indexOf("[error]") >= 0) @@ -350,7 +351,7 @@ Item { if (xhr.readyState === XMLHttpRequest.DONE) { textView.setText(xhr.status === 200 ? xhr.responseText : "") loading = false - // re-trigger reload source file + // Re-trigger reload source file if (autoReload) reloadTimer.restart() } diff --git a/meshroom/ui/qml/DialogsFactory.qml b/meshroom/ui/qml/DialogsFactory.qml index 10290840..ab24e55e 100644 --- a/meshroom/ui/qml/DialogsFactory.qml +++ b/meshroom/ui/qml/DialogsFactory.qml @@ -4,6 +4,7 @@ import Controls 1.0 /** * DialogsFactory is utility object to instantiate generic purpose Dialogs. */ + QtObject { readonly property string defaultErrorText: "An unexpected error has occurred" diff --git a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml index 15c187b0..940df7a1 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml @@ -56,12 +56,10 @@ ListView { } } - // Helper MouseArea to lose edit/activeFocus - // when clicking on the background + // Helper MouseArea to lose edit/activeFocus when clicking on the background MouseArea { anchors.fill: parent onClicked: forceActiveFocus() z: -1 } } - diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index edbf1523..774524b0 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -8,18 +8,19 @@ import Utils 1.0 import Controls 1.0 /** - Instantiate a control to visualize and edit an Attribute based on its type. -*/ + * Instantiate a control to visualize and edit an Attribute based on its type. + */ + RowLayout { id: root property variant attribute: null - property bool readOnly: false // whether the attribute's value can be modified + property bool readOnly: false // Whether the attribute's value can be modified property bool objectsHideable: true property string filterText: "" - property alias label: parameterLabel // accessor to the internal Label (attribute's name) - property int labelWidth // shortcut to set the fixed size of the Label + property alias label: parameterLabel // Accessor to the internal Label (attribute's name) + property int labelWidth // Shortcut to set the fixed size of the Label readonly property bool editable: !attribute.isOutput && !attribute.isLink && !readOnly @@ -91,10 +92,10 @@ RowLayout { delay: 800 } - // make label bold if attribute's value is not the default one + // Make label bold if attribute's value is not the default one font.bold: !object.isOutput && !object.isDefault - // make label italic if attribute is a link + // Make label italic if attribute is a link font.italic: object.isLink MouseArea { @@ -295,7 +296,7 @@ RowLayout { anchors.fill: parent acceptedButtons: Qt.RightButton onClicked: function(mouse) { - // Do not loose the selection during the right click + // Do not lose the selection during the right click textField.persistentSelection = true // We store the status of the activeFocus before opening the popup textField.memoryActiveFocus = textField.activeFocus @@ -321,7 +322,7 @@ RowLayout { Clipboard.clear() Clipboard.setText(attribute.value) } else { - // copy selection only + // Copy selection only textField.copy() } } @@ -331,12 +332,12 @@ RowLayout { enabled: Clipboard.getText() != "" && !readOnly onTriggered: { if (textField.memoryActiveFocus) { - // replace the selected text with the clipboard + // Replace the selected text with the clipboard // or if there is no selection insert at the cursor position var before = textField.text.substr(0, textField.selectionStart) var after = textField.text.substr(textField.selectionEnd, textField.text.length) setTextFieldAttribute(before + Clipboard.getText() + after) - // set the cursor at the end of the added text + // Set the cursor at the end of the added text textField.cursorPosition = before.length + Clipboard.getText().length } else { setTextFieldAttribute(Clipboard.getText()) @@ -473,7 +474,7 @@ RowLayout { inputModel: attribute.values Component.onCompleted: { - // if value not in list, override the text and precise it is not valid + // If value not in list, override the text and precise it is not valid var idx = find(attribute.value) if (idx === -1) { displayText = attribute.value @@ -490,10 +491,10 @@ RowLayout { Connections { target: attribute function onValueChanged() { - // when reset, clear and find the current index + // When reset, clear and find the current index // but if only reopen the combo box, keep the current value - //convert all values of desc values as string + // Convert all values of desc values as string var valuesAsString = attribute.values.map(function(value) { return value.toString() }) @@ -521,9 +522,9 @@ RowLayout { onToggled: { var t = attribute.value if (!checked) { - t.splice(t.indexOf(modelData), 1) // remove element + t.splice(t.indexOf(modelData), 1) // Remove element } else { - t.push(modelData) // add element + t.push(modelData) // Add element } _reconstruction.setAttribute(attribute, t) } @@ -541,12 +542,12 @@ RowLayout { } DoubleValidator { id: doubleValidator - locale: 'C' // use '.' decimal separator disregarding the system locale + locale: 'C' // Use '.' decimal separator disregarding the system locale } implicitWidth: 100 Layout.fillWidth: !slider.active enabled: root.editable - // cast value to string to avoid intrusive scientific notations on numbers + // Cast value to string to avoid intrusive scientific notations on numbers property string displayValue: String(slider.active && slider.item.pressed ? slider.item.formattedValue : attribute.value) text: displayValue selectByMouse: true @@ -698,7 +699,7 @@ RowLayout { { 'model': Qt.binding(function() { return attribute.value }), 'readOnly': Qt.binding(function() { return root.readOnly }), - 'labelWidth': 100, // reduce label width for children (space gain) + 'labelWidth': 100, // Reduce label width for children (space gain) 'objectsHideable': Qt.binding(function() { return root.objectsHideable }), 'filterText': Qt.binding(function() { return root.filterText }), }) @@ -714,12 +715,12 @@ RowLayout { TextField { implicitWidth: 100 enabled: root.editable - // cast value to string to avoid intrusive scientific notations on numbers + // Cast value to string to avoid intrusive scientific notations on numbers property string displayValue: String(slider.pressed ? slider.formattedValue : attribute.value) text: displayValue selectByMouse: true validator: DoubleValidator { - locale: 'C' // use '.' decimal separator disregarding the system locale + locale: 'C' // Use '.' decimal separator disregarding the system locale } onEditingFinished: setTextFieldAttribute(text) onAccepted: setTextFieldAttribute(text) diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index b768ef52..d435601b 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -5,8 +5,9 @@ import QtQuick.Layouts import Utils 1.0 /** - The representation of an Attribute on a Node. -*/ + * The representation of an Attribute on a Node. + */ + RowLayout { id: root @@ -43,14 +44,12 @@ RowLayout { x: nameLabel.x } - function updatePin(isSrc, isVisible) - { + function updatePin(isSrc, isVisible) { if (isSrc) { innerOutputAnchor.linkEnabled = isVisible } else { innerInputAnchor.linkEnabled = isVisible } - } // Instantiate empty Items for each child attribute @@ -96,21 +95,21 @@ RowLayout { property bool acceptableDrop: false - // add negative margins for DropArea to make the connection zone easier to reach + // Add negative margins for DropArea to make the connection zone easier to reach anchors.fill: parent anchors.margins: -2 - // add horizontal negative margins according to the current layout + // Add horizontal negative margins according to the current layout anchors.rightMargin: -root.width * 0.3 keys: [inputDragTarget.objectName] onEntered: function(drag) { // Check if attributes are compatible to create a valid connection - if (root.readOnly // cannot connect on a read-only attribute - || drag.source.objectName != inputDragTarget.objectName // not an edge connector - || drag.source.baseType !== inputDragTarget.baseType // not the same base type - || drag.source.nodeItem === inputDragTarget.nodeItem // connection between attributes of the same node - || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children - || drag.source.connectorType === "input" // refuse to connect an "input pin" on another one (input attr can be connected to input attr, but not the graphical pin) + if (root.readOnly // Cannot connect on a read-only attribute + || drag.source.objectName != inputDragTarget.objectName // Not an edge connector + || drag.source.baseType !== inputDragTarget.baseType // Not the same base type + || drag.source.nodeItem === inputDragTarget.nodeItem // Connection between attributes of the same node + || (drag.source.isList && childrenRepeater.count) // Source/target are lists but target already has children + || drag.source.connectorType === "input" // Refuse to connect an "input pin" on another one (input attr can be connected to input attr, but not the graphical pin) ) { // Refuse attributes connection drag.accepted = false @@ -119,6 +118,7 @@ RowLayout { } inputDropArea.acceptableDrop = drag.accepted } + onExited: { if (inputDragTarget.attribute.isLink) { // Already connected attribute root.edgeAboutToBeRemoved(undefined) @@ -161,7 +161,7 @@ RowLayout { drag.smoothed: false enabled: !root.readOnly anchors.fill: parent - // use the same negative margins as DropArea to ease pin selection + // Use the same negative margins as DropArea to ease pin selection anchors.margins: inputDropArea.anchors.margins anchors.leftMargin: inputDropArea.anchors.leftMargin anchors.rightMargin: inputDropArea.anchors.rightMargin @@ -186,14 +186,11 @@ RowLayout { } } - - // Attribute name Item { id: nameContainer - Layout.fillWidth: true implicitHeight: childrenRect.height - + Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter Label { @@ -209,13 +206,13 @@ RowLayout { anchors.right: attribute && attribute.isOutput ? parent.right : undefined rightPadding: 0 color: { - if ((object.hasOutputConnections || object.isLink) && !object.enabled) return Colors.lightgrey + if ((object.hasOutputConnections || object.isLink) && !object.enabled) + return Colors.lightgrey return hovered ? palette.highlight : palette.text } } } - Rectangle { id: outputAnchor @@ -258,12 +255,12 @@ RowLayout { keys: [outputDragTarget.objectName] onEntered: function(drag) { // Check if attributes are compatible to create a valid connection - if (drag.source.objectName != outputDragTarget.objectName // not an edge connector - || drag.source.baseType !== outputDragTarget.baseType // not the same base type - || drag.source.nodeItem === outputDragTarget.nodeItem // connection between attributes of the same node - || (!drag.source.isList && outputDragTarget.isList) // connection between a list and a simple attribute - || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children - || drag.source.connectorType === "output" // refuse to connect an output pin on another one + if (drag.source.objectName != outputDragTarget.objectName // Not an edge connector + || drag.source.baseType !== outputDragTarget.baseType // Not the same base type + || drag.source.nodeItem === outputDragTarget.nodeItem // Connection between attributes of the same node + || (!drag.source.isList && outputDragTarget.isList) // Connection between a list and a simple attribute + || (drag.source.isList && childrenRepeater.count) // Source/target are lists but target already has children + || drag.source.connectorType === "output" // Refuse to connect an output pin on another one ) { // Refuse attributes connection drag.accepted = false @@ -310,7 +307,7 @@ RowLayout { // Move the edge's tip straight to the the current mouse position instead of waiting after the drag operation has started drag.smoothed: false anchors.fill: parent - // use the same negative margins as DropArea to ease pin selection + // Use the same negative margins as DropArea to ease pin selection anchors.margins: outputDropArea.anchors.margins anchors.leftMargin: outputDropArea.anchors.leftMargin anchors.rightMargin: outputDropArea.anchors.rightMargin diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/ChunksListView.qml index fdac5274..10fdec27 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/ChunksListView.qml @@ -7,6 +7,7 @@ import "common.js" as Common /** * ChunkListView */ + ColumnLayout { id: root property variant chunks diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml index dd96c6b8..2a6cc1e9 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml @@ -4,12 +4,13 @@ import QtQuick.Layouts import MaterialIcons 2.2 - -/** Node Badge to inform about compatibility issues +/** + * Node Badge to inform about compatibility issues * Provides 2 delegates (can be set using sourceComponent property): * - iconDelegate (default): icon + tooltip with information about the issue * - bannerDelegate: banner with issue info + upgrade request button -*/ + */ + Loader { id: root diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml index 66c63bdf..3bc955b0 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml @@ -8,17 +8,18 @@ import Utils 1.0 /** * CompatibilityManager summarizes and allows to resolve compatibility issues. -*/ + */ + MessageDialog { id: root - // the UIGraph instance + // The UIGraph instance property var uigraph - // alias to underlying compatibilityNodes model + // Alias to underlying compatibilityNodes model readonly property var nodesModel: uigraph ? uigraph.graph.compatibilityNodes : undefined - // the total number of compatibility issues + // The total number of compatibility issues readonly property int issueCount: (nodesModel !== undefined && nodesModel !== null) ? nodesModel.count : 0 - // the number of CompatibilityNodes that can be upgraded + // The number of CompatibilityNodes that can be upgraded readonly property int upgradableCount: { var count = 0 for (var i = 0; i < issueCount; ++i) { @@ -28,7 +29,7 @@ MessageDialog { return count } - // override MessageDialog.getAsString to add compatibility report + // Override MessageDialog.getAsString to add compatibility report function getAsString() { var t = asString + "\n" t += '-------------------------\n' diff --git a/meshroom/ui/qml/GraphEditor/Edge.qml b/meshroom/ui/qml/GraphEditor/Edge.qml index cccb1e70..d9adbd3e 100644 --- a/meshroom/ui/qml/GraphEditor/Edge.qml +++ b/meshroom/ui/qml/GraphEditor/Edge.qml @@ -6,8 +6,9 @@ import GraphEditor 1.0 import MaterialIcons 2.2 /** - A cubic spline representing an edge, going from point1 to point2, providing mouse interaction. -*/ + * A cubic spline representing an edge, going from point1 to point2, providing mouse interaction. + */ + Item { id: root @@ -69,7 +70,6 @@ Item { control2X: x - ctrlPtDist control2Y: y } - } ShapePath { @@ -98,11 +98,13 @@ Item { } } } + Item { // Place the label at the middle of the edge x: (root.startX + root.endX) / 2 y: (root.startY + root.endY) / 2 visible: root.isForLoop + Rectangle { anchors.centerIn: parent property int margin: 2 @@ -110,6 +112,7 @@ Item { height: icon.height + 2 * margin radius: width color: path.strokeColor + MaterialToolLabel { id: icon anchors.centerIn: parent @@ -120,6 +123,7 @@ Item { color: palette.base ToolTip.text: "Foreach Loop" } + MouseArea { id: loopArea anchors.fill: parent diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index b027a950..bbbeaa9f 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -7,14 +7,15 @@ import MaterialIcons 2.2 import Utils 1.0 /** - A component displaying a Graph (nodes, attributes and edges). -*/ + * A component displaying a Graph (nodes, attributes and edges). + */ + Item { id: root - property variant uigraph: null /// Meshroom ui graph (UIGraph) - readonly property variant graph: uigraph ? uigraph.graph : null /// core graph contained in ui graph - property variant nodeTypesModel: null /// the list of node types that can be instantiated + property variant uigraph: null /// Meshroom UI graph (UIGraph) + readonly property variant graph: uigraph ? uigraph.graph : null /// Core graph contained in the UI graph + property variant nodeTypesModel: null /// The list of node types that can be instantiated property real maxZoom: 2.0 property real minZoom: 0.1 @@ -22,7 +23,7 @@ Item { property var _attributeToDelegate: ({}) - // signals + // Signals signal workspaceMoved() signal workspaceClicked() @@ -34,10 +35,9 @@ Item { property int nbMeshroomScenes: 0 property int nbDraggedFiles: 0 - // Files have been dropped - signal filesDropped(var drop, var mousePosition) + signal filesDropped(var drop, var mousePosition) // Files have been dropped - // trigger initial fit() after initialization + // Trigger initial fit() after initialization // (ensure GraphEditor has its final size) Component.onCompleted: firstFitTimer.start() @@ -215,7 +215,7 @@ Item { onClicked: function(mouse) { if (mouse.button == Qt.RightButton) { - // store mouse click position in 'draggable' coordinates as new node spawn position + // Store mouse click position in 'draggable' coordinates as new node spawn position newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouse.x, mouse.y) newNodeMenu.popup() } @@ -274,7 +274,7 @@ Item { onVisibleChanged: { searchBar.clear() if (visible) { - // when menu is shown, give focus to the TextField filter + // When menu is shown, give focus to the TextField filter searchBar.forceActiveFocus() } } @@ -298,12 +298,12 @@ Item { // Forward key events to the search bar to continue typing seamlessly // even if this delegate took the activeFocus due to mouse hovering Keys.forwardTo: [searchBar.textField] - Keys.onPressed: { + Keys.onPressed: function(event) { event.accepted = false; switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: - // create node on validation (Enter/Return keys) + // Create node on validation (Enter/Return keys) newNodeMenu.createNode(modelData) event.accepted = true break @@ -311,7 +311,7 @@ Item { case Qt.Key_Down: case Qt.Key_Left: case Qt.Key_Right: - break // ignore if arrow key was pressed to let the menu be controlled + break // Ignore if arrow key was pressed to let the menu be controlled default: searchBar.forceActiveFocus() } @@ -326,8 +326,8 @@ Item { name: "invisible" PropertyChanges { target: menuItemDelegate - height: 0 // make sure the item is no visible by setting height to 0 - focusPolicy: Qt.NoFocus // don't grab focus when not visible + height: 0 // Make sure the item is no visible by setting height to 0 + focusPolicy: Qt.NoFocus // Don't grab focus when not visible } } ] @@ -429,7 +429,7 @@ Item { const newSrcAttr = listAttr.value.at(value - 1) const dst = edgeMenu.currentEdge.dst - // if the edge exists do not replace it + // If the edge exists, do not replace it if (newSrcAttr === edgeMenu.currentEdge.src && dst === edgeMenu.currentEdge.dst) { return } @@ -488,7 +488,7 @@ Item { Repeater { id: edgesRepeater - // delay edges loading after nodes (edges needs attribute pins to be created) + // Delay edges loading after nodes (edges needs attribute pins to be created) model: nodeRepeater.loaded && root.graph ? root.graph.edges : undefined delegate: Edge { @@ -512,7 +512,6 @@ Item { } return (inFocus) ? 2 : 1 } - point1x: isValidEdge ? src.globalX + src.outputAnchorPos.x : 0 point1y: isValidEdge ? src.globalY + src.outputAnchorPos.y : 0 point2x: isValidEdge ? dst.globalX + dst.inputAnchorPos.x : 0 @@ -552,7 +551,7 @@ Item { id: nodeMenu property var currentNode: null property bool canComputeNode: currentNode != null && uigraph.graph.canComputeTopologically(currentNode) - //canSubmitOrCompute: return int n : 0 >= n <= 3 | n=0 cannot submit or compute | n=1 can compute | n=2 can submit | n=3 can compute & submit + // canSubmitOrCompute: return int n : 0 >= n <= 3 | n=0 cannot submit or compute | n=1 can compute | n=2 can submit | n=3 can compute & submit property int canSubmitOrCompute: currentNode != null && uigraph.graph.canSubmitOrCompute(currentNode) property bool isComputed: { var count = 0 @@ -601,7 +600,7 @@ Item { } } } - return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit) + return canCompute // canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit) } onTriggered: { @@ -875,12 +874,10 @@ Item { onEdgeAboutToBeRemoved: function(input) { /* - Sometimes the signals are not in the right order - because of weird Qt/QML update order (next DropArea - entered signal before previous DropArea exited signal) - so edgeAboutToBeRemoved must be set to undefined before - it can be set to another attribute object. - */ + * Sometimes the signals are not in the right order because of weird Qt/QML update order + * (next DropArea entered signal before previous DropArea exited signal) so edgeAboutToBeRemoved + * must be set to undefined before it can be set to another attribute object. + */ if (input === undefined) { if (nodeRepeater.temporaryEdgeAboutToBeRemoved === undefined) { root.edgeAboutToBeRemoved = input @@ -899,7 +896,7 @@ Item { onPositionChanged: { if (dragging && uigraph.selectedNodes.contains(node)) { - // update all selected nodes positions with this node that is being dragged + // Update all selected nodes positions with this node that is being dragged for (var i = 0; i < nodeRepeater.count; i++) { var otherNode = nodeRepeater.itemAt(i) if (uigraph.selectedNodes.contains(otherNode.node) && otherNode.node !== node) { @@ -910,10 +907,10 @@ Item { } } - // allow all nodes to know if they are being dragged + // Allow all nodes to know if they are being dragged onDraggingChanged: nodeRepeater.dragging = dragging - // must not be enabled during drag because the other nodes will be slow to match the movement of the node being dragged + // Must not be enabled during drag because the other nodes will be slow to match the movement of the node being dragged Behavior on x { enabled: !nodeRepeater.dragging NumberAnimation { duration: 100 } @@ -1122,12 +1119,12 @@ Item { } function nextItem() { - // compute bounding box + // Compute bounding box var node = nodeRepeater.itemAt(filteredNodes.itemAt(navigation.currentIndex).index_) var bbox = Qt.rect(node.x, node.y, node.width, node.height) - // rescale to fit the bounding box in the view, zoom is limited to prevent huge text + // Rescale to fit the bounding box in the view, zoom is limited to prevent huge text draggable.scale = Math.min(Math.min(root.width / bbox.width, root.height / bbox.height),maxZoom) - // recenter + // Recenter draggable.x = bbox.x*draggable.scale * -1 + (root.width - bbox.width * draggable.scale) * 0.5 draggable.y = bbox.y*draggable.scale * -1 + (root.height - bbox.height * draggable.scale) * 0.5 } @@ -1136,6 +1133,7 @@ Item { function registerAttributePin(attribute, pin) { root._attributeToDelegate[attribute] = pin } + function unregisterAttributePin(attribute, pin) { delete root._attributeToDelegate[attribute] } @@ -1160,11 +1158,11 @@ Item { // Fit graph to fill root function fit() { - // compute bounding box + // Compute bounding box var bbox = boundingBox() - // rescale to fit the bounding box in the view, zoom is limited to prevent huge text + // Rescale to fit the bounding box in the view, zoom is limited to prevent huge text draggable.scale = Math.min(Math.min(root.width / bbox.width, root.height / bbox.height), maxZoom) - // recenter + // Recenter draggable.x = bbox.x * draggable.scale * -1 + (root.width - bbox.width * draggable.scale) * 0.5 draggable.y = bbox.y * draggable.scale * -1 + (root.height - bbox.height * draggable.scale) * 0.5 } diff --git a/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml b/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml index 9013c4ee..2dfb5349 100644 --- a/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml @@ -1,10 +1,10 @@ pragma Singleton import QtCore - /** * Persistent Settings related to the GraphEditor module. */ + Settings { category: 'GraphEditor' property bool showAdvancedAttributes: false diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 7748749a..ac84c345 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -6,10 +6,10 @@ import Qt5Compat.GraphicalEffects import MaterialIcons 2.2 import Utils 1.0 - /** * Visual representation of a Graph Node. */ + Item { id: root diff --git a/meshroom/ui/qml/GraphEditor/NodeChunks.qml b/meshroom/ui/qml/GraphEditor/NodeChunks.qml index 023baf49..5505da7c 100644 --- a/meshroom/ui/qml/GraphEditor/NodeChunks.qml +++ b/meshroom/ui/qml/GraphEditor/NodeChunks.qml @@ -2,8 +2,6 @@ import QtQuick import Utils 1.0 -//import "common.js" as Common - ListView { id: root interactive: false @@ -15,7 +13,7 @@ ListView { property real chunkHeight: height property bool modelIsBig: (3 * model.count >= width) property real chunkWidth: { - if(!model || model.count == 0) + if (!model || model.count == 0) return 0 return (width / model.count) - spacing } @@ -30,13 +28,12 @@ ListView { width: root.chunkWidth property var chunkColor: Colors.getChunkColor(object, { "NONE": root.defaultColor }) color: { - if(!highlightChunks || model.count == 1) + if (!highlightChunks || model.count == 1) return chunkColor - if(index % 2 == 0) + if (index % 2 == 0) return Qt.lighter(chunkColor, 1.1) else return Qt.darker(chunkColor, 1.1) } } } - diff --git a/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml index 13e9296b..da291a00 100644 --- a/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml +++ b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml @@ -9,6 +9,7 @@ import "common.js" as Common /** * Displays Node documentation */ + FocusScope { id: root diff --git a/meshroom/ui/qml/GraphEditor/NodeEditor.qml b/meshroom/ui/qml/GraphEditor/NodeEditor.qml index 9122fb76..d405efa8 100644 --- a/meshroom/ui/qml/GraphEditor/NodeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditor.qml @@ -6,11 +6,11 @@ import Controls 1.0 import MaterialIcons 2.2 import Utils 1.0 - /** * NodeEditor allows to visualize and edit the parameters of a Node. * It mainly provides an attribute editor and a log inspector. */ + Panel { id: root @@ -36,7 +36,7 @@ Panel { if (node !== null && (node.isFinishedOrRunning() || globalStatus == "ERROR")) { computationInfo.text = Format.sec2timeStr(node.elapsedTime) } - else{ + else { computationInfo.text = "" } } @@ -118,6 +118,7 @@ Panel { Menu { id: settingsMenu y: parent.height + Menu { id: filterAttributesMenu title: "Filter Attributes" @@ -139,7 +140,9 @@ Panel { enabled: tabBar.currentIndex === 0 } } + MenuSeparator {} + RowLayout { CheckBox { id: defaultToggle @@ -158,7 +161,9 @@ Panel { enabled: tabBar.currentIndex === 0 } } + MenuSeparator {} + RowLayout { CheckBox { id: linkToggle @@ -177,7 +182,9 @@ Panel { enabled: tabBar.currentIndex === 0 } } + MenuSeparator {} + CheckBox { id: advancedToggle text: "Advanced" @@ -197,7 +204,9 @@ Panel { enabled: root.node !== null onClicked: Qt.openUrlExternally(Filepath.stringToUrl(root.node.internalFolder)) } + MenuSeparator {} + MenuItem { enabled: root.node !== null text: "Clear Pending Status" @@ -209,6 +218,7 @@ Panel { } } } + ColumnLayout { anchors.fill: parent @@ -216,7 +226,7 @@ Panel { Loader { active: root.isCompatibilityNode Layout.fillWidth: true - visible: active // for layout update + visible: active // For layout update sourceComponent: CompatibilityBadge { canUpgrade: root.node.canUpgrade diff --git a/meshroom/ui/qml/GraphEditor/NodeLog.qml b/meshroom/ui/qml/GraphEditor/NodeLog.qml index 4678cd0b..163ffd42 100644 --- a/meshroom/ui/qml/GraphEditor/NodeLog.qml +++ b/meshroom/ui/qml/GraphEditor/NodeLog.qml @@ -5,11 +5,12 @@ import QtQuick.Layouts import Controls 1.0 /** - * NodeLog displays log and statistics data of Node's chunks (NodeChunks) + * NodeLog displays the log file of Node's chunks (NodeChunks). * * To ease monitoring, it provides periodic auto-reload of the opened file * if the related NodeChunk is being computed. */ + FocusScope { id: root property variant node @@ -40,7 +41,6 @@ FocusScope { anchors.fill: parent source: componentLoader.sourceFile autoReload: root.currentChunk !== undefined && root.currentChunk.statusName === "RUNNING" - // source is set in fileSelector } } } diff --git a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml index 559af662..12cfe863 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatistics.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatistics.qml @@ -5,11 +5,12 @@ import QtQuick.Layouts import Controls 1.0 /** - * NodeLog displays log and statistics data of Node's chunks (NodeChunks) + * NodeStatistics displays statistics data of Node's chunks (NodeChunks). * * To ease monitoring, it provides periodic auto-reload of the opened file * if the related NodeChunk is being computed. */ + FocusScope { id: root diff --git a/meshroom/ui/qml/GraphEditor/NodeStatus.qml b/meshroom/ui/qml/GraphEditor/NodeStatus.qml index 7596e832..697b17b4 100644 --- a/meshroom/ui/qml/GraphEditor/NodeStatus.qml +++ b/meshroom/ui/qml/GraphEditor/NodeStatus.qml @@ -3,11 +3,12 @@ import QtQuick.Controls import QtQuick.Layouts /** - * NodeLog displays log and statistics data of Node's chunks (NodeChunks) + * NodeStatus displays the status-related information of Node's chunks (NodeChunks) * * To ease monitoring, it provides periodic auto-reload of the opened file * if the related NodeChunk is being computed. */ + FocusScope { id: root property variant node @@ -42,7 +43,7 @@ FocusScope { id: statusListModel function readSourceFile() { - // make sure we are trying to load a statistics file + // Make sure we are trying to load a statistics file if (!Filepath.urlToString(source).endsWith("status")) return @@ -51,31 +52,28 @@ FocusScope { xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { - // console.warn("StatusListModel: read valid file") if (lastModified === undefined || lastModified !== xhr.getResponseHeader('Last-Modified')) { lastModified = xhr.getResponseHeader('Last-Modified') try { var jsonObject = JSON.parse(xhr.responseText) var entries = [] - // prepare data to populate the ListModel from the input json object + // Prepare data to populate the ListModel from the input json object for (var key in jsonObject) { var entry = {} entry["key"] = key entry["value"] = String(jsonObject[key]) entries.push(entry) } - // reset the model with prepared data (limit to one update event) + // Reset the model with prepared data (limit to one update event) statusListModel.clear() statusListModel.append(entries) } catch(exc) { - // console.warn("StatusListModel: failed to read file") lastModified = undefined statusListModel.clear() } } } else { - // console.warn("StatusListModel: invalid file") lastModified = undefined statusListModel.clear() } @@ -99,7 +97,6 @@ FocusScope { Rectangle { id: statusKey anchors.margins: 2 - // height: statusValue.height color: Qt.darker(activePalette.window, 1.1) Layout.preferredWidth: sizeHandle.x Layout.minimumWidth: 10.0 * Qt.application.font.pixelSize diff --git a/meshroom/ui/qml/GraphEditor/StatViewer.qml b/meshroom/ui/qml/GraphEditor/StatViewer.qml index 03bf8ce3..91e22468 100644 --- a/meshroom/ui/qml/GraphEditor/StatViewer.qml +++ b/meshroom/ui/qml/GraphEditor/StatViewer.qml @@ -37,8 +37,7 @@ Item { property color textColor: Colors.sysPalette.text - - readonly property var colors: [ + readonly property var colors: [ "#f44336", "#e91e63", "#9c27b0", @@ -94,7 +93,7 @@ Item { } function readSourceFile() { - // make sure we are trying to load a statistics file + // Make sure we are trying to load a statistics file if (!Filepath.urlToString(source).endsWith("statistics")) return @@ -103,7 +102,7 @@ Item { xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) { - if (sourceModified === undefined || sourceModified < xhr.getResponseHeader('Last-Modified')) { + if (sourceModified === undefined || sourceModified < xhr.getResponseHeader("Last-Modified")) { try { root.jsonObject = JSON.parse(xhr.responseText) } catch(exc) { @@ -112,7 +111,7 @@ Item { return } resetCharts() - sourceModified = xhr.getResponseHeader('Last-Modified') + sourceModified = xhr.getResponseHeader("Last-Modified") root.createCharts() reloadTimer.restart() } @@ -130,8 +129,8 @@ Item { } function createCharts() { - root.deltaTime = getPropertyWithDefault(jsonObject, 'interval', 30) / 60.0; - root.fileVersion = getPropertyWithDefault(jsonObject, 'fileVersion', 0.0) + root.deltaTime = getPropertyWithDefault(jsonObject, "interval", 30) / 60.0; + root.fileVersion = getPropertyWithDefault(jsonObject, "fileVersion", 0.0) initCpuChart() initRamChart() initGpuChart() @@ -158,7 +157,7 @@ Item { var nbCores = categories.length root.nbCores = nbCores - root.cpuFrequency = getPropertyWithDefault(jsonObject.computer, 'cpuFreq', -1) + root.cpuFrequency = getPropertyWithDefault(jsonObject.computer, "cpuFreq", -1) root.nbReads = categories[0].length-1 @@ -219,9 +218,9 @@ Item { function initRamChart() { - var ram = getPropertyWithDefault(jsonObject.computer.curves, 'ramUsage', -1) + var ram = getPropertyWithDefault(jsonObject.computer.curves, "ramUsage", -1) - root.ramTotal = getPropertyWithDefault(jsonObject.computer, 'ramTotal', -1) + root.ramTotal = getPropertyWithDefault(jsonObject.computer, "ramTotal", -1) root.ramLabel = "RAM: " if (root.ramTotal <= 0) { var maxRamPeak = 0 @@ -249,17 +248,18 @@ Item { ramSerie.color = colors[10] } + /************************** *** GPU *** **************************/ function initGpuChart() { - root.gpuTotalMemory = getPropertyWithDefault(jsonObject.computer, 'gpuMemoryTotal', 0) - root.gpuName = getPropertyWithDefault(jsonObject.computer, 'gpuName', '') + root.gpuTotalMemory = getPropertyWithDefault(jsonObject.computer, "gpuMemoryTotal", 0) + root.gpuName = getPropertyWithDefault(jsonObject.computer, "gpuName", "") - var gpuUsedMemory = getPropertyWithDefault(jsonObject.computer.curves, 'gpuMemoryUsed', 0) - var gpuUsed = getPropertyWithDefault(jsonObject.computer.curves, 'gpuUsed', 0) - var gpuTemperature = getPropertyWithDefault(jsonObject.computer.curves, 'gpuTemperature', 0) + var gpuUsedMemory = getPropertyWithDefault(jsonObject.computer.curves, "gpuMemoryUsed", 0) + var gpuUsed = getPropertyWithDefault(jsonObject.computer.curves, "gpuUsed", 0) + var gpuTemperature = getPropertyWithDefault(jsonObject.computer.curves, "gpuTemperature", 0) var gpuUsedSerie = gpuChart.createSeries(ChartView.SeriesTypeLine, "GPU", valueGpuX, valueGpuY) var gpuUsedMemorySerie = gpuChart.createSeries(ChartView.SeriesTypeLine, "Memory", valueGpuX, valueGpuY) @@ -390,7 +390,7 @@ Item { plotAreaColor: "transparent" titleColor: textColor - visible: (root.fileVersion > 0.0) // only visible if we have valid information + visible: (root.fileVersion > 0.0) // Only visible if we have valid information title: "CPU: " + root.nbCores + " cores, " + root.cpuFrequency + "MHz" ValueAxis { @@ -422,7 +422,6 @@ Item { } - /************************** *** RAM UI *** **************************/ @@ -444,7 +443,7 @@ Item { plotAreaColor: "transparent" titleColor: textColor - visible: (root.fileVersion > 0.0) // only visible if we have valid information + visible: (root.fileVersion > 0.0) // Only visible if we have valid information title: root.ramLabel + root.ramTotal + "GB" ValueAxis { @@ -476,7 +475,6 @@ Item { } - /************************** *** GPU UI *** **************************/ diff --git a/meshroom/ui/qml/GraphEditor/TaskManager.qml b/meshroom/ui/qml/GraphEditor/TaskManager.qml index d9e3ca33..aa3bbc79 100644 --- a/meshroom/ui/qml/GraphEditor/TaskManager.qml +++ b/meshroom/ui/qml/GraphEditor/TaskManager.qml @@ -261,7 +261,6 @@ Item { radius: 3 border.width: 2 border.color: chunkList.node === uigraph.selectedNode ? Colors.sysPalette.text : Colors.getChunkColor(object, {"NONE": bgColor}) - } MouseArea { diff --git a/meshroom/ui/qml/GraphEditor/common.js b/meshroom/ui/qml/GraphEditor/common.js index 35c754ce..2d51ef26 100644 --- a/meshroom/ui/qml/GraphEditor/common.js +++ b/meshroom/ui/qml/GraphEditor/common.js @@ -1,4 +1,3 @@ - var statusColors = { "NONE": "transparent", "SUBMITTED": "#009688", diff --git a/meshroom/ui/qml/ImageGallery/ImageBadge.qml b/meshroom/ui/qml/ImageGallery/ImageBadge.qml index d5d768a0..3de25b44 100644 --- a/meshroom/ui/qml/ImageGallery/ImageBadge.qml +++ b/meshroom/ui/qml/ImageGallery/ImageBadge.qml @@ -3,14 +3,17 @@ import QtQuick import MaterialIcons 2.2 import Utils 1.0 - /** * ImageBadge is a preset MaterialLabel to display an icon bagdge on an image. */ + MaterialLabel { id: root font.pointSize: 10 padding: 2 - background: Rectangle { color: Colors.sysPalette.window; opacity: 0.6 } + background: Rectangle { + color: Colors.sysPalette.window + opacity: 0.6 + } } diff --git a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml index 523f4d0f..ed8b9c7b 100644 --- a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml @@ -4,10 +4,10 @@ import QtQuick.Layouts import Utils 1.0 - /** * ImageDelegate for a Viewpoint object. */ + Item { id: root @@ -25,7 +25,7 @@ Item { default property alias children: imageMA.children - // retrieve viewpoints inner data + // Retrieve viewpoints inner data QtObject { id: _viewpoint property url source: viewpoint ? Filepath.stringToUrl(viewpoint.get("path").value) : '' @@ -34,8 +34,8 @@ Item { property var metadata: metadataStr ? JSON.parse(viewpoint.get("metadata").value) : {} } - // update thumbnail location - // can be called from the GridView when a new thumbnail has been written on disk + // Update thumbnail location + // Can be called from the GridView when a new thumbnail has been written on disk function updateThumbnail() { thumbnail.source = ThumbnailCache.thumbnail(root.source, root.cellID) } @@ -136,6 +136,7 @@ Item { running: thumbnail.status != Image.Ready } } + // Image basename Label { id: imageLabel diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index 03242168..b57eda20 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -12,6 +12,7 @@ import Utils 1.0 * ImageGallery displays as a grid of Images a model containing Viewpoints objects. * It manages a model of multiple CameraInit nodes as individual groups. */ + Panel { id: root @@ -28,7 +29,7 @@ Panel { property int defaultCellSize: 160 property bool readOnly: false - property var filesByType: {} + property var filesByType: ({}) property int nbMeshroomScenes: 0 property int nbDraggedFiles: 0 @@ -98,7 +99,7 @@ Panel { intrinsic[currentAttribute.name + "." + currentAttribute.value.at(k).name] = currentAttribute.value.at(k) } } else if (currentAttribute.type === "ListAttribute") { - // not needed for now + // Not needed for now } else { intrinsic[currentAttribute.name] = currentAttribute } @@ -217,12 +218,12 @@ Panel { Connections { target: ThumbnailCache function onThumbnailCreated(imgSource, callerID) { - let item = grid.itemAtIndex(callerID); // item is an ImageDelegate + let item = grid.itemAtIndex(callerID); // "item" is an ImageDelegate if (item && item.source === imgSource) { item.updateThumbnail() return } - // fallback in case the ImageDelegate cellID changed + // Fallback in case the ImageDelegate cellID changed for (let idx = 0; idx < grid.count; idx++) { item = grid.itemAtIndex(idx) if (item && item.source === imgSource) { @@ -250,7 +251,7 @@ Panel { ] property var reconstructionFilter: undefined - // override modelData to return basename of viewpoint's path for sorting + // Override modelData to return basename of viewpoint's path for sorting function modelData(item, roleName_) { var roleNameAndCmd = roleName_.split(".") var roleName = roleName_ @@ -831,8 +832,7 @@ Panel { } } onEnabledChanged: { - // Reset the toggle to avoid getting stuck - // with the HDR node checked but disabled. + // Reset the toggle to avoid getting stuck with the HDR node checked but disabled if (checked) { checked = false close() @@ -875,8 +875,7 @@ Panel { } } onEnabledChanged: { - // Reset the toggle to avoid getting stuck - // with the HDR node checked but disabled. + // Reset the toggle to avoid getting stuck with the HDR node checked but disabled if (checked) { checked = false close() diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml index 97d1b63f..eae7eddc 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml @@ -190,7 +190,7 @@ RowLayout { DoubleValidator { id: doubleValidator - locale: 'C' // use '.' decimal separator disregarding the system locale + locale: 'C' // Use '.' decimal separator disregarding the system locale } validator: doubleValidator diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml b/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml index 2bf5ba77..cda6f91b 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicsIndicator.qml @@ -4,11 +4,11 @@ import QtQuick.Controls import MaterialIcons 2.2 import Utils 1.0 - /** * Display camera initialization status and the value of metadata * that take part in this process. */ + ImageBadge { id: root @@ -28,7 +28,8 @@ ImageBadge { } return "" } - // access useful metadata + + // Access useful metadata readonly property var make: findMetadata("Make") readonly property var model: findMetadata("Model") readonly property var focalLength: findMetadata("FocalLength") @@ -104,13 +105,12 @@ ImageBadge { } }, State { - // fallback status when initialization mode is unset + // Fallback status when initialization mode is unset name: "none" PropertyChanges { target: root visible: false } } - ] } diff --git a/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml b/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml index 585404fc..c61a5e5f 100644 --- a/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml +++ b/meshroom/ui/qml/ImageGallery/SensorDBDialog.qml @@ -5,7 +5,6 @@ import QtQuick.Layouts import MaterialIcons 2.2 import Controls 1.0 - MessageDialog { id: root diff --git a/meshroom/ui/qml/LiveSfmView.qml b/meshroom/ui/qml/LiveSfmView.qml index 1d6560f4..d3f2a9ab 100644 --- a/meshroom/ui/qml/LiveSfmView.qml +++ b/meshroom/ui/qml/LiveSfmView.qml @@ -3,13 +3,14 @@ import QtQuick.Controls import QtQuick.Layouts import MaterialIcons 2.2 -import Qt.labs.platform 1.0 as Platform // for FileDialog +import Qt.labs.platform 1.0 as Platform import Controls 1.0 /** * LiveSfMView provides controls for setting up and starting a live reconstruction. */ + Panel { id: root diff --git a/meshroom/ui/qml/MaterialIcons/MLabel.qml b/meshroom/ui/qml/MaterialIcons/MLabel.qml index 4854b5c5..a98cad46 100644 --- a/meshroom/ui/qml/MaterialIcons/MLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MLabel.qml @@ -1,11 +1,11 @@ import QtQuick import QtQuick.Controls - /** * MLabel is a standard Label. * If ToolTip.text is set, it shows up a tooltip when hovered. */ + Label { padding: 4 MouseArea { diff --git a/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml b/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml index 587a0ec6..0b7981ba 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialLabel.qml @@ -1,11 +1,11 @@ import QtQuick import QtQuick.Controls - /** * MaterialLabel is a standard Label using MaterialIcons font. * If ToolTip.text is set, it also shows up a tooltip when hovered. */ + Label { font.family: MaterialIcons.fontFamily font.pointSize: 10 diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml index 287069bc..8378b20e 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolButton.qml @@ -2,11 +2,11 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - /** * MaterialToolButton is a standard ToolButton using MaterialIcons font. * It also shows up its tooltip when hovered. */ + ToolButton { id: control font.family: MaterialIcons.fontFamily diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml index afd08949..6c1f867d 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolLabel.qml @@ -2,11 +2,11 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - /** * MaterialToolLabel is a Label with an icon (using MaterialIcons). * It shows up its tooltip when hovered. */ + Item { id: control property alias iconText: iconItem.text diff --git a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml index 5ec9ecc7..53ca5884 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialToolLabelButton.qml @@ -2,11 +2,11 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - /** * MaterialToolButton is a standard ToolButton using MaterialIcons font. * It also shows up its tooltip when hovered. */ + ToolButton { id: control property alias iconText: icon.text diff --git a/meshroom/ui/qml/Utils/Clipboard.qml b/meshroom/ui/qml/Utils/Clipboard.qml index 07898a8a..630af096 100644 --- a/meshroom/ui/qml/Utils/Clipboard.qml +++ b/meshroom/ui/qml/Utils/Clipboard.qml @@ -4,6 +4,7 @@ import Meshroom.Helpers 1.0 /** * Clipboard singleton object to copy values to paste buffer. */ + ClipboardHelper { } diff --git a/meshroom/ui/qml/Utils/Colors.qml b/meshroom/ui/qml/Utils/Colors.qml index beb9cfa6..d592a64f 100644 --- a/meshroom/ui/qml/Utils/Colors.qml +++ b/meshroom/ui/qml/Utils/Colors.qml @@ -5,6 +5,7 @@ import QtQuick.Controls /** * Singleton that gathers useful colors, shades and system palettes. */ + QtObject { property SystemPalette sysPalette: SystemPalette {} property SystemPalette disabledSysPalette: SystemPalette { colorGroup: SystemPalette.Disabled } diff --git a/meshroom/ui/qml/Utils/Scene3DHelper.qml b/meshroom/ui/qml/Utils/Scene3DHelper.qml index 8941425b..2b7d64f2 100644 --- a/meshroom/ui/qml/Utils/Scene3DHelper.qml +++ b/meshroom/ui/qml/Utils/Scene3DHelper.qml @@ -2,5 +2,4 @@ pragma Singleton import Meshroom.Helpers 1.0 Scene3DHelper { - } diff --git a/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml b/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml index 9168e75e..dff46867 100644 --- a/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml +++ b/meshroom/ui/qml/Utils/SortFilterDelegateModel.qml @@ -17,21 +17,21 @@ import QtQuick.Controls * * Based on http://doc.qt.io/qt-5/qtquick-tutorials-dynamicview-dynamicview4-example.html */ + DelegateModel { id: sortFilterModel - property string sortRole: "" /// the role to use for sorting - property int sortOrder: Qt.AscendingOrder /// the sorting order - property var filters: [] /// filter format: {role: "roleName", value: "filteringValue"} + property string sortRole: "" /// The role to use for sorting + property int sortOrder: Qt.AscendingOrder /// The sorting order + property var filters: [] /// Filter format: {role: "roleName", value: "filteringValue"} onSortRoleChanged: invalidateSort() onSortOrderChanged: invalidateSort() onFiltersChanged: invalidateFilters() - // display "filtered" group + // Display "filtered" group filterOnGroup: "filtered" - // don't include elements in "items" group by default - // as they must fall in the "unsorted" group + // Don't include elements in "items" group by default as they must fall in the "unsorted" group items.includeByDefault: false groups: [ @@ -41,15 +41,15 @@ DelegateModel { name: "unsorted" includeByDefault: true - // if the source model changes, perform sorting and filtering + // If the source model changes, perform sorting and filtering onChanged: { - // no sorting: move everything from unsorted to sorted group + // No sorting: move everything from unsorted to sorted group if(sortRole == "") { unsortedItems.setGroups(0, unsortedItems.count, ["items"]) } else { sort() } - // perform filter invalidation in both cases + // Perform filter invalidation in both cases invalidateFilters() } }, @@ -87,8 +87,7 @@ DelegateModel { if (filter === undefined) { return true; } - switch (value.constructor.name) - { + switch (value.constructor.name) { case "String": return value.toLowerCase().indexOf(filter.toLowerCase()) > -1 default: @@ -98,8 +97,8 @@ DelegateModel { /// Apply respectFilter mapping and logical AND/OR reduction on filters function respectFilters(item) { - let cond = (filter => respectFilter(modelData(item, filter.role), filter.value)); - return filters.every(x => Array.isArray(x) ? x.some(cond) : cond(x)); + let cond = (filter => respectFilter(modelData(item, filter.role), filter.value)) + return filters.every(x => Array.isArray(x) ? x.some(cond) : cond(x)) } /// Reverse sort order (toggle between Qt.AscendingOrder / Qt.DescendingOrder) @@ -108,40 +107,42 @@ DelegateModel { } property var lessThan: [ - function(left, right) { return modelData(left, sortRole) < modelData(right, sortRole) } + function(left, right) { + return modelData(left, sortRole) < modelData(right, sortRole) + } ] function invalidateSort() { if (!sortFilterModel.model || !sortFilterModel.model.count) return; - // move everything from "items" to "unsorted - // will trigger "unsorted" DelegateModelGroup 'changed' signal + // Move everything from "items" to "unsorted", will trigger "unsorted" DelegateModelGroup 'changed' signal items.setGroups(0, items.count, ["unsorted"]) } /// Invalidate filtering function invalidateFilters() { for (var i = 0; i < items.count; ++i) { - // if the property value contains filterText, add it to the filtered group + // If the property value contains filterText, add it to the filtered group if (respectFilters(items.get(i))) { items.addGroups(items.get(i), 1, "filtered") - } else { // otherwise, remove it from the filtered group + } else { // Otherwise, remove it from the filtered group items.removeGroups(items.get(i), 1, "filtered") } } } - /// Compute insert position of 'item' based on the value - /// of its sortProperty + /// Compute insert position of 'item' based on the value of its sortProperty function insertPosition(lessThan, item) { var lower = 0 var upper = items.count while (lower < upper) { var middle = Math.floor(lower + (upper - lower) / 2) var result = lessThan(item, items.get(middle)) - if (sortOrder == Qt.DescendingOrder) + if (sortOrder == Qt.DescendingOrder) { result = !result + } + if (result) { upper = middle } else { @@ -159,7 +160,7 @@ DelegateModel { item.groups = ["items"] items.move(item.itemsIndex, index) } - // if some items were actually sorted, filter will be correctly invalidated + // If some items were actually sorted, filter will be correctly invalidated // as unsortedGroup 'changed' signal will be triggered } } diff --git a/meshroom/ui/qml/Utils/Transformations3DHelper.qml b/meshroom/ui/qml/Utils/Transformations3DHelper.qml index 16e90ea6..a4a77be0 100644 --- a/meshroom/ui/qml/Utils/Transformations3DHelper.qml +++ b/meshroom/ui/qml/Utils/Transformations3DHelper.qml @@ -2,5 +2,4 @@ pragma Singleton import Meshroom.Helpers 1.0 Transformations3DHelper { - -} \ No newline at end of file +} diff --git a/meshroom/ui/qml/Utils/format.js b/meshroom/ui/qml/Utils/format.js index 139dc11c..846340de 100644 --- a/meshroom/ui/qml/Utils/format.js +++ b/meshroom/ui/qml/Utils/format.js @@ -1,8 +1,7 @@ .pragma library - function intToString(v) { - // use EN locale to get comma separated thousands + // Use EN locale to get comma separated thousands // + remove automatically added trailing decimals // (this 'toLocaleString' does not take any option) return v.toLocaleString(Qt.locale('en-US')).split('.')[0] @@ -10,8 +9,8 @@ function intToString(v) { // Convert a plain text to an html escaped string. function plainToHtml(t) { - var escaped = t.replace(/&/g, '&').replace(//g, '>') // escape text - return escaped.replace(/\n/g, '
') // replace line breaks + var escaped = t.replace(/&/g, '&').replace(//g, '>') // Escape text + return escaped.replace(/\n/g, '
') // Replace line breaks } function divmod(x, y) { @@ -41,8 +40,7 @@ function sec2timecode(timeSeconds) { } function sec2timeStr(timeSeconds) { - // Need to decide the rounding precision first - // to propagate the right values + // Need to decide the rounding precision first to propagate the right values if (timeSeconds >= 60.0) { timeSeconds = Math.round(timeSeconds) } else { @@ -57,7 +55,7 @@ function sec2timeStr(timeSeconds) { timeStr += timeObj.minutes + "m" } if (timeObj.hours === 0) { - // seconds only matter if the elapsed time is less than 1 hour + // Seconds only matter if the elapsed time is less than 1 hour if (timeObj.minutes === 0) { // If less than a minute, keep millisecond precision timeStr += timeObj.seconds.toFixed(2) + "s" @@ -103,4 +101,4 @@ function GB2SizeStr(GB) { sizeStr += sizeObj.KB + "KB" } return sizeStr -} \ No newline at end of file +} diff --git a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml index b9015edd..992d7c9f 100644 --- a/meshroom/ui/qml/Viewer/CameraResponseGraph.qml +++ b/meshroom/ui/qml/Viewer/CameraResponseGraph.qml @@ -31,7 +31,7 @@ FloatingPane { onWheel: {} } - // note: We need to use csvData.getNbColumns() slot instead of the csvData.nbColumns property to avoid a crash on linux. + // Note: We need to use csvData.getNbColumns() slot instead of the csvData.nbColumns property to avoid a crash on linux. property bool crfReady: csvData && csvData.ready && (csvData.getNbColumns() >= 4) onCrfReadyChanged: { if (crfReady) { @@ -77,24 +77,24 @@ FloatingPane { } // We cannot use a Repeater with these Components so we need to instantiate them one by one - // Red curve LineSeries { + // Red curve id: redCurve axisX: valueAxisX axisY: valueAxisY name: crfReady ? csvData.getColumn(1).title : "" color: name.toLowerCase() } - // Green curve LineSeries { + // Green curve id: greenCurve axisX: valueAxisX axisY: valueAxisY name: crfReady ? csvData.getColumn(2).title : "" color: name.toLowerCase() } - // Blue curve LineSeries { + // Blue curve id: blueCurve axisX: valueAxisX axisY: valueAxisY diff --git a/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml b/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml index b3e1eb00..e30393cd 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerEntity.qml @@ -3,9 +3,9 @@ import QtQuick Item { id: root - // required for perspective transform - property real sizeX: 1675.0 // might be overridden in ColorCheckerViewer - property real sizeY: 1125.0 // might be overridden in ColorCheckerViewer + // Required for perspective transform + property real sizeX: 1675.0 // Might be overridden in ColorCheckerViewer + property real sizeY: 1125.0 // Might be overridden in ColorCheckerViewer property var colors: null property var window: null @@ -27,10 +27,8 @@ Item { id: transformation matrix: Qt.matrix4x4() } - } - function applyTransform(m) { transformation.matrix = Qt.matrix4x4( m[0][0], m[0][1], 0, m[0][2], @@ -38,5 +36,4 @@ Item { 0, 0, 1, 0, m[2][0], m[2][1], 0, m[2][2]) } - } diff --git a/meshroom/ui/qml/Viewer/ColorCheckerPane.qml b/meshroom/ui/qml/Viewer/ColorCheckerPane.qml index a5336491..de3e1f4f 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerPane.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerPane.qml @@ -12,7 +12,6 @@ FloatingPane { padding: 4 anchors.rightMargin: 0 - ColumnLayout { anchors.fill: parent @@ -34,9 +33,7 @@ FloatingPane { height: root.height / grid.rows - grid.spacing * (grid.rows + 1) / grid.rows color: Qt.rgba(modelData.r, modelData.g, modelData.b, 1.0) } - } } } - } diff --git a/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml b/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml index 622ec2b8..4a517a8e 100644 --- a/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml +++ b/meshroom/ui/qml/Viewer/ColorCheckerViewer.qml @@ -8,9 +8,9 @@ Item { property var viewpoint: null property real zoom: 1.0 - // required for perspective transform + // Required for perspective transform // Match theoretical values in AliceVision - // see https://github.com/alicevision/AliceVision/blob/68ab70bcbc3eb01b73dc8dea78c78d8b4778461c/src/software/utils/main_colorCheckerDetection.cpp#L47 + // See https://github.com/alicevision/AliceVision/blob/68ab70bcbc3eb01b73dc8dea78c78d8b4778461c/src/software/utils/main_colorCheckerDetection.cpp#L47 readonly property real ccheckerSizeX: 1675.0 readonly property real ccheckerSizeY: 1125.0 @@ -34,16 +34,13 @@ Item { function readSourceFile() { var xhr = new XMLHttpRequest - // console.warn("readSourceFile: " + root.source) xhr.open("GET", root.source) xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) { try { root.json = null - // console.warn("readSourceFile: update json from " + root.source) root.json = JSON.parse(xhr.responseText) - // console.warn("readSourceFile: root.json.checkers.length=" + root.json.checkers.length) } catch(exc) { console.warn("Failed to parse ColorCheckerDetection JSON file: " + source) return diff --git a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml index 63de169d..ecfee836 100644 --- a/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml +++ b/meshroom/ui/qml/Viewer/FeaturesInfoOverlay.qml @@ -10,6 +10,7 @@ import Utils 1.0 * FeaturesInfoOverlay is an overlay that displays info and * provides controls over a FeaturesViewer component. */ + FloatingPane { id: root @@ -65,7 +66,10 @@ FloatingPane { ComboBox { id: featureDisplayModeCB flat: true - ToolTip.text: "Feature Display Mode:\n* Points: Simple points.\n* Square: Scaled filled squares.\n* Oriented Square: Scaled and oriented squares." + ToolTip.text: "Feature Display Mode:\n" + + "* Points: Simple points.\n" + + "* Square: Scaled filled squares.\n" + + "* Oriented Square: Scaled and oriented squares." ToolTip.visible: hovered Layout.fillHeight: true Layout.alignment: Qt.AlignRight @@ -81,7 +85,10 @@ FloatingPane { ComboBox { id: trackDisplayModeCB flat: true - ToolTip.text: "Track Display Mode:\n* Lines Only: Only track lines.\n* Current Matches: Track lines with current matches / landmarks.\n* All Matches: Track lines with all matches / landmarks." + ToolTip.text: "Track Display Mode:\n" + + "* Lines Only: Only track lines.\n" + + "* Current Matches: Track lines with current matches/landmarks.\n" + + "* All Matches: Track lines with all matches / landmarks." ToolTip.visible: hovered Layout.fillHeight: true Layout.alignment: Qt.AlignRight @@ -152,7 +159,8 @@ FloatingPane { } SpinBox { id: timeWindowSB - ToolTip.text: "Time Window: The number of frames to consider for tracks display.\ne.g. With time window set at x, tracks will start at current frame - x and they will end at current frame + x." + ToolTip.text: "Time Window: The number of frames to consider for tracks display.\n" + + "e.g. With time window set at x, tracks will start at current frame - x and they will end at current frame + x." ToolTip.visible: hovered Layout.fillHeight: true Layout.alignment: Qt.AlignRight diff --git a/meshroom/ui/qml/Viewer/FeaturesViewer.qml b/meshroom/ui/qml/Viewer/FeaturesViewer.qml index a1acd4d4..1bcb88a6 100644 --- a/meshroom/ui/qml/Viewer/FeaturesViewer.qml +++ b/meshroom/ui/qml/Viewer/FeaturesViewer.qml @@ -7,6 +7,7 @@ import Utils 1.0 * FeaturesViewer displays the extracted feature points of a View. * Requires QtAliceVision plugin. */ + Repeater { id: root @@ -60,7 +61,7 @@ Repeater { model: root.describerTypes - // instantiate one FeaturesViewer by describer type + // Instantiate one FeaturesViewer by describer type delegate: AliceVision.FeaturesViewer { readonly property int colorIndex: (index + colorOffset) % root.colors.length property int colorOffset: 0 diff --git a/meshroom/ui/qml/Viewer/FloatImage.qml b/meshroom/ui/qml/Viewer/FloatImage.qml index 711e6798..31e5181b 100644 --- a/meshroom/ui/qml/Viewer/FloatImage.qml +++ b/meshroom/ui/qml/Viewer/FloatImage.qml @@ -96,7 +96,6 @@ AliceVision.FloatImageViewer { if (!isHighlightable) root.surface.mouseOver = false } - /* * Principal Point */ diff --git a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml index 5ef3f14c..0945b807 100644 --- a/meshroom/ui/qml/Viewer/HdrImageToolbar.qml +++ b/meshroom/ui/qml/Viewer/HdrImageToolbar.qml @@ -30,19 +30,18 @@ FloatingPane { DoubleValidator { id: doubleValidator - locale: 'C' // use '.' decimal separator disregarding of the system locale + locale: 'C' // Use '.' decimal separator disregarding of the system locale } RowLayout { id: toolLayout - // anchors.verticalCenter: parent anchors.fill: parent - // channel mode + // Channel mode ComboBox { id: channelsCtrl - // set min size to 4 characters + one margin for the combobox + // Set min size to 4 characters + one margin for the combobox Layout.minimumWidth: 5.0 * Qt.application.font.pixelSize Layout.preferredWidth: Layout.minimumWidth flat: true @@ -57,7 +56,7 @@ FloatingPane { model: channels } - // gain slider + // Gain slider RowLayout { spacing: 5 @@ -97,7 +96,7 @@ FloatingPane { } } - // gamma slider + // Gamma slider RowLayout { spacing: 5 @@ -242,7 +241,7 @@ FloatingPane { TextMetrics { id: textMetrics_colorValue font: red.font - text: "1.2345" // use one more than expected to get the correct value (probably needed due to TextField margin) + text: "1.2345" // Use one more than expected to get the correct value (probably needed due to TextField margin) } TextMetrics { id: textMetrics_gainValue diff --git a/meshroom/ui/qml/Viewer/ImageMetadataView.qml b/meshroom/ui/qml/Viewer/ImageMetadataView.qml index 412f02db..448f6644 100644 --- a/meshroom/ui/qml/Viewer/ImageMetadataView.qml +++ b/meshroom/ui/qml/Viewer/ImageMetadataView.qml @@ -12,6 +12,7 @@ import Utils 1.0 /** * ImageMetadataView displays a JSON model representing an image's metadata as a ListView. */ + FloatingPane { id: root @@ -94,7 +95,7 @@ FloatingPane { entry["raw"] = entry["group"] + ":" + entry["key"] + "=" + entry["value"] entries.push(entry) } - // reset the model with prepared data (limit to one update event) + // Reset the model with prepared data (limit to one update event) metadataModel.append(entries) coordinates = getGPSCoordinates(metadata) } diff --git a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml index c8dd87af..936973b9 100644 --- a/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml +++ b/meshroom/ui/qml/Viewer/LensDistortionToolbar.qml @@ -31,7 +31,7 @@ FloatingPane { DoubleValidator { id: doubleValidator - locale: 'C' // use '.' decimal separator disregarding of the system locale + locale: 'C' // Use '.' decimal separator disregarding of the system locale } RowLayout { @@ -148,12 +148,11 @@ FloatingPane { } } - //Fill rectangle to have a better UI + // Fill rectangle to have a better UI Rectangle { color: root.palette.window Layout.fillWidth: true } - } TextMetrics { diff --git a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml index bbebba1a..642e8c6a 100644 --- a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml +++ b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml @@ -32,7 +32,7 @@ FloatingPane { DoubleValidator { id: doubleValidator - locale: 'C' // use '.' decimal separator disregarding of the system locale + locale: 'C' // Use '.' decimal separator disregarding of the system locale } RowLayout { @@ -132,7 +132,6 @@ FloatingPane { Layout.fillWidth: false Layout.maximumWidth: 50 - validator: DoubleValidator { bottom: Math.min(speedSpinBox.from, speedSpinBox.to) top: Math.max(speedSpinBox.from, speedSpinBox.to) @@ -165,7 +164,6 @@ FloatingPane { Layout.fillWidth: false Layout.maximumWidth: 50 - validator: DoubleValidator { bottom: Math.min(downscaleSpinBox.from, downscaleSpinBox.to) top: Math.max(downscaleSpinBox.from, downscaleSpinBox.to) @@ -180,8 +178,8 @@ FloatingPane { } } } - } + TextMetrics { id: textMetrics_subdivisionsValue font: subdivisionsLabel.font diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index a890c9ce..a5d73c05 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -73,7 +73,7 @@ AliceVision.PanoramaViewer { property double pitchNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.x").value : 0 property double rollNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.z").value : 0 - //Convert angle functions + // Convert angle functions function toDegrees(radians) { return radians * (180 / Math.PI) } @@ -82,12 +82,16 @@ AliceVision.PanoramaViewer { return degrees * (Math.PI / 180) } - function fmod(a,b) { return Number((a - (Math.floor(a / b) * b)).toPrecision(8)) } + function fmod(a,b) { + return Number((a - (Math.floor(a / b) * b)).toPrecision(8)) + } // Limit angle between -180 and 180 function limitAngle(angle) { - if (angle > 180) angle = -180.0 + (angle - 180.0) - if (angle < -180) angle = 180.0 - (Math.abs(angle) - 180) + if (angle > 180) + angle = -180.0 + (angle - 180.0) + if (angle < -180) + angle = 180.0 - (Math.abs(angle) - 180) return angle } @@ -273,33 +277,31 @@ AliceVision.PanoramaViewer { var sourceItem = Filepath.stringToUrl(msfmData.getUrlFromViewId(idViewItem)) setSource("FloatImage.qml", { - 'surface.viewerType': AliceVision.Surface.EViewerType.PANORAMA, - 'viewerTypeString': 'panorama', - 'surface.subdivisions': Qt.binding(function() { return subdivisionsPano }), - 'cropFisheye' : Qt.binding(function(){ return cropFisheyePano }), - 'surface.pitch': Qt.binding(function() { return root.pitch }), - 'surface.yaw': Qt.binding(function() { return root.yaw }), - 'surface.roll': Qt.binding(function() { return root.roll }), - 'idView': Qt.binding(function() { return idViewItem }), - 'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }), - 'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }), - 'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }), - 'downscaleLevel' : Qt.binding(function() { return downscale }), - 'source': Qt.binding(function() { return sourceItem }), - 'surface.msfmData': Qt.binding(function() { return root.msfmData }), - 'canBeHovered': true, - 'useSequence': false + "surface.viewerType": AliceVision.Surface.EViewerType.PANORAMA, + "viewerTypeString": "panorama", + "surface.subdivisions": Qt.binding(function() { return subdivisionsPano }), + "cropFisheye" : Qt.binding(function(){ return cropFisheyePano }), + "surface.pitch": Qt.binding(function() { return root.pitch }), + "surface.yaw": Qt.binding(function() { return root.yaw }), + "surface.roll": Qt.binding(function() { return root.roll }), + "idView": Qt.binding(function() { return idViewItem }), + "gamma": Qt.binding(function() { return hdrImageToolbar.gammaValue }), + "gain": Qt.binding(function() { return hdrImageToolbar.gainValue }), + "channelModeString": Qt.binding(function() { return hdrImageToolbar.channelModeValue }), + "downscaleLevel": Qt.binding(function() { return downscale }), + "source": Qt.binding(function() { return sourceItem }), + "surface.msfmData": Qt.binding(function() { return root.msfmData }), + "canBeHovered": true, + "useSequence": false }) imageLoaded = Qt.binding(function() { return repeater.itemAt(index).item.imageStatus === Image.Ready ? true : false }) } - } } Repeater { id: repeater model: 0 delegate: imgPano - } Connections { target: root @@ -309,7 +311,7 @@ AliceVision.PanoramaViewer { // Retrieve downscale value from C++ panoramaViewerToolbar.updateDownscaleValue(root.downscale) - //Changing the repeater model (number of elements) + // Changing the repeater model (number of elements) panoImages.updateRepeater() root.readyToLoad = Image.Ready diff --git a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml index be0e11b1..07376d20 100644 --- a/meshroom/ui/qml/Viewer/SfmGlobalStats.qml +++ b/meshroom/ui/qml/Viewer/SfmGlobalStats.qml @@ -100,7 +100,6 @@ FloatingPane { anchors.leftMargin: residualsPerViewChart.width * 0.25 RowLayout { - ChartViewCheckBox { id: allObservations text: "ALL" @@ -198,7 +197,6 @@ FloatingPane { anchors.leftMargin: observationsLengthsPerViewChart.width * 0.25 RowLayout { - ChartViewCheckBox { id: allModes text: "ALL" diff --git a/meshroom/ui/qml/Viewer/SfmStatsView.qml b/meshroom/ui/qml/Viewer/SfmStatsView.qml index e2d697ce..fd5672c3 100644 --- a/meshroom/ui/qml/Viewer/SfmStatsView.qml +++ b/meshroom/ui/qml/Viewer/SfmStatsView.qml @@ -145,7 +145,6 @@ FloatingPane { anchors.leftMargin: observationsLengthsChart.width * 0.25 RowLayout { - ChartViewCheckBox { id: allObservations text: "ALL" @@ -213,7 +212,6 @@ FloatingPane { anchors.leftMargin: observationsScaleChart.width * 0.15 RowLayout { - ChartViewCheckBox { id: allObservationsScales text: "ALL" diff --git a/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml b/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml index 809930ae..99892ae5 100644 --- a/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml +++ b/meshroom/ui/qml/Viewer/TestAliceVisionPlugin.qml @@ -5,6 +5,7 @@ import AliceVision 1.0 /** * To evaluate if the QtAliceVision plugin is available. */ + Item { id: root } diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 658eff98..8501233b 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -123,11 +123,13 @@ FocusScope { anchors.fill: parent property double factor: 1.2 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + onPressed: function(mouse) { imgContainer.forceActiveFocus() if (mouse.button & Qt.MiddleButton || (mouse.button & Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier)) drag.target = imgContainer // Start drag } + onReleased: function(mouse) { drag.target = undefined // Stop drag if (mouse.button & Qt.RightButton) { @@ -137,6 +139,7 @@ FocusScope { menu.open() } } + onWheel: function(wheel) { var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor @@ -184,17 +187,17 @@ FocusScope { function tryLoadNode(node) { useExternal = false - // safety check + // Safety check if (!node) { return false } - // node must be computed or at least running + // Node must be computed or at least running if (node.isComputable && !node.isPartiallyFinished()) { return false } - // node must have at least one output attribute with the image semantic + // Node must have at least one output attribute with the image semantic if (!node.hasImageOutput && !node.hasSequenceOutput) { return false } @@ -212,7 +215,6 @@ FocusScope { function getViewpoint(viewId) { // Get viewpoint from cameraInit with matching id // This requires to loop over all viewpoints - for (var i = 0; i < _reconstruction.viewpoints.count; i++) { var vp = _reconstruction.viewpoints.at(i) if (vp.childAttribute("viewId").value == viewId) { @@ -264,11 +266,11 @@ FocusScope { if (displayedNode && displayedNode.hasSequenceOutput && displayedAttr) { - // reset current frame to 0 if it is imageList but not sequence + // Reset current frame to 0 if it is imageList but not sequence if (displayedAttr.desc.semantic === "imageList") { let includesSeqMissingFiles = false // list only the existing files let [_, filesSeqs] = Filepath.resolveSequence(pathTemplate, includesSeqMissingFiles) - // concat in one array all sequences in resolved + // Concat in one array all sequences in resolved outputFiles = [].concat.apply([], filesSeqs) let newFrameRange = [0, outputFiles.length - 1] @@ -287,7 +289,7 @@ FocusScope { let [frameRanges, filesSeqs] = Filepath.resolveSequence(pathTemplate, includesSeqMissingFiles) let newFrameRange = [0, 0] if (filesSeqs.length > 0) { - // if there is one or several sequences, take the first one + // If there is one or several sequences, take the first one outputFiles = filesSeqs[0] newFrameRange = frameRanges[0] @@ -321,7 +323,6 @@ FocusScope { function getSequence() { // Entry point for getting the current image sequence - if (useExternal) { return [] } @@ -342,10 +343,10 @@ FocusScope { root.source = "" } - // update output attribute names + // Update output attribute names var names = [] if (displayedNode) { - // store attr name for output attributes that represent images + // Store attr name for output attributes that represent images for (var i = 0; i < displayedNode.attributes.count; i++) { var attr = displayedNode.attributes.at(i) if (attr.isOutput && (attr.desc.semantic === "image" || attr.desc.semantic === "sequence" || @@ -546,28 +547,28 @@ FocusScope { // Instantiate and initialize a FloatImage component dynamically using Loader.setSource // Note: It does not work to use previously created component, so we re-create it with setSource. floatImageViewerLoader.setSource("FloatImage.qml", { - 'source': Qt.binding(function() { return getImageFile() }), - 'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }), - 'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }), - 'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }), - 'isPrincipalPointsDisplayed': Qt.binding(function() { return lensDistortionImageToolbar.displayPrincipalPoint }), - 'surface.displayGrid': Qt.binding(function() { return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid }), - 'surface.gridOpacity': Qt.binding(function() { return lensDistortionImageToolbar.opacityValue }), - 'surface.gridColor': Qt.binding(function() { return lensDistortionImageToolbar.color }), - 'surface.subdivisions': Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }), - 'viewerTypeString': Qt.binding(function() { return displayLensDistortionViewer.checked ? "distortion" : "hdr" }), - 'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }), - 'canBeHovered': false, - '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() { + "source": Qt.binding(function() { return getImageFile() }), + "gamma": Qt.binding(function() { return hdrImageToolbar.gammaValue }), + "gain": Qt.binding(function() { return hdrImageToolbar.gainValue }), + "channelModeString": Qt.binding(function() { return hdrImageToolbar.channelModeValue }), + "isPrincipalPointsDisplayed": Qt.binding(function() { return lensDistortionImageToolbar.displayPrincipalPoint }), + "surface.displayGrid": Qt.binding(function() { return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid }), + "surface.gridOpacity": Qt.binding(function() { return lensDistortionImageToolbar.opacityValue }), + "surface.gridColor": Qt.binding(function() { return lensDistortionImageToolbar.color }), + "surface.subdivisions": Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }), + "viewerTypeString": Qt.binding(function() { return displayLensDistortionViewer.checked ? "distortion" : "hdr" }), + "surface.msfmData": Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }), + "canBeHovered": false, + "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")))) }), - 'fetchingSequence': Qt.binding(function() { return sequencePlayer.loading }), - 'memoryLimit': Qt.binding(function() { return sequencePlayer.settings_SequencePlayer.maxCacheMemory }), + "fetchingSequence": Qt.binding(function() { return sequencePlayer.loading }), + "memoryLimit": Qt.binding(function() { return sequencePlayer.settings_SequencePlayer.maxCacheMemory }), }) } else { // Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 @@ -588,14 +589,14 @@ FocusScope { onActiveChanged: { if (active) { setSource("PanoramaViewer.qml", { - 'subdivisionsPano': Qt.binding(function() { return panoramaViewerToolbar.subdivisionsValue }), - 'cropFisheyePano': Qt.binding(function() { return root.cropFisheye }), - 'downscale': Qt.binding(function() { return panoramaViewerToolbar.downscaleValue }), - 'isEditable': Qt.binding(function() { return panoramaViewerToolbar.enableEdit }), - 'isHighlightable': Qt.binding(function() { return panoramaViewerToolbar.enableHover }), - 'displayGridPano': Qt.binding(function() { return panoramaViewerToolbar.displayGrid }), - 'mouseMultiplier': Qt.binding(function() { return panoramaViewerToolbar.mouseSpeed }), - 'msfmData': Qt.binding(function() { return (msfmDataLoader && msfmDataLoader.item && msfmDataLoader.status === Loader.Ready + "subdivisionsPano": Qt.binding(function() { return panoramaViewerToolbar.subdivisionsValue }), + "cropFisheyePano": Qt.binding(function() { return root.cropFisheye }), + "downscale": Qt.binding(function() { return panoramaViewerToolbar.downscaleValue }), + "isEditable": Qt.binding(function() { return panoramaViewerToolbar.enableEdit }), + "isHighlightable": Qt.binding(function() { return panoramaViewerToolbar.enableHover }), + "displayGridPano": Qt.binding(function() { return panoramaViewerToolbar.displayGrid }), + "mouseMultiplier": Qt.binding(function() { return panoramaViewerToolbar.mouseSpeed }), + "msfmData": Qt.binding(function() { return (msfmDataLoader && msfmDataLoader.item && msfmDataLoader.status === Loader.Ready && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }), }) } else { @@ -622,7 +623,7 @@ FocusScope { onWidthChanged: if (status==Image.Ready) fit() source: getImageFile() onStatusChanged: { - // update cache source when image is loaded + // Update cache source when image is loaded if (status === Image.Ready) qtImageViewerCache.source = source } @@ -655,7 +656,7 @@ FocusScope { scale: 1.0 // FeatureViewer: display view extracted feature points - // note: requires QtAliceVision plugin - use a Loader to evaluate plugin availability at runtime + // Note: requires QtAliceVision plugin - use a Loader to evaluate plugin availability at runtime ExifOrientedViewer { id: featuresViewerLoader active: displayFeatures.checked && !useExternal @@ -671,12 +672,12 @@ FocusScope { if (active) { // Instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource setSource("FeaturesViewer.qml", { - 'model': Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : "" }), - 'currentViewId': Qt.binding(function() { return _reconstruction.selectedViewId }), - 'features': Qt.binding(function() { return mfeaturesLoader.status === Loader.Ready ? mfeaturesLoader.item : null }), - 'tracks': Qt.binding(function() { return mtracksLoader.status === Loader.Ready ? mtracksLoader.item : null }), - 'sfmData': Qt.binding(function() { return msfmDataLoader.status === Loader.Ready ? msfmDataLoader.item : null }), - 'syncFeaturesSelected': Qt.binding(function() { return sequencePlayer.syncFeaturesSelected }), + "model": Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : "" }), + "currentViewId": Qt.binding(function() { return _reconstruction.selectedViewId }), + "features": Qt.binding(function() { return mfeaturesLoader.status === Loader.Ready ? mfeaturesLoader.item : null }), + "tracks": Qt.binding(function() { return mtracksLoader.status === Loader.Ready ? mtracksLoader.item : null }), + "sfmData": Qt.binding(function() { return msfmDataLoader.status === Loader.Ready ? msfmDataLoader.item : null }), + "syncFeaturesSelected": Qt.binding(function() { return sequencePlayer.syncFeaturesSelected }), }) } else { // Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 @@ -756,7 +757,7 @@ FocusScope { onJsonFolderChanged: { json = null if (activeNode.attribute("autoDetect").value) { - // auto detection enabled + // Auto detection enabled var jsonPath = activeNode.attribute("output").value Request.get(Filepath.stringToUrl(jsonPath), function(xhr) { if (xhr.readyState === XMLHttpRequest.DONE) { @@ -778,25 +779,25 @@ FocusScope { function updateGizmo() { if (activeNode.attribute("autoDetect").value) { - // update gizmo from auto detection json file + // Update gizmo from auto detection JSON file if (json) { - // json file found + // JSON file found var data = json[currentViewId] if (data && data[0]) { - // current view id found + // Current view id found circleX = data[0].x circleY= data[0].y circleRadius = data[0].r return } } - // no auto detection data + // No auto detection data circleX = -1 circleY= -1 circleRadius = 0 } else { - // update gizmo from node manual parameters + // Update gizmo from node manual parameters circleX = nodeCircleX circleY = nodeCircleY circleRadius = nodeCircleRadius @@ -816,7 +817,7 @@ FocusScope { } // ColorCheckerViewer: display color checker detection results - // note: use a Loader to evaluate if a ColorCheckerDetection node exist and displayColorChecker checked at runtime + // Note: use a Loader to evaluate if a ColorCheckerDetection node exist and displayColorChecker checked at runtime ExifOrientedViewer { id: colorCheckerViewerLoader anchors.centerIn: parent @@ -845,6 +846,7 @@ FocusScope { ColumnLayout { anchors.fill: parent spacing: 0 + FloatingPane { id: imagePathToolbar Layout.fillWidth: true @@ -856,7 +858,7 @@ FocusScope { width: parent.width height: childrenRect.height - // selectable filepath to source image + // Selectable filepath to source image TextField { padding: 0 background: Item {} @@ -869,7 +871,7 @@ FocusScope { text: Filepath.urlToString(getImageFile()) } - // write which node is being displayed + // Write which node is being displayed Label { id: displayedNodeName text: root.displayedNode ? root.displayedNode.label : "" @@ -881,7 +883,7 @@ FocusScope { height: contentHeight } - // button to clear currently displayed file + // Button to clear currently displayed file MaterialToolButton { id: clearViewerButton text: MaterialIcons.close @@ -889,8 +891,10 @@ FocusScope { enabled: root.displayedNode || root.useExternal visible: root.displayedNode || root.useExternal onClicked: { - if (root.displayedNode) root.displayedNode = null - if (root.useExternal) root.useExternal = false + if (root.displayedNode) + root.displayedNode = null + if (root.useExternal) + root.useExternal = false } } } @@ -946,7 +950,7 @@ FocusScope { } visible: metadataCB.checked - // only load metadata model if visible + // Only load metadata model if visible metadata: { if (visible) { if (root.useExternal || outputAttribute.name != "gallery") { @@ -985,13 +989,13 @@ FocusScope { onActiveChanged: { if (active) { - // instantiate and initialize a MFeatures component dynamically using Loader.setSource - // so it can fail safely if the c++ plugin is not available + // Instantiate and initialize a MFeatures component dynamically using Loader.setSource + // so it can fail safely if the C++ plugin is not available setSource("MFeatures.qml", { - 'describerTypes': Qt.binding(function() { + "describerTypes": Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : {} }), - 'featureFolders': Qt.binding(function() { + "featureFolders": Qt.binding(function() { let result = [] if (activeNode) { if (activeNode.nodeType == "FeatureExtraction" && isComputed) { @@ -1005,7 +1009,7 @@ FocusScope { } return result }), - 'viewIds': Qt.binding(function() { + "viewIds": Qt.binding(function() { if (_reconstruction) { let result = []; for (let i = 0; i < _reconstruction.viewpoints.count; i++) { @@ -1023,6 +1027,7 @@ FocusScope { } } } + Loader { id: msfmDataLoader @@ -1060,10 +1065,10 @@ FocusScope { onActiveChanged: { if (active) { - // instantiate and initialize a SfmStatsView component dynamically using Loader.setSource + // Instantiate and initialize a SfmStatsView component dynamically using Loader.setSource // so it can fail safely if the c++ plugin is not available setSource("MSfMData.qml", { - 'sfmDataPath': Qt.binding(function() { return filepath }), + "sfmDataPath": Qt.binding(function() { return filepath }), }) } else { // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 @@ -1071,6 +1076,7 @@ FocusScope { } } } + Loader { id: mtracksLoader @@ -1090,7 +1096,7 @@ FocusScope { // instantiate and initialize a SfmStatsView component dynamically using Loader.setSource // so it can fail safely if the c++ plugin is not available setSource("MTracks.qml", { - 'matchingFolders': Qt.binding(function() { + "matchingFolders": Qt.binding(function() { let result = [] if (activeNode) { if (activeNode.nodeType == "FeatureMatching" && isComputed) { @@ -1111,6 +1117,7 @@ FocusScope { } } } + Loader { id: sfmStatsView anchors.fill: parent @@ -1129,6 +1136,7 @@ FocusScope { } } } + Loader { id: sfmGlobalStats anchors.fill: parent @@ -1139,8 +1147,8 @@ FocusScope { // (necessary since Qt 5.14, Component.onCompleted cannot be used anymore to load the data once and for all) if (active) { setSource("SfmGlobalStats.qml", { - 'msfmData': Qt.binding(function() { return msfmDataLoader.item }), - 'mTracks': Qt.binding(function() { return mtracksLoader.item }), + "msfmData": Qt.binding(function() { return msfmDataLoader.item }), + "mTracks": Qt.binding(function() { return mtracksLoader.item }), }) } else { @@ -1148,6 +1156,7 @@ FocusScope { } } } + Loader { id: featuresOverlay anchors { @@ -1171,7 +1180,7 @@ FocusScope { id: ldrHdrCalibrationGraph anchors.fill: parent - property var activeNode: _reconstruction ? _reconstruction.activeNodes.get('LdrToHdrCalibration').node : null + property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("LdrToHdrCalibration").node : null property var isEnabled: displayLdrHdrCalibrationGraph.checked && activeNode && activeNode.isComputed active: isEnabled @@ -1183,6 +1192,7 @@ FocusScope { } } } + FloatingPane { id: bottomToolbar padding: 4 @@ -1192,9 +1202,11 @@ FocusScope { RowLayout { anchors.fill: parent - // zoom label + // Zoom label MLabel { text: ((imgContainer.image && (imgContainer.image.imageStatus === Image.Ready)) ? imgContainer.scale.toFixed(2) : "1.00") + "x" + ToolTip.text: "Zoom" + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton @@ -1210,8 +1222,8 @@ FocusScope { } } } - ToolTip.text: "Zoom" } + MaterialToolButton { id: displayAlphaBackground ToolTip.text: "Alpha Background" @@ -1220,13 +1232,12 @@ FocusScope { Layout.minimumWidth: 0 checkable: true } - MaterialToolButton - { + + MaterialToolButton { id: displayHDR ToolTip.text: "High-Dynamic-Range Image Viewer" text: MaterialIcons.hdr_on - // larger font but smaller padding, - // so it is visually similar. + // Larger font but smaller padding, so it is visually similar font.pointSize: 20 padding: 0 Layout.minimumWidth: 0 @@ -1241,12 +1252,12 @@ FocusScope { root.useFloatImageViewer = !root.useFloatImageViewer } } + MaterialToolButton { id: displayLensDistortionViewer - property int numberChanges: 0 property bool previousChecked: false - property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('sfmData').node : null + property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get("sfmData").node : null property bool isComputed: { if (!activeNode) return false @@ -1294,9 +1305,10 @@ FocusScope { } } } + MaterialToolButton { id: displayPanoramaViewer - property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('SfMTransform').node : null + property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get("SfMTransform").node : null property bool isComputed: { if (!activeNode) return false @@ -1333,6 +1345,7 @@ FocusScope { } } } + MaterialToolButton { id: displayFeatures ToolTip.text: "Display Features" @@ -1343,16 +1356,18 @@ FocusScope { checked: false enabled: root.aliceVisionPluginAvailable && !displayPanoramaViewer.checked && !useExternal onEnabledChanged : { - if (useExternal) return - if (enabled == false) checked = false + if (useExternal) + return + if (enabled == false) + checked = false } } + MaterialToolButton { id: displayFisheyeCircleLoader - property var activeNode: _reconstruction ? _reconstruction.activeNodes.get('PanoramaInit').node : null + property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("PanoramaInit").node : null ToolTip.text: "Display Fisheye Circle: " + (activeNode ? activeNode.label : "No Node") text: MaterialIcons.vignette - // text: MaterialIcons.panorama_fish_eye font.pointSize: 11 Layout.minimumWidth: 0 checkable: true @@ -1360,9 +1375,10 @@ FocusScope { enabled: activeNode && activeNode.attribute("useFisheye").value && !displayPanoramaViewer.checked visible: activeNode } + MaterialToolButton { id: displayLightingCircleLoader - property var activeNode: _reconstruction.activeNodes.get('SphereDetection').node + property var activeNode: _reconstruction.activeNodes.get("SphereDetection").node ToolTip.text: "Display Lighting Circle: " + (activeNode ? activeNode.label : "No Node") text: MaterialIcons.location_searching font.pointSize: 11 @@ -1372,11 +1388,12 @@ FocusScope { enabled: activeNode visible: activeNode } + MaterialToolButton { id: displayColorCheckerViewerLoader - property var activeNode: _reconstruction ? _reconstruction.activeNodes.get('ColorCheckerDetection').node : null + property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("ColorCheckerDetection").node : null ToolTip.text: "Display Color Checker: " + (activeNode ? activeNode.label : "No Node") - text: MaterialIcons.view_comfy //view_module grid_on gradient view_comfy border_all + text: MaterialIcons.view_comfy font.pointSize: 11 Layout.minimumWidth: 0 checkable: true @@ -1465,7 +1482,7 @@ FocusScope { MaterialToolButton { id: displaySfmStatsView - property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('sfm').node : null + property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get("sfm").node : null property bool isComputed: activeNode && activeNode.isComputed font.family: MaterialIcons.fontFamily @@ -1491,7 +1508,7 @@ FocusScope { MaterialToolButton { id: displaySfmDataGlobalStats - property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('sfm').node : null + property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get("sfm").node : null property bool isComputed: activeNode && activeNode.isComputed font.family: MaterialIcons.fontFamily @@ -1514,6 +1531,7 @@ FocusScope { } } } + MaterialToolButton { id: metadataCB @@ -1543,7 +1561,11 @@ FocusScope { id: sequencePlayer anchors.margins: 0 Layout.fillWidth: true - sortedViewIds: { return (root.enableSequencePlayer && (root.displayedNode && root.displayedNode.hasSequenceOutput)) ? root.sequence : (_reconstruction && _reconstruction.viewpoints.count > 0) ? buildOrderedSequence("") : [] } + sortedViewIds: { + return (root.enableSequencePlayer && (root.displayedNode && root.displayedNode.hasSequenceOutput)) ? + root.sequence : + (_reconstruction && _reconstruction.viewpoints.count > 0) ? buildOrderedSequence("") : [] + } viewer: floatImageViewerLoader.status === Loader.Ready ? floatImageViewerLoader.item : null visible: root.enableSequencePlayer enabled: root.enableSequencePlayer @@ -1556,14 +1578,14 @@ FocusScope { // Busy indicator BusyIndicator { anchors.centerIn: parent - // running property binding seems broken, only dynamic binding assignment works + // Running property binding seems broken, only dynamic binding assignment works Component.onCompleted: { running = Qt.binding(function() { return (root.usePanoramaViewer === true && imgContainer.image && imgContainer.image.allImagesLoaded === false) || (imgContainer.image && imgContainer.image.imageStatus === Image.Loading) }) } - // disable the visibility when unused to avoid stealing the mouseEvent to the image color picker + // Disable the visibility when unused to avoid stealing the mouseEvent to the image color picker visible: running onVisibleChanged: { @@ -1578,10 +1600,10 @@ FocusScope { shortcut: "R" onTriggered: { - if (hdrImageToolbar.channelModeValue !== 'r') { - hdrImageToolbar.channelModeValue = 'r' + if (hdrImageToolbar.channelModeValue !== "r") { + hdrImageToolbar.channelModeValue = "r" } else { - hdrImageToolbar.channelModeValue = 'rgba' + hdrImageToolbar.channelModeValue = "rgba" } } } @@ -1591,10 +1613,10 @@ FocusScope { shortcut: "G" onTriggered: { - if (hdrImageToolbar.channelModeValue !== 'g') { - hdrImageToolbar.channelModeValue = 'g' + if (hdrImageToolbar.channelModeValue !== "g") { + hdrImageToolbar.channelModeValue = "g" } else { - hdrImageToolbar.channelModeValue = 'rgba' + hdrImageToolbar.channelModeValue = "rgba" } } } @@ -1604,10 +1626,10 @@ FocusScope { shortcut: "B" onTriggered: { - if (hdrImageToolbar.channelModeValue !== 'b') { - hdrImageToolbar.channelModeValue = 'b' + if (hdrImageToolbar.channelModeValue !== "b") { + hdrImageToolbar.channelModeValue = "b" } else { - hdrImageToolbar.channelModeValue = 'rgba' + hdrImageToolbar.channelModeValue = "rgba" } } } @@ -1617,10 +1639,10 @@ FocusScope { shortcut: "A" onTriggered: { - if (hdrImageToolbar.channelModeValue !== 'a') { - hdrImageToolbar.channelModeValue = 'a' + if (hdrImageToolbar.channelModeValue !== "a") { + hdrImageToolbar.channelModeValue = "a" } else { - hdrImageToolbar.channelModeValue = 'rgba' + hdrImageToolbar.channelModeValue = "rgba" } } } diff --git a/meshroom/ui/qml/Viewer3D/BoundingBox.qml b/meshroom/ui/qml/Viewer3D/BoundingBox.qml index 95bf01bb..543d90d3 100644 --- a/meshroom/ui/qml/Viewer3D/BoundingBox.qml +++ b/meshroom/ui/qml/Viewer3D/BoundingBox.qml @@ -15,7 +15,7 @@ Entity { CuboidMesh { id: cube - property real edge : 1.995 // Almost 2: important to have all the cube's vertices with a unit of 1 + property real edge : 1.995 // Almost 2: important to have all the cube's vertices with a unit of 1 xExtent: edge yExtent: edge zExtent: edge @@ -88,4 +88,4 @@ Entity { } } } -} \ No newline at end of file +} diff --git a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml index 24e6bd8a..5320753d 100644 --- a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml +++ b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml @@ -23,7 +23,7 @@ Entity { property alias windowSize: trackball.windowSize property alias trackballSize: trackball.trackballSize - property bool loseMouseFocus: false // Must be changed by other entities when they want to take mouse focus + property bool loseMouseFocus: false // Must be changed by other entities when they want to take mouse focus readonly property alias pressed: mouseHandler._pressed signal mousePressed(var mouse) @@ -84,9 +84,9 @@ Entity { } if (zooming) { // Zoom with alt + RMD mouseHandler.hasMoved = true - d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position + d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position var zoomPower = 0.2 - var tz = axisMX.value * root.translateSpeed * zoomPower // Translation to apply depending on user action (mouse move), bigger absolute value means we'll zoom/dezoom more + var tz = axisMX.value * root.translateSpeed * zoomPower // Translation to apply depending on user action (mouse move), bigger absolute value means we'll zoom/dezoom more var tzThreshold = 0.001 // We forbid too big zoom, as it means the distance between camera and center would be too low and we'll have no translation after (due to float representation) @@ -104,10 +104,10 @@ Entity { onDoubleClicked: function(mouse) { mouseDoubleClicked(mouse) } onWheel: function(wheel) { - var d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position + var d = root.camera.viewCenter.minus(root.camera.position).length() // Distance between camera position and center position var zoomPower = 0.2 - var angleStep = 120 // wheel.angleDelta.y = +- 120 * number of wheel rotations - var tz = (wheel.angleDelta.y / angleStep) * d * zoomPower // Translation to apply depending on user action (mouse wheel), bigger absolute value means we'll zoom/dezoom more + var angleStep = 120 + var tz = (wheel.angleDelta.y / angleStep) * d * zoomPower // Translation to apply depending on user action (mouse wheel), bigger absolute value means we'll zoom/dezoom more var tzThreshold = 0.001 // We forbid too big zoom, as it means the distance between camera and center would be too low and we'll have no translation after (due to float representation) @@ -129,8 +129,7 @@ Entity { sourceDevice: keyboardSourceDevice property bool _pressed - // When focus is lost while pressing a key, the corresponding action - // stays active, even when it's released. + // When focus is lost while pressing a key, the corresponding action stays active, even when it's released. // Handle this issue manually by keeping an additional _pressed state // which is cleared when focus changes (used for 'pickingActive' property). onFocusChanged: function(focus) { diff --git a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml index 8ec7b0d4..0eea255e 100644 --- a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml +++ b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml @@ -4,11 +4,12 @@ import DepthMapEntity 2.1 * Support for Depth Map files (EXR) in Qt3d. * Create this component dynamically to test for DepthMapEntity plugin availability. */ + DepthMapEntity { id: root pointSize: Viewer3DSettings.pointSize * (Viewer3DSettings.fixedPointSize ? 1.0 : 0.001) - // map render modes to custom visualization modes + // Map render modes to custom visualization modes displayMode: Viewer3DSettings.renderMode == 0 ? DepthMapEntity.Points : DepthMapEntity.Triangles displayColor: Viewer3DSettings.renderMode == 1 } diff --git a/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml b/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml index 034371cd..f2fc7976 100644 --- a/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml +++ b/meshroom/ui/qml/Viewer3D/EnvironmentMapEntity.qml @@ -3,12 +3,12 @@ import Qt3D.Core 2.6 import Qt3D.Render 2.6 import Qt3D.Extras 2.15 - /** * EnvironmentMap maps an equirectangular image on a Sphere. * The 'position' property can be used to virually attach it to a camera * and get the impression of an environment at an infinite distance. */ + Entity { id: root diff --git a/meshroom/ui/qml/Viewer3D/Grid3D.qml b/meshroom/ui/qml/Viewer3D/Grid3D.qml index 25e57123..06ec8fdc 100644 --- a/meshroom/ui/qml/Viewer3D/Grid3D.qml +++ b/meshroom/ui/qml/Viewer3D/Grid3D.qml @@ -20,30 +20,29 @@ Entity { buffer: Buffer { data: { function buildGrid(first, last, offset, attribute) { - var vertexCount = (((last-first)/offset)+1)*4; - var f32 = new Float32Array(vertexCount*3); - for (var id = 0, i = first; i <= last; i += offset, id++) - { - f32[12*id] = i; - f32[12*id+1] = 0.0; - f32[12*id+2] = first; + var vertexCount = (((last - first) / offset) + 1) * 4 + var f32 = new Float32Array(vertexCount * 3) + for (var id = 0, i = first; i <= last; i += offset, id++) { + f32[12 * id] = i + f32[12 * id + 1] = 0.0 + f32[12 * id + 2] = first - f32[12*id+3] = i; - f32[12*id+4] = 0.0; - f32[12*id+5] = last; + f32[12 * id + 3] = i + f32[12 * id + 4] = 0.0 + f32[12 * id + 5] = last - f32[12*id+6] = first; - f32[12*id+7] = 0.0; - f32[12*id+8] = i; + f32[12 * id + 6] = first + f32[12 * id + 7] = 0.0 + f32[12 * id + 8] = i - f32[12*id+9] = last; - f32[12*id+10] = 0.0; - f32[12*id+11] = i; + f32[12 * id + 9] = last + f32[12 * id + 10] = 0.0 + f32[12 * id + 11] = i } - attribute.count = vertexCount; - return f32; + attribute.count = vertexCount + return f32 } - return buildGrid(-12, 12, 1, gridPosition); + return buildGrid(-12, 12, 1, gridPosition) } } } diff --git a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml index e4b2d48c..89cc63ee 100644 --- a/meshroom/ui/qml/Viewer3D/ImageOverlay.qml +++ b/meshroom/ui/qml/Viewer3D/ImageOverlay.qml @@ -6,10 +6,11 @@ import QtQuick.Layouts * It takes the principal point correction into account and handle image ratio to * correctly fit or crop according to original image ratio and parent Item ratio. */ + Item { id: root - /// The url of the image to display + /// The URL of the image to display property alias source: image.source /// Source image ratio property real imageRatio: 1.0 @@ -53,14 +54,13 @@ Item { smooth: false anchors.fill: parent visible: false - // Preserver aspect fit while display ratio is aligned with image ratio, crop otherwise - fillMode: width/height >= imageRatio ? Image.PreserveAspectFit : Image.PreserveAspectCrop + // Preserve aspect fit while display ratio is aligned with image ratio, crop otherwise + fillMode: width / height >= imageRatio ? Image.PreserveAspectFit : Image.PreserveAspectCrop autoTransform: true } - // Custom shader for displaying undistorted images - // with principal point correction + // Custom shader for displaying undistorted images with principal point correction ShaderEffect { id: shader anchors.centerIn: parent diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index aa2ea093..c7eedd85 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -352,7 +352,7 @@ FloatingPane { filters: [{role: "label", value: searchBar.text}] delegate: MouseArea { id: mediaDelegate - // add mediaLibrary.count in the binding to ensure 'entity' + // Add mediaLibrary.count in the binding to ensure 'entity' // is re-evaluated when mediaLibrary delegates are modified property bool loading: model.status === SceneLoader.Loading property bool hovered: model.attribute ? (uigraph ? uigraph.hoveredNode === model.attribute.node : false) : containsMouse diff --git a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml index 78d4174b..eb6ef08e 100644 --- a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml @@ -11,6 +11,7 @@ import "Materials" * MaterialSwitcher is an Entity that can change its parent's material * by setting the 'mode' property. */ + Entity { id: root objectName: "MaterialSwitcher" @@ -28,7 +29,7 @@ Entity { id: m property Material material onMaterialChanged: { - // remove previous material(s) + // Remove previous material(s) removeComponentsByType(parent, "Material") Scene3DHelper.addComponent(root.parent, material) } @@ -38,10 +39,8 @@ Entity { { if (!entity) return - for (var i = 0; i < entity.components.length; ++i) - { + for (var i = 0; i < entity.components.length; ++i) { if (entity.components[i].toString().indexOf(type) !== -1) { - //entity.components[i].enabled = false; Scene3DHelper.removeComponent(entity, entity.components[i]) } } diff --git a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml index 96d9f5b7..5086fa65 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/SphericalHarmonicsMaterial.qml @@ -13,7 +13,7 @@ Material { /// Whether to display normals instead of SH property bool displayNormals: false - // default coefficients (uniform magenta) + // Default coefficients (uniform magenta) readonly property var noCoeffs: [ Qt.vector3d(0.0, 0.0, 0.0), Qt.vector3d(0.0, 0.0, 0.0), @@ -29,10 +29,11 @@ Material { effect: SphericalHarmonicsEffect {} onShlSourceChanged: { - if(!shlSource) { - coefficients = noCoeffs; - return; + if (!shlSource) { + coefficients = noCoeffs + return } + Request.get(Filepath.urlToString(shlSource), function(xhr) { if (xhr.readyState === XMLHttpRequest.DONE) { var coeffs = [] @@ -40,7 +41,8 @@ Material { lines.forEach(function(l) { var lineCoeffs = [] l.split(" ").forEach(function(v) { - if (v) { lineCoeffs.push(v) } + if (v) + lineCoeffs.push(v) }) if (lineCoeffs.length == 3) coeffs.push(Qt.vector3d(lineCoeffs[0], lineCoeffs[1], lineCoeffs[2])) diff --git a/meshroom/ui/qml/Viewer3D/MediaCache.qml b/meshroom/ui/qml/Viewer3D/MediaCache.qml index bd620e30..9c394aa1 100644 --- a/meshroom/ui/qml/Viewer3D/MediaCache.qml +++ b/meshroom/ui/qml/Viewer3D/MediaCache.qml @@ -10,7 +10,7 @@ Entity { /// Enable debug mode (show cache entity with a scale applied) property bool debug: false - enabled: false // disabled entity + enabled: false // Disabled entity components: [ Transform { @@ -58,7 +58,7 @@ Entity { if (debug) { console.log("[cache] add: " + source) } mediaCache[source] = object object.parent = root - // remove oldest entry in cache + // Remove oldest entry in cache if (currentSize() > cacheSize) shrink() return true @@ -72,7 +72,7 @@ Entity { var obj = mediaCache[source] delete mediaCache[source] if (debug) { console.log("[cache] pop: " + source) } - // delete cached obj if file does not exist on disk anymore + // Delete cached obj if file does not exist on disk anymore if (!Filepath.exists(source)) { if (debug) { console.log("[cache] destroy: " + source) } obj.destroy() diff --git a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml index b06dbcfb..1d8d2a87 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml @@ -9,13 +9,14 @@ import Utils 1.0 * MediaLibrary is an Entity that loads and manages a list of 3D media. * It also uses an internal cache to instantly reload media. */ + Entity { id: root readonly property alias model: m.mediaModel property int renderMode property bool pickingEnabled: false - readonly property alias count: instantiator.count // number of instantiated media delegates + readonly property alias count: instantiator.count // Number of instantiated media delegates // For TransformGizmo in BoundingBox property DefaultCameraController sceneCameraController @@ -47,10 +48,10 @@ Entity { "valid": true, "label": "", "visible": true, - "hasBoundingBox": false, // for Meshing node only - "displayBoundingBox": true, // for Meshing node only - "hasTransform": false, // for SfMTransform node only - "displayTransform": true, // for SfMTransform node only + "hasBoundingBox": false, // For Meshing node only + "displayBoundingBox": true, // For Meshing node only + "hasTransform": false, // For SfMTransform node only + "displayTransform": true, // For SfMTransform node only "section": "", "attribute": null, "entity": null, @@ -71,7 +72,7 @@ Entity { } function ensureVisible(source) { - var idx = find(source); + var idx = find(source) if (idx === -1) return m.mediaModel.get(idx).visible = true @@ -194,7 +195,7 @@ Entity { // Whether MediaLoader has been fully instantiated by the NodeInstantiator property bool fullyInstantiated: false - // explicitly store some attached model properties for outside use and ease binding + // Explicitly store some attached model properties for outside use and ease binding readonly property var attribute: model.attribute readonly property int idx: index readonly property var modelSource: attribute || model.source @@ -340,7 +341,7 @@ Entity { } // Transform: display a TransformGizmo for SfMTransform node only - // note: use a NodeInstantiator to evaluate if the current node is a SfMTransform node and if the transform mode is set to Manual + // Note: use a NodeInstantiator to evaluate if the current node is a SfMTransform node and if the transform mode is set to Manual NodeInstantiator { id: sfmTransformGizmoInstantiator active: instantiatedEntity.hasTransform @@ -355,14 +356,14 @@ Entity { enabled: mediaLoader.visible && instantiatedEntity.displayTransform Component.onCompleted: { - mediaLoader.drawInputSource() // Because we are sure we want to show the input in MANUAL mode only - Scene3DHelper.addComponent(mediaLoader, sfmTransformGizmoEntity.objectTransform) // Add the transform to the media to see real-time transformations + mediaLoader.drawInputSource() // Because we are sure we want to show the input in MANUAL mode only + Scene3DHelper.addComponent(mediaLoader, sfmTransformGizmoEntity.objectTransform) // Add the transform to the media to see real-time transformations } } } // BoundingBox: display bounding box for MESHING computation - // note: use a NodeInstantiator to evaluate if the current node is a MESHING node and if the checkbox is active + // Note: use a NodeInstantiator to evaluate if the current node is a MESHING node and if the checkbox is active NodeInstantiator { id: boundingBoxInstantiator active: instantiatedEntity.hasBoundingBox diff --git a/meshroom/ui/qml/Viewer3D/MediaLoader.qml b/meshroom/ui/qml/Viewer3D/MediaLoader.qml index b386815b..10a23305 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoader.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoader.qml @@ -7,11 +7,11 @@ import QtQuick.Scene3D 2.6 import "Materials" import Utils 1.0 - /** * MediaLoader provides a single entry point for 3D media loading. * It encapsulates all available plugins/loaders. */ + Entity { id: root @@ -32,7 +32,7 @@ import Utils 1.0 return } - // clear previously created object if any + // Clear previously created object if any if (object) { object.destroy() object = null @@ -48,13 +48,11 @@ import Utils 1.0 switch (Filepath.extension(source)) { case ".ply": - if ((Filepath.extension(Filepath.removeExtension(source))) == ".pc") - { + if ((Filepath.extension(Filepath.removeExtension(source))) == ".pc") { if (Viewer3DSettings.supportSfmData) component = sfmDataLoaderEntityComponent } - else - { + else { component = sceneLoaderEntityComponent } break @@ -108,28 +106,28 @@ import Utils 1.0 id: sfmDataLoaderEntity Component.onCompleted: { var obj = Viewer3DSettings.sfmDataLoaderComp.createObject(sfmDataLoaderEntity, { - 'source': source, - 'pointSize': Qt.binding(function() { return 0.01 * Viewer3DSettings.pointSize }), - 'locatorScale': Qt.binding(function() { return Viewer3DSettings.cameraScale }), - 'cameraPickingEnabled': Qt.binding(function() { return root.enabled }), - 'resectionId': Qt.binding(function() { return Viewer3DSettings.resectionId }), - 'displayResections': Qt.binding(function() { return Viewer3DSettings.displayResectionIds }), - 'syncPickedViewId': Qt.binding(function() { return Viewer3DSettings.syncWithPickedViewId }) + "source": source, + "pointSize": Qt.binding(function() { return 0.01 * Viewer3DSettings.pointSize }), + "locatorScale": Qt.binding(function() { return Viewer3DSettings.cameraScale }), + "cameraPickingEnabled": Qt.binding(function() { return root.enabled }), + "resectionId": Qt.binding(function() { return Viewer3DSettings.resectionId }), + "displayResections": Qt.binding(function() { return Viewer3DSettings.displayResectionIds }), + "syncPickedViewId": Qt.binding(function() { return Viewer3DSettings.syncWithPickedViewId }) }); obj.statusChanged.connect(function() { if (obj.status === SceneLoader.Ready) { for (var i = 0; i < obj.pointClouds.length; ++i) { - vertexCount += Scene3DHelper.vertexCount(obj.pointClouds[i]); + vertexCount += Scene3DHelper.vertexCount(obj.pointClouds[i]) } - cameraCount = obj.spawnCameraSelectors(); + cameraCount = obj.spawnCameraSelectors() } - Viewer3DSettings.resectionIdCount = obj.countResectionIds(); - Viewer3DSettings.resectionGroups = obj.countResectionGroups(Viewer3DSettings.resectionIdCount + 1); + Viewer3DSettings.resectionIdCount = obj.countResectionIds() + Viewer3DSettings.resectionGroups = obj.countResectionGroups(Viewer3DSettings.resectionIdCount + 1) resectionIdCount = Viewer3DSettings.resectionIdCount resectionGroups = Viewer3DSettings.resectionGroups resectionId = Viewer3DSettings.resectionIdCount - root.status = obj.status; + root.status = obj.status }) obj.cameraSelected.connect( @@ -158,7 +156,7 @@ import Utils 1.0 // - [1] as a depth map var obj = Viewer3DSettings.depthMapLoaderComp.createObject( exrLoaderEntity, { - 'source': source + "source": source }) if (obj.status === SceneLoader.Ready) { @@ -172,8 +170,8 @@ import Utils 1.0 root.status = SceneLoader.Loading obj = Qt.createComponent("EnvironmentMapEntity.qml").createObject( exrLoaderEntity, { - 'source': source, - 'position': Qt.binding(function() { return root.camera.position }) + "source": source, + "position": Qt.binding(function() { return root.camera.position }) }) obj.statusChanged.connect(function() { root.status = obj.status; @@ -208,9 +206,9 @@ import Utils 1.0 { var comp = entity.components[i] - // handle DiffuseMapMaterials created by SceneLoader + // Handle DiffuseMapMaterials created by SceneLoader if (comp.toString().indexOf("QDiffuseMapMaterial") > -1) { - // store material definition + // Store material definition var m = { "diffuseMap": comp.diffuse.data[0].source, "shininess": comp.shininess, @@ -224,19 +222,19 @@ import Utils 1.0 } if (comp.toString().indexOf("QPhongMaterial") > -1) { - // create MaterialSwitcher with default colors + // Create MaterialSwitcher with default colors mats.push({}) componentsToRemove.push(comp) } } mats.forEach(function(m) { - // create a material switcher for each material definition + // Create a material switcher for each material definition var matSwitcher = materialSwitcherComponent.createObject(entity, m) - matSwitcher.mode = Qt.binding(function(){ return root.renderMode }) + matSwitcher.mode = Qt.binding(function() { return root.renderMode }) }) - // remove replaced components + // Remove replaced components componentsToRemove.forEach(function(comp) { Scene3DHelper.removeComponent(entity, comp) }) diff --git a/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml b/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml index f64efdb5..963765ad 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml @@ -1,11 +1,11 @@ import QtQuick import Qt3D.Core 2.6 - /** * MediaLoaderEntity provides a unified interface for accessing statistics * of a 3D media independently from the way it was loaded. */ + Entity { property url source diff --git a/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml b/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml index c8c89841..88bf5666 100644 --- a/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/SfMTransformGizmo.qml @@ -9,6 +9,7 @@ import QtQuick * Gizmo for SfMTransform node. * Uses EntityWithGizmo wrapper because we should not instantiate TransformGizmo alone. */ + Entity { id: root property DefaultCameraController sceneCameraController @@ -24,7 +25,7 @@ Entity { sceneCameraController: root.sceneCameraController frontLayerComponent: root.frontLayerComponent window: root.window - uniformScale: true // We want to make uniform scale transformations + uniformScale: true // We want to make uniform scale transformations // Update node SfMTransform slider values when the gizmo has changed: translation, rotation, scale, type transformGizmo.onGizmoChanged: { diff --git a/meshroom/ui/qml/Viewer3D/TransformGizmo.qml b/meshroom/ui/qml/Viewer3D/TransformGizmo.qml index cb98aa43..e1d71153 100644 --- a/meshroom/ui/qml/Viewer3D/TransformGizmo.qml +++ b/meshroom/ui/qml/Viewer3D/TransformGizmo.qml @@ -8,25 +8,25 @@ import QtQuick.Controls import Utils 1.0 - /** * Simple transformation gizmo entirely made with Qt3D entities. * Uses Python Transformations3DHelper to compute matrices. * This TransformGizmo entity should only be instantiated in EntityWithGizmo entity which is its wrapper. * It means, to use it for a specified application, make sure to instantiate EntityWithGizmo. */ + Entity { id: root property Camera camera property var windowSize - property Layer frontLayerComponent // Used to draw gizmo on top of everything + property Layer frontLayerComponent // Used to draw gizmo on top of everything property var window readonly property alias gizmoScale: gizmoScaleLookSlider.value - property bool uniformScale: false // By default, the scale is not uniform - property bool focusGizmoPriority: false // If true, it is used to give the priority to the current transformation (and not to a upper-level binding) + property bool uniformScale: false // By default, the scale is not uniform + property bool focusGizmoPriority: false // If true, it is used to give the priority to the current transformation (and not to a upper-level binding) property Transform gizmoDisplayTransform: Transform { id: gizmoDisplayTransform - scale: root.gizmoScale * (camera.position.minus(gizmoDisplayTransform.translation)).length() // The gizmo needs a constant apparent size + scale: root.gizmoScale * (camera.position.minus(gizmoDisplayTransform.translation)).length() // The gizmo needs a constant apparent size } // Component the object controlled by the gizmo must use property Transform objectTransform : Transform { @@ -39,7 +39,7 @@ Entity { signal gizmoChanged(var translation, var rotation, var scale, int type) function emitGizmoChanged(type) { - const translation = gizmoDisplayTransform.translation // Position in space + const translation = gizmoDisplayTransform.translation // Position in space const rotation = Qt.vector3d(gizmoDisplayTransform.rotationX, gizmoDisplayTransform.rotationY, gizmoDisplayTransform.rotationZ) // Euler angles const scale = objectTransform.scale3D // Scale of the object @@ -249,12 +249,12 @@ Entity { // Do the transformation if (objectPicker.gizmoType === TransformGizmo.Type.TRANSLATION && offset !== 0) { - doRelativeTranslation(objectPicker.modelMatrix, pickedAxis.times(offset)) // Do a translation from the initial Object Model Matrix when we picked the gizmo + doRelativeTranslation(objectPicker.modelMatrix, pickedAxis.times(offset)) // Do a translation from the initial Object Model Matrix when we picked the gizmo } else if (objectPicker.gizmoType === TransformGizmo.Type.SCALE && offset !== 0) { if (root.uniformScale) - doRelativeScale(objectPicker.modelMatrix, Qt.vector3d(1, 1, 1).times(offset)) // Do a uniform scale from the initial Object Model Matrix when we picked the gizmo + doRelativeScale(objectPicker.modelMatrix, Qt.vector3d(1, 1, 1).times(offset)) // Do a uniform scale from the initial Object Model Matrix when we picked the gizmo else - doRelativeScale(objectPicker.modelMatrix, pickedAxis.times(offset)) // Do a scale on one axis from the initial Object Model Matrix when we picked the gizmo + doRelativeScale(objectPicker.modelMatrix, pickedAxis.times(offset)) // Do a scale on one axis from the initial Object Model Matrix when we picked the gizmo } else if (objectPicker.gizmoType === TransformGizmo.Type.ALL && offset !== 0) { @@ -284,7 +284,8 @@ Entity { const gizmoToCameraVector = camera.position.toVector4d().minus(gizmoCenterPoint) const orientation = gizmoLocalAxisVector.dotProduct(gizmoToCameraVector) > 0 ? 1 : -1 - if (angle !== 0) doRelativeRotation(objectPicker.modelMatrix, pickedAxis, angle * orientation) // Do a rotation from the initial Object Model Matrix when we picked the gizmo + if (angle !== 0) + doRelativeRotation(objectPicker.modelMatrix, pickedAxis, angle * orientation) // Do a rotation from the initial Object Model Matrix when we picked the gizmo return } @@ -297,7 +298,7 @@ Entity { onReleased: { if (objectPicker && mouse.button === Qt.LeftButton) { const type = objectPicker.gizmoType - objectPicker = null // To prevent going again in the onPositionChanged + objectPicker = null // To prevent going again in the onPositionChanged emitGizmoChanged(type) } } @@ -388,9 +389,9 @@ Entity { } property color baseColor: { switch (axis) { - case TransformGizmo.Axis.X: return "#e63b55" // Red - case TransformGizmo.Axis.Y: return "#83c414" // Green - case TransformGizmo.Axis.Z: return "#3387e2" // Blue + case TransformGizmo.Axis.X: return "#e63b55" // Red + case TransformGizmo.Axis.Y: return "#83c414" // Green + case TransformGizmo.Axis.Z: return "#3387e2" // Blue } } property real lineRadius: 0.011 @@ -564,7 +565,7 @@ Entity { // These three surfaces have "forward direction". The three othersurfaces have "backward direction". NodeInstantiator { model: 2 - active: !root.uniformScale // shouldn't be active for SfmTransform Gizmo node for example + active: !root.uniformScale // Shouldn't be active for SfmTransform Gizmo node for example Entity { @@ -654,7 +655,7 @@ Entity { Transform { id: torusTransform matrix: { - const scaleDiff = 2 * torusMesh.minorRadius + 0.01 // Just to make sure there is no face overlapping + const scaleDiff = 2 * torusMesh.minorRadius + 0.01 // Just to make sure there is no face overlapping const m = Qt.matrix4x4() switch (axis) { case TransformGizmo.Axis.X: m.rotate(90, Qt.vector3d(0, 1, 0)); break diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 9c24caeb..3d51f9fc 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -26,7 +26,7 @@ FocusScope { readonly property var viewpoint: _reconstruction ? _reconstruction.selectedViewpoint : null readonly property bool doSyncViewpointCamera: Viewer3DSettings.syncViewpointCamera && (viewpoint && viewpoint.isReconstructed) - // functions + // Functions function resetCameraPosition() { mainCamera.position = defaultCamPosition mainCamera.upVector = defaultCamUpVector @@ -62,8 +62,8 @@ FocusScope { Scene3D { id: scene3D anchors.fill: parent - cameraAspectRatioMode: Scene3D.AutomaticAspectRatio // vs. UserAspectRatio - hoverEnabled: true // if true, will trigger positionChanged events in attached MouseHandler + cameraAspectRatioMode: Scene3D.AutomaticAspectRatio // vs. UserAspectRatio + hoverEnabled: true // If true, will trigger positionChanged events in attached MouseHandler aspects: ["logic", "input"] focus: true @@ -85,9 +85,9 @@ FocusScope { Keys.onPressed: function(event) { if (event.key === Qt.Key_F) { - resetCameraPosition(); + resetCameraPosition() } else if (Qt.Key_1 <= event.key && event.key < Qt.Key_1 + Viewer3DSettings.renderModes.length) { - Viewer3DSettings.renderMode = event.key - Qt.Key_1; + Viewer3DSettings.renderMode = event.key - Qt.Key_1 } else { event.accepted = false } @@ -179,7 +179,7 @@ FocusScope { components: [ RenderSettings { - pickingSettings.pickMethod: PickingSettings.PrimitivePicking // enables point/edge/triangle picking + pickingSettings.pickMethod: PickingSettings.PrimitivePicking // Enables point/edge/triangle picking pickingSettings.pickResultMode: PickingSettings.NearestPick renderPolicy: RenderSettings.Always @@ -326,7 +326,7 @@ FocusScope { font.pointSize: 11 onClicked: Viewer3DSettings.renderMode = index checked: Viewer3DSettings.renderMode === index - checkable: !checked // hack to disabled check on toggle + checkable: !checked // Hack to disabled check on toggle } } } diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index 8e946a21..d4c02780 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -6,28 +6,29 @@ import MaterialIcons 2.2 /** * Viewer3DSettings singleton gathers properties related to the 3D Viewer capabilities, state and display options. */ + Item { readonly property Component sfmDataLoaderComp: Qt.createComponent("SfmDataLoader.qml") readonly property bool supportSfmData: sfmDataLoaderComp.status == Component.Ready readonly property Component depthMapLoaderComp: Qt.createComponent("DepthMapLoader.qml") readonly property bool supportDepthMap: depthMapLoaderComp.status == Component.Ready - // supported 3D files extensions + // Supported 3D files extensions readonly property var supportedExtensions: { - var exts = ['.obj', '.stl', '.fbx', '.gltf', '.ply']; + var exts = [".obj", ".stl", ".fbx", ".gltf", ".ply"]; if (supportSfmData) { - exts.push('.abc') - exts.push('.json') - exts.push('.sfm') + exts.push(".abc") + exts.push(".json") + exts.push(".sfm") } if (supportDepthMap) - exts.push('.exr') + exts.push(".exr") return exts; } // Available render modes - readonly property var renderModes: [ // Can't use ListModel because of MaterialIcons expressions + readonly property var renderModes: [ // Can't use ListModel because of MaterialIcons expressions {"name": "Solid", "icon": MaterialIcons.crop_din }, /* {"name": "Wireframe", "icon": MaterialIcons.details }, */ {"name": "Textured", "icon": MaterialIcons.texture }, diff --git a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml index df1328c4..bc84d5c1 100644 --- a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml +++ b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml @@ -2,10 +2,10 @@ import QtQuick import Qt3D.Core 2.6 import Qt3D.Render 2.6 - /** * ViewpointCamera sets up a Camera to match a Viewpoint's internal parameters. */ + Entity { id: root @@ -51,5 +51,4 @@ Entity { } ] } - } diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index 2772ffa8..46324d09 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -143,8 +143,7 @@ ApplicationWindow { // Check and return whether no local computation is in progress function ensureNotComputing() { - if (_reconstruction.computingLocally) - { + if (_reconstruction.computingLocally) { // Open a warning dialog to ask for computation to be stopped mainStack.currentItem.computingAtExitDialog.open() return false From 5953ed5767fa29dd8d3389a4e922f721d0936621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 11 Oct 2024 15:57:23 +0200 Subject: [PATCH 47/64] [qt6] Add QT6 support for wireframe on nvidia --- meshroom/submitters/simpleFarmSubmitter.py | 2 +- meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml | 12 +- .../Viewer3D/Materials/WireframeEffect.qml | 9 -- .../Viewer3D/Materials/WireframeMaterial.qml | 17 --- .../Materials/shaders/robustwireframe.frag | 117 ++-------------- .../Materials/shaders/robustwireframe.geom | 131 ------------------ .../Materials/shaders/robustwireframe.vert | 46 ++++-- meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 2 +- 8 files changed, 49 insertions(+), 287 deletions(-) delete mode 100644 meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.geom diff --git a/meshroom/submitters/simpleFarmSubmitter.py b/meshroom/submitters/simpleFarmSubmitter.py index d869a332..2628c291 100644 --- a/meshroom/submitters/simpleFarmSubmitter.py +++ b/meshroom/submitters/simpleFarmSubmitter.py @@ -39,7 +39,7 @@ class SimpleFarmSubmitter(BaseSubmitter): # logging.info('REZ: {}'.format(str(r))) v = r.split('-') # logging.info(' v: {}'.format(str(v))) - if len(v) == 2: + if len(v) >= 2: resolvedVersions[v[0]] = v[1] for p in packages: if p.startswith('~'): diff --git a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml index eb6ef08e..9a9614be 100644 --- a/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml @@ -55,10 +55,10 @@ Entity { name: "Solid" PropertyChanges { target: m; material: solid } }, - /* State { + State { name: "Wireframe" PropertyChanges { target: m; material: wireframe } - }, */ + }, State { name: "Textured" PropertyChanges { @@ -105,15 +105,11 @@ Entity { } } - /* WireframeMaterial { + WireframeMaterial { id: wireframe objectName: "WireframeMaterial" effect: WireframeEffect {} - ambient: root.ambient - diffuse: root.diffuseColor - shininess: 0 - specular: root.specular - } */ + } SphericalHarmonicsMaterial { id: shMaterial diff --git a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml index f3a888c4..0ae376e6 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/WireframeEffect.qml @@ -5,10 +5,6 @@ Effect { id: root parameters: [ - Parameter { name: "ka"; value: Qt.vector3d(0.1, 0.1, 0.1) }, - Parameter { name: "kd"; value: Qt.vector3d(0.7, 0.7, 0.7) }, - Parameter { name: "ks"; value: Qt.vector3d(0.95, 0.95, 0.95) }, - Parameter { name: "shininess"; value: 150.0 } ] techniques: [ @@ -23,17 +19,12 @@ Effect { filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ] parameters: [ - Parameter { name: "light.position"; value: Qt.vector4d(0.0, 0.0, 0.0, 1.0) }, - Parameter { name: "light.intensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }, - Parameter { name: "line.width"; value: 1.0 }, - Parameter { name: "line.color"; value: Qt.vector4d(1.0, 1.0, 1.0, 1.0) } ] renderPasses: [ RenderPass { shaderProgram: ShaderProgram { vertexShaderCode: loadSource(Qt.resolvedUrl("shaders/robustwireframe.vert")) - geometryShaderCode: loadSource(Qt.resolvedUrl("shaders/robustwireframe.geom")) fragmentShaderCode: loadSource(Qt.resolvedUrl("shaders/robustwireframe.frag")) } } diff --git a/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml b/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml index 37dc534c..c9b54131 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml +++ b/meshroom/ui/qml/Viewer3D/Materials/WireframeMaterial.qml @@ -4,25 +4,8 @@ import Qt3D.Render 2.6 Material { id: root - property color ambient: Qt.rgba(0.05, 0.05, 0.05, 1.0) - property color diffuse: Qt.rgba(0.7, 0.7, 0.7, 1.0) - property color specular: Qt.rgba(0.95, 0.95, 0.95, 1.0) - property real shininess: 1.0 - property real lineWidth: 0.8 - property color lineColor: Qt.rgba(0.2, 0.2, 0.2, 1.0) - property vector3d lightIntensity: Qt.vector3d(0.7, 0.7, 0.7) - property vector4d lightPosition: Qt.vector4d(0.0, 0.0, 0.0, 1.0) - effect: WireframeEffect {} parameters: [ - Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) }, - Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) }, - Parameter { name: "ksp"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) }, - Parameter { name: "shininess"; value: root.shininess }, - Parameter { name: "line.width"; value: root.lineWidth }, - Parameter { name: "line.color"; value: root.lineColor }, - Parameter { name: "light.intensity"; value: root.lightIntensity }, - Parameter { name: "light.position"; value: root.lightPosition } ] } diff --git a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.frag b/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.frag index 89d21e98..a84351c0 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.frag +++ b/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.frag @@ -1,112 +1,17 @@ -#version 330 core +#version 450 -uniform struct LightInfo { - vec4 position; - vec3 intensity; -} light; +#extension GL_NV_fragment_shader_barycentric : require -uniform struct LineInfo { - float width; - vec4 color; -} line; - -uniform vec3 ka; // Ambient reflectivity -uniform vec3 kd; // Diffuse reflectivity -uniform vec3 ks; // Specular reflectivity -uniform float shininess; // Specular shininess factor - -in WireframeVertex { - vec3 position; - vec3 normal; - noperspective vec4 edgeA; - noperspective vec4 edgeB; - flat int configuration; -} fs_in; - -out vec4 fragColor; - -vec3 adsModel( const in vec3 pos, const in vec3 n ) -{ - // Calculate the vector from the light to the fragment - vec3 s = normalize( vec3( light.position ) - pos ); - - // Calculate the vector from the fragment to the eye position (the - // origin since this is in "eye" or "camera" space - vec3 v = normalize( -pos ); - - // Calculate the diffus component - vec3 diffuse = vec3( max( dot( s, n ), 0.0 ) ); - - // Calculate the specular component - vec3 specular = vec3(0.0, 0.0, 0.0); - if(shininess > 0) - { - // Refleft the light beam using the normal at this fragment - vec3 r = reflect( -s, n ); - vec3( pow( max( dot( r, v ), 0.0 ), shininess ) ); - } - - // Combine the ambient, diffuse and specular contributions - return light.intensity * ( ka + kd * diffuse + ks * specular ); -} - - -vec4 shadeLine( const in vec4 color ) -{ - // Find the smallest distance between the fragment and a triangle edge - float d; - if ( fs_in.configuration == 0 ) - { - // Common configuration - d = min( fs_in.edgeA.x, fs_in.edgeA.y ); - d = min( d, fs_in.edgeA.z ); - } - else - { - // Handle configuration where screen space projection breaks down - // Compute and compare the squared distances - vec2 AF = gl_FragCoord.xy - fs_in.edgeA.xy; - float sqAF = dot( AF, AF ); - float AFcosA = dot( AF, fs_in.edgeA.zw ); - d = abs( sqAF - AFcosA * AFcosA ); - - vec2 BF = gl_FragCoord.xy - fs_in.edgeB.xy; - float sqBF = dot( BF, BF ); - float BFcosB = dot( BF, fs_in.edgeB.zw ); - d = min( d, abs( sqBF - BFcosB * BFcosB ) ); - - // Only need to care about the 3rd edge for some configurations. - if ( fs_in.configuration == 1 || fs_in.configuration == 2 || fs_in.configuration == 4 ) - { - float AFcosA0 = dot( AF, normalize( fs_in.edgeB.xy - fs_in.edgeA.xy ) ); - d = min( d, abs( sqAF - AFcosA0 * AFcosA0 ) ); - } - - d = sqrt( d ); - } - - // Blend between line color and phong color - float mixVal; - if ( d < line.width - 1.0 ) - { - mixVal = 1.0; - } - else if ( d > line.width + 1.0 ) - { - mixVal = 0.0; - } - else - { - float x = d - ( line.width - 1.0 ); - mixVal = exp2( -2.0 * ( x * x ) ); - } - - return mix( color, line.color, mixVal ); -} +layout(location = 0) out vec4 fragColor; void main() { - // Calculate the color from the phong model - vec4 color = vec4( adsModel( fs_in.position, normalize( fs_in.normal ) ), 1.0 ); - fragColor = shadeLine( color ); + vec3 barycentric = gl_BaryCoordNV; + + float mindist = min(min(barycentric.x, barycentric.y), barycentric.z); + + if (mindist < 0.05) + { + fragColor = vec4(1.0, 1.0, 1.0, 1.0); + } } diff --git a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.geom b/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.geom deleted file mode 100644 index 86d0423c..00000000 --- a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.geom +++ /dev/null @@ -1,131 +0,0 @@ -#version 330 core - -layout( triangles ) in; -layout( triangle_strip, max_vertices = 3 ) out; - -in EyeSpaceVertex { - vec3 position; - vec3 normal; -} gs_in[]; - -out WireframeVertex { - vec3 position; - vec3 normal; - noperspective vec4 edgeA; - noperspective vec4 edgeB; - flat int configuration; -} gs_out; - -uniform mat4 viewportMatrix; - -const int infoA[] = int[]( 0, 0, 0, 0, 1, 1, 2 ); -const int infoB[] = int[]( 1, 1, 2, 0, 2, 1, 2 ); -const int infoAd[] = int[]( 2, 2, 1, 1, 0, 0, 0 ); -const int infoBd[] = int[]( 2, 2, 1, 2, 0, 2, 1 ); - -vec2 transformToViewport( const in vec4 p ) -{ - return vec2( viewportMatrix * ( p / p.w ) ); -} - -void main() -{ - gs_out.configuration = int(gl_in[0].gl_Position.z < 0) * int(4) - + int(gl_in[1].gl_Position.z < 0) * int(2) - + int(gl_in[2].gl_Position.z < 0); - - // If all vertices are behind us, cull the primitive - if (gs_out.configuration == 7) - return; - - // Transform each vertex into viewport space - vec2 p[3]; - p[0] = transformToViewport( gl_in[0].gl_Position ); - p[1] = transformToViewport( gl_in[1].gl_Position ); - p[2] = transformToViewport( gl_in[2].gl_Position ); - - if (gs_out.configuration == 0) - { - // Common configuration where all vertices are within the viewport - gs_out.edgeA = vec4(0.0); - gs_out.edgeB = vec4(0.0); - - // Calculate lengths of 3 edges of triangle - float a = length( p[1] - p[2] ); - float b = length( p[2] - p[0] ); - float c = length( p[1] - p[0] ); - - // Calculate internal angles using the cosine rule - float alpha = acos( ( b * b + c * c - a * a ) / ( 2.0 * b * c ) ); - float beta = acos( ( a * a + c * c - b * b ) / ( 2.0 * a * c ) ); - - // Calculate the perpendicular distance of each vertex from the opposing edge - float ha = abs( c * sin( beta ) ); - float hb = abs( c * sin( alpha ) ); - float hc = abs( b * sin( alpha ) ); - - // Now add this perpendicular distance as a per-vertex property in addition to - // the position and normal calculated in the vertex shader. - - // Vertex 0 (a) - gs_out.edgeA = vec4( ha, 0.0, 0.0, 0.0 ); - gs_out.normal = gs_in[0].normal; - gs_out.position = gs_in[0].position; - gl_Position = gl_in[0].gl_Position; - EmitVertex(); - - // Vertex 1 (b) - gs_out.edgeA = vec4( 0.0, hb, 0.0, 0.0 ); - gs_out.normal = gs_in[1].normal; - gs_out.position = gs_in[1].position; - gl_Position = gl_in[1].gl_Position; - EmitVertex(); - - // Vertex 2 (c) - gs_out.edgeA = vec4( 0.0, 0.0, hc, 0.0 ); - gs_out.normal = gs_in[2].normal; - gs_out.position = gs_in[2].position; - gl_Position = gl_in[2].gl_Position; - EmitVertex(); - - // Finish the primitive off - EndPrimitive(); - } - else - { - // Viewport projection breaks down for one or two vertices. - // Calculate what we can here and defer rest to fragment shader. - // Since this is coherent for the entire primitive the conditional - // in the fragment shader is still cheap as all concurrent - // fragment shader invocations will take the same code path. - - // Copy across the viewport-space points for the (up to) two vertices - // in the viewport - gs_out.edgeA.xy = p[infoA[gs_out.configuration]]; - gs_out.edgeB.xy = p[infoB[gs_out.configuration]]; - - // Copy across the viewport-space edge vectors for the (up to) two vertices - // in the viewport - gs_out.edgeA.zw = normalize( gs_out.edgeA.xy - p[ infoAd[gs_out.configuration] ] ); - gs_out.edgeB.zw = normalize( gs_out.edgeB.xy - p[ infoBd[gs_out.configuration] ] ); - - // Pass through the other vertex attributes - gs_out.normal = gs_in[0].normal; - gs_out.position = gs_in[0].position; - gl_Position = gl_in[0].gl_Position; - EmitVertex(); - - gs_out.normal = gs_in[1].normal; - gs_out.position = gs_in[1].position; - gl_Position = gl_in[1].gl_Position; - EmitVertex(); - - gs_out.normal = gs_in[2].normal; - gs_out.position = gs_in[2].position; - gl_Position = gl_in[2].gl_Position; - EmitVertex(); - - // Finish the primitive off - EndPrimitive(); - } -} diff --git a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.vert b/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.vert index e53a2b59..770df4e6 100644 --- a/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.vert +++ b/meshroom/ui/qml/Viewer3D/Materials/shaders/robustwireframe.vert @@ -1,21 +1,39 @@ -#version 330 core +#version 450 core -in vec3 vertexPosition; -in vec3 vertexNormal; +layout(location = 0) in vec3 vertexPosition; -out EyeSpaceVertex { - vec3 position; - vec3 normal; -} vs_out; +layout(std140, binding = 0) uniform qt3d_render_view_uniforms { + mat4 viewMatrix; + mat4 projectionMatrix; + mat4 uncorrectedProjectionMatrix; + mat4 clipCorrectionMatrix; + mat4 viewProjectionMatrix; + mat4 inverseViewMatrix; + mat4 inverseProjectionMatrix; + mat4 inverseViewProjectionMatrix; + mat4 viewportMatrix; + mat4 inverseViewportMatrix; + vec4 textureTransformMatrix; + vec3 eyePosition; + float aspectRatio; + float gamma; + float exposure; + float time; + float yUpInNDC; + float yUpInFBO; +}; -uniform mat4 modelView; -uniform mat3 modelViewNormal; -uniform mat4 mvp; +layout(std140, binding = 1) uniform qt3d_command_uniforms { + mat4 modelMatrix; + mat4 inverseModelMatrix; + mat4 modelViewMatrix; + mat3 modelNormalMatrix; + mat4 inverseModelViewMatrix; + mat4 modelViewProjection; + mat4 inverseModelViewProjectionMatrix; +}; void main() { - vs_out.normal = normalize( modelViewNormal * vertexNormal ); - vs_out.position = vec3( modelView * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( vertexPosition, 1.0 ); } diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index d4c02780..e8ffc939 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -30,7 +30,7 @@ Item { // Available render modes readonly property var renderModes: [ // Can't use ListModel because of MaterialIcons expressions {"name": "Solid", "icon": MaterialIcons.crop_din }, - /* {"name": "Wireframe", "icon": MaterialIcons.details }, */ + {"name": "Wireframe", "icon": MaterialIcons.details }, {"name": "Textured", "icon": MaterialIcons.texture }, {"name": "Spherical Harmonics", "icon": MaterialIcons.brightness_7} ] From b884fc4e6bdd1efaa3a4eba395896ac7b8b19118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 11 Oct 2024 15:58:08 +0200 Subject: [PATCH 48/64] [qt6] Viewer3D: Reset the default render mode to "Textured" --- meshroom/ui/qml/Viewer3D/DepthMapLoader.qml | 4 ++-- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 2 +- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 4 ++-- meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml index 0eea255e..6ebf5cc1 100644 --- a/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml +++ b/meshroom/ui/qml/Viewer3D/DepthMapLoader.qml @@ -10,6 +10,6 @@ DepthMapEntity { pointSize: Viewer3DSettings.pointSize * (Viewer3DSettings.fixedPointSize ? 1.0 : 0.001) // Map render modes to custom visualization modes - displayMode: Viewer3DSettings.renderMode == 0 ? DepthMapEntity.Points : DepthMapEntity.Triangles - displayColor: Viewer3DSettings.renderMode == 1 + displayMode: Viewer3DSettings.renderMode == 1 ? DepthMapEntity.Points : DepthMapEntity.Triangles + displayColor: Viewer3DSettings.renderMode == 2 } diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index c7eedd85..23bf7c7d 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -14,7 +14,7 @@ FloatingPane { implicitWidth: 200 - property int renderMode: 1 + property int renderMode: 2 property Grid3D grid: null property MediaLibrary mediaLibrary property Camera camera diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 3d51f9fc..e92c954b 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -15,7 +15,7 @@ import Utils 1.0 FocusScope { id: root - property int renderMode: 1 + property int renderMode: 2 readonly property alias library: mediaLibrary readonly property alias mainCamera: mainCamera @@ -283,7 +283,7 @@ FocusScope { } FloatingPane { - visible: Viewer3DSettings.renderMode == 2 + visible: Viewer3DSettings.renderMode == 3 anchors.bottom: renderModesPanel.top GridLayout { columns: 2 diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index e8ffc939..393526a3 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -35,7 +35,7 @@ Item { {"name": "Spherical Harmonics", "icon": MaterialIcons.brightness_7} ] // Current render mode - property int renderMode: 1 + property int renderMode: 2 // Spherical Harmonics file property string shlFile: "" From 62f0a3e5dfb03cc8663a921df8812e6f432df782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 11 Oct 2024 17:29:33 +0200 Subject: [PATCH 49/64] [qt6][Viewer3D] Change picking behavior --- meshroom/ui/qml/Viewer3D/MediaLibrary.qml | 6 ++- meshroom/ui/qml/Viewer3D/MediaLoader.qml | 3 +- meshroom/ui/qml/Viewer3D/SfmDataLoader.qml | 50 ++++++++++++++++------ meshroom/ui/qml/Viewer3D/Viewer3D.qml | 20 ++------- 4 files changed, 47 insertions(+), 32 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml index 1d8d2a87..bb305d75 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml @@ -35,7 +35,7 @@ Entity { return false } - signal pressed(var pick) + signal clicked(var pick) signal loadRequest(var idx) QtObject { @@ -192,6 +192,8 @@ Entity { MediaLoader { id: mediaLoader + cameraPickingEnabled: !sceneCameraController.pickingActive + // Whether MediaLoader has been fully instantiated by the NodeInstantiator property bool fullyInstantiated: false @@ -335,7 +337,7 @@ Entity { ObjectPicker { enabled: mediaLoader.enabled && pickingEnabled hoverEnabled: false - onPressed: function(pick) { root.pressed(pick) } + onClicked: function(pick) { root.clicked(pick) } } ] } diff --git a/meshroom/ui/qml/Viewer3D/MediaLoader.qml b/meshroom/ui/qml/Viewer3D/MediaLoader.qml index 10a23305..fba782e5 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLoader.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLoader.qml @@ -25,6 +25,7 @@ import Utils 1.0 property Camera camera: null property bool cached: false + property bool cameraPickingEnabled: false onSourceChanged: { if (cached) { @@ -109,7 +110,7 @@ import Utils 1.0 "source": source, "pointSize": Qt.binding(function() { return 0.01 * Viewer3DSettings.pointSize }), "locatorScale": Qt.binding(function() { return Viewer3DSettings.cameraScale }), - "cameraPickingEnabled": Qt.binding(function() { return root.enabled }), + "cameraPickingEnabled": Qt.binding(function() { return root.enabled && root.cameraPickingEnabled }), "resectionId": Qt.binding(function() { return Viewer3DSettings.resectionId }), "displayResections": Qt.binding(function() { return Viewer3DSettings.displayResectionIds }), "syncPickedViewId": Qt.binding(function() { return Viewer3DSettings.syncWithPickedViewId }) diff --git a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml index d8471ffc..57c5e600 100644 --- a/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml +++ b/meshroom/ui/qml/Viewer3D/SfmDataLoader.qml @@ -9,13 +9,14 @@ import SfmDataEntity 1.0 * Support for SfMData files in Qt3D. * Create this component dynamically to test for SfmDataEntity plugin availability. */ + SfmDataEntity { id: root property bool cameraPickingEnabled: true property bool syncPickedViewId: false - // filter out non-reconstructed cameras + // Filter out non-reconstructed cameras skipHidden: true signal cameraSelected(var viewId) @@ -32,7 +33,7 @@ SfmDataEntity { function spawnCameraSelectors() { var validCameras = 0; - // spawn camera selector for each camera + // Spawn camera selector for each camera for (var i = 0; i < root.cameras.length; ++i) { var cam = root.cameras[i]; @@ -41,6 +42,7 @@ SfmDataEntity { if (viewId === undefined) continue; camSelectionComponent.createObject(cam, {"viewId": viewId}); + dummyCamSelectionComponent.createObject(cam, {"viewId": viewId}); validCameras++; } return validCameras; @@ -80,11 +82,11 @@ SfmDataEntity { id: activePalette } - // Camera selection picking and display + // Camera selection display only Component { - id: camSelectionComponent + id: dummyCamSelectionComponent Entity { - id: camSelector + id: dummyCamSelector property string viewId property color customColor: Qt.hsva((parseInt(viewId) / 255.0) % 1.0, 0.3, 1.0, 1.0) property real extent: cameraPickingEnabled ? 0.2 : 0 @@ -102,8 +104,33 @@ SfmDataEntity { }, PhongMaterial{ id: mat - ambient: _reconstruction && (viewId === _reconstruction.selectedViewId || (viewId === _reconstruction.pickedViewId && syncPickedViewId)) ? activePalette.highlight : customColor // "#CCC" - diffuse: cameraPicker.containsMouse ? Qt.lighter(activePalette.highlight, 1.2) : ambient + ambient: _reconstruction && (viewId === _reconstruction.selectedViewId || + (viewId === _reconstruction.pickedViewId && syncPickedViewId)) ? + activePalette.highlight : customColor // "#CCC" + } + ] + } + } + + // Camera selection picking only + Component { + id: camSelectionComponent + Entity { + id: camSelector + property string viewId + property color customColor: Qt.hsva((parseInt(viewId) / 255.0) % 1.0, 0.3, 1.0, 1.0) + property real extent: cameraPickingEnabled ? 0.5 : 0 + + components: [ + // Use cuboid to represent the camera + Transform { + translation: Qt.vector3d(0, 0, 0.5 * cameraBack.zExtent) + }, + CuboidMesh { + id: cameraBack + xExtent: parent.extent + yExtent: xExtent + zExtent: xExtent }, ObjectPicker { id: cameraPicker @@ -113,11 +140,10 @@ SfmDataEntity { pick.accepted = (pick.buttons & Qt.LeftButton) && cameraPickingEnabled } onReleased: function(pick) { - const delta = Qt.point(Math.abs(pos.x - pick.position.x), Math.abs(pos.y - pick.position.y)); - // only trigger picking when mouse has not moved between press and release - if (delta.x + delta.y < 4) - { - _reconstruction.selectedViewId = camSelector.viewId; + const delta = Qt.point(Math.abs(pos.x - pick.position.x), Math.abs(pos.y - pick.position.y)) + // Only trigger picking when mouse has not moved between press and release + if (delta.x + delta.y < 4) { + _reconstruction.selectedViewId = camSelector.viewId } } } diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index e92c954b..7f91fdc4 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -154,11 +154,6 @@ FocusScope { focus: scene3D.activeFocus onMousePressed: function(mouse) { scene3D.forceActiveFocus() - if (mouse.button === Qt.LeftButton) { - if (!doubleClickTimer.running) - doubleClickTimer.restart() - } else - doubleClickTimer.stop() } onMouseReleased: function(mouse, moved) { if (moving) @@ -167,14 +162,6 @@ FocusScope { contextMenu.popup() } } - - // Manually handle double click to activate object picking - // for camera re-centering only during a short amount of time - Timer { - id: doubleClickTimer - running: false - interval: 300 - } } components: [ @@ -223,8 +210,8 @@ FocusScope { id: mediaLibrary renderMode: Viewer3DSettings.renderMode // Picking to set focus point (camera view center) - // Only activate it when a double click may happen or when the 'Control' key is pressed - pickingEnabled: cameraController.pickingActive || doubleClickTimer.running + // Only activate it when the 'Control' key is pressed + pickingEnabled: cameraController.pickingActive camera: cameraSelector.camera // Used for TransformGizmo in BoundingBox @@ -238,11 +225,10 @@ FocusScope { } ] - onPressed: function(pick) { + onClicked: function(pick) { if (pick.button === Qt.LeftButton) { mainCamera.viewCenter = pick.worldIntersection } - doubleClickTimer.stop() } } From d4eb365ada887f2cbcf3441ff7097640a8f2ff51 Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Wed, 9 Oct 2024 11:39:37 +0200 Subject: [PATCH 50/64] [qt6][Viewer] Fix zoom in 8bits viewer --- meshroom/ui/qml/Viewer/Viewer2D.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 8501233b..b384a6de 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -624,10 +624,13 @@ FocusScope { source: getImageFile() onStatusChanged: { // Update cache source when image is loaded + imageStatus = status if (status === Image.Ready) qtImageViewerCache.source = source } + property var imageStatus: Image.Ready + // Image cache of the last loaded image // Only visible when the main one is loading, to maintain a displayed image for smoother transitions Image { From 36f7f4e420af1a284cbd22af202e8d38b543e1e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 17 Oct 2024 15:14:07 +0200 Subject: [PATCH 51/64] [qt6][Viewer] Viewer2D: Fix automatic fitting for missing orientation tags --- meshroom/ui/qml/Viewer/Viewer2D.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index b384a6de..315680d0 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -161,7 +161,7 @@ FocusScope { // Functions function fit() { // Make sure the image is ready for use - if (!imgContainer.image || imgContainer.orientationTag == undefined) { + if (!imgContainer.image) { return false } @@ -482,7 +482,6 @@ FocusScope { orientationTag: imgContainer.orientationTag xOrigin: imgContainer.width / 2 yOrigin: imgContainer.height / 2 - property real targetSize: Math.max(width, height) * imgContainer.scale property real resizeRatio: imgContainer.scale From a61231916f68aadc50aed6ff8eb6c360c570c4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 17 Oct 2024 15:14:31 +0200 Subject: [PATCH 52/64] [qt6][GraphEditor] Node: Ensure `readOnly` is set with a boolean --- meshroom/ui/qml/GraphEditor/Node.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index ac84c345..d36a44f1 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -446,7 +446,7 @@ Item { property real globalX: root.x + nodeAttributes.x + inputs.x + inputLoader.x + inPin.x property real globalY: root.y + nodeAttributes.y + inputs.y + inputLoader.y + inPin.y - readOnly: root.readOnly || object.isReadOnly + readOnly: Boolean(root.readOnly || object.isReadOnly) Component.onCompleted: attributePinCreated(attribute, inPin) Component.onDestruction: attributePinDeleted(attribute, inPin) onPressed: function(mouse) { root.pressed(mouse) } From 2699bffcdab616e31a43ea6f00448c3917f1aef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 17 Oct 2024 17:52:47 +0200 Subject: [PATCH 53/64] [qt6][ImageGallery] IntrinsicDisplayDelegate: Support `File` attributes --- meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml index eae7eddc..0aeecdae 100644 --- a/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/IntrinsicDisplayDelegate.qml @@ -52,6 +52,7 @@ RowLayout { case "FloatParam": return floatComponent case "BoolParam": return boolComponent case "StringParam": return textFieldComponent + case "File": return textFieldComponent default: return undefined } } From 65a014d9b1d8072a77eb9694a09ac4dc643eaac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 13 Nov 2024 18:48:07 +0100 Subject: [PATCH 54/64] [qt6][Viewer] Viewer2D: Fix `fit()` with the Sequence Player With the Sequence Player always enabled by default, the `fit()` function must be triggered at the right moment, and only once the layout has been correctly initialized; otherwise, zoom factors may become negative and the images will not be placed correctly in the viewer. Changes in the orientation tag must be handled independently from the state of the zoom factor. --- meshroom/ui/qml/Viewer/Viewer2D.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 315680d0..725e18d1 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -501,9 +501,9 @@ FocusScope { var sizeValid = (width > 0) && (height > 0) var layoutValid = (root.width > 50) && (root.height > 50) var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height) - + if ((!root.fittedOnce && imgContainer.image && sizeValid && layoutValid) || - (root.fittedOnce && sizeChanged && sizeValid && layoutValid)) { + (root.fittedOnce && sizeChanged && sizeValid && layoutValid)) { var ret = fit() if (!ret) return @@ -515,12 +515,16 @@ FocusScope { } } - onHeightChanged : { + onWidthChanged : { floatImageViewerLoader.sizeChanged(); } Connections { target: root + function onWidthChanged() { + floatImageViewerLoader.sizeChanged() + } + function onHeightChanged() { floatImageViewerLoader.sizeChanged() } @@ -534,7 +538,6 @@ FocusScope { var ret = fit() if (!ret) return - root.fittedOnce = true root.previousWidth = width root.previousHeight = height root.previousOrientationTag = orientationTag From 69ea5b88d2f1a0ca4ac02c3b690216c7e4489133 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Wed, 9 Oct 2024 18:13:34 +0200 Subject: [PATCH 55/64] [qt6][Viewer3D] Fix mouse camera controller --- .../ui/qml/Viewer3D/DefaultCameraController.qml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml index 5320753d..4da16c96 100644 --- a/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml +++ b/meshroom/ui/qml/Viewer3D/DefaultCameraController.qml @@ -14,9 +14,6 @@ Entity { property real translateSpeed: 75.0 property real tiltSpeed: 500.0 property real panSpeed: 500.0 - readonly property bool moving: actionLMB.active - readonly property bool panning: (keyboardHandler._pressed && actionLMB.active && actionShift.active) || actionMMB.active - readonly property bool zooming: keyboardHandler._pressed && actionRMB.active && actionAlt.active property alias focus: keyboardHandler.focus readonly property bool pickingActive: actionControl.active && keyboardHandler._pressed property alias rotationSpeed: trackball.rotationSpeed @@ -25,6 +22,10 @@ Entity { property bool loseMouseFocus: false // Must be changed by other entities when they want to take mouse focus + property bool moving: false + property bool panning: false + property bool zooming: false + readonly property alias pressed: mouseHandler._pressed signal mousePressed(var mouse) signal mouseReleased(var mouse, var moved) @@ -68,7 +69,12 @@ Entity { const dt = 0.02 var d - if (panning) { // Translate + root.moving = mouse.buttons & Qt.LeftButton + root.panning = (mouse.buttons & Qt.MiddleButton) + var panningAlt = actionShift.active && (mouse.buttons & Qt.LeftButton) + root.zooming = actionAlt.active && (mouse.buttons & Qt.RightButton) + + if (panning || panningAlt) { // Translate d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03 var tx = axisMX.value * root.translateSpeed * d var ty = axisMY.value * root.translateSpeed * d @@ -76,7 +82,7 @@ Entity { root.camera.translate(Qt.vector3d(-tx, -ty, 0).times(dt)) return } - if (moving){ // Trackball rotation + if (moving) { // Trackball rotation trackball.rotate(mouseHandler.lastPosition, mouseHandler.currentPosition, dt) mouseHandler.lastPosition = mouseHandler.currentPosition mouseHandler.hasMoved = true From 9b48531cb7c3f8e69fb35d282658524ffeab49f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:42:30 +0200 Subject: [PATCH 56/64] [ui] Controls: Add `DirectionalLightPane` component --- .../ui/qml/Controls/DirectionalLightPane.qml | 261 ++++++++++++++++++ meshroom/ui/qml/Controls/qmldir | 3 +- 2 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 meshroom/ui/qml/Controls/DirectionalLightPane.qml diff --git a/meshroom/ui/qml/Controls/DirectionalLightPane.qml b/meshroom/ui/qml/Controls/DirectionalLightPane.qml new file mode 100644 index 00000000..c54cf7ea --- /dev/null +++ b/meshroom/ui/qml/Controls/DirectionalLightPane.qml @@ -0,0 +1,261 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Qt5Compat.GraphicalEffects // for OpacityMask & Glow +import MaterialIcons 2.2 +import Utils 1.0 + +/** +* Directional Light Pane +* +* @biref A small pane to control a directional light with a 2d ball controller. +* +* @param lightYawValue - directional light yaw (degrees) +* @param lightPitchValue - directional light pitch (degrees) +*/ + +FloatingPane { + id: root + + // yaw and pitch properties + property double lightYawValue: 0 + property double lightPitchValue: 0 + + // 2d controller display size properties + readonly property real controllerSize: 80 + readonly property real controllerRadius: controllerSize * 0.5 + + function reset() { + lightYawValue = 0; + lightPitchValue = 0; + } + + // update 2d controller if yaw value changed + onLightYawValueChanged: { lightBallController.update() } + + // update 2d controller if pitch value changed + onLightPitchValueChanged: { lightBallController.update() } + + anchors.margins: 0 + padding: 5 + radius: 0 + + ColumnLayout { + anchors.fill: parent + spacing: 5 + + // header + RowLayout { + // pane title + Label { + text: "Directional Light" + font.bold: true + Layout.fillWidth: true + } + + // minimize or maximize button + MaterialToolButton { + id: bodyButton + text: lightPaneBody.visible ? MaterialIcons.arrow_drop_down : MaterialIcons.arrow_drop_up + font.pointSize: 10 + ToolTip.text: lightPaneBody.visible ? "Minimize" : "Maximize" + onClicked: { lightPaneBody.visible = !lightPaneBody.visible } + } + + // reset button + MaterialToolButton { + id: resetButton + text: MaterialIcons.refresh + font.pointSize: 10 + ToolTip.text: "Reset" + onClicked: reset() + } + } + + // body + RowLayout { + id: lightPaneBody + spacing: 10 + + // light parameters + GridLayout { + columns: 3 + rowSpacing: 2 + columnSpacing: 8 + Layout.alignment: Qt.AlignBottom + + // light yaw + Label { + text: "Yaw" + } + TextField { + id: lightYawTF + text: lightYawValue.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleDegreeValidator + onEditingFinished: { lightYawValue = lightYawTF.text } + ToolTip.text: "Light yaw (degrees)." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsDegreeValue.width + } + Label { + text: "°" + } + + // light pitch + Label { + text: "Pitch" + } + TextField { + id: lightPitchTF + text: lightPitchValue.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleDegreeValidator + onEditingFinished: { lightPitchValue = lightPitchTF.text } + ToolTip.text: "Light pitch (degrees)." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsDegreeValue.width + } + Label { + text: "°" + } + } + + // directional light ball controller + Rectangle { + id: lightBallController + anchors.margins: 0 + width: controllerSize + height: controllerSize + radius: 180 // circle + color: "#FF000000" + Layout.rightMargin: 5 + Layout.leftMargin: 5 + Layout.bottomMargin: 5 + + function update() { + // get point from light yaw and pitch + var y = (lightPitchValue / 90 * controllerRadius) + var xMax = Math.sqrt(controllerRadius * controllerRadius - y * y) // get sphere maximum x coordinate + var x = (lightYawValue / 90 * xMax) + + // get angle and distance + var angleRad = Math.atan2(y, x) + var distance = Math.sqrt(x * x + y * y) + + // avoid controller overflow + if(distance > controllerRadius) + { + x = controllerRadius * Math.cos(angleRad) + y = controllerRadius * Math.sin(angleRad) + } + + // compute distance function for light gradient emulation + var distanceRatio = Math.min(distance, controllerRadius) / controllerRadius + var distanceFunct = distanceRatio * distanceRatio * 0.3 + + // update light point + lightPoint.x = lightPoint.startOffset + x + lightPoint.y = lightPoint.startOffset + y + + // update light gradient + lightGradient.angle = angleRad * (180 / Math.PI) // radians to degrees + lightGradient.horizontalRadius = controllerSize * (1 - distanceFunct) + lightGradient.verticalRadius = controllerSize * (1 + distanceFunct) + lightGradient.horizontalOffset = x * (1 - distanceFunct) + lightGradient.verticalOffset = y * (1 - distanceFunct) + } + + RadialGradient { + id: lightGradient + anchors.centerIn: parent + width: controllerSize + height: width + horizontalRadius: controllerSize + verticalRadius: controllerSize + angle: 0 + gradient: Gradient { + GradientStop { position: 0.00; color: "#FFFFFFFF" } + GradientStop { position: 0.10; color: "#FFAAAAAA" } + GradientStop { position: 0.50; color: "#FF0C0C0C" } + } + layer.enabled: true + layer.effect: OpacityMask { + id: mask + maskSource: Rectangle { + height: lightGradient.height + width: lightGradient.width + radius: 180 // circle + } + } + } + + Rectangle { + id: lightPoint + + property double startOffset : (parent.width - width) * 0.5 + + x: startOffset + y: startOffset + width: controllerRadius / 6 + height: width + radius: 180 // circle + color: "white" + } + + Glow { + anchors.fill: lightPoint + radius: controllerRadius / 5 + samples: 17 + color: "white" + source: lightPoint + } + + MouseArea { + id: lightMouseArea + anchors.centerIn: parent + anchors.fill: parent + + onPositionChanged: { + // get coordinates from center + var x = mouseX - controllerRadius + var y = mouseY - controllerRadius + + // get distance to center + var distance = Math.sqrt(x * x + y * y) + + // avoid controller overflow + if(distance > controllerRadius) + { + var angleRad = Math.atan2(y, x) + x = controllerRadius * Math.cos(angleRad) + y = controllerRadius * Math.sin(angleRad) + } + + // get sphere maximum x coordinate + var xMax = Math.sqrt(controllerRadius * controllerRadius - y * y) + + // update light yaw and pitch + lightYawValue = (xMax > 0) ? ((x / xMax) * 90) : 0 // between -90 and 90 degrees + lightPitchValue = (y / controllerRadius) * 90 // between -90 and 90 degrees + } + } + } + } + } + + DoubleValidator { + id: doubleDegreeValidator + locale: 'C' // use '.' decimal separator disregarding of the system locale + bottom: -90.0 + top: 90.0 + } + + TextMetrics { + id: textMetricsDegreeValue + font: lightYawTF.font + text: "12.3456" + } +} \ No newline at end of file diff --git a/meshroom/ui/qml/Controls/qmldir b/meshroom/ui/qml/Controls/qmldir index 2e80685d..35f49eac 100644 --- a/meshroom/ui/qml/Controls/qmldir +++ b/meshroom/ui/qml/Controls/qmldir @@ -14,4 +14,5 @@ ExifOrientedViewer 1.0 ExifOrientedViewer.qml FilterComboBox 1.0 FilterComboBox.qml IntSelector 1.0 IntSelector.qml MScrollBar 1.0 MScrollBar.qml -MSplitView 1.0 MSplitView.qml \ No newline at end of file +MSplitView 1.0 MSplitView.qml +DirectionalLightPane 1.0 DirectionalLightPane.qml From 765a1f96d5afbfba825c3064666e4932109dfabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:44:57 +0200 Subject: [PATCH 57/64] [ui] Viewer: Add `PhongImageViewerToolbar` component --- .../ui/qml/Viewer/PhongImageViewerToolbar.qml | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 meshroom/ui/qml/Viewer/PhongImageViewerToolbar.qml diff --git a/meshroom/ui/qml/Viewer/PhongImageViewerToolbar.qml b/meshroom/ui/qml/Viewer/PhongImageViewerToolbar.qml new file mode 100644 index 00000000..f09ade47 --- /dev/null +++ b/meshroom/ui/qml/Viewer/PhongImageViewerToolbar.qml @@ -0,0 +1,275 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Dialogs +import MaterialIcons 2.2 +import Controls 1.0 +import Utils 1.0 + +FloatingPane { + id: root + + property color baseColorValue: colorText.text + property real textureOpacityValue: textureTF.text + property real kaValue: ambientTF.text + property real kdValue: diffuseTF.text + property real ksValue: specularTF.text + property real shininessValue: shininessTF.text + property bool displayLightController: true + + function reset () { + colorText.text = "#333333" + textureCtrl.value = 1.0 + ambientCtrl.value = 0.0 + diffuseCtrl.value = 1.0 + specularCtrl.value = 0.5 + shininessCtrl.value = 20.0 + } + + anchors.margins: 0 + padding: 5 + radius: 0 + + ColumnLayout { + id: phongLightingParameters + anchors.fill: parent + spacing: 5 + + // header + RowLayout { + // pane title + Label { + text: _reconstruction && _reconstruction.activeNodes.get("PhotometricStereo").node ? _reconstruction.activeNodes.get("PhotometricStereo").node.label : "" + font.bold: true + Layout.fillWidth: true + } + + // minimize or maximize button + MaterialToolButton { + id: bodyButton + text: phongLightingToolbarBody.visible ? MaterialIcons.arrow_drop_down : MaterialIcons.arrow_drop_up + font.pointSize: 10 + ToolTip.text: phongLightingToolbarBody.visible ? "Minimize" : "Maximize" + onClicked: { phongLightingToolbarBody.visible = !phongLightingToolbarBody.visible } + } + + // reset button + MaterialToolButton { + id: resetButton + text: MaterialIcons.refresh + font.pointSize: 10 + ToolTip.text: "Reset" + onClicked: reset() + } + + // settings menu + MaterialToolButton { + text: MaterialIcons.settings + font.pointSize: 10 + onClicked: settingsMenu.popup(width, 0) + Menu { + id: settingsMenu + padding: 4 + implicitWidth: 250 + + RowLayout { + Label { + text: "Display Directional Light Contoller:" + } + CheckBox { + id: displayLightControllerCB + ToolTip.text: "Hides directional light controller." + ToolTip.visible: hovered + Layout.fillHeight: true + Layout.alignment: Qt.AlignRight + checked: root.displayLightController + onClicked: root.displayLightController = displayLightControllerCB.checked + } + } + } + } + } + + // body + GridLayout { + id: phongLightingToolbarBody + columns: 3 + rowSpacing: 2 + columnSpacing: 8 + + // base color + Label { + text: "Base Color" + } + Rectangle { + height: colorText.height * 0.8 + color: colorText.text + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + Layout.preferredWidth: textMetricsNormValue.width + + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + TextField { + id: colorText + text: "#333333" + selectByMouse: true + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + } + ColorDialog { + id: colorDialog + title: "Please choose a color" + options: ColorDialog.NoEyeDropperButton + selectedColor: colorText.text + onAccepted: { + colorText.text = selectedColor + colorText.editingFinished() // artificially trigger change of attribute value + close() + } + onRejected: close() + } + + // texture opacity + Label { + text: "Texture" + } + TextField { + id: textureTF + text: textureCtrl.value.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleNormalizedValidator + onEditingFinished: { textureCtrl.value = textureTF.text } + ToolTip.text: "Texture Opacity." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsNormValue.width + } + Slider { + id: textureCtrl + from: 0.0 + to: 1.0 + value: 1.0 + stepSize: 0.01 + Layout.fillWidth: true + } + + // diffuse (kd) + Label { + text: "Diffuse" + } + TextField { + id: diffuseTF + text: diffuseCtrl.value.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleNormalizedValidator + onEditingFinished: { diffuseCtrl.value = diffuseTF.text } + ToolTip.text: "Diffuse reflection (kd)." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsNormValue.width + } + Slider { + id: diffuseCtrl + from: 0.0 + to: 1.0 + value: 1.0 + stepSize: 0.01 + Layout.fillWidth: true + } + + // ambient (ka) + Label { + text: "Ambient" + } + TextField { + id: ambientTF + text: ambientCtrl.value.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleNormalizedValidator + onEditingFinished: { ambientCtrl.value = ambientTF.text } + ToolTip.text: "Ambient reflection (ka)." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsNormValue.width + } + Slider { + id: ambientCtrl + from: 0.0 + to: 1.0 + value: 0.0 + stepSize: 0.01 + Layout.fillWidth: true + } + + // specular (ks) + Label { + text: "Specular" + } + TextField { + id: specularTF + text: specularCtrl.value.toFixed(2) + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: doubleNormalizedValidator + onEditingFinished: { specularCtrl.value = specularTF.text } + ToolTip.text: "Specular reflection (ks)." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsNormValue.width + } + Slider { + id: specularCtrl + from: 0.0 + to: 1.0 + value: 0.5 + stepSize: 0.01 + Layout.fillWidth: true + } + + // shininess + Label { + text: "Shininess" + } + TextField { + id: shininessTF + text: shininessCtrl.value + selectByMouse: true + horizontalAlignment: TextInput.AlignRight + validator: intShininessValidator + onEditingFinished: { shininessCtrl.value = shininessTF.text } + ToolTip.text: "Shininess constant." + ToolTip.visible: hovered + Layout.preferredWidth: textMetricsNormValue.width + } + Slider { + id: shininessCtrl + from: 1 + to: 128 + value: 20 + stepSize: 1 + Layout.fillWidth: true + } + } + } + + DoubleValidator { + id: doubleNormalizedValidator + locale: 'C' // use '.' decimal separator disregarding of the system locale + bottom: 0.0 + top: 1.0 + } + + IntValidator { + id: intShininessValidator + bottom: 1 + top: 128 + } + + TextMetrics { + id: textMetricsNormValue + font: ambientTF.font + text: "1.2345" + } +} \ No newline at end of file From b6b9d1b34f0073baaa99c8e0c8dbdab1f60691c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:46:07 +0200 Subject: [PATCH 58/64] [ui] Viewer: Add `PhongImageViewer` component --- meshroom/ui/qml/Viewer/PhongImageViewer.qml | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 meshroom/ui/qml/Viewer/PhongImageViewer.qml diff --git a/meshroom/ui/qml/Viewer/PhongImageViewer.qml b/meshroom/ui/qml/Viewer/PhongImageViewer.qml new file mode 100644 index 00000000..35237419 --- /dev/null +++ b/meshroom/ui/qml/Viewer/PhongImageViewer.qml @@ -0,0 +1,48 @@ +import QtQuick +import Utils 1.0 + +import AliceVision 1.0 as AliceVision + +/** + * PhongImageViewer displays an Image (albedo + normal) with a given light direction. + * Shading is done using Blinn-Phong reflection model, material and light direction parameters available. + * Accept HdrImageToolbar controls (gamma / offset / channel). + * + * Requires QtAliceVision plugin. + */ + +AliceVision.PhongImageViewer { + id: root + + width: sourceSize.width + height: sourceSize.height + visible: true + + // paintedWidth / paintedHeight / imageStatus for compatibility with standard Image + property int paintedWidth: sourceSize.width + property int paintedHeight: sourceSize.height + property var imageStatus: { + if (root.status === AliceVision.PhongImageViewer.EStatus.LOADING) { + return Image.Loading + } else if (root.status === AliceVision.PhongImageViewer.EStatus.LOADING_ERROR || + root.status === AliceVision.PhongImageViewer.EStatus.MISSING_FILE) { + return Image.Error + } else if ((root.sourcePath === "") || (root.sourceSize.height <= 0) || (root.sourceSize.width <= 0)) { + return Image.Null + } + + return Image.Ready + } + + property string channelModeString : "rgba" + channelMode: { + switch (channelModeString) { + case "rgb": return AliceVision.PhongImageViewer.EChannelMode.RGB + case "r": return AliceVision.PhongImageViewer.EChannelMode.R + case "g": return AliceVision.PhongImageViewer.EChannelMode.G + case "b": return AliceVision.PhongImageViewer.EChannelMode.B + case "a": return AliceVision.PhongImageViewer.EChannelMode.A + default: return AliceVision.PhongImageViewer.EChannelMode.RGBA + } + } +} From 39b7dfd512aaeb1523f1ac94c122a7ac97733b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:51:34 +0200 Subject: [PATCH 59/64] [ui] Viewer: Add `PhongImageViewer` and toolbars to `Viewer2D` --- meshroom/ui/qml/Viewer/Viewer2D.qml | 147 +++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 5 deletions(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 725e18d1..48761090 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -61,6 +61,11 @@ FocusScope { if (floatImageViewerLoader.active && floatImageViewerLoader.item) { return floatImageViewerLoader.item.metadata } + // Metadata from PhongImageViewer + // Directly read from the image file on disk + if (phongImageViewerLoader.active) { + return phongImageViewerLoader.item.metadata + } // Use viewpoint metadata for the special case of the 8-bit viewer if (qtImageViewerLoader.active) { return viewpointMetadata @@ -418,7 +423,7 @@ FocusScope { resetDefaultValues() } colorPickerVisible: { - return !displayPanoramaViewer.checked + return !displayPanoramaViewer.checked && !displayPhongLighting.checked } colorRGBA: { @@ -475,8 +480,7 @@ FocusScope { // qtAliceVision Image Viewer ExifOrientedViewer { id: floatImageViewerLoader - active: root.aliceVisionPluginAvailable && - (root.useFloatImageViewer || root.useLensDistortionViewer) && !panoramaViewerLoader.active + active: root.aliceVisionPluginAvailable && (root.useFloatImageViewer || root.useLensDistortionViewer) && !panoramaViewerLoader.active && !phongImageViewerLoader.active visible: (floatImageViewerLoader.status === Loader.Ready) && active anchors.centerIn: parent orientationTag: imgContainer.orientationTag @@ -609,10 +613,108 @@ FocusScope { } } + // qtAliceVision Phong Image Viewer + ExifOrientedViewer { + id: phongImageViewerLoader + active: root.aliceVisionPluginAvailable && displayPhongLighting.enabled && displayPhongLighting.checked + visible: (phongImageViewerLoader.status === Loader.Ready) && active + anchors.centerIn: parent + orientationTag: imgContainer.orientationTag + xOrigin: imgContainer.width / 2 + yOrigin: imgContainer.height / 2 + + property var activeNode: _reconstruction ? _reconstruction.activeNodes.get('PhotometricStereo').node : null + property var vp: _reconstruction ? getViewpoint(_reconstruction.selectedViewId) : null + property url sourcePath: getAlbedoFile() + property url normalPath: getNormalFile() + property bool fittedOnce: false + property int previousWidth: 0 + property int previousHeight: 0 + property int previousOrientationTag: 1 + + function getAlbedoFile() { + + if(vp && activeNode && activeNode.hasAttribute("albedo")) { + return Filepath.stringToUrl(Filepath.resolve(activeNode.attribute("albedo").value, vp)) + } + + return getImageFile() + } + + function getNormalFile() { + + if(vp && activeNode && activeNode.hasAttribute("normals")) { + return Filepath.stringToUrl(Filepath.resolve(activeNode.attribute("normals").value, vp)) + } + + return getImageFile() + } + + onWidthChanged: { + /* 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 && imgContainer.image.width > 0) || + (fittedOnce && ((width > 1 && previousWidth != width) || (height > 1 && previousHeight != height)))) { + var ret = fit() + if (!ret) + return + fittedOnce = true + previousWidth = width + previousHeight = height + if (orientationTag != undefined) + previousOrientationTag = orientationTag + } + } + + onOrientationTagChanged: { + /* For images of the same width and height but with different orientations, the auto-fit + * will not be triggered by the "widthChanged()" signal, so it needs to be triggered upon + * either a change in the image's size or in its orientation. */ + if (orientationTag != undefined && previousOrientationTag != orientationTag) { + var ret = fit() + if (!ret) + return + fittedOnce = true + previousWidth = width + previousHeight = height + previousOrientationTag = orientationTag + } + } + + onActiveChanged: { + if (active) { + /* Instantiate and initialize a PhongImageViewer component dynamically using Loader.setSource + * Note: It does not work to use previously created component, so we re-create it with setSource. */ + setSource("PhongImageViewer.qml", { + 'sourcePath': Qt.binding(function() { return sourcePath }), + 'normalPath': Qt.binding(function() { return normalPath }), + 'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }), + 'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }), + 'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }), + 'baseColor': Qt.binding(function() { return phongImageViewerToolbar.baseColorValue }), + 'textureOpacity': Qt.binding(function() { return phongImageViewerToolbar.textureOpacityValue }), + 'ka': Qt.binding(function() { return phongImageViewerToolbar.kaValue }), + 'kd': Qt.binding(function() { return phongImageViewerToolbar.kdValue }), + 'ks': Qt.binding(function() { return phongImageViewerToolbar.ksValue }), + 'shininess': Qt.binding(function() { return phongImageViewerToolbar.shininessValue }), + 'lightYaw': Qt.binding(function() { return -directionalLightPane.lightYawValue }), // left handed coordinate system + 'lightPitch': Qt.binding(function() { return directionalLightPane.lightPitchValue }), + }) + } else { + // Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 + setSource("", {}) + fittedOnce = false + } + } + } + // Simple QML Image Viewer (using Qt or qtAliceVisionImageIO to load images) ExifOrientedViewer { id: qtImageViewerLoader - active: !floatImageViewerLoader.active && !panoramaViewerLoader.active + active: !floatImageViewerLoader.active && !panoramaViewerLoader.active && !phongImageViewerLoader.active anchors.centerIn: parent orientationTag: imgContainer.orientationTag xOrigin: imgContainer.width / 2 @@ -653,6 +755,8 @@ FocusScope { floatImageViewerLoader.item else if (panoramaViewerLoader.active) panoramaViewerLoader.item + else if (phongImageViewerLoader.active) + phongImageViewerLoader.item else qtImageViewerLoader.item } @@ -873,7 +977,7 @@ FocusScope { font.pointSize: 8 readOnly: true selectByMouse: true - text: Filepath.urlToString(getImageFile()) + text: (phongImageViewerLoader.active) ? Filepath.urlToString(phongImageViewerLoader.sourcePath) : Filepath.urlToString(getImageFile()) } // Write which node is being displayed @@ -1196,6 +1300,27 @@ FocusScope { responsePath: Filepath.resolve(path, vp) } } + + PhongImageViewerToolbar { + id: phongImageViewerToolbar + + anchors { + bottom: parent.bottom + left: parent.left + margins: 2 + } + visible: root.aliceVisionPluginAvailable && phongImageViewerLoader.active + } + + DirectionalLightPane { + id: directionalLightPane + anchors { + bottom: parent.bottom + right: parent.right + margins: 2 + } + visible: root.aliceVisionPluginAvailable && phongImageViewerLoader.active && phongImageViewerToolbar.displayLightController + } } FloatingPane { @@ -1394,6 +1519,18 @@ FocusScope { visible: activeNode } + MaterialToolButton { + id: displayPhongLighting + property var activeNode: _reconstruction.activeNodes.get('PhotometricStereo').node + ToolTip.text: "Display Phong Lighting: " + (activeNode ? activeNode.label : "No Node") + text: MaterialIcons.light_mode + font.pointSize: 11 + Layout.minimumWidth: 0 + checkable: true + checked: false + enabled: activeNode + visible: activeNode + } MaterialToolButton { id: displayColorCheckerViewerLoader property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("ColorCheckerDetection").node : null From 9df260ac6cc015d247d25432be124edf1d6f8229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:54:23 +0200 Subject: [PATCH 60/64] [ui] scene3D: Add `getRotatedCameraViewVector` function --- meshroom/ui/components/scene3D.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meshroom/ui/components/scene3D.py b/meshroom/ui/components/scene3D.py index 58890fea..11f1de0d 100644 --- a/meshroom/ui/components/scene3D.py +++ b/meshroom/ui/components/scene3D.py @@ -354,7 +354,23 @@ class Transformations3DHelper(QObject): U = M * quaternion * M return U.toEulerAngles() - + + @Slot(QVector3D, QVector3D, float, float, result=QVector3D) + def getRotatedCameraViewVector(self, camereViewVector, cameraUpVector, pitch, yaw): + """ Compute the rotated camera view vector with given pitch and yaw (in degrees). + Args: + camereViewVector (QVector3D): Camera view vector, the displacement from the camera position to its target + cameraUpVector (QVector3D): Camera up vector, the direction the top of the camera is facing + pitch (float): Rotation pitch (in degrees) + yaw (float): Rotation yaw (in degrees) + Returns: + QVector3D: rotated camera view vector + """ + cameraSideVector = QVector3D.crossProduct(camereViewVector, cameraUpVector) + yawRot = QQuaternion.fromAxisAndAngle(cameraUpVector, yaw) + pitchRot = QQuaternion.fromAxisAndAngle(cameraSideVector, pitch) + return (yawRot * pitchRot).rotatedVector(camereViewVector) + @Slot(QVector3D, QMatrix4x4, Qt3DRender.QCamera, QSize, result=float) def computeScaleUnitFromModelMatrix(self, axis, modelMat, camera, windowSize): """ Compute the length of the screen projected vector axis unit transformed by the model matrix. From bfda6f66acdef3a8cf51f5586e7eb6de49a6d20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 20:59:50 +0200 Subject: [PATCH 61/64] [ui] Viewer3D: Use directional light & add light controller Use a single light entity instead of one per camera. Use directional light instead of point light. Add camera relative directional light controller. --- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 6 ++++ meshroom/ui/qml/Viewer3D/Viewer3D.qml | 29 +++++++++++++------ meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml | 1 + meshroom/ui/qml/Viewer3D/ViewpointCamera.qml | 9 ------ 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index 23bf7c7d..293aa2ee 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -70,6 +70,12 @@ FloatingPane { checked: Viewer3DSettings.displayOrigin onClicked: Viewer3DSettings.displayOrigin = !Viewer3DSettings.displayOrigin } + MaterialToolButton { + text: MaterialIcons.light_mode + ToolTip.text: "Display Light Controller" + checked: Viewer3DSettings.displayLightController + onClicked: Viewer3DSettings.displayLightController = !Viewer3DSettings.displayLightController + } } MaterialLabel { text: MaterialIcons.grain diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 7f91fdc4..2e9078bf 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -107,15 +107,6 @@ FocusScope { upVector: defaultCamUpVector viewCenter: defaultCamViewCenter aspectRatio: width/height - - // Scene light, attached to the camera - Entity { - components: [ - PointLight { - color: "white" - } - ] - } } ViewpointCamera { @@ -125,6 +116,15 @@ FocusScope { camera.aspectRatio: width/height } + Entity { + components: [ + DirectionalLight{ + color: "white" + worldDirection: Transformations3DHelper.getRotatedCameraViewVector(cameraSelector.camera.viewVector, cameraSelector.camera.upVector, directionalLightPane.lightPitchValue, directionalLightPane.lightYawValue).normalized() + } + ] + } + TrackballGizmo { beamRadius: 4.0/root.height alpha: cameraController.moving ? 1.0 : 0.7 @@ -318,6 +318,17 @@ FocusScope { } } + // Directional light controller + DirectionalLightPane { + id: directionalLightPane + anchors { + bottom: parent.bottom + right: parent.right + margins: 2 + } + visible: Viewer3DSettings.displayLightController + } + // Menu Menu { id: contextMenu diff --git a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml index 393526a3..8d97a26f 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml @@ -51,6 +51,7 @@ Item { property bool displayGrid: true property bool displayGizmo: true property bool displayOrigin: false + property bool displayLightController: false // Camera property bool syncViewpointCamera: false property bool syncWithPickedViewId: false // Sync active camera with picked view ID from sequence player if the setting is enabled diff --git a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml index bc84d5c1..e706f9e3 100644 --- a/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml +++ b/meshroom/ui/qml/Viewer3D/ViewpointCamera.qml @@ -16,15 +16,6 @@ Entity { nearPlane : 0.1 farPlane : 10000.0 viewCenter: Qt.vector3d(0.0, 0.0, -1.0) - - // Scene light, attached to the camera - Entity { - components: [ - PointLight { - color: "white" - } - ] - } } components: [ From 5fca8a74e248fa763adabf273eea47c84a5a1333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Fri, 14 Jun 2024 21:06:39 +0200 Subject: [PATCH 62/64] [ui] Viewer3D: Fix wrong camera up vector initialization Default camera up should be accurate and consistent with camera view center. Default camera up vector is not refresh or checked when default camera view center is set. --- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 2e9078bf..a0546c5a 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -20,7 +20,7 @@ FocusScope { readonly property alias mainCamera: mainCamera readonly property vector3d defaultCamPosition: Qt.vector3d(12.0, 10.0, -12.0) - readonly property vector3d defaultCamUpVector: Qt.vector3d(0.0, 1.0, 0.0) + readonly property vector3d defaultCamUpVector: Qt.vector3d(-0.358979, 0.861550, 0.358979) // should be accurate, consistent with camera view center readonly property vector3d defaultCamViewCenter: Qt.vector3d(0.0, 0.0, 0.0) readonly property var viewpoint: _reconstruction ? _reconstruction.selectedViewpoint : null From d63f7f257524dda90772957db071c7859f5e911d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 15 Nov 2024 10:49:41 +0100 Subject: [PATCH 63/64] [qt6] `.git-blame-ignore-revs`: Add clean-up commits --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index c2f54208..8acbe767 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,3 +1,5 @@ +# [qt6][qml] Clean-up code and harmonize comments +5a0b1c0c9547b0d00f3f10fae6994d6d8ea0b45e # [nodes] Linting: Clean-up files 4c0409f573c2694325b104c2686a1532f95cb9bc # Linting: Clean-up files From 9af6adeba9ec15b78c5c9525b8dd7149db638895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 21 Nov 2024 11:19:38 +0000 Subject: [PATCH 64/64] [qt6][ui] Limit useless calls to `recentProjectFiles` when opening dialogs This prevents emitting signals that lead to countless updates when a single one is necessary, thus causing some freezes in the interface. --- meshroom/ui/app.py | 2 ++ meshroom/ui/qml/main.qml | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index 7725bd18..884b8851 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -354,6 +354,7 @@ class MeshroomApp(QApplication): p = {"path": p, "thumbnail": thumbnail} projects.append(p) settings.endArray() + settings.endGroup() return projects @Slot(str) @@ -393,6 +394,7 @@ class MeshroomApp(QApplication): settings.setArrayIndex(i) settings.setValue("filepath", p) settings.endArray() + settings.endGroup() settings.sync() self.recentProjectFilesChanged.emit() diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index 46324d09..16940a74 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -76,13 +76,19 @@ ApplicationWindow { function initFileDialogFolder(dialog, importImages = false) { let folder = "" - let projects = MeshroomApp.recentProjectFiles + let project = "" + try { + // The list of recent projects might be empty, hence the try/catch + project = MeshroomApp.recentProjectFiles[0]["path"] + } catch (error) { + console.info("The list of recent projects is currently empty.") + } let currentItem = mainStack.currentItem if (currentItem instanceof Homepage) { // From the homepage, take the folder from the most recent project (no prior check on its existence) - if (projects.length > 0 && Filepath.exists(projects[0]["path"])) { - folder = Filepath.stringToUrl(Filepath.dirname(projects[0]["path"])) + if (project != "" && Filepath.exists(project)) { + folder = Filepath.stringToUrl(Filepath.dirname(project)) } } else { @@ -97,8 +103,8 @@ ApplicationWindow { } else { // If the currently opened project has not been saved, the dialog will open in the same // folder as the most recent project if it exists; otherwise, it will not be set - if (projects.length > 0 && Filepath.exists(projects[0]["path"])) { - folder = Filepath.stringToUrl(Filepath.dirname(projects[0]["path"])) + if (project != "" && Filepath.exists(project)) { + folder = Filepath.stringToUrl(Filepath.dirname(project)) } }