| 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 |
| 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 |
| 152 |
|
} |
| 153 |
|
if {"$vl" == "all" && ! [chksave]} {return 0} |
| 154 |
|
set curmess {Please wait...} |
| 155 |
< |
update idletasks |
| 155 |
> |
update |
| 156 |
|
if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] { |
| 157 |
|
set curmess [exec cat /usr/tmp/ro[pid]] |
| 158 |
|
exec rm -f /usr/tmp/ro[pid] |
| 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 |
< |
set 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 isfile $f] && ! [file writable $f] && |
| 260 |
+ |
[catch {exec chmod u+w $f} curmess]} { |
| 261 |
+ |
beep |
| 262 |
+ |
return 0 |
| 263 |
+ |
} |
| 264 |
|
if [save_vars $f] { |
| 265 |
|
set rifname [pwd]/$f |
| 266 |
|
set readonly 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 |
< |
set rif_glob $curpat |
| 301 |
> |
cd [file dirname $rifname] |
| 302 |
> |
set myglob(rif) $curpat |
| 303 |
|
return |
| 304 |
|
} |
| 305 |
|
frame $w |
| 307 |
|
pack $w.left -side left |
| 308 |
|
button $w.left.load -text LOAD -width 5 \ |
| 309 |
|
-relief raised -command {newload $curfile} |
| 310 |
< |
button $w.left.save -text SAVE -width 5 \ |
| 311 |
< |
-relief raised -command {newsave $curfile} |
| 310 |
> |
button $w.left.save -text SAVE -width 5 -relief raised \ |
| 311 |
> |
-command "newsave \$curfile; update_dir $w.right" |
| 312 |
|
button $w.left.new -text NEW -width 5 \ |
| 313 |
|
-relief raised -command {newnew $curfile} |
| 314 |
|
pack $w.left.load $w.left.save $w.left.new -side top -pady 15 -padx 20 |
| 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 |
|
} |