XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

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

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.

renderSettings -firstImageName
> 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 ?

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?


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.