Creating a batch file for rendering frame sets with xsibatch


Here’s a quick and dirty way to get a batch file that renders a scene in chunks (by “chunks” I mean something like “10 frames at a time”).

var start = 1;
var end = 76;
var step = 10;

var sCmdLine = "call \"%BATCH%\" -render \"%SCN%\"";

LogMessage( "set BATCH=" + Application.InstallationPath( siFactoryPath ) + "\\Application\\bin\\xsibatch.bat" );
LogMessage( "set SCN=" + Application.ActiveProject.ActiveScene.FileName.Value );
for ( var i=start; i<end; i=i+step )
{
	var x = i + step-1;
	x = (x > end) ? end : x;
	LogMessage( sCmdLine + " -frames " + i + "-" + x );
}

This will give you:

// INFO : set BATCH=C:\Program Files\Autodesk\Softimage 2012 SP1\Application\bin\xsibatch.bat
// INFO : set SCN=C:\Users\blairs\Documents\Support\My_Support\Scenes\PolygonReduction_CAV.scn
// INFO : call "%BATCH%" -render "%SCN%" -frames 1-10
// INFO : call "%BATCH%" -render "%SCN%" -frames 11-20
// INFO : call "%BATCH%" -render "%SCN%" -frames 21-30
// INFO : call "%BATCH%" -render "%SCN%" -frames 31-40
// INFO : call "%BATCH%" -render "%SCN%" -frames 41-50
// INFO : call "%BATCH%" -render "%SCN%" -frames 51-60
// INFO : call "%BATCH%" -render "%SCN%" -frames 61-70
// INFO : call "%BATCH%" -render "%SCN%" -frames 71-76

Now all you have to do is paste it into a text editor, do a search and replace to get rid of the “// INFO : ” (that’s the dirty part), and you’ve got a batch file that you can use to render your scene.

Python version:

from siutils import si		# Application
from siutils import siproj	# ActiveProject2
from siutils import siut	# XSIUtils
from siutils import C		# win32com.client.constants

start = 1
end = 76
step = 10

sCmdLine = 'call "%BATCH%" -render "%SCN%"'
print "set BATCH=" + siut.BuildPath( si.InstallationPath( C.siFactoryPath ), "Application", "bin", "xsibatch.bat" )
print "set SCN=" + si.ActiveProject.ActiveScene.FileName.Value
for i in range(start,end,step):
	x = i + step-1
	x = end if (x > end) else x
	print "%s %s %s %s %s" % (sCmdLine, " -frames ", i, "-",x )