adriand
04-15-2008, 07:19 PM
I would like to be able to run a batch file that both caches the fluid containters (with a run-up padding) and renders (without the padding). This is what I'm doing, so if someonce can tell me what I'm doing wrong.
I'm a bit pressed for time (aren't we all), so please help if you can!
I have a batch file that runs this command:
"C:\Program Files\...\Maya.exe" -batch -proj "..\Proj" -file "scenes\file.ma" -script "ad_dynBatchCache.mel" -command "ad_dynBatchCache(40, 1);"
where the script called looks like this:
global proc ad_dynBatchCache(float $pad, int $reset)
{
string $sceneName = `file -q -sceneName`;
float $startFrame = `playbackOptions -q -min` - $pad;
float $endFrame = `playbackOptions -q -max`;
setAttr globalCacheControl.writeEnable true;
setAttr globalCacheControl.writeEnable false;
string $fluids[] = `ls -type fluidShape`;
for( $fluid in $fluids ){
print ("Setting Start Frame to: "+$startFrame+"\n");
setAttr ($fluid+".startFrame") $startFrame;
}
if( $reset ){
print "Deleting Cache on: "; print $fluids; print "\n";
select -r $fluid;
DeleteFluidCache;
print "Creating Cache on: "; print $fluids; print "\n";
select -r $fluids;
doFluidsDiskCache 2 { "mcfp", 3, 1, $startFrame, $endFrame, 2, 1, 1, 1, 1, 1, 1, 1, 0, "$sceneName", 1 } ;
}
}
The idea is to simply replace the "reset" flag in the batch file whenever I want to redo the cache, otherwise, leave it alone. When I run this, I get the print commants to work, but it just seems to skip over the delete/do commands.
When I run this in a GUI mode (normal), I notice the doFluids commands throws a prompt about the filesize of the cache. Is this screwing with my batch commands?
Much Thanks!
Adrian
I'm a bit pressed for time (aren't we all), so please help if you can!
I have a batch file that runs this command:
"C:\Program Files\...\Maya.exe" -batch -proj "..\Proj" -file "scenes\file.ma" -script "ad_dynBatchCache.mel" -command "ad_dynBatchCache(40, 1);"
where the script called looks like this:
global proc ad_dynBatchCache(float $pad, int $reset)
{
string $sceneName = `file -q -sceneName`;
float $startFrame = `playbackOptions -q -min` - $pad;
float $endFrame = `playbackOptions -q -max`;
setAttr globalCacheControl.writeEnable true;
setAttr globalCacheControl.writeEnable false;
string $fluids[] = `ls -type fluidShape`;
for( $fluid in $fluids ){
print ("Setting Start Frame to: "+$startFrame+"\n");
setAttr ($fluid+".startFrame") $startFrame;
}
if( $reset ){
print "Deleting Cache on: "; print $fluids; print "\n";
select -r $fluid;
DeleteFluidCache;
print "Creating Cache on: "; print $fluids; print "\n";
select -r $fluids;
doFluidsDiskCache 2 { "mcfp", 3, 1, $startFrame, $endFrame, 2, 1, 1, 1, 1, 1, 1, 1, 0, "$sceneName", 1 } ;
}
}
The idea is to simply replace the "reset" flag in the batch file whenever I want to redo the cache, otherwise, leave it alone. When I run this, I get the print commants to work, but it just seems to skip over the delete/do commands.
When I run this in a GUI mode (normal), I notice the doFluids commands throws a prompt about the filesize of the cache. Is this screwing with my batch commands?
Much Thanks!
Adrian
