Forum

move disabled cameras with Python? (not remove)

Started by wyowill, December 19, 2019, 02:39:53 AM

Previous topic - Next topic

wyowill

Is there a way to (non-manually) either:

1) select disabled cameras, or
2) select disabled cameras and move to another chunk

#2 isn't a big deal as it's just a few mouse clicks to move cameras once selected.

This post comes close to what I'm looking for:
https://www.agisoft.com/forum/index.php?topic=10829.msg48926#msg48926

But I don't want to remove from the psx file entirely.  My searches of the Python Reference Manual (for v1.5.0) didn't find select or move functionality.

Cheers,
W

Alexey Pasumansky

Hello wyowill,

The following code selects disabled cameras and also filters the images in the Photos pane, leaving only enabled cameras in the pane.


chunk = Metashape.app.document.chunk
enabled = [camera for camera in chunk.cameras if camera.enabled]
disabled = [camera for camera in chunk.cameras if not camera.enabled]
for camera in disabled:
    camera.selected = True
Metashape.app.photos_pane.setFilter(enabled)
Best regards,
Alexey Pasumansky,
Agisoft LLC