- Fri Nov 20, 2015 12:46 pm
#389442
hi,
I have a mxs file with several cameras (as a result of an export from a sketchup file with several scenes) and I have this script:
thx for your support
I have a mxs file with several cameras (as a result of an export from a sketchup file with several scenes) and I have this script:
Code: Select all
How should the script be modified, so that I have to specify a mxs-file and the script will render all the cameras within the mxs-file (instead of rendering the active camera of various mxs within a folder?// This script gets all the mxs's located in the folder "input"
// Renders them until a desired Initial SL, to get a first version of the whole sequence, allowing the user to start the postproduction process
// Then continues refining the sequence until the Final SL, advancing in certain steps (slStep), offering continuous refinement
// Edit the following lines with your own project Input and Output folders
var inputFolder = "C:\directory";
var outputFolder = "C:\directory\output";
var mxsCount = FileManager.getNumberOfFilesInFolder( inputFolder, "*.mxs" );
var mxsList = FileManager.getFilesInFolder( inputFolder, "*.mxs" );
RenderEvents["renderFinished()"].connect(renderHasFinished);
// The following SL values can be customized to fit your needs
var initialSL = 8;
var finalSL = 16;
var slStep = 2;
var currentSL = initialSL;
var i = 0;
var isRendering = 0;
while( currentSL <= finalSL )
{
for( i = 0; i < mxsCount; i++ )
{
renderScene();
while( 1 )
{
if( isRendering == 0 )
{
break;
}
}
}
currentSL += slStep;
}
//////////////////////////////////////////////////////////////////
function renderScene()
{
var mxsFile = mxsList[i];
var imagePath = outputFolder + "\" + FileManager.getFileName( mxsFile ) + ".png";
var mxiPath = outputFolder + "\" + FileManager.getFileName( mxsFile ) + ".mxi";
Maxwell.print( "rendering Mxs file: " + mxsFile );
Maxwell.openMxs( mxsFile );
Scene.setImagePath( imagePath );
Scene.setMxiPath( mxiPath );
Scene.setSamplingLevel( currentSL );
// Uncomment the following lines if you want to set a different resolution than the indicated in the MXS scene file
Mxi.setResX( 1200 );
Mxi.setResY( 588 );
Scene.setResumeRenderEnabled( true );
isRendering = 1;
Maxwell.startRender();
}
//////////////////////////////////////////////////////////////////
function renderHasFinished()
{
isRendering = 0;
Maxwell.print( "Render finished!!" );
}
//////////////////////////////////////////////////////////////////
thx for your support