--- ray/src/util/do_file.tcl 1995/07/06 12:15:54 2.9 +++ ray/src/util/do_file.tcl 1996/05/17 13:53:07 2.13 @@ -3,12 +3,10 @@ # Choose the Rad Input File to work on. # -set rif_glob *.rif - proc preen {} { # clean up radvar global radvar rifname foreach n {objects scene materials illum mkillum render oconv pfilt - AMBFILE OPTFILE EXPOSURE ZONE REPORT} { + RAWFILE ZFILE AMBFILE OPTFILE EXPOSURE ZONE REPORT} { if {! [info exists radvar($n)]} { set radvar($n) {} } @@ -66,11 +64,6 @@ proc preen {} { # clean up radvar } else { set radvar(PENUMBRAS) False } - if [info exists radvar(RAWSAVE)] { - cardval radvar(RAWSAVE) {True False} - } else { - set radvar(RAWSAVE) False - } if [info exists radvar(VARIABILITY)] { cardval radvar(VARIABILITY) {High Medium Low} } else { @@ -103,9 +96,10 @@ proc setradvar stmt { # assign a rad variable IND* { set radvar(INDIRECT) $vval } DET* { set radvar(DETAIL) $vval } PEN* { set radvar(PENUMBRAS) $vval } - RAW* { set radvar(RAWSAVE) $vval } VAR* { set radvar(VARIABILITY) $vval } REP* { set radvar(REPORT) $vval } + RAW* { set radvar(RAWFILE) $vval } + ZF* {set radvar(ZFILE) $vval } } } @@ -125,7 +119,7 @@ proc putradvar {fi vn} { # print out a rad variable } if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS - RAWSAVE VARIABILITY REPORT} $vn] >= 0} { + RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} { puts $fi "$vn= $radvar($vn)" return } @@ -147,7 +141,7 @@ proc putradvar {fi vn} { # print out a rad variable proc load_vars {f {vl all}} { # load RIF variables global curmess radvar alldone if {"$f" == ""} {return 0} - if {! [file exists $f]} { + if {! [file isfile $f]} { beep set curmess "$f: no such file." return 0 @@ -242,13 +236,19 @@ proc newsave f { # save a RIF return 0 } } elseif {[file exists $f]} { + set ftyp [file type $f] + if { $ftyp != "file" } { + beep + set curmess "Selected file $f is a $ftyp." + return 0 + } if [tk_dialog .dlg {Verification} \ "Overwrite existing file $f?" \ questhead 1 {Go Ahead} {Cancel}] { return 0 } } - if {[file exists $f] && ! [file writable $f] && + if {[file isfile $f] && ! [file writable $f] && [catch {exec chmod u+w $f} curmess]} { beep return 0 @@ -265,6 +265,12 @@ proc newsave f { # save a RIF proc newnew f { # create a new RIF global rifname readonly curmess radvar if [file exists $f] { + set ftyp [file type $f] + if { $ftyp != "file" } { + beep + set curmess "Selected file $f is a $ftyp." + return 0 + } if [tk_dialog .dlg {Verification} \ "File $f exists -- disregard it?" \ questhead 1 {Yes} {Cancel}] { @@ -282,10 +288,10 @@ proc newnew f { # create a new RIF } proc do_file w { - global rifname readonly rif_glob curfile curpat + global rifname readonly myglob curfile curpat if {"$w" == "done"} { cd [file dirname $rifname] - set rif_glob $curpat + set myglob(rif) $curpat return } frame $w @@ -306,6 +312,6 @@ proc do_file w { helplink $w.left.new trad file new helplink $w.left.ro trad file readonly getfile -view view_txt -perm \ - -win $w.right -glob [file dirname $rifname]/$rif_glob + -win $w.right -glob [file dirname $rifname]/$myglob(rif) set curfile [file tail $rifname] }