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

github.com/alicevision/meshroom.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Vital <mugulmotion@gmail.com>2022-09-29 12:40:28 +0300
committerFabien Castan <fabcastan@gmail.com>2022-10-19 11:50:19 +0300
commit88e822a9de9f449e060fdb705d5d210a34586be9 (patch)
treeb2d9ab07181eab550afe6790eea4dcc9a94697b2
parentb91d0b372eebc2fe98c86f585020d599b8df1b05 (diff)
[ui] fix drag and drop external images on Viewer2D
-rw-r--r--meshroom/ui/qml/Viewer/Viewer2D.qml32
-rw-r--r--meshroom/ui/qml/WorkspaceView.qml3
2 files changed, 29 insertions, 6 deletions
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 {