diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 0af53edd..ba077a43 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -10,6 +10,10 @@ FocusScope { clip: true property var displayedNode: _reconstruction.cameraInit + + property bool useExternal: false + property url sourceExternal + property url source property var metadata property var viewIn3D @@ -155,6 +159,8 @@ FocusScope { } function tryLoadNode(node) { + useExternal = false; + // safety check if (!node) { return false; @@ -182,15 +188,33 @@ FocusScope { return true; } + function loadExternal(path) { + useExternal = true; + sourceExternal = path; + displayedNode = null; + metadata = {}; + } + function getImageFile() { - // entry point for getting the image file URL that corresponds to - // the displayed node, selected output attribute and selected viewId + // entry point for getting the image file URL + if (useExternal) { + return sourceExternal; + } if (!displayedNode || outputAttribute.name == "" || outputAttribute.name == "gallery") { return getViewpointPath(_reconstruction.selectedViewId); } return getFileAttributePath(displayedNode, outputAttribute.name, _reconstruction.selectedViewId); } + function getMetadata() { + // entry point for getting the image metadata + if (useExternal) { + return {}; + } else { + return getViewpointMetadata(_reconstruction.selectedViewId); + } + } + function getFileAttributePath(node, attrName, viewId) { // get output attribute with matching name // and parse its value to get the image filepath @@ -226,7 +250,7 @@ FocusScope { return vp.childAttribute("metadata").value; } } - return ""; + return {}; } onDisplayedNodeChanged: { @@ -252,7 +276,7 @@ FocusScope { target: _reconstruction onSelectedViewIdChanged: { root.source = getImageFile(); - root.metadata = getViewpointMetadata(_reconstruction.selectedViewId); + root.metadata = getMetadata(); } } diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index c4582e8f..2c4d6ae2 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -152,8 +152,7 @@ Item { anchors.fill: parent keys: ["text/uri-list"] onDropped: { - viewer2D.source = drop.urls[0] - viewer2D.metadata = {} + viewer2D.loadExternal(drop.urls[0]); } } Rectangle {