From c45d29976bd912f366c5978f8ff8b2d4f671474d Mon Sep 17 00:00:00 2001 From: Julien-Haudegond <44610840+Julien-Haudegond@users.noreply.github.com> Date: Tue, 21 Jul 2020 16:24:03 +0200 Subject: [PATCH] [ui] Viewer3D: specific bounding box options in the Inspector3D --- meshroom/ui/qml/Viewer3D/Inspector3D.qml | 10 +++---- meshroom/ui/qml/Viewer3D/MediaLibrary.qml | 34 +++++++++++------------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/meshroom/ui/qml/Viewer3D/Inspector3D.qml b/meshroom/ui/qml/Viewer3D/Inspector3D.qml index 7f6bbc88..9f7973ad 100644 --- a/meshroom/ui/qml/Viewer3D/Inspector3D.qml +++ b/meshroom/ui/qml/Viewer3D/Inspector3D.qml @@ -284,19 +284,19 @@ FloatingPane { } } - // Transform visibility (bbox for meshing) + // BoundingBox visibility (if meshing node) MaterialToolButton { - visible: model.hasTransform + visible: model.hasBoundingBox enabled: model.visible Layout.alignment: Qt.AlignTop Layout.fillHeight: true text: MaterialIcons.transform font.pointSize: 10 - ToolTip.text: model.displayTransform ? "Hide BBox" : "Show BBox" + ToolTip.text: model.displayBoundingBox ? "Hide BBox" : "Show BBox" flat: true - opacity: model.visible ? (model.displayTransform ? 1.0 : 0.6) : 0.6 + opacity: model.visible ? (model.displayBoundingBox ? 1.0 : 0.6) : 0.6 onClicked: { - model.displayTransform = !model.displayTransform + model.displayBoundingBox = !model.displayBoundingBox } } diff --git a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml index 8f526a74..363d5915 100644 --- a/meshroom/ui/qml/Viewer3D/MediaLibrary.qml +++ b/meshroom/ui/qml/Viewer3D/MediaLibrary.qml @@ -46,8 +46,8 @@ Entity { "valid": true, "label": "", "visible": true, - "hasTransform": false, - "displayTransform": true, + "hasBoundingBox": false, // for Meshing node only + "displayBoundingBox": true, // for Meshing node only "section": "", "attribute": null, "entity": null, @@ -156,20 +156,20 @@ Entity { delegate: MediaLoader { id: mediaLoader + // Get the node property var currentNode: model.attribute ? model.attribute.node : null property string nodeType: currentNode ? currentNode.nodeType: null - property bool hasTransform: { - if(nodeType !== "Meshing") // Cannot have a Transform - return false - const value = currentNode ? currentNode.attribute("useBoundingBox").value : null - if (value !== null) - mediaLoader.hasTransformPropertyChanged(value) - return value - } - property bool displayTransform: model.displayTransform - signal hasTransformPropertyChanged(bool transform) - onHasTransformPropertyChanged: model.hasTransform = transform + // Specific properties to the Meshing node (declared and initialiazed for every MediaLoader anyway) + property bool hasBoundingBox: { + if(nodeType === "Meshing") { // Can have a BoundingBox + const value = currentNode.attribute("useBoundingBox") ? currentNode.attribute("useBoundingBox").value : false + model.hasBoundingBox = value + return value + } + return false + } + property bool displayBoundingBox: model.displayBoundingBox // whether MediaLoader has been fully instantiated by the NodeInstantiator property bool fullyInstantiated: false @@ -210,12 +210,12 @@ Entity { onObjectRemoved: remove(idx) } - // BoundingBox: display bounding box for meshing computation + // 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 NodeInstantiator { id: boundingBoxInstantiator property var currentNode: mediaLoader.currentNode - active: currentNode.nodeType === "Meshing" && currentNode.attribute("useBoundingBox").value + active: mediaLoader.hasBoundingBox model: 1 MeshingBoundingBox { @@ -223,7 +223,7 @@ Entity { frontLayerComponent: root.frontLayerComponent window: root.window currentMeshingNode: boundingBoxInstantiator.currentNode - enabled: mediaLoader.displayTransform + enabled: mediaLoader.displayBoundingBox } } @@ -266,8 +266,6 @@ Entity { // if external media failed to open, remove element from model if(!attribute && !object) remove(index) - // tell the model if it has a Transform (Gizmo) - model.hasTransform = hasTransform } onCurrentSourceChanged: {