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} { |
9 |
> |
RAWFILE ZFILE AMBFILE 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 } |
94 |
|
AMB* { set radvar(AMBFILE) $vval } |
95 |
|
OPT* { set radvar(OPTFILE) $vval } |
96 |
|
EXP* { set radvar(EXPOSURE) $vval } |
97 |
+ |
EYE* { set radvar(EYESEP) $vval } |
98 |
|
RES* { set radvar(RESOLUTION) $vval } |
99 |
|
UP { set radvar(UP) $vval } |
100 |
|
IND* { set radvar(INDIRECT) $vval } |
102 |
|
PEN* { set radvar(PENUMBRAS) $vval } |
103 |
|
VAR* { set radvar(VARIABILITY) $vval } |
104 |
|
REP* { set radvar(REPORT) $vval } |
105 |
+ |
RAW* { set radvar(RAWFILE) $vval } |
106 |
+ |
ZF* {set radvar(ZFILE) $vval } |
107 |
|
} |
108 |
|
|
109 |
|
} |
123 |
|
} |
124 |
|
if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE |
125 |
|
EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS |
126 |
< |
VARIABILITY REPORT} $vn] >= 0} { |
126 |
> |
EYESEP RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} { |
127 |
|
puts $fi "$vn= $radvar($vn)" |
128 |
|
return |
129 |
|
} |
145 |
|
proc load_vars {f {vl all}} { # load RIF variables |
146 |
|
global curmess radvar alldone |
147 |
|
if {"$f" == ""} {return 0} |
148 |
< |
if {! [file exists $f]} { |
148 |
> |
if {! [file isfile $f]} { |
149 |
|
beep |
150 |
|
set curmess "$f: no such file." |
151 |
|
return 0 |
162 |
|
if {"$vl" == "all"} { |
163 |
|
catch {unset radvar} |
164 |
|
while {[gets $fi curli] != -1} { |
165 |
< |
if [regexp {^[a-zA-Z][a-zA-Z0-9]*= } $curli] { |
165 |
> |
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
166 |
|
setradvar $curli |
167 |
|
} else { |
168 |
|
break |
171 |
|
set curmess {Project loaded.} |
172 |
|
} else { |
173 |
|
foreach n $vl { |
174 |
< |
catch {unset radvar($n)} |
174 |
> |
if [regexp {[a-z][a-z]*} $n] { |
175 |
> |
set radvar($n) {} |
176 |
> |
} else { |
177 |
> |
catch {unset radvar($n)} |
178 |
> |
} |
179 |
|
} |
180 |
|
while {[gets $fi curli] != -1} { |
181 |
|
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
244 |
|
return 0 |
245 |
|
} |
246 |
|
} elseif {[file exists $f]} { |
247 |
+ |
set ftyp [file type $f] |
248 |
+ |
if { $ftyp != "file" } { |
249 |
+ |
beep |
250 |
+ |
set curmess "Selected file $f is a $ftyp." |
251 |
+ |
return 0 |
252 |
+ |
} |
253 |
|
if [tk_dialog .dlg {Verification} \ |
254 |
|
"Overwrite existing file $f?" \ |
255 |
|
questhead 1 {Go Ahead} {Cancel}] { |
256 |
|
return 0 |
257 |
|
} |
258 |
|
} |
259 |
< |
if {[file exists $f] && ! [file writable $f] && |
259 |
> |
if {[file isfile $f] && ! [file writable $f] && |
260 |
|
[catch {exec chmod u+w $f} curmess]} { |
261 |
|
beep |
262 |
|
return 0 |
273 |
|
proc newnew f { # create a new RIF |
274 |
|
global rifname readonly curmess radvar |
275 |
|
if [file exists $f] { |
276 |
+ |
set ftyp [file type $f] |
277 |
+ |
if { $ftyp != "file" } { |
278 |
+ |
beep |
279 |
+ |
set curmess "Selected file $f is a $ftyp." |
280 |
+ |
return 0 |
281 |
+ |
} |
282 |
|
if [tk_dialog .dlg {Verification} \ |
283 |
|
"File $f exists -- disregard it?" \ |
284 |
|
questhead 1 {Yes} {Cancel}] { |
296 |
|
} |
297 |
|
|
298 |
|
proc do_file w { |
299 |
< |
global rifname readonly rif_glob curfile curpat |
299 |
> |
global rifname readonly myglob curfile curpat |
300 |
|
if {"$w" == "done"} { |
301 |
|
cd [file dirname $rifname] |
302 |
< |
set rif_glob $curpat |
302 |
> |
set myglob(rif) $curpat |
303 |
|
return |
304 |
|
} |
305 |
|
frame $w |
320 |
|
helplink $w.left.new trad file new |
321 |
|
helplink $w.left.ro trad file readonly |
322 |
|
getfile -view view_txt -perm \ |
323 |
< |
-win $w.right -glob [file dirname $rifname]/$rif_glob |
323 |
> |
-win $w.right -glob [file dirname $rifname]/$myglob(rif) |
324 |
|
set curfile [file tail $rifname] |
325 |
|
} |