| 1 |
< |
# SCCSid "$SunId$ LBL" |
| 1 |
> |
# RCSid: $Id$ |
| 2 |
|
# |
| 3 |
|
# Choose the Rad Input File to work on. |
| 4 |
|
# |
| 5 |
|
|
| 6 |
– |
set rif_glob *.rif |
| 7 |
– |
|
| 6 |
|
proc preen {} { # clean up radvar |
| 7 |
|
global radvar rifname |
| 8 |
< |
foreach n {objects scene materials illum mkillum render oconv pfilt |
| 9 |
< |
AMBFILE OPTFILE EXPOSURE ZONE REPORT} { |
| 8 |
> |
foreach n {objects scene materials illum mkillum mkpmap render oconv rvu rpict pfilt |
| 9 |
> |
RAWFILE ZFILE AMBFILE PGMAP PCMAP OPTFILE EXPOSURE ZONE REPORT} { |
| 10 |
|
if {! [info exists radvar($n)]} { |
| 11 |
|
set radvar($n) {} |
| 12 |
|
} |
| 43 |
|
if {! [info exists radvar(RESOLUTION)]} { |
| 44 |
|
set radvar(RESOLUTION) 512 |
| 45 |
|
} |
| 46 |
+ |
if {! [info exists radvar(EYESEP)]} { |
| 47 |
+ |
set radvar(EYESEP) 1 |
| 48 |
+ |
} |
| 49 |
|
if [info exists radvar(QUALITY)] { |
| 50 |
|
cardval radvar(QUALITY) {High Medium Low} |
| 51 |
|
} else { |
| 76 |
|
|
| 77 |
|
proc setradvar stmt { # assign a rad variable |
| 78 |
|
global radvar |
| 79 |
< |
regexp {^([a-zA-Z][a-zA-Z0-9]*) *= *(.*)$} $stmt dummy vnam vval |
| 79 |
> |
regexp {^([a-zA-Z][a-zA-Z0-9]*) *=[ ]*(.*)$} $stmt dummy vnam vval |
| 80 |
|
switch -glob $vnam { |
| 81 |
|
obj* { eval lappend radvar(objects) $vval } |
| 82 |
|
sce* { eval lappend radvar(scene) $vval } |
| 83 |
|
mat* { eval lappend radvar(materials) $vval } |
| 84 |
|
ill* { eval lappend radvar(illum) $vval } |
| 85 |
|
mki* { eval lappend radvar(mkillum) $vval } |
| 86 |
+ |
mkp* { eval lappend radvar(mkpmap) $vval } |
| 87 |
|
ren* { eval lappend radvar(render) $vval } |
| 88 |
|
oco* { eval lappend radvar(oconv) $vval } |
| 89 |
+ |
rvu { eval lappend radvar(rvu) $vval } |
| 90 |
+ |
rpi* { eval lappend radvar(rpict) $vval } |
| 91 |
|
pf* { eval lappend radvar(pfilt) $vval } |
| 92 |
|
vi* { lappend radvar(view) $vval } |
| 93 |
|
ZO* { set radvar(ZONE) $vval } |
| 97 |
|
AMB* { set radvar(AMBFILE) $vval } |
| 98 |
|
OPT* { set radvar(OPTFILE) $vval } |
| 99 |
|
EXP* { set radvar(EXPOSURE) $vval } |
| 100 |
+ |
EYE* { set radvar(EYESEP) $vval } |
| 101 |
|
RES* { set radvar(RESOLUTION) $vval } |
| 102 |
|
UP { set radvar(UP) $vval } |
| 103 |
|
IND* { set radvar(INDIRECT) $vval } |
| 107 |
|
REP* { set radvar(REPORT) $vval } |
| 108 |
|
RAW* { set radvar(RAWFILE) $vval } |
| 109 |
|
ZF* {set radvar(ZFILE) $vval } |
| 110 |
+ |
PGM* {set radvar(PGMAP) $vval } |
| 111 |
+ |
PCM* {set radvar(PCMAP) $vval } |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
} |
| 128 |
|
} |
| 129 |
|
if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE |
| 130 |
|
EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS |
| 131 |
< |
RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} { |
| 131 |
> |
EYESEP RAWFILE ZFILE VARIABILITY REPORT |
| 132 |
> |
PGMAP PCMAP} $vn] >= 0} { |
| 133 |
|
puts $fi "$vn= $radvar($vn)" |
| 134 |
|
return |
| 135 |
|
} |
| 151 |
|
proc load_vars {f {vl all}} { # load RIF variables |
| 152 |
|
global curmess radvar alldone |
| 153 |
|
if {"$f" == ""} {return 0} |
| 154 |
< |
if {! [file exists $f]} { |
| 154 |
> |
if {! [file isfile $f]} { |
| 155 |
|
beep |
| 156 |
|
set curmess "$f: no such file." |
| 157 |
|
return 0 |
| 159 |
|
if {"$vl" == "all" && ! [chksave]} {return 0} |
| 160 |
|
set curmess {Please wait...} |
| 161 |
|
update |
| 162 |
< |
if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] { |
| 163 |
< |
set curmess [exec cat /usr/tmp/ro[pid]] |
| 164 |
< |
exec rm -f /usr/tmp/ro[pid] |
| 162 |
> |
if [catch {exec rad -n -w -e $f >& /tmp/ro[pid]}] { |
| 163 |
> |
set curmess [exec cat /tmp/ro[pid]] |
| 164 |
> |
exec rm -f /tmp/ro[pid] |
| 165 |
|
return 0 |
| 166 |
|
} |
| 167 |
< |
set fi [open /usr/tmp/ro[pid] r] |
| 167 |
> |
set fi [open /tmp/ro[pid] r] |
| 168 |
|
if {"$vl" == "all"} { |
| 169 |
|
catch {unset radvar} |
| 170 |
|
while {[gets $fi curli] != -1} { |
| 171 |
< |
if [regexp {^[a-zA-Z][a-zA-Z0-9]*= } $curli] { |
| 171 |
> |
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
| 172 |
|
setradvar $curli |
| 173 |
|
} else { |
| 174 |
|
break |
| 177 |
|
set curmess {Project loaded.} |
| 178 |
|
} else { |
| 179 |
|
foreach n $vl { |
| 180 |
< |
catch {unset radvar($n)} |
| 180 |
> |
if [regexp {[a-z][a-z]*} $n] { |
| 181 |
> |
set radvar($n) {} |
| 182 |
> |
} else { |
| 183 |
> |
catch {unset radvar($n)} |
| 184 |
> |
} |
| 185 |
|
} |
| 186 |
|
while {[gets $fi curli] != -1} { |
| 187 |
|
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
| 197 |
|
} |
| 198 |
|
set alldone [eof $fi] |
| 199 |
|
close $fi |
| 200 |
< |
exec rm -f /usr/tmp/ro[pid] |
| 200 |
> |
exec rm -f /tmp/ro[pid] |
| 201 |
|
preen |
| 202 |
|
return 1 |
| 203 |
|
} |
| 250 |
|
return 0 |
| 251 |
|
} |
| 252 |
|
} elseif {[file exists $f]} { |
| 253 |
+ |
set ftyp [file type $f] |
| 254 |
+ |
if { $ftyp != "file" } { |
| 255 |
+ |
beep |
| 256 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 257 |
+ |
return 0 |
| 258 |
+ |
} |
| 259 |
|
if [tk_dialog .dlg {Verification} \ |
| 260 |
|
"Overwrite existing file $f?" \ |
| 261 |
|
questhead 1 {Go Ahead} {Cancel}] { |
| 262 |
|
return 0 |
| 263 |
|
} |
| 264 |
|
} |
| 265 |
< |
if {[file exists $f] && ! [file writable $f] && |
| 265 |
> |
if {[file isfile $f] && ! [file writable $f] && |
| 266 |
|
[catch {exec chmod u+w $f} curmess]} { |
| 267 |
|
beep |
| 268 |
|
return 0 |
| 279 |
|
proc newnew f { # create a new RIF |
| 280 |
|
global rifname readonly curmess radvar |
| 281 |
|
if [file exists $f] { |
| 282 |
+ |
set ftyp [file type $f] |
| 283 |
+ |
if { $ftyp != "file" } { |
| 284 |
+ |
beep |
| 285 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 286 |
+ |
return 0 |
| 287 |
+ |
} |
| 288 |
|
if [tk_dialog .dlg {Verification} \ |
| 289 |
|
"File $f exists -- disregard it?" \ |
| 290 |
|
questhead 1 {Yes} {Cancel}] { |
| 302 |
|
} |
| 303 |
|
|
| 304 |
|
proc do_file w { |
| 305 |
< |
global rifname readonly rif_glob curfile curpat |
| 305 |
> |
global rifname readonly myglob curfile curpat |
| 306 |
|
if {"$w" == "done"} { |
| 307 |
|
cd [file dirname $rifname] |
| 308 |
< |
set rif_glob $curpat |
| 308 |
> |
set myglob(rif) $curpat |
| 309 |
|
return |
| 310 |
|
} |
| 311 |
|
frame $w |
| 326 |
|
helplink $w.left.new trad file new |
| 327 |
|
helplink $w.left.ro trad file readonly |
| 328 |
|
getfile -view view_txt -perm \ |
| 329 |
< |
-win $w.right -glob [file dirname $rifname]/$rif_glob |
| 329 |
> |
-win $w.right -glob [file dirname $rifname]/$myglob(rif) |
| 330 |
|
set curfile [file tail $rifname] |
| 331 |
|
} |