Hello Boink,
For the version 1.2.6 you also need to comment the line for 1.3:
import PhotoScan
doc = PhotoScan.app.document
chunk = doc.chunk
path = PhotoScan.app.getOpenFileName("Specify bundler.out file used:")
file = open(path, "rt")
coords = list()
line = file.readline()
line = file.readline()
for i in range(0, len(chunk.cameras)):
line = file.readline()
line = file.readline()
line = file.readline()
line = file.readline()
line = file.readline()
x, y, z = line.split()
coords.append(PhotoScan.Vector([float(x), float(y), float(z)]))
T = chunk.cameras[i].transform
###for version 1.3:
#R = chunk.cameras[i].transform.rotation() * PhotoScan.Matrix.Diag([1,-1,-1]) #for version 1.3
###end of code for version 1.3
###for version 1.2:
R = PhotoScan.Matrix([[T[0,0], T[0,1], T[0,2]],
[T[1,0], T[1,1], T[1,2]],
[T[2,0], T[2,1], T[2,2]]])
R = R * PhotoScan.Matrix.Diag([1,-1,-1]) #for version 1.2
###end of code for version 1.2
v = (-1) * R * coords[-1]
chunk.cameras[i].transform = PhotoScan.Matrix([[T[0,0], T[0,1], T[0,2], v.x],
[T[1,0], T[1,1], T[1,2], v.y],
[T[2,0], T[2,1], T[2,2], v.z],
[0, 0, 0, 1]])
file.close()
print("finished")