Forum

Author Topic: move disabled cameras with Python? (not remove)  (Read 1766 times)

wyowill

  • Newbie
  • *
  • Posts: 20
    • View Profile
move disabled cameras with Python? (not remove)
« on: December 19, 2019, 02:39:53 AM »
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

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: move disabled cameras with Python? (not remove)
« Reply #1 on: December 19, 2019, 12:50:24 PM »
Hello wyowill,

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

Code: [Select]
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

wyowill

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: move disabled cameras with Python? (not remove)
« Reply #2 on: December 20, 2019, 01:21:04 AM »
Excellent.  Cheers!