Render queue example

This script gets all the MXS files located in the folder “input” and its children. Opens them, changes their SL and resolution and launches each render.
The output of all the images is stored in the folder “output”.

The script also shows how to handle render events.

Example
// This script gets all the MXS files located in the folder "input" and its children
// Opens them, changes their SL and resolution and launches each render
// The output of all the images is stored in the folder "output"
// The script also shows how to handle render events

var inputFolder = "C:\input";
var outputFolder = "C:\output";
var engineVersion = Maxwell.getEngineVersion();
var mxsCount = FileManager.getNumberOfFilesInBranch( inputFolder, "*.mxs" );
var mxsList = FileManager.getFilesInBranch( inputFolder, "*.mxs" );
// Connect event
RenderEvents["renderFinished()"].connect(renderHasFinished);
var i = 0;
var isRendering = 0;
for( i = 0; i < mxsCount; i++ )
{
   renderScene();
   while( 1 )
   {
      if( isRendering == 0 )
      {
         break;
      }
   }
}

//////////////////////////////////////////////////////////////////
function renderScene()


{
   var mxsFile = mxsList[i];
   var imagePath = outputFolder + "\" + FileManager.getFileName( mxsFile ) + ".png";
   Maxwell.print( "rendering Mxs file: " + mxsFile );
   Maxwell.openMxs( mxsFile );
   Scene.setImagePath( imagePath );
   Scene.setSamplingLevel( 3 );
   Mxi.setResX( 256 );
   Mxi.setResY( 256 );
   isRendering = 1;
   Maxwell.startRender();
}

//////////////////////////////////////////////////////////////////
function renderHasFinished()
{
   isRendering = 0;
   Maxwell.print( "Render finished!!" );
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////