mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-30 09:26:32 +02:00
[ui] Add removeImage function in Python to check for intrinsic still used
This commit is contained in:
parent
561e9b806c
commit
c50d3cc9e7
3 changed files with 33 additions and 25 deletions
|
@ -816,6 +816,30 @@ class UIGraph(QObject):
|
|||
def removeAttribute(self, attribute):
|
||||
self.push(commands.ListAttributeRemoveCommand(self._graph, attribute))
|
||||
|
||||
@Slot(Attribute)
|
||||
def removeImage(self, image):
|
||||
with self.groupedGraphModification("Remove Image"):
|
||||
# look if the viewpoint's intrinsic is used by another viewpoint
|
||||
# if not, remove it
|
||||
intrinsicId = image.intrinsicId.value
|
||||
|
||||
intrinsicUsed = False
|
||||
for intrinsic in self.cameraInit.attribute("viewpoints").getExportValue():
|
||||
if image.getExportValue() != intrinsic and intrinsic['intrinsicId'] == intrinsicId:
|
||||
intrinsicUsed = True
|
||||
break
|
||||
|
||||
if not intrinsicUsed:
|
||||
#find the intrinsic and remove it
|
||||
for x in range(len(self.cameraInit.attribute("intrinsics"))):
|
||||
intrinsic = self.cameraInit.attribute("intrinsics").at(x)
|
||||
if intrinsic.getExportValue()["intrinsicId"] == intrinsicId:
|
||||
self.removeAttribute(intrinsic)
|
||||
break
|
||||
|
||||
# After every check we finally remove the attribute
|
||||
self.removeAttribute(image)
|
||||
|
||||
@Slot()
|
||||
def removeAllImages(self):
|
||||
with self.groupedGraphModification("Remove All Images"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue