In some cases, like when opening the most recent file from the command
line, switching the color palette or hot reloading, the intrinsics
might be parsed and ready to populate the intrinsics' `TableModel` while
the model itself is being instantiated.
To prevent crashes, we forbid operations on the `TableModel` until it has
been fully instantiated.
Warning dialog when project and images are dropped, both for
ImageGallery and GraphEditor.
Counter of meshroom projects and compare to actual list of files
dragged.
In Image Gallery :
- drop 1 .mg open the scene
- drop images either create new camera or augment the reconstruction
In Graph Editor :
- drop 1 .mg open the scene
- drop images create new camera at position of mouse
Update the names of the commands that remove images in the "File"
menu to match with those in the Image Gallery menu.
"Clear Images" becomes "Remove All Images" and "Clear All Images" becomes
"Remove Images From All CameraInit Nodes".
In addition to the existing "Remove" menu action in the Image Gallery that
deletes the currently selected image, add a "Remove All Images" menu
action that performs the same action as "Clear Images" from the "File"
menu.
The "Del" key was used as a shortcut to remove the currently selected
image when the Image Gallery has the focus, "Shift+Del" can now also be
used to remove all the images at once.
Prior to this commit, when a `CameraInit` node was added to or removed
from the list of `CameraInit` nodes, the active `CameraInit` was always
reset to the first one in the list, independently from its previous
value.
This commit changes that behaviour by only modifying the active
`CameraInit` if no `CameraInit` node has been assigned yet, or if the
active `CameraInit` does not exist anymore (meaning it has been removed).
This requires to emit the `cameraInitChanged` signal every single time
the list of existing `CameraInit` nodes is modified even if the active one
is not changed, and to connect it to the ImageGallery in order to ensure
the index from the combo box always corresponds to the currently active
`CameraInit` node. Indeed, when the list of CameraInits is updated, the
model for the combo box is reset, and it needs to be re-updated with the
correct non-default value.
When all the images in the gallery are cleared using the "Clear Images" or
"Clear All Images" menu action while the "Visualize HDR images" option is
turned on, the gallery is correctly emptied and the viewer correctly reset
but the button remains turned on even though there is nothing left to show.
As it is turned on (although with a "0" count), the gallery remains in
read-only mode and no more image can be dropped until the button is
manually clicked to be turned off. Even after that, it remains clickable
instead of being disabled.
This commit ensures that the button gets disabled if the number of
viewpoints is 0 (meaning the gallery is empty). That way, the button
correctly reflects the current situation, and the gallery is ready to have
images dropped.
Add the name of the currently active `CameraInit` group in the Image
Gallery, as well as the name of the previous / next group in the tooltip
of the buttons to switch between groups.
When the last image from the active group has been manually removed from
the Image Gallery (meaning it has been removed either with the "Del" key
or the "Remove" option), the list of viewpoints and intrinsics should
both be reset, like they are when "Clear Images" is used.
Prior to this commit, the list of viewpoints was emptied (but not reset)
and the list of intrinsics remained untouched. Removing all the images
manually did not affect the list of intrinsics, which could cause issues
later on.
The Image Gallery should only switch to read-only if the currently active
group is being computed. The behaviour prior to this commit was to lock it
as soon as any node in the entire graph was being computed, even if it did
not involve the active CameraInit node.
As the temporary CameraInit nodes are not really part of the graph, their
attributes cannot be edited. By default, the intrinsics can be edited for
any CameraInit node from the intrinsics table.
For temporary CameraInit nodes, we want the intrinsics to be displayed in
read-only mode to ensure that the user cannot attempt to edit them, which
would cause errors.
Upon its creation, the temporary CameraInit node is locked (as if it were
computed), and the intrinsics table's component are updated to be displayed
as read-only if the CameraInit node is locked.
When setting a temporary CameraInit node, the intrinsics of the actual
CameraInit node are used, meaning that the temporary CameraInit has all
the intrinsics information we need to fill the intrinsics table.
However, when a temporary CameraInit node is set, the parsing of the
intrinsics and the model update are not performed. If the active CameraInit
group does not change, this is not directly visible as the table keeps on
displaying the intrinsics from the actual CameraInit node.
If the active group changes, we attempt to fill the table with the
intrinsics of the temporary CameraInit node, which is being re-set for the
active group. The intrinsics are thus not available, leading to an empty
table, and the parsing is never retriggered once the temporary CameraInit
has been fully set.
Instead of re-parsing the intrinsics when the CameraInitIndex is updated,
the parsing is triggered when the intrinsics are updated, since this
ensures they will be available and its covers all the cases we could
be facing.
When there is a temporary CameraInit, it means that either the "Visualize
HDR images" or "Preprocessed images" options are enabled.
If several CameraInit groups are available, and if the currently selected
image in the GridView is the first one (index = 0), there is a possibility,
depending on the input images, that the first images in two different
groups are not identical but have the same view ID. If that happens, there
will be no update of the Viewer2D, as the selectedViewId property will not
have been modified.
By setting the selectedViewId property to -1 when there is a temporary
CameraInit and the current index in the GridView is 0, we trigger an
update of the viewer even when there is no apparent change in the view ID.
Selecting any filter in the Image Gallery changes the displayed content of
the gallery according to the filter. Unselecting any filter automatically
switches the displayed content back to the "input images" filter (which
simply displays all the input images), but the "input images" button is
never reselected, meaning that there can be a display corresponding to a
filter without any filter being selected.
This commit prevents unselecting a filter without reselecting the one
corresponding to the display. Since the "input images" is always the
display that is reverted to, unselecting any filter automatically selects
its button.
This commit fixes an "Unable to assign QJSValue to QObject*".
In IntrinsicDisplayDelegate, initialize the "attribute" variant to null
and set it as a parameter during the instantiation in ImageGallery.
All references to "model.display" in IntrinsicDisplayDelegate have been
replaced with a correct use of "attribute".
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.
The output of "cameraInit.attribute("sensorDatabase").value" is the
unresolved ${ALICEVISION_SENSOR_DB} environment variable.
To get the path, the variable needs to be evaluated.
The "cacheBuffer" property determines whether delegates are retained
outside the visible area of view. In the case of the ImageGallery,
it determines whether the images that are not currently visible in
the GridView (because we need to scroll up or down to be able to see
them) will remain in the cache or not. The default value is platform-
dependent (320 for Windows) and currently causes any image that is not
directly visible to be lost, even if it was previously loaded when it
appeared in the view: if we scroll up or down, we will necessarily need
to wait for the images to be loaded again.
10000 is an arbitrary value that seems to work correctly for most cases.