I've been scouring the internet for days trying to find the answer to this. To be clear, I don't need the list of renderable cameras, I need the camera which is about to be rendered - and I need to find it in batch mode for a prerender script. Can anyone help me with this? I'd really appreciate it.
Cheers
What do you need to do?
I'm not seeing a way to get the camera pre-render. If there's multiple renderable cameras, the MtoA render command is looping over those and updating the in-memory Arnold scene representation, and that's not pre-render.
There is the Post Translation callback (Render Settings > System tab > Render Settings > Callbacks)
In that callback, you could get the camera using the Arnold API in Python.
I need to get the focal length of the camera and pipe it through a node network which drives the line thickness of aiToon shaders. If there's a way to do this without a direct connection (like the way you get the distance with an attribute called "R") i am all for it.
For pipeline reasons, After the render the node network needs to disconnect from the camera.
You mention using the Arnold api to get the camera. Could you give me one or two more guiding hints? I should mention that while I'm decent with python I'm retarded when it comes to Arnold and doubly so when it comes to rendering.
Hmm, the thing is you won't get the focal length from the Arnold scene. The camera will have an fov value calculated from the focal length and other parameters in the Maya scene.
The python would be something like this
from arnold import * o = AiNodeLookUpByName('options') cam = AiNodeGetPtr( o, "camera" ) print AiNodeGetStr( cam, "name" )
https://arnoldsupport.com/2015/03/04/arnold-getting-started-with-the-arnold-python-api/
Thank you. I will give this a try when I get back to work on Monday. Where did you learn the Arnold python api?