I have a script that is supposed to run through every frame and output a selected camera’s animation data. The problem I’ve run into is that the performance of the script decreases as the total animation range increases. For example, if I have a 100 frame range it takes about 3 seconds to get through all 100 frames, but if I have a 3000 frame range it takes 20 seconds to get through those same 100 frames. I’ve already done everything I thought would help for optimization with no luck. What could be the underlying issue?
camExportDummy = Dummy name:"CameraExportDummy" pos:[0,0,0]
disablesceneredraw
undo off
for i = animationRange.start to animationRange.end do
(
sliderTime = i
cbTimestamp = at time i $MetadataDummy.modifiers[1].replayCurrentFrame as string
format "%\t\t"cbTimestamp to:outFile
camx = at time i $.transform.pos.x
camy = at time i $.transform.pos.y*-1
camz = at time i $.transform.pos.z
format "%,%,%\t" camx camy camz to:outFile
camExportDummy.rotation = at time i $.transform.rotation
camExportDummy.transform *= (rotateXmatrix 90)
camExportDummy.transform *= (rotateZmatrix -90)
camQX = camExportDummy.rotation.x
camQY = camExportDummy.rotation.y
camQZ = camExportDummy.rotation.z
camQW = camExportDummy.rotation.w
format "%,%,%,%\t" -camQX camQY -camQZ camQW to:outFile
camFOV = at time i $.fov
format "%\t" camFOV to:outFile
camFocus = at time i $.mpassEffect.focalDepth
format "%" camFocus to:outFile
if i < end - 1 do
format "\n" to:outFile
i += 1
)
delete camExportDummy
close outFile
undo on
enableSceneRedraw