PDA

View Full Version : Renderable Camera Script Problem


rBrady
04-10-2008, 04:13 PM
I am working on a tool that will allow you to set a renderable frame range for any camera in a scene. So far I have a UI that adds a script to a camera along with 10 in and out points that are stored as attributes on the camera. It works fine when I scrub the time line. The camera becomes active and inactive at the correct times. But when I render I get the following error.


Warning: (Mayatomr.Scene) : no render camera found, final scene will be incomplete and can't be rendered
Error: No object matches name: .i0
Error: An execution error occured in the expression render_cameraShape1.


This is the expression that gets written to the camera.

int $step = 0;
int $in = 0;
int $out = 0;
setAttr cameraShape1.renderable 0;

while ( $step < 10 )
{
$in = `getAttr cameraShape1(".i" + $step)`;
$out = `getAttr cameraShape1(".o" + $step)`;
if ( frame > $in && frame < $out)
{
setAttr cameraShape1.renderable 1;
}
$step = $step + 1;



Any help would be appreciated.

kojala
04-11-2008, 04:43 AM
hi .. I havent tested that but two lines popped to my eye..
here they are with fixed syntax:

$in = `getAttr ("cameraShape1.i" + $step)`;
$out = `getAttr ("cameraShape1.o" + $step)`;

that should fix this error:
Error: No object matches name: .i0

rBrady
04-11-2008, 03:39 PM
I added 10 attributes to the camera to store in points and 10 more for out points. Those lines of the script work perfectly when I am scrubing through maya. It only fails when I run a batch.

greatPumpkin
04-11-2008, 03:45 PM
So you're trying to launch a batch render that will render different ranges in one job? I suspect the renderer won't let you do it- you'd likely need a separate job for each range even with the expression.

Even with separate jobs you also might need to make sure you save the scene on a frame where the camera is renderable as I suspect the renderer is not going to expect that the renderable attribute will be animated and will just get it at at whatever frame the scene file is saved out at

rBrady
04-11-2008, 04:36 PM
I see what your saying greatPumpkin and I understand that it might not work. But I did a test a few months ago and got it working. I am kicking myself for not saving my code. I was able to switch the renderable attribute between 3 different cameras. And as long as there was no overlap or gaps I was able to render one continuous sequence without it separating the files by camera. I did have a glitch with a render layer if I remember correctly. I was hoping that I am missing something simple.

Thanks for taking a look at my code everyone, I really appreciate it.

CGTalk Moderation
04-11-2008, 04:36 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.