diff --git a/meshroom/multiview.py b/meshroom/multiview.py index e3d95362..28af8cee 100644 --- a/meshroom/multiview.py +++ b/meshroom/multiview.py @@ -82,17 +82,17 @@ class FilesByType: self.images = [] self.videos = [] self.panoramaInfo = [] - self.meshroomScene = [] + self.meshroomScenes = [] self.other = [] def __bool__(self): - return self.images or self.videos or self.panoramaInfo or self.meshroomScene + return self.images or self.videos or self.panoramaInfo or self.meshroomScenes def extend(self, other): self.images.extend(other.images) self.videos.extend(other.videos) self.panoramaInfo.extend(other.panoramaInfo) - self.meshroomScene.extend(other.meshroomScene) + self.meshroomScenes.extend(other.meshroomScenes) self.other.extend(other.other) def addFile(self, file): @@ -103,7 +103,7 @@ class FilesByType: elif hasExtension(file, panoramaInfoExtensions): self.panoramaInfo.append(file) elif hasExtension(file, meshroomSceneExtensions): - self.meshroomScene.append(file) + self.meshroomScenes.append(file) else: self.other.append(file) diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index 748853be..75728bf8 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -29,7 +29,7 @@ Panel { property bool readOnly: false property bool isMeshroomScene : false - property int nbFilesDropped: 0 + property int nbDraggedFiles: 0 signal removeImageRequest(var attribute) signal allViewpointsCleared() @@ -443,10 +443,10 @@ Panel { keys: ["text/uri-list"] onEntered: { isMeshroomScene = false - nbFilesDropped = drag.urls.length - if (nbFilesDropped == 1){ + nbDraggedFiles = drag.urls.length + if (nbDraggedFiles == 1) { var url = drag.urls[0] - if (url.endsWith(".mg")){ + if (url.endsWith(".mg")) { isMeshroomScene = true } } @@ -477,12 +477,12 @@ Panel { verticalAlignment: Text.AlignVCenter text: { if (isMeshroomScene) { - if(nbFilesDropped == 1) { + if (nbDraggedFiles == 1) { return "Load Project" } else { return "Only one project" } - }else if (!isMeshroomScene){ + } else { return "Add Images" } } @@ -506,11 +506,13 @@ Panel { font.bold: true wrapMode: Text.WrapAtWordBoundaryOrAnywhere visible: { - if(isMeshroomScene) + if (isMeshroomScene) { return false - if(m.viewpoints){ + } + + if (m.viewpoints) { return m.viewpoints.count > 0 - }else{ + } else { return false } } diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index fd6de4a7..f217720e 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -82,7 +82,7 @@ Item { onAllViewpointsCleared: { reconstruction.removeAllImages(); reconstruction.selectedViewId = "-1" } onFilesDropped: { var filesByType = _reconstruction.getFilesByTypeFromDrop(drop.urls) - if (filesByType["meshroomScene"].length == 1) { + if (filesByType["meshroomScenes"].length == 1) { ensureSaved(function() { reconstruction.handleFilesUrl(filesByType, augmentSfm ? null : cameraInit) }) diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index b3da5cf9..cd34e5d8 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -1188,7 +1188,7 @@ ApplicationWindow { } onFilesDropped: { var filesByType = _reconstruction.getFilesByTypeFromDrop(drop.urls) - if (filesByType["meshroomScene"].length == 1) { + if (filesByType["meshroomScenes"].length == 1) { ensureSaved(function() { _reconstruction.handleFilesUrl(filesByType, null, mousePosition) }) diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index 15065897..d1e0e4b2 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -724,7 +724,7 @@ class Reconstruction(UIGraph): This method allows to reduce process time by doing it on Python side. Args: - {images, videos, panoramaInfo, otherFiles}: Map of paths of recognized images and list of other files + {images, videos, panoramaInfo, meshroomScenes, otherFiles}: Map containing the lists of paths for recognized images, videos, Meshroom scenes and other files. Node: cameraInit node used to add new images to it QPoint: position to locate the node (usually the mouse position) """ @@ -785,19 +785,19 @@ class Reconstruction(UIGraph): "", )) - if filesByType["meshroomScene"]: - if len(filesByType["meshroomScene"]) > 1: + if filesByType["meshroomScenes"]: + if len(filesByType["meshroomScenes"]) > 1: self.error.emit( Message( - "Too much Meshroom Scenes", - "You should only import 1 .mg file" + "Too many Meshroom Scenes", + "A single Meshroom scene (.mg file) can be imported at once." ) ) else: - self.loadUrl(filesByType["meshroomScene"][0]) + self.loadUrl(filesByType["meshroomScenes"][0]) - if not filesByType["images"] and not filesByType["videos"] and not filesByType["panoramaInfo"] and not filesByType["meshroomScene"]: + if not filesByType["images"] and not filesByType["videos"] and not filesByType["panoramaInfo"] and not filesByType["meshroomScenes"]: if filesByType["other"]: extensions = set([os.path.splitext(url)[1] for url in filesByType["other"]]) self.error.emit( @@ -816,7 +816,7 @@ class Reconstruction(UIGraph): urls: list of filepaths Returns: - {images, otherFiles}: Map of recognized images and list of other files + {images, videos, panoramaInfo, meshroomScenes, otherFiles}: Map containing the lists of paths for recognized images, videos, Meshroom scenes and other files. """ # Build the list of images paths filesByType = multiview.FilesByType() @@ -826,7 +826,7 @@ class Reconstruction(UIGraph): filesByType.extend(multiview.findFilesByTypeInFolder(localFile)) else: filesByType.addFile(localFile) - return {"images": filesByType.images, "videos": filesByType.videos, "panoramaInfo": filesByType.panoramaInfo, "meshroomScene": filesByType.meshroomScene, "other": filesByType.other} + return {"images": filesByType.images, "videos": filesByType.videos, "panoramaInfo": filesByType.panoramaInfo, "meshroomScenes": filesByType.meshroomScenes, "other": filesByType.other} def importImagesFromFolder(self, path, recursive=False): """