mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[ui] Add project to recent projects when dropping a file
This commit is contained in:
parent
d387b7cf71
commit
ea7f51cdf2
3 changed files with 15 additions and 6 deletions
|
@ -83,7 +83,9 @@ Item {
|
|||
onFilesDropped: {
|
||||
if (drop["meshroomScenes"].length == 1) {
|
||||
ensureSaved(function() {
|
||||
reconstruction.handleFilesUrl(drop, augmentSfm ? null : cameraInit)
|
||||
if (reconstruction.handleFilesUrl(drop, augmentSfm ? null : cameraInit)) {
|
||||
MeshroomApp.addRecentProjectFile(drop["meshroomScenes"][0])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
reconstruction.handleFilesUrl(drop, augmentSfm ? null : cameraInit)
|
||||
|
|
|
@ -1255,7 +1255,9 @@ ApplicationWindow {
|
|||
var filesByType = _reconstruction.getFilesByTypeFromDrop(drop.urls)
|
||||
if (filesByType["meshroomScenes"].length == 1) {
|
||||
ensureSaved(function() {
|
||||
_reconstruction.handleFilesUrl(filesByType, null, mousePosition)
|
||||
if (_reconstruction.handleFilesUrl(filesByType, null, mousePosition)) {
|
||||
MeshroomApp.addRecentProjectFile(filesByType["meshroomScenes"][0])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_reconstruction.handleFilesUrl(filesByType, null, mousePosition)
|
||||
|
|
|
@ -752,9 +752,9 @@ class Reconstruction(UIGraph):
|
|||
""" Get all view Ids involved in the reconstruction. """
|
||||
return [vp.viewId.value for node in self._cameraInits for vp in node.viewpoints.value]
|
||||
|
||||
@Slot("QVariantMap")
|
||||
@Slot("QVariantMap", Node)
|
||||
@Slot("QVariantMap", Node, "QPoint")
|
||||
@Slot("QVariantMap", result=bool)
|
||||
@Slot("QVariantMap", Node, result=bool)
|
||||
@Slot("QVariantMap", Node, "QPoint", result=bool)
|
||||
def handleFilesUrl(self, filesByType, cameraInit=None, position=None):
|
||||
""" Handle drop events aiming to add images to the Reconstruction.
|
||||
This method allows to reduce process time by doing it on Python side.
|
||||
|
@ -830,7 +830,8 @@ class Reconstruction(UIGraph):
|
|||
)
|
||||
)
|
||||
else:
|
||||
self.loadUrl(filesByType["meshroomScenes"][0])
|
||||
return self.loadUrl(filesByType["meshroomScenes"][0])
|
||||
|
||||
|
||||
|
||||
if not filesByType["images"] and not filesByType["videos"] and not filesByType["panoramaInfo"] and not filesByType["meshroomScenes"]:
|
||||
|
@ -843,6 +844,10 @@ class Reconstruction(UIGraph):
|
|||
"Unknown file extensions: " + ', '.join(extensions)
|
||||
)
|
||||
)
|
||||
|
||||
# As the boolean is introduced to check if the project is loaded or not, the return value is added to the function.
|
||||
# The default value is False, which means the project is not loaded.
|
||||
return False
|
||||
|
||||
@Slot("QList<QUrl>", result="QVariantMap")
|
||||
def getFilesByTypeFromDrop(self, urls):
|
||||
|
|
Loading…
Add table
Reference in a new issue