[ui] Add a "Clear All Images" action and update "Clear Images"'s behaviour

"Clear Images" used to clear the intrinsics and viewpoints for all the
existing CameraInit nodes in the graph. There was no-user friendly way
to clear the images of a specific CameraInit node.

This commit modifies the behaviour of "Clear Images" so that it only
deletes the intrinsics and viewpoints of the current CameraInit. A new menu
action, "Clear All Images", is added in the "Advanced" sub-menu, and
deletes all the intrinsics and viewpoints for all the CameraInit nodes.

The way images are cleared is also modified: instead of removing the
intrinsics and viewpoints attributes, they are reset. To be undone
properly, a corresponding "ClearImagesCommand" has been added. This offers
a great performance increase (clearing 1000 images now takes 1s).

Tooltips have been added to make the distinction clearer for users.
This commit is contained in:
Candice Bentéjac 2023-02-22 13:24:32 +01:00
parent 2987bf0617
commit 43f439be88
4 changed files with 66 additions and 26 deletions

View file

@ -733,6 +733,16 @@ class UIGraph(QObject):
def removeAttribute(self, attribute):
self.push(commands.ListAttributeRemoveCommand(self._graph, attribute))
@Slot()
def clearImages(self):
with self.groupedGraphModification("Clear Images"):
self.push(commands.ClearImagesCommand(self._graph, [self.cameraInit]))
@Slot()
def clearAllImages(self):
with self.groupedGraphModification("Clear All Images"):
self.push(commands.ClearImagesCommand(self._graph, list(self.cameraInits)))
@Slot(Node)
def appendSelection(self, node):
""" Append 'node' to the selection if it is not already part of the selection. """