PDA

View Full Version : render camera from render globals?


kletterget
08-30-2005, 12:49 PM
Hi there,
I thought this would be a cinch to get, but I just can't seem to find an attribute or an environment variable or anything which describes the current render camera, as shown in the render globals window. It seems so simple that I feel rather silly.

this:
print (`listAttr defaultRenderGlobals`);
returns a whole lotta stuff, but nothing which remotely has anything to do with a camera.

Help much appreciated

/c.

thematt
08-30-2005, 03:22 PM
you actually have to query the renderable attr of your camera..



try that (quick hack)



{

string $cam[] =`ls -type "camera"`;

for ($i in $cam)

{

float $renderable = `getAttr ($i+".renderable")`;

if ($renderable ==1)

{

print $i;

}

}

}

harmless
08-30-2005, 03:32 PM
and if you need to get at other things in the render globals, they are all contained in these nodes:

defaultRenderQuality

defaultResolution // print (`listAttr defaultResolution `);

defaultRenderGlobals


"defaultResolution" contains things like pixel aspect, width, and height. If you can't find what you are looking for, save a preset in the render Globals and look in your maya/presets folder for the files renderGlobalsPreset_myPrestName.mel etc.

kletterget
08-30-2005, 04:20 PM
you actually have to query the renderable attr of your camera..
string $cam[] =`ls -type "camera"`;
for ($i in $cam){
float $renderable = `getAttr ($i+".renderable")`;
if ($renderable ==1){
print $i;
}
}


Hmm... the problem with that is that you can have more than one renderable camera. What I want to know is where the information is stored for the chosen camera as it is shown in the render globals window. It surely has to be somewhere!:argh:

/c.

kletterget
08-31-2005, 08:17 AM
Ok, I think I've worked out what is going on here. For those of you who are curious...

Every time you open the RenderGlobals Window, it does a search for all cameras and puts them all in the Camera list. The first renderable camera it comes across is the one which it puts as the chosen render camera. It's as simple as that. If you choose another camera, a procedure is called which makes the new camera renderable and turns all the other ones off.

In theory it ensures that there can only be one renderable camera at a time. But there seems to be a little problem when one manually makes more than one camera renderable. The procedure specifically works only if there is one renderable camera in the scene, which I think is a little weird.

C:\Program Files\Alias\Maya6.5\scripts\others\createMayaSoftwareCommonGlobalsTab.mel (line 1044 contains the offending if statement)

So there you have it. I feel rather pleased with myself that I worked all that out actually, not that it amounts to much. It involved quite a bit of hunting around.

/c.

thematt
08-31-2005, 08:25 AM
oops yes sorry ..could have tell you..my bad

CGTalk Moderation
08-31-2005, 08:25 AM
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.