View Full Version : MEL: geting access to the render-camera
playmesumch00ns 02-28-2003, 02:43 PM Hi, how can I get the name/DAG-path to the camera currently selected for rendering with MEL? Even better, how can I get it from the API?
thanks
|
|
lostpencil
02-28-2003, 02:59 PM
Not sure about the API, but:
lookThru -q;
Will return the camera name that the current view is using.
alexx
02-28-2003, 03:10 PM
no idea in the API..
but mel:
//check for the camera that will be used for rendering.
$camSelection = `listCameras`;
//check all the cameras for the render flag
$i=0;
while (!(`getAttr ($camSelection[$i]+".rnd")`))
{
$i++;
}
print ("\n// Camera that is used for rendering: ");
print($camSelection[$i]);
print("\n");
cheers
alexx
lostpencil
02-28-2003, 03:14 PM
D'oh. Good call Alexx. I missed that little important tidbit which said 'rendering camera' :surprised
playmesumch00ns
02-28-2003, 08:58 PM
Thanks alexx!:thumbsup:
Jozvex
03-01-2003, 12:11 AM
*hijacks thread*
Along similar lines (but easier), how can I get the name of the curent camera's shape node?
Because I want to end up with something like:
$currentCam = perspShape1.bgcolor
Thanks!
lostpencil
03-01-2003, 02:03 AM
Here is one way:
// get the camera of the current window
string $cur_camera = `lookThru -q`;
float $color[] = `getAttr $cur_camera.col`;
//display the camera's color values
print ("Background Color (R G B): ");
for ($i=0; $i<3; $i++)
print ($color[$i] + " ");
print ("\n");
// make the background of camera red
$attrib = $cur_camera + ".colr";
setAttr $attrib 255;
If you want to set the green and blue, just use colg and colb for the attribute names.
CGTalk Moderation
01-14-2006, 12:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.