mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-23 05:56:36 +02:00
[ui] convert string paths to urls outside Viewers
* fix external image drop on 2D Viewer * fix 3D model loading from "Load Model" button
This commit is contained in:
parent
ccab9cb663
commit
266f0985d2
4 changed files with 11 additions and 26 deletions
|
@ -21,7 +21,7 @@ Item {
|
||||||
// retrieve viewpoints inner data
|
// retrieve viewpoints inner data
|
||||||
QtObject {
|
QtObject {
|
||||||
id: _viewpoint
|
id: _viewpoint
|
||||||
property string source: viewpoint ? viewpoint.get("path").value : ''
|
property url source: viewpoint ? Filepath.stringToUrl(viewpoint.get("path").value) : ''
|
||||||
property string metadataStr: viewpoint ? viewpoint.get("metadata").value : ''
|
property string metadataStr: viewpoint ? viewpoint.get("metadata").value : ''
|
||||||
property var metadata: metadataStr ? JSON.parse(viewpoint.get("metadata").value) : null
|
property var metadata: metadataStr ? JSON.parse(viewpoint.get("metadata").value) : null
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ Item {
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 4
|
anchors.margins: 4
|
||||||
source: Filepath.stringToUrl(imageDelegate.source)
|
source: imageDelegate.source
|
||||||
sourceSize: Qt.size(100, 100)
|
sourceSize: Qt.size(100, 100)
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
|
|
|
@ -8,7 +8,7 @@ FocusScope {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
property string source
|
property url source
|
||||||
property var metadata
|
property var metadata
|
||||||
|
|
||||||
// slots
|
// slots
|
||||||
|
@ -49,7 +49,7 @@ FocusScope {
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
onWidthChanged: if(status==Image.Ready) fit()
|
onWidthChanged: if(status==Image.Ready) fit()
|
||||||
source: Filepath.stringToUrl(root.source)
|
source: root.source
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
// update cache source when image is loaded
|
// update cache source when image is loaded
|
||||||
if(status === Image.Ready)
|
if(status === Image.Ready)
|
||||||
|
|
|
@ -18,7 +18,7 @@ Item {
|
||||||
|
|
||||||
property variant reconstruction: _reconstruction
|
property variant reconstruction: _reconstruction
|
||||||
readonly property variant cameraInits: _reconstruction.cameraInits
|
readonly property variant cameraInits: _reconstruction.cameraInits
|
||||||
readonly property string meshFile: _reconstruction.meshFile
|
readonly property url meshFile: Filepath.stringToUrl(_reconstruction.meshFile)
|
||||||
property bool readOnly: false
|
property bool readOnly: false
|
||||||
|
|
||||||
implicitWidth: 300
|
implicitWidth: 300
|
||||||
|
@ -31,17 +31,12 @@ Item {
|
||||||
// Load a 3D media file in the 3D viewer
|
// Load a 3D media file in the 3D viewer
|
||||||
function load3DMedia(filepath)
|
function load3DMedia(filepath)
|
||||||
{
|
{
|
||||||
if(Filepath.extension(filepath) === ".abc")
|
switch(Filepath.extension(filepath))
|
||||||
{
|
{
|
||||||
viewer3D.abcSource = filepath
|
case ".abc": viewer3D.abcSource = filepath; break;
|
||||||
|
case ".exr": viewer3D.depthMapSource = filepath; break;
|
||||||
|
case ".obj": viewer3D.source = filepath; break;
|
||||||
}
|
}
|
||||||
else if(Filepath.extension(filepath) === ".exr")
|
|
||||||
{
|
|
||||||
// viewer3D.clearDepthMap()
|
|
||||||
viewer3D.depthMapSource = filepath
|
|
||||||
}
|
|
||||||
else
|
|
||||||
viewer3D.source = filepath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -137,23 +132,13 @@ Item {
|
||||||
background: Rectangle { color: palette.base; opacity: 0.5 }
|
background: Rectangle { color: palette.base; opacity: 0.5 }
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "3D Model not available"
|
|
||||||
visible: meshFile == ''
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: 10
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
padding: 6
|
|
||||||
background: Rectangle { color: palette.base; opacity: 0.5 }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load reconstructed model
|
// Load reconstructed model
|
||||||
Button {
|
Button {
|
||||||
text: "Load Model"
|
text: "Load Model"
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 10
|
anchors.bottomMargin: 10
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: meshFile != '' && (viewer3D.source != meshFile)
|
visible: meshFile != "" && (viewer3D.source != meshFile)
|
||||||
onClicked: load3DMedia(meshFile)
|
onClicked: load3DMedia(meshFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,7 +391,7 @@ ApplicationWindow {
|
||||||
&& attr.desc.type === "File"
|
&& attr.desc.type === "File"
|
||||||
&& _3dFileExtensions.indexOf(Filepath.extension(attr.value)) > - 1 )
|
&& _3dFileExtensions.indexOf(Filepath.extension(attr.value)) > - 1 )
|
||||||
{
|
{
|
||||||
workspaceView.load3DMedia(attr.value)
|
workspaceView.load3DMedia(Filepath.stringToUrl(attr.value))
|
||||||
break // only load first model found
|
break // only load first model found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue