PDA

View Full Version : help with fluid cache batch commands


adriand
04-15-2008, 08: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

ranxx
04-18-2008, 07:21 PM
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


yes, it is screwing with your batch command. I ran into this same problem and realized that the batch command was waiting for a prompt which it was never going to get. I found the doFluids.mel code, and edited it to make my own version with the parts where it prompts you commented out (renamed it to something else of course). This worked. If someone knows of a better way I'd love to know it.

-ranxx

adriand
04-19-2008, 01:34 AM
could you provide the script you made? it would help me out a lot so i wouldn't have to dig around internal code I don't really understand.

Thanks

EDIT:

Fishing around the scripts directory i found "dynRunupForBatchRender.mel"
global proc dynRunupForBatchRender()
{
string $renderGlobal = "defaultRenderGlobals";
if( `getAttr ($renderGlobal + ".animation")` )
{
// animation. runup to start frame
runup -mxf `getAttr ($renderGlobal + ".startFrame")` -fromStartFrame -cache;
}
else
{
// single frame batch render. runup to current frame
runup -mxf `currentTime -q` -fromStartFrame -cache;
}
}

looking at the "runup" command, the docs say that it can cache all the dynamics up to a specified frame. Is there a way to save this cache file? That would be great!

I will try and see if this, along with a "file -save" or other command/s would do the trick...

Adrian

ranxx
04-19-2008, 05:06 PM
I'm sorry I can't post it, but all you really have to do is comment out the parts where it goes into the prompt dialog.

-ranxx

could you provide the script you made? it would help me out a lot so i wouldn't have to dig around internal code I don't really understand.

Thanks

EDIT:

Fishing around the scripts directory i found "dynRunupForBatchRender.mel"
global proc dynRunupForBatchRender()
{
string $renderGlobal = "defaultRenderGlobals";
if( `getAttr ($renderGlobal + ".animation")` )
{
// animation. runup to start frame
runup -mxf `getAttr ($renderGlobal + ".startFrame")` -fromStartFrame -cache;
}
else
{
// single frame batch render. runup to current frame
runup -mxf `currentTime -q` -fromStartFrame -cache;
}
}

looking at the "runup" command, the docs say that it can cache all the dynamics up to a specified frame. Is there a way to save this cache file? That would be great!

I will try and see if this, along with a "file -save" or other command/s would do the trick...

Adrian

CGTalk Moderation
04-19-2008, 05:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.