ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/do_file.tcl
(Generate patch)

Comparing ray/src/util/do_file.tcl (file contents):
Revision 2.7 by greg, Tue Mar 21 16:19:26 1995 UTC vs.
Revision 2.20 by greg, Tue May 26 12:39:25 2015 UTC

# Line 1 | Line 1
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} {
8 >        foreach n {objects scene materials illum mkillum mkpmap render oconv rvu rpict pfilt
9 >                        RAWFILE ZFILE AMBFILE PGMAP PCMAP OPTFILE EXPOSURE ZONE REPORT} {
10                  if {! [info exists radvar($n)]} {
11                          set radvar($n) {}
12                  }
# Line 19 | Line 17 | proc preen {} {                        # clean up radvar
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
# Line 45 | Line 43 | proc preen {} {                        # clean up radvar
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 {
# Line 75 | Line 76 | proc preen {} {                        # clean up radvar
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 }
83                  mat* { eval lappend radvar(materials) $vval }
84                  ill* { eval lappend radvar(illum) $vval }
85                  mki* { eval lappend radvar(mkillum) $vval }
86 +                mkp* { eval lappend randvar(mkpmap) $vval }
87                  ren* { eval lappend radvar(render) $vval }
88                  oco* { eval lappend radvar(oconv) $vval }
89 +                rvu { eval lappend radvar(rvu) $vval }
90 +                rpi* { eval lappend radvar(rpict) $vval }
91                  pf* { eval lappend radvar(pfilt) $vval }
92                  vi* { lappend radvar(view) $vval }
93                  ZO* { set radvar(ZONE) $vval }
# Line 93 | Line 97 | proc setradvar stmt {          # assign a rad variable
97                  AMB* { set radvar(AMBFILE) $vval }
98                  OPT* { set radvar(OPTFILE) $vval }
99                  EXP* { set radvar(EXPOSURE) $vval }
100 +                EYE* { set radvar(EYESEP) $vval }
101                  RES* { set radvar(RESOLUTION) $vval }
102                  UP { set radvar(UP) $vval }
103                  IND* { set radvar(INDIRECT) $vval }
# Line 100 | Line 105 | proc setradvar stmt {          # assign a rad variable
105                  PEN* { set radvar(PENUMBRAS) $vval }
106                  VAR* { set radvar(VARIABILITY) $vval }
107                  REP* { set radvar(REPORT) $vval }
108 +                RAW* { set radvar(RAWFILE) $vval }
109 +                ZF* {set radvar(ZFILE) $vval }
110 +                PGM* {set radvar(PGMAP) $vval }
111 +                PCM* {set radvar(PCMAP) $vval }
112          }
113                  
114   }
# Line 119 | Line 128 | proc putradvar {fi vn} {       # print out a rad variable
128          }
129          if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE
130                          EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS
131 <                        VARIABILITY REPORT} $vn] >= 0} {
131 >                        EYESEP RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} {
132                  puts $fi "$vn= $radvar($vn)"
133                  return
134          }
# Line 141 | Line 150 | proc putradvar {fi vn} {       # print out a rad variable
150   proc load_vars {f {vl all}} {   # load RIF variables
151          global curmess radvar alldone
152          if {"$f" == ""} {return 0}
153 <        if {! [file exists $f]} {
153 >        if {! [file isfile $f]} {
154                  beep
155                  set curmess "$f: no such file."
156                  return 0
# Line 149 | Line 158 | proc load_vars {f {vl all}} {  # load RIF variables
158          if {"$vl" == "all" && ! [chksave]} {return 0}
159          set curmess {Please wait...}
160          update
161 <        if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] {
162 <                set curmess [exec cat /usr/tmp/ro[pid]]
163 <                exec rm -f /usr/tmp/ro[pid]
161 >        if [catch {exec rad -n -w -e $f >& /tmp/ro[pid]}] {
162 >                set curmess [exec cat /tmp/ro[pid]]
163 >                exec rm -f /tmp/ro[pid]
164                  return 0
165          }
166 <        set fi [open /usr/tmp/ro[pid] r]
166 >        set fi [open /tmp/ro[pid] r]
167          if {"$vl" == "all"} {
168                  catch {unset radvar}
169                  while {[gets $fi curli] != -1} {
170 <                        if [regexp {^[a-zA-Z][a-zA-Z0-9]*= } $curli] {
170 >                        if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] {
171                                  setradvar $curli
172                          } else {
173                                  break
# Line 167 | Line 176 | proc load_vars {f {vl all}} {  # load RIF variables
176                  set curmess {Project loaded.}
177          } else {
178                  foreach n $vl {
179 <                        catch {unset radvar($n)}
179 >                        if [regexp {[a-z][a-z]*} $n] {
180 >                                set radvar($n) {}
181 >                        } else {
182 >                                catch {unset radvar($n)}
183 >                        }
184                  }
185                  while {[gets $fi curli] != -1} {
186                          if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] {
# Line 183 | Line 196 | proc load_vars {f {vl all}} {  # load RIF variables
196          }
197          set alldone [eof $fi]
198          close $fi
199 <        exec rm -f /usr/tmp/ro[pid]
199 >        exec rm -f /tmp/ro[pid]
200          preen
201          return 1
202   }
# Line 236 | Line 249 | proc newsave f {               # save a RIF
249                          return 0
250                  }
251          } elseif {[file exists $f]} {
252 +                set ftyp [file type $f]
253 +                if { $ftyp != "file" } {
254 +                        beep
255 +                        set curmess "Selected file $f is a $ftyp."
256 +                        return 0
257 +                }
258                  if [tk_dialog .dlg {Verification} \
259                                  "Overwrite existing file $f?" \
260                                  questhead 1 {Go Ahead} {Cancel}] {
261                          return 0
262                  }
263          }
264 <        if {[file exists $f] && ! [file writable $f] &&
264 >        if {[file isfile $f] && ! [file writable $f] &&
265                          [catch {exec chmod u+w $f} curmess]} {
266                  beep
267                  return 0
# Line 259 | Line 278 | proc newsave f {               # save a RIF
278   proc newnew f {                 # create a new RIF
279          global rifname readonly curmess radvar
280          if [file exists $f] {
281 +                set ftyp [file type $f]
282 +                if { $ftyp != "file" } {
283 +                        beep
284 +                        set curmess "Selected file $f is a $ftyp."
285 +                        return 0
286 +                }
287                  if [tk_dialog .dlg {Verification} \
288                                  "File $f exists -- disregard it?" \
289                                  questhead 1 {Yes} {Cancel}] {
# Line 276 | Line 301 | proc newnew f {                        # create a new RIF
301   }
302  
303   proc do_file w {
304 <        global rifname readonly rif_glob curfile curpat
304 >        global rifname readonly myglob curfile curpat
305          if {"$w" == "done"} {
306                  cd [file dirname $rifname]
307 <                set rif_glob $curpat
307 >                set myglob(rif) $curpat
308                  return
309          }
310          frame $w
# Line 300 | Line 325 | proc do_file w {
325          helplink $w.left.new trad file new
326          helplink $w.left.ro trad file readonly
327          getfile -view view_txt -perm \
328 <                        -win $w.right -glob [file dirname $rifname]/$rif_glob
328 >                        -win $w.right -glob [file dirname $rifname]/$myglob(rif)
329          set curfile [file tail $rifname]
330   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines