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.19 by greg, Sun Jun 3 20:32:49 2012 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 render oconv rvu rpict pfilt
9 >                        RAWFILE ZFILE AMBFILE 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 }
# Line 84 | Line 85 | proc setradvar stmt {          # assign a rad variable
85                  mki* { eval lappend radvar(mkillum) $vval }
86                  ren* { eval lappend radvar(render) $vval }
87                  oco* { eval lappend radvar(oconv) $vval }
88 +                rvu { eval lappend radvar(rvu) $vval }
89 +                rpi* { eval lappend radvar(rpict) $vval }
90                  pf* { eval lappend radvar(pfilt) $vval }
91                  vi* { lappend radvar(view) $vval }
92                  ZO* { set radvar(ZONE) $vval }
# Line 93 | Line 96 | proc setradvar stmt {          # assign a rad variable
96                  AMB* { set radvar(AMBFILE) $vval }
97                  OPT* { set radvar(OPTFILE) $vval }
98                  EXP* { set radvar(EXPOSURE) $vval }
99 +                EYE* { set radvar(EYESEP) $vval }
100                  RES* { set radvar(RESOLUTION) $vval }
101                  UP { set radvar(UP) $vval }
102                  IND* { set radvar(INDIRECT) $vval }
# Line 100 | Line 104 | proc setradvar stmt {          # assign a rad variable
104                  PEN* { set radvar(PENUMBRAS) $vval }
105                  VAR* { set radvar(VARIABILITY) $vval }
106                  REP* { set radvar(REPORT) $vval }
107 +                RAW* { set radvar(RAWFILE) $vval }
108 +                ZF* {set radvar(ZFILE) $vval }
109          }
110                  
111   }
# Line 119 | Line 125 | proc putradvar {fi vn} {       # print out a rad variable
125          }
126          if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE
127                          EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS
128 <                        VARIABILITY REPORT} $vn] >= 0} {
128 >                        EYESEP RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} {
129                  puts $fi "$vn= $radvar($vn)"
130                  return
131          }
# Line 141 | Line 147 | proc putradvar {fi vn} {       # print out a rad variable
147   proc load_vars {f {vl all}} {   # load RIF variables
148          global curmess radvar alldone
149          if {"$f" == ""} {return 0}
150 <        if {! [file exists $f]} {
150 >        if {! [file isfile $f]} {
151                  beep
152                  set curmess "$f: no such file."
153                  return 0
# Line 149 | Line 155 | proc load_vars {f {vl all}} {  # load RIF variables
155          if {"$vl" == "all" && ! [chksave]} {return 0}
156          set curmess {Please wait...}
157          update
158 <        if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] {
159 <                set curmess [exec cat /usr/tmp/ro[pid]]
160 <                exec rm -f /usr/tmp/ro[pid]
158 >        if [catch {exec rad -n -w -e $f >& /tmp/ro[pid]}] {
159 >                set curmess [exec cat /tmp/ro[pid]]
160 >                exec rm -f /tmp/ro[pid]
161                  return 0
162          }
163 <        set fi [open /usr/tmp/ro[pid] r]
163 >        set fi [open /tmp/ro[pid] r]
164          if {"$vl" == "all"} {
165                  catch {unset radvar}
166                  while {[gets $fi curli] != -1} {
167 <                        if [regexp {^[a-zA-Z][a-zA-Z0-9]*= } $curli] {
167 >                        if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] {
168                                  setradvar $curli
169                          } else {
170                                  break
# Line 167 | Line 173 | proc load_vars {f {vl all}} {  # load RIF variables
173                  set curmess {Project loaded.}
174          } else {
175                  foreach n $vl {
176 <                        catch {unset radvar($n)}
176 >                        if [regexp {[a-z][a-z]*} $n] {
177 >                                set radvar($n) {}
178 >                        } else {
179 >                                catch {unset radvar($n)}
180 >                        }
181                  }
182                  while {[gets $fi curli] != -1} {
183                          if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] {
# Line 183 | Line 193 | proc load_vars {f {vl all}} {  # load RIF variables
193          }
194          set alldone [eof $fi]
195          close $fi
196 <        exec rm -f /usr/tmp/ro[pid]
196 >        exec rm -f /tmp/ro[pid]
197          preen
198          return 1
199   }
# Line 236 | Line 246 | proc newsave f {               # save a RIF
246                          return 0
247                  }
248          } elseif {[file exists $f]} {
249 +                set ftyp [file type $f]
250 +                if { $ftyp != "file" } {
251 +                        beep
252 +                        set curmess "Selected file $f is a $ftyp."
253 +                        return 0
254 +                }
255                  if [tk_dialog .dlg {Verification} \
256                                  "Overwrite existing file $f?" \
257                                  questhead 1 {Go Ahead} {Cancel}] {
258                          return 0
259                  }
260          }
261 <        if {[file exists $f] && ! [file writable $f] &&
261 >        if {[file isfile $f] && ! [file writable $f] &&
262                          [catch {exec chmod u+w $f} curmess]} {
263                  beep
264                  return 0
# Line 259 | Line 275 | proc newsave f {               # save a RIF
275   proc newnew f {                 # create a new RIF
276          global rifname readonly curmess radvar
277          if [file exists $f] {
278 +                set ftyp [file type $f]
279 +                if { $ftyp != "file" } {
280 +                        beep
281 +                        set curmess "Selected file $f is a $ftyp."
282 +                        return 0
283 +                }
284                  if [tk_dialog .dlg {Verification} \
285                                  "File $f exists -- disregard it?" \
286                                  questhead 1 {Yes} {Cancel}] {
# Line 276 | Line 298 | proc newnew f {                        # create a new RIF
298   }
299  
300   proc do_file w {
301 <        global rifname readonly rif_glob curfile curpat
301 >        global rifname readonly myglob curfile curpat
302          if {"$w" == "done"} {
303                  cd [file dirname $rifname]
304 <                set rif_glob $curpat
304 >                set myglob(rif) $curpat
305                  return
306          }
307          frame $w
# Line 300 | Line 322 | proc do_file w {
322          helplink $w.left.new trad file new
323          helplink $w.left.ro trad file readonly
324          getfile -view view_txt -perm \
325 <                        -win $w.right -glob [file dirname $rifname]/$rif_glob
325 >                        -win $w.right -glob [file dirname $rifname]/$myglob(rif)
326          set curfile [file tail $rifname]
327   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines