Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

MEL script rendering wrong camera

MEL script rendering wrong camera

J-Fry
Enthusiast Enthusiast
59 Views
0 Replies
Message 1 of 1

MEL script rendering wrong camera

J-Fry
Enthusiast
Enthusiast

Hi,

I have a bunch of scenes to render but they are all pretty short (40-200 frames). I am trying to set up a post render MEL script that opens the next scene file and kicks off that render. So I don't have to be there to start the next scene render when one finishes.

 

I am able to get it to open up the next scene and start the render, but I cannot get it to use the correct camera (renderCam). It just renders with the persp camera every time. I tried to force it to use "renderCam" in the MEL script, but it still renders using the persp camera.

 

Can somebody explain how to get it to render the camera in the render settings instead of the persp camera?

 

Here is the current (broken) script:

global proc forceRenderSequenceCamera2(string $targetCamShape) {
    string $nextScene = "D:/maya/projects/myProject/scenes/myScene2.ma";
    // Open the next scene
    file -f -open $nextScene;

    pause -sec 2;  // Give Maya time to settle

// Wait until the camera exists and is renderable
while (!`objExists "renderCamShape"` || !`getAttr "renderCamShape.renderable"`) {
    pause -sec 1;
}
    
    // Get all cameras in the scene
    string $allCameras[] = `ls -type "camera"`;

    // Disable renderable on all cameras
    for ($cam in $allCameras) {
        if (`objExists $cam`) {
            setAttr ($cam + ".renderable") 0;
        }
    }

    // Enable renderable on the target camera
    setAttr ($targetCamShape + ".renderable") 1;

    // Force the active panel to look through it
    string $panel = `getPanel -withFocus`;
    lookThru $targetCamShape;

    // Run RenderSequence
    RenderSequence;
}

 

0 Likes
60 Views
0 Replies
Replies (0)