#!/usr/local/bin/perl $|=1; #Unbuffer output. More NT crap. if ( $#ARGV != 5 ) { &Help(); exit; } $MiRoot = $ARGV[0]; shift @ARGV; $PicRoot = $ARGV[0]; shift @ARGV; $StartFrame = $ARGV[0]; shift @ARGV; $EndFrame = $ARGV[0]; shift @ARGV; $JumpFrame = $ARGV[0]; shift @ARGV; $Log = $ARGV[0]; shift @ARGV; if ( $Log eq '' ) { $Log = ''; } else { $Log = "2>> $Log"; } $Log = ''; $Ray = $ENV{'SI_MI_TRACER2'}; print "Ray $MiRoot $PicRoot $StartFrame $EndFrame $JumpFrame $Log\n"; for ( $Frame = $StartFrame; $Frame <= $EndFrame; $Frame += $JumpFrame ) { $MiFile = "$MiRoot.$Frame"; $PicFile = "$PicRoot.$Frame.pic"; $SemaFile = "$PicFile.sema"; $Skip = 0; if ( -f "$PicFile" ) { $Skip = 1; } mkdir( $SemaFile, 0444 ) or $Skip = 1; #print "Create = $!\n"; if ( $! =~ '--File exists' ) { print "Warning: Problem creating semaphore directory for Ray $!"; } else { if ( $Skip == 0 ) { printf( "rendering $Frame\n" ); `$Ray @ARGV $MiFile $Log`; if ( (-s $PicFile) == 128 ) { #128 bytes = header only = fucked frame. warn( "mental ray probably died befor completing $PicFile" ); `echo mr error > $PicFile.mr.err`; } sleep 5; unlink "$MiFile.mi" || warn( "Unable to remove Mi file $MiFile.mi" ); # So, why does rmdir fail to delete directories, even when it thinks # It's succeeded? rmdir( "$SemaFile" ) or warn( "Unable to remove Semaphore dir $SemaFile" ); #print "Delete = <$! $SemaFile>\n"; if ( -d "$SemaFile" ) { warn( "Semaphore dir never got removed. Ooo Err" ); } } } } sub Help { print "Useage Ray \n"; }