| 8 |
|
proc preen {} { # clean up radvar |
| 9 |
|
global radvar rifname |
| 10 |
|
foreach n {objects scene materials illum mkillum render oconv pfilt |
| 11 |
< |
AMBFILE OPTFILE EXPOSURE ZONE REPORT} { |
| 11 |
> |
RAWFILE ZFILE AMBFILE OPTFILE EXPOSURE ZONE REPORT} { |
| 12 |
|
if {! [info exists radvar($n)]} { |
| 13 |
|
set radvar($n) {} |
| 14 |
|
} |
| 19 |
|
set n 1 |
| 20 |
|
foreach v $oldval { |
| 21 |
|
if {"[string index $v 0]" == "-"} { |
| 22 |
< |
lappend radvar(view) "$n $v" |
| 22 |
> |
lappend radvar(view) "u$n $v" |
| 23 |
|
} elseif {[lsearch -glob $radvar(view) \ |
| 24 |
|
"[lindex $v 0] *"] >= 0} { |
| 25 |
|
continue |
| 100 |
|
PEN* { set radvar(PENUMBRAS) $vval } |
| 101 |
|
VAR* { set radvar(VARIABILITY) $vval } |
| 102 |
|
REP* { set radvar(REPORT) $vval } |
| 103 |
+ |
RAW* { set radvar(RAWFILE) $vval } |
| 104 |
+ |
ZF* {set radvar(ZFILE) $vval } |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
} |
| 121 |
|
} |
| 122 |
|
if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE |
| 123 |
|
EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS |
| 124 |
< |
VARIABILITY REPORT} $vn] >= 0} { |
| 124 |
> |
RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} { |
| 125 |
|
puts $fi "$vn= $radvar($vn)" |
| 126 |
|
return |
| 127 |
|
} |
| 143 |
|
proc load_vars {f {vl all}} { # load RIF variables |
| 144 |
|
global curmess radvar alldone |
| 145 |
|
if {"$f" == ""} {return 0} |
| 146 |
< |
if {! [file exists $f]} { |
| 146 |
> |
if {! [file isfile $f]} { |
| 147 |
|
beep |
| 148 |
|
set curmess "$f: no such file." |
| 149 |
|
return 0 |
| 150 |
|
} |
| 151 |
|
if {"$vl" == "all" && ! [chksave]} {return 0} |
| 152 |
|
set curmess {Please wait...} |
| 153 |
< |
update idletasks |
| 153 |
> |
update |
| 154 |
|
if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] { |
| 155 |
|
set curmess [exec cat /usr/tmp/ro[pid]] |
| 156 |
|
exec rm -f /usr/tmp/ro[pid] |
| 169 |
|
set curmess {Project loaded.} |
| 170 |
|
} else { |
| 171 |
|
foreach n $vl { |
| 172 |
< |
set radvar($n) {} |
| 172 |
> |
catch {unset radvar($n)} |
| 173 |
|
} |
| 174 |
|
while {[gets $fi curli] != -1} { |
| 175 |
|
if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] { |
| 238 |
|
return 0 |
| 239 |
|
} |
| 240 |
|
} elseif {[file exists $f]} { |
| 241 |
+ |
set ftyp [file type $f] |
| 242 |
+ |
if { $ftyp != "file" } { |
| 243 |
+ |
beep |
| 244 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 245 |
+ |
return 0 |
| 246 |
+ |
} |
| 247 |
|
if [tk_dialog .dlg {Verification} \ |
| 248 |
|
"Overwrite existing file $f?" \ |
| 249 |
|
questhead 1 {Go Ahead} {Cancel}] { |
| 250 |
|
return 0 |
| 251 |
|
} |
| 252 |
|
} |
| 253 |
+ |
if {[file isfile $f] && ! [file writable $f] && |
| 254 |
+ |
[catch {exec chmod u+w $f} curmess]} { |
| 255 |
+ |
beep |
| 256 |
+ |
return 0 |
| 257 |
+ |
} |
| 258 |
|
if [save_vars $f] { |
| 259 |
|
set rifname [pwd]/$f |
| 260 |
|
set readonly 0 |
| 267 |
|
proc newnew f { # create a new RIF |
| 268 |
|
global rifname readonly curmess radvar |
| 269 |
|
if [file exists $f] { |
| 270 |
+ |
set ftyp [file type $f] |
| 271 |
+ |
if { $ftyp != "file" } { |
| 272 |
+ |
beep |
| 273 |
+ |
set curmess "Selected file $f is a $ftyp." |
| 274 |
+ |
return 0 |
| 275 |
+ |
} |
| 276 |
|
if [tk_dialog .dlg {Verification} \ |
| 277 |
|
"File $f exists -- disregard it?" \ |
| 278 |
|
questhead 1 {Yes} {Cancel}] { |
| 292 |
|
proc do_file w { |
| 293 |
|
global rifname readonly rif_glob curfile curpat |
| 294 |
|
if {"$w" == "done"} { |
| 295 |
+ |
cd [file dirname $rifname] |
| 296 |
|
set rif_glob $curpat |
| 297 |
|
return |
| 298 |
|
} |
| 301 |
|
pack $w.left -side left |
| 302 |
|
button $w.left.load -text LOAD -width 5 \ |
| 303 |
|
-relief raised -command {newload $curfile} |
| 304 |
< |
button $w.left.save -text SAVE -width 5 \ |
| 305 |
< |
-relief raised -command {newsave $curfile} |
| 304 |
> |
button $w.left.save -text SAVE -width 5 -relief raised \ |
| 305 |
> |
-command "newsave \$curfile; update_dir $w.right" |
| 306 |
|
button $w.left.new -text NEW -width 5 \ |
| 307 |
|
-relief raised -command {newnew $curfile} |
| 308 |
|
pack $w.left.load $w.left.save $w.left.new -side top -pady 15 -padx 20 |