Skip to main content
Known Participant
March 4, 2023
Question

Get updated camera info

  • March 4, 2023
  • 1 reply
  • 601 views

Hi,
I have set the flags PF_OutFlag2_SUPPORTS_THREADED_RENDERING, PF_OutFlag2_I_USE_3D_CAMERA, and PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS in global setup.
When the camera position is updated, I retrieve the updated camera info and send it to another app using a WebSocket. As soon as I receive updated info from the other app based on the camera update, I want to call render again to update the info on my UI.
However, this procedure is very slow because the render function is called for every frame, and it tries to gather camera info for every frame, even though the camera info is the same. Is there any other command or trigger that gets hit when the camera info is updated that I can use to optimize my plugin? 
Thankyou

This topic has been closed for replies.

1 reply

Community Expert
March 5, 2023

where exactly is the slowdown? is it the AE calls for pre-render, the fetching of the camera info, or the round trip of your API?

Veena2411Author
Known Participant
March 5, 2023
Both the AE calls for pre-render and the fetching of the camera info are
causing some slowdown.
I've set the PF_OutFlag_WIDE_TIME_INPUT as I want the render to be called
multiple times in some other case, but while sending camera info, I want
the render to be called only once.
Can I change the outflag somewhere in between.

Also, I would like to know if there is a way to know when the camera is
updated and what part of the camera is updated.
Community Expert
March 5, 2023

i doubt the pre-render calls cause a slowdown. many plugins get pre-render calls for any change in the comp and it doesn't seem to slow anything down.

by "fetching camera info"  do you mean getting it from AE< to sending it to the websocket (and possibly waiting for a reply)?

as for telling what changed in the camera, there's no aPI for that. you can cache the camera info you had on the previous pre-render call for the same time sample and compare. you can also cache just the camera matrix, which encapsulates all the camera transformation info, and then decide whether or not you should get the full data.