I think this is a tough question, as I have tested different ways with no result :
I'd like to get the name of the camera node that is used at render time, in a batch render process (no UI-based functions available), in a render layer that has more than one renderable viewport.
The script is called by a pre-frame-render event.
> doesnt update its result when changing camera.
string $currentPanel = getPanel ("-withFocus");
string $camera = modelPanel ("-q", "-camera", $currentPanel);
> No UI, no panel, no modelPanel
(borrowed procedure from the base script renderWindowPanel.mel)
$camera = getCurrentCamera();
> doesn't return a valid name (0)
string $camera = lookThru ("-q");
> No viewport, no way
Listing the global variables with env()
> No camera-related global variable
(boorowed procedure from the base script FurPluginCreateUI.mel)
$camera = HfGetRenderCamera();
> Returns the first renderable camera
... I don't remember the other tests I made.
Does anyone see a solution ?