#!/bin/sh
#
# 	%W% %E%
#
# script for generating a batch job to render animation files
#
# - calls gig_sa with the necessary intercol file names to generate
#   a batch job and enters the intercol command to start up the batch
#   job via a pipe
# - the first three arguments are taken to be arguments to intercol
#   command 'addanibatch';
# - all following arguments are taken to be intercol file names and are
#   passed on to gig_sa;

GIGSA="gig_sa"
GIGARG=""
intfiles="intjob giglist videoback giganimap giganibatch0"

set -- `getopt vr:i:o:idp: $*`
if [ $? != 0 -o $# -eq 1 ]
then
  echo usage: addjob -p project animationname startframenr endframenr 
  echo
  exit
fi
for i in $*
do
  case $i in
  -d)       GIGARG="$GIGARG -d"; shift;;
  -v | -V)  GIGARG="$GIGARG -r verbose"; shift;;
  -r)       GIGARG="$GIGARG -r $2"; shift 2;;
  -o)       GIGARG="$GIGARG -o $2"; shift 2;;
  -p)       GIGARG="$GIGARG -p $2"; project=$2; shift 2;;
  -i)       intfiles="$intfiles $2"; shift 2;;
  --)       shift; break;;
  esac
done

if [ $# -lt 3 ]
then
  echo usage: addjob -p project animationname startframenr endframenr 
  echo
  exit
fi

aniname=$1
anifrm0=$2
anifrmN=$3

shift
shift
shift

while [ $# != 0 ] 
do
  if test -r $1.int
  then
    intfiles=${intfiles}" "$1
    shift
  fi
done

echo okie

