| 1 | greg | 2.1 | #!/bin/csh -f | 
| 2 | greg | 2.2 | # RCSid $Id$ | 
| 3 | greg | 2.1 | # | 
| 4 |  |  | # Combine alternate lines in full frames for field rendering | 
| 5 |  |  | # | 
| 6 |  |  | # Expects numbered frames on command line, as given by ranimate | 
| 7 |  |  | # | 
| 8 |  |  | # If an odd number of frames is provided, the spare frame at the | 
| 9 |  |  | # end is linked to $spare_name for the next run | 
| 10 |  |  | # | 
| 11 |  |  | # Written by Greg Ward for Iebele Atelier in August 2005 | 
| 12 |  |  | # | 
| 13 |  |  | set spare_name=spare_fieldcomb_frame.pic | 
| 14 |  |  | if ($#argv > 1) then | 
| 15 |  |  | if ("$argv[1]" == "-r") then | 
| 16 |  |  | set remove_orig | 
| 17 |  |  | shift argv | 
| 18 |  |  | endif | 
| 19 |  |  | endif | 
| 20 |  |  | if ($#argv < 2) then | 
| 21 |  |  | echo "Usage: $0 [-r] field1.pic field2.pic .." | 
| 22 |  |  | exit 1 | 
| 23 |  |  | endif | 
| 24 |  |  | set f1=$argv[1]:q | 
| 25 |  |  | set ext=$f1:e | 
| 26 |  |  | set basenm="`echo $f1:q | sed 's/[0-9]*\.'$ext'//'`" | 
| 27 |  |  | set curfi=`echo $f1:q | sed 's/^[^1-9]*\(.[0-9]*\)\.'$ext'$/\1/'` | 
| 28 |  |  | set fields=($argv[*]:q) | 
| 29 |  |  | if (-r $spare_name) then | 
| 30 |  |  | set fields=($spare_name $fields:q) | 
| 31 |  |  | @ curfi-- | 
| 32 |  |  | endif | 
| 33 |  |  | @ curfr = $curfi / 2 | 
| 34 |  |  | set curfi=1 | 
| 35 |  |  | while ($curfi < $#fields) | 
| 36 |  |  | @ nextfi = $curfi + 1 | 
| 37 | greg | 2.2 | pcomb -e 'ro=ri(fld); go=gi(fld); bo=bi(fld)' \ | 
| 38 |  |  | -e 'yd=yres-1-y; odd=.5*yd-floor(.5*yd)-.25' \ | 
| 39 |  |  | -e 'fld=if(odd,1,2)' \ | 
| 40 | greg | 2.1 | $fields[$curfi]:q $fields[$nextfi]:q \ | 
| 41 |  |  | > "${basenm}C$curfr.$ext" | 
| 42 |  |  | if ($?remove_orig) rm $fields[$curfi]:q $fields[$nextfi]:q | 
| 43 |  |  | @ curfr++ | 
| 44 |  |  | @ curfi = $nextfi + 1 | 
| 45 |  |  | end | 
| 46 |  |  | rm -f $spare_name | 
| 47 |  |  | if ($curfi == $#fields) ln "${basenm}$curfi.$ext" $spare_name |