PDA

View Full Version : How to get the render camera in a 'pre frame render' script ?


phlam
01-17-2008, 05:21 PM
Hi there,
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.

Test1:
renderSettings -firstImageName
> doesnt update its result when changing camera.

Test2:
string $currentPanel = getPanel ("-withFocus");
string $camera = modelPanel ("-q", "-camera", $currentPanel);
> No UI, no panel, no modelPanel

Test3:
(borrowed procedure from the base script renderWindowPanel.mel)
$camera = getCurrentCamera();
> doesn't return a valid name (0)

Test4:
string $camera = lookThru ("-q");
> No viewport, no way

Test5:
Listing the global variables with env()
> No camera-related global variable

Test6:
(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 ?
Cheers
Philippe

unsmoothed
01-17-2008, 05:50 PM
In the shape node of a camera, there is a .renderable attribute you can query. It's also found under the 'Output Settings' tab in the attribute editor which tells the camera if it's a renderable one or not... is that the kind of data you're looking for?

-un

phlam
01-17-2008, 06:09 PM
Nop, thank you, the trick is :

If there are more than one Renderable Camera used by the active renderlayer, I can filter these cameras from the scene, but I cannot get the info telling *which* camera is actually used by the renderer when the pre-frame-render script is called.

Maybe using the listConnections function I could find something, but I don't know where to dig.

CGTalk Moderation
01-17-2008, 06:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.