Last active
May 13, 2018 10:50
-
-
Save Arty2/d013cf8ac1af77592a0cedff3fe94b17 to your computer and use it in GitHub Desktop.
Script for Maxwell Render: render all the MXS files located in the folder 'inputFolder', including its children
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script for Maxwell Render: render all the MXS files located in the folder 'inputFolder', including its children | |
var inputFolder = 'C:/_queue'; | |
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(i,mxsCount); | |
while( 1 ) { | |
if( isRendering == 0 ) { | |
break; | |
} | |
} | |
} | |
////////////////////////////////////////////////////////////////// | |
function renderScene(i,count) { | |
var mxsFile = mxsList[i]; | |
var subDir = outputFolder + '/' + FileManager.getFileName( mxsFile ); | |
var makesubDir = FileManager.createAbsoluteFolder(subDir); | |
var imagePath = subDir + '/' + FileManager.getFileName( mxsFile ) + '.png'; | |
var MxiPath = subDir + '/' + FileManager.getFileName( mxsFile ) + '.mxi'; | |
Maxwell.print( '############################################' ); | |
Maxwell.print( 'Rendering ' + ( i + 1 ) + ' of ' + count + ': ' + mxsFile ); | |
Maxwell.openMxs( mxsFile ); | |
//Scene.setResumeRenderEnabled( true ); | |
Scene.setMxiPath( MxiPath ); | |
Scene.setImagePath( imagePath ); | |
Scene.setSamplingLevel( 13 ); | |
// Mxi.setResX( 256 ); | |
// Mxi.setResY( 256 ); | |
isRendering = 1; | |
Maxwell.startRender(); | |
} | |
////////////////////////////////////////////////////////////////// | |
function renderHasFinished() { | |
isRendering = 0; | |
Maxwell.print( '############################################' ); | |
Maxwell.print( 'Batch render finished!' ); | |
} | |
///////////////////////////////////////////////////////////////// | |
//Function: string getEnv( string var ); | |
//Description: Returns a string with the value of the given system environment variable. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment