Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Use the location of the most recently imported images as the base folder for the "Import Images" dialog #1864

Merged
merged 6 commits into from
Jan 22, 2023

Conversation

cbentejac
Copy link
Contributor

@cbentejac cbentejac commented Jan 9, 2023

Description

Since #1778, all the actions from the "File" menu that open dialogs use the folder of the .mg file that was opened last as the base folder.

This is also the case for the "Import Images" dialog, which means that at each import, the dialog opens in the folder containing the most recently opened .mg file rather than the most recently imported images.

This PR changes that behaviour by saving the location of the last imported images, and using it as the base folder specifically for the "Import Images" dialog. The new behaviour can be summed up as follows:

  • The last 3 locations of the imported images are saved across Meshroom sessions and used as a base folder (if the most recent location is not valid anymore, it is dropped and the second most recent location is used, and so on until either the list is empty or a valid location in it has been found);
  • If no location has been saved when Meshroom is started (or if they are all invalid) and a graph with images has already been loaded, then the base folder will be the location of the graph's images;
  • If no location has been saved when Meshroom is started (or if they are all invalid), and if the "Import Images" is the first dialog to be opened (or the already loaded graph has no image), then the same base folder as the other file dialogs is used.

The base folder for all the other file dialogs ("Open", "Save As", "Import Project", "Save As Template") remains unchanged.

Features list

  • Save the locations of the most recently imported images across sessions
  • Use the saved locations of the most recently imported images as the "Import Images" dialog's base folder

@cbentejac cbentejac self-assigned this Jan 9, 2023
Copy link
Contributor

@sbrood sbrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well !
Maybe we could add something similar when a project is loaded ? For the moment the path is still the one of the .mg file. It could be the path of the first or last image loaded ?

meshroom/ui/qml/main.qml Outdated Show resolved Hide resolved
meshroom/ui/qml/main.qml Outdated Show resolved Hide resolved
@mugulmd
Copy link
Contributor

mugulmd commented Jan 10, 2023

Could also be interesting to make this feature work in-between sessions

@cbentejac cbentejac marked this pull request as draft January 10, 2023 11:47
This commit changes the folder in which the "Import Images" dialog
opens: it used to be opened in the folder in which the last .mg file
had been opened, and it now opens in the folder from which the last
images were imported.

The location of the last imported images is saved, and used specifically
when opening the "Import Images" dialog, as opposed to all the other
dialogs which open in the folder of the last opened .mg file.
@cbentejac cbentejac force-pushed the dev/saveImportImagesFolder branch 3 times, most recently from 6f8812a to 125a391 Compare January 11, 2023 13:59
@cbentejac
Copy link
Contributor Author

Could also be interesting to make this feature work in-between sessions

Done, the folders are now saved across sessions!

This works well ! Maybe we could add something similar when a project is loaded ? For the moment the path is still the one of the .mg file. It could be the path of the first or last image loaded ?

Also done. If no folder has been saved yet (or if the settings have all been reset), and the user opens a .mg file that contains images before trying to import images, the base folder for the "Import Images" dialog will be the location of the project's images.

@cbentejac cbentejac marked this pull request as ready for review January 11, 2023 14:06
Copy link
Member

@fabiencastan fabiencastan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some modifications

…e base folder

If a project has already been opened before the "Import Images" dialog
is opened for the first time, and if the opened project has imported
images, use the location of these images' folder as the base folder for
the "Import Images" dialog.

If the opened project has no imported images, the base folder will remain
identical to the other dialogs' until images are imported.
Save up to 3 folder locations from which images have been imported.
These folder locations will be saved across Meshroom sessions, in
a similar fashion as the "Recent Files" entries.
If no folder location has been saved (or if all saved folder locations
are invalid), we fall back to the default behaviour: if a project with
images has been opened before the "Import Images" action is called, then
the base folder will be the folder containing the opened project's
images.
…aved

Prior to saving the images' locations across sessions, if no image had
been yet imported but a project file with images had been opened, the
default base folder for the session became the project images' location.
The location of dropped images back then was never saved.

Now that the locations from the "Import Images" are saved across session,
the possibilities of having no location saved have drastically decreased.
The three cases where it can happen are the following:
- the user has never opened Meshroom before (or the user has been using
Meshroom without ever using "Import Images")
- the user has cleared their Meshroom settings
- the 3 saved locations have become invalid

For these three cases, the default base folder is either set to the
location of the first dropped image or to the opened project's images.
That location is NOT saved for later sessions. Using the "Import Images"
action is necessary for the location to be saved.
@fabiencastan fabiencastan added this to the Meshroom 2023.1.0 milestone Jan 22, 2023
@fabiencastan fabiencastan merged commit 40b182e into develop Jan 22, 2023
@fabiencastan fabiencastan deleted the dev/saveImportImagesFolder branch January 22, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants