- Fri May 31, 2013 5:01 pm
#368248
I know this may be a stretch, but I have a singular MXS file with multiple cameras (each represent a single frame from a scene in SketchUp). What I would like to do is to strip out a single MXS for each frame/camera, so I can then batch render out all frames.
Right now, the script I have to render all the cameras is this (care of JD and others). The problem is that this can only be used on a single render node, and I can't resume rendering to a higher SL (it just starts over again), so progressive rendering is off the table.
Obviously I know nothing about scripting, so any help would be appreciated.
Right now, the script I have to render all the cameras is this (care of JD and others). The problem is that this can only be used on a single render node, and I can't resume rendering to a higher SL (it just starts over again), so progressive rendering is off the table.
Obviously I know nothing about scripting, so any help would be appreciated.
Code: Select all
// This script loops through a set of cameras, specified by name and
// index. It must be customized to fit the characteristics of the given
// MXS file. As set up, it expects to find the MXS filled with cameras
// whose names begin with 'Scene '. This base name is stored below
// in the 'baseName' variable. It expects the scene numbers to begin
// at 1 and to end at 3, with these limits being stored below in the
// 'firstFrame' and 'lastFrame' variables. It will loop through the frame
// range looking for cameras which fit the pattern 'Scene 1', rendering
// each one as it is found.
var firstFrame = 1;
var lastFrame = 24;
var baseName = "f";
// internal vars & events
var isRendering = 0;
var currentFrame = firstFrame;
var outputFolder = FileManager.getFileFolder(Scene.mxsPath);
RenderEvents["renderFinished()"].connect(renderHasFinished);
// render loop
while (currentFrame <= lastFrame)
{
renderCamera(currentFrame);
while(1)
{
if(isRendering == 0)
{
break;
}
}
currentFrame++;
}
// functions
function renderCamera(frameNumber)
{
var sceneName = baseName + frameNumber;
Mxi.setActiveCamera(sceneName);
if (Mxi.activeCameraName != sceneName)
{
Maxwell.print("The MXS contains no camera named '" + sceneName + "'!");
}
else
{
Maxwell.print("rendering Scene: " + sceneName);
Scene.setMxiPath(outputFolder + "\" + sceneName + ".mxi");
Scene.setImagePath(outputFolder + "\" + sceneName + ".png");
isRendering = 1;
Maxwell.startRender();
}
}
function renderHasFinished()
{
isRendering = 0;
Maxwell.print("Render finished!!");
}