| 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} { |
| 9 |
> |
RAWFILE ZFILE AMBFILE OPTFILE EXPOSURE ZONE REPORT} { |
| 10 |
|
if {! [info exists radvar($n)]} { |
| 11 |
|
set radvar($n) {} |
| 12 |
|
} |
| 64 |
|
} else { |
| 65 |
|
set radvar(PENUMBRAS) False |
| 66 |
|
} |
| 69 |
– |
if [info exists radvar(RAWSAVE)] { |
| 70 |
– |
cardval radvar(RAWSAVE) {True False} |
| 71 |
– |
} else { |
| 72 |
– |
set radvar(RAWSAVE) False |
| 73 |
– |
} |
| 67 |
|
if [info exists radvar(VARIABILITY)] { |
| 68 |
|
cardval radvar(VARIABILITY) {High Medium Low} |
| 69 |
|
} else { |
| 73 |
|
|
| 74 |
|
proc setradvar stmt { # assign a rad variable |
| 75 |
|
global radvar |
| 76 |
< |
regexp {^([a-zA-Z][a-zA-Z0-9]*) *= *(.*)$} $stmt dummy vnam vval |
| 76 |
> |
regexp {^([a-zA-Z][a-zA-Z0-9]*) *=[ ]*(.*)$} $stmt dummy vnam vval |
| 77 |
|
switch -glob $vnam { |
| 78 |
|
obj* { eval lappend radvar(objects) $vval } |
| 79 |
|
sce* { eval lappend radvar(scene) $vval } |
| 96 |
|
IND* { set radvar(INDIRECT) $vval } |
| 97 |
|
DET* { set radvar(DETAIL) $vval } |
| 98 |
|
PEN* { set radvar(PENUMBRAS) $vval } |
| 106 |
– |
RAW* { set radvar(RAWSAVE) $vval } |
| 99 |
|
VAR* { set radvar(VARIABILITY) $vval } |
| 100 |
|
REP* { set radvar(REPORT) $vval } |
| 101 |
+ |
RAW* { set radvar(RAWFILE) $vval } |
| 102 |
+ |
ZF* {set radvar(ZFILE) $vval } |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
} |
| 119 |
|
} |
| 120 |
|
if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE |
| 121 |
|
EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS |
| 122 |
< |
RAWSAVE VARIABILITY REPORT} $vn] >= 0} { |
| 122 |
> |
RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} { |
| 123 |
|
puts $fi "$vn= $radvar($vn)" |
| 124 |
|
return |
| 125 |
|
} |
| 141 |
|
proc load_vars {f {vl all}} { # load RIF variables |
| 142 |
|
global curmess radvar alldone |
| 143 |
|
if {"$f" == ""} {return 0} |
| 144 |
< |
if {! [file exists $f]} { |
| 144 |
> |
if {! [file isfile $f]} { |
| 145 |
|
beep |
| 146 |
|
set curmess "$f: no such file." |
| 147 |
|
return 0 |
| 158 |
|
if {"$vl" == "all"} { |
| 159 |
|
catch {unset radvar} |
| 160 |
|
while {[gets $fi curli] != -1} { |
| 161 |
< |
if [regexp {^[a-zA-Z][a-zA-Z0-9]*= } $curli] { |
| 161 |
> |
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
| 162 |
|
setradvar $curli |
| 163 |
|
} else { |
| 164 |
|
break |
| 167 |
|
set curmess {Project loaded.} |
| 168 |
|
} else { |
| 169 |
|
foreach n $vl { |
| 170 |
< |
catch {unset radvar($n)} |
| 170 |
> |
if [regexp {[a-z][a-z]*} $n] { |
| 171 |
> |
set radvar($n) {} |
| 172 |
> |
} else { |
| 173 |
> |
catch {unset radvar($n)} |
| 174 |
> |
} |
| 175 |
|
} |
| 176 |
|
while {[gets $fi curli] != -1} { |
| 177 |
|
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
| 240 |
|
return 0 |
| 241 |
|
} |
| 242 |
|
} elseif {[file exists $f]} { |
| 243 |
+ |
set ftyp [file type $f] |
| 244 |
+ |
if { $ftyp != "file" } { |
| 245 |
+ |
beep |
| 246 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 247 |
+ |
return 0 |
| 248 |
+ |
} |
| 249 |
|
if [tk_dialog .dlg {Verification} \ |
| 250 |
|
"Overwrite existing file $f?" \ |
| 251 |
|
questhead 1 {Go Ahead} {Cancel}] { |
| 252 |
|
return 0 |
| 253 |
|
} |
| 254 |
|
} |
| 255 |
< |
if {[file exists $f] && ! [file writable $f] && |
| 255 |
> |
if {[file isfile $f] && ! [file writable $f] && |
| 256 |
|
[catch {exec chmod u+w $f} curmess]} { |
| 257 |
|
beep |
| 258 |
|
return 0 |
| 269 |
|
proc newnew f { # create a new RIF |
| 270 |
|
global rifname readonly curmess radvar |
| 271 |
|
if [file exists $f] { |
| 272 |
+ |
set ftyp [file type $f] |
| 273 |
+ |
if { $ftyp != "file" } { |
| 274 |
+ |
beep |
| 275 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 276 |
+ |
return 0 |
| 277 |
+ |
} |
| 278 |
|
if [tk_dialog .dlg {Verification} \ |
| 279 |
|
"File $f exists -- disregard it?" \ |
| 280 |
|
questhead 1 {Yes} {Cancel}] { |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
proc do_file w { |
| 295 |
< |
global rifname readonly rif_glob curfile curpat |
| 295 |
> |
global rifname readonly myglob curfile curpat |
| 296 |
|
if {"$w" == "done"} { |
| 297 |
|
cd [file dirname $rifname] |
| 298 |
< |
set rif_glob $curpat |
| 298 |
> |
set myglob(rif) $curpat |
| 299 |
|
return |
| 300 |
|
} |
| 301 |
|
frame $w |
| 316 |
|
helplink $w.left.new trad file new |
| 317 |
|
helplink $w.left.ro trad file readonly |
| 318 |
|
getfile -view view_txt -perm \ |
| 319 |
< |
-win $w.right -glob [file dirname $rifname]/$rif_glob |
| 319 |
> |
-win $w.right -glob [file dirname $rifname]/$myglob(rif) |
| 320 |
|
set curfile [file tail $rifname] |
| 321 |
|
} |