i think i did it
# Script to add exif for SODA Meta data for all cameras in the active chunk.
import PhotoScan
# Checking compatibility
compatible_major_version = "1.4"
found_major_version = ".".join(PhotoScan.app.version.split('.')[:2])
if found_major_version != compatible_major_version:
raise Exception("Incompatible PhotoScan version: {} != {}".format(found_major_version, compatible_major_version))
def sodaADD():
"""
Reads Soda/accuracy/YPR
"""
doc = PhotoScan.app.document
if not len(doc.chunks):
raise Exception("No chunks!")
print("Script started...")
chunk = doc.chunk
for camera in chunk.cameras:
vect = PhotoScan.Vector((10, 10, 10))
locationAccuracy = PhotoScan.Vector((10, 10, 10))
if 'Sensefly/Yaw' in camera.photo.meta.keys():
vect[0] = float(camera.photo.meta["Sensefly/Yaw"])
if 'Sensefly/Pitch' in camera.photo.meta.keys():
vect[1] = float(camera.photo.meta["Sensefly/Pitch"])
if 'Sensefly/Roll' in camera.photo.meta.keys():
vect[2] = float(camera.photo.meta["Sensefly/Roll"])
print(vect)
if 'Sensefly/GPSXYAccuracy' in camera.photo.meta.keys():
locationAccuracy[0] = float(camera.photo.meta["Sensefly/GPSXYAccuracy"])
if 'Sensefly/GPSXYAccuracy' in camera.photo.meta.keys():
locationAccuracy[1] = float(camera.photo.meta["Sensefly/GPSXYAccuracy"])
if 'Sensefly/GPSZAccuracy' in camera.photo.meta.keys():
locationAccuracy[2] = float(camera.photo.meta["Sensefly/GPSZAccuracy"])
print(locationAccuracy)
camera.reference.rotation = vect
camera.reference.location_accuracy = locationAccuracy
chunk.updateTransform()
PhotoScan.app.update()
print("Script finished")
label = "Custom menu/Add S.O.D.A Exif Data"
PhotoScan.app.addMenuItem(label, sodaADD)
print("To execute this script press {}".format(label))