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 |
|
} |
17 |
|
set n 1 |
18 |
|
foreach v $oldval { |
19 |
|
if {"[string index $v 0]" == "-"} { |
20 |
< |
lappend radvar(view) "$n $v" |
20 |
> |
lappend radvar(view) "u$n $v" |
21 |
|
} elseif {[lsearch -glob $radvar(view) \ |
22 |
|
"[lindex $v 0] *"] >= 0} { |
23 |
|
continue |
98 |
|
PEN* { set radvar(PENUMBRAS) $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 |
< |
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 |
148 |
|
} |
149 |
|
if {"$vl" == "all" && ! [chksave]} {return 0} |
150 |
|
set curmess {Please wait...} |
151 |
< |
update idletasks |
151 |
> |
update |
152 |
|
if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] { |
153 |
|
set curmess [exec cat /usr/tmp/ro[pid]] |
154 |
|
exec rm -f /usr/tmp/ro[pid] |
167 |
|
set curmess {Project loaded.} |
168 |
|
} else { |
169 |
|
foreach n $vl { |
170 |
< |
set radvar($n) {} |
170 |
> |
catch {unset radvar($n)} |
171 |
|
} |
172 |
|
while {[gets $fi curli] != -1} { |
173 |
|
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
236 |
|
return 0 |
237 |
|
} |
238 |
|
} elseif {[file exists $f]} { |
239 |
+ |
set ftyp [file type $f] |
240 |
+ |
if { $ftyp != "file" } { |
241 |
+ |
beep |
242 |
+ |
set curmess "Selected file $f is a $ftyp." |
243 |
+ |
return 0 |
244 |
+ |
} |
245 |
|
if [tk_dialog .dlg {Verification} \ |
246 |
|
"Overwrite existing file $f?" \ |
247 |
|
questhead 1 {Go Ahead} {Cancel}] { |
248 |
|
return 0 |
249 |
|
} |
250 |
|
} |
251 |
+ |
if {[file isfile $f] && ! [file writable $f] && |
252 |
+ |
[catch {exec chmod u+w $f} curmess]} { |
253 |
+ |
beep |
254 |
+ |
return 0 |
255 |
+ |
} |
256 |
|
if [save_vars $f] { |
257 |
|
set rifname [pwd]/$f |
258 |
|
set readonly 0 |
265 |
|
proc newnew f { # create a new RIF |
266 |
|
global rifname readonly curmess radvar |
267 |
|
if [file exists $f] { |
268 |
+ |
set ftyp [file type $f] |
269 |
+ |
if { $ftyp != "file" } { |
270 |
+ |
beep |
271 |
+ |
set curmess "Selected file $f is a $ftyp." |
272 |
+ |
return 0 |
273 |
+ |
} |
274 |
|
if [tk_dialog .dlg {Verification} \ |
275 |
|
"File $f exists -- disregard it?" \ |
276 |
|
questhead 1 {Yes} {Cancel}] { |
288 |
|
} |
289 |
|
|
290 |
|
proc do_file w { |
291 |
< |
global rifname readonly rif_glob curfile curpat |
291 |
> |
global rifname readonly myglob curfile curpat |
292 |
|
if {"$w" == "done"} { |
293 |
< |
set rif_glob $curpat |
293 |
> |
cd [file dirname $rifname] |
294 |
> |
set myglob(rif) $curpat |
295 |
|
return |
296 |
|
} |
297 |
|
frame $w |
299 |
|
pack $w.left -side left |
300 |
|
button $w.left.load -text LOAD -width 5 \ |
301 |
|
-relief raised -command {newload $curfile} |
302 |
< |
button $w.left.save -text SAVE -width 5 \ |
303 |
< |
-relief raised -command {newsave $curfile} |
302 |
> |
button $w.left.save -text SAVE -width 5 -relief raised \ |
303 |
> |
-command "newsave \$curfile; update_dir $w.right" |
304 |
|
button $w.left.new -text NEW -width 5 \ |
305 |
|
-relief raised -command {newnew $curfile} |
306 |
|
pack $w.left.load $w.left.save $w.left.new -side top -pady 15 -padx 20 |
312 |
|
helplink $w.left.new trad file new |
313 |
|
helplink $w.left.ro trad file readonly |
314 |
|
getfile -view view_txt -perm \ |
315 |
< |
-win $w.right -glob [file dirname $rifname]/$rif_glob |
315 |
> |
-win $w.right -glob [file dirname $rifname]/$myglob(rif) |
316 |
|
set curfile [file tail $rifname] |
317 |
|
} |