w i l l wrote:Nice one, thanks. That worked.
Can it be done so that the user selects a folder of images with various file names (but all the same size though) and it auto pulls those onto the book cover, then renders each image?
Yes it can, and now it gets really complicated

By the way, let me know if I made the explanation too complex.
2 Things to keep in mind!
1)
Maxwell script can do this in numerous ways. One way is to render each scene fully the other way is interactive, and that is really neat!
The interactive way will react to when the client changes images on the fly and will rewrite a new mxi (you can keep the old one or overwrite it)
If you want to have a good start with the interactive mode, you can use the progressive script as a starting point.
I made one script as a proof of concept based on that script and it works, big code shown below. This concept can do animation as well.
2)
To enable the "select a folder of images with various file names" you would possibly need to use an external application with maxwell script command:
Code: Select allint launchProcessAndWait (string execPath, array arguments);
Like command/batch file is one solution: (where sceneImage.bmp would be the image Maxwell uses that you need to replace.)
Code: Select allcmd /c del c:\folderWithImages\sceneImage.bmp
cmd /c ren c:\folderWithImages\clientImage1.bmp sceneImage.bmp
followed by:
cmd /c del c:\folderWithImages\sceneImage.bmp
cmd /c ren c:\folderWithImages\clientImage2.bmp sceneImage.bmp
etc..
Or forget all of the above and you could control it all from an external application... but then it has to be a custom written application

Just like my MXM Updater is for updating material previews
http://www.maxwellrender.com/forum/view ... 97&t=35515
Now to show you how I did that interactive script, I will share my Maxwell script code as I explained above as proof of concept. The one based on progressive_animation.ms. The quick and dirty solution I did was to make Maxwell react to changes in number of files in inputFolder (c:\mxm\m). I know that's not the most elegant way but as proof of concept it works. There are other ways but hey, short on time here

Code: Select all// 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:\mxm\m\";
var outputFolder = "C:\mxm\m";
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 = 1;
var finalSL = 12;
var slStep = 1;
var currentSL = initialSL;
var initialNum = FileManager.getNumberOfFilesInFolder(inputFolder,"*.*");
var currentNum = FileManager.getNumberOfFilesInFolder(inputFolder,"*.*");
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
// Scene.setResX( 400 );
// Scene.setResY( 400 );
currentNum = FileManager.getNumberOfFilesInFolder(inputFolder,"*.*");
Maxwell.print("***************************************************:initial vs current: " + initialNum + currentNum);
if(currentSL == initialSL)
{
Scene.setResumeRenderEnabled( false );
}
else
{
if(initialNum == currentNum){
Maxwell.print("***************************************************:initial == current: " + initialNum + currentNum);
Scene.setResumeRenderEnabled( true );
}
else{
Maxwell.print("***************************************************:initial != current: " + initialNum + currentNum);
Scene.setResumeRenderEnabled( false );
initialNum = currentNum;
}
}
isRendering = 1;
Maxwell.startRender();
}
//////////////////////////////////////////////////////////////////
function renderHasFinished()
{
isRendering = 0;
Maxwell.print( "***************************************************Render finished!!" );
}
//////////////////////////////////////////////////////////////////