| 1 |
# RCSid: $Id: do_options.tcl,v 2.9 2014/08/01 02:18:42 greg Exp $ |
| 2 |
# |
| 3 |
# Options screen for trad |
| 4 |
# |
| 5 |
|
| 6 |
proc amb_delete {} { # delete ambient file |
| 7 |
global radvar curmess |
| 8 |
if {"$radvar(AMBFILE)" == {} || ! [file isfile $radvar(AMBFILE)]} { |
| 9 |
set curmess {No ambient file.} |
| 10 |
return |
| 11 |
} |
| 12 |
set hl [string length [exec getinfo < $radvar(AMBFILE)]] |
| 13 |
set fl [file size $radvar(AMBFILE)] |
| 14 |
set nv [expr ($fl - $hl - 2) / 67] |
| 15 |
if {$nv > 1000 && [tk_dialog .dlg {Verification} \ |
| 16 |
"Really delete ambient file $radvar(AMBFILE)\ |
| 17 |
with $nv indirect irradiance values?" \ |
| 18 |
questhead 0 {Delete} {Cancel}]} { |
| 19 |
return 0 |
| 20 |
} |
| 21 |
if [catch {exec rm $radvar(AMBFILE) < /dev/null} curmess] {return 0} |
| 22 |
set curmess {Ambient file deleted.} |
| 23 |
return 1 |
| 24 |
} |
| 25 |
|
| 26 |
proc pgm_delete {} { # delete global photon map file |
| 27 |
global radvar curmess |
| 28 |
set pm [lindex $radvar(PGMAP) 0] |
| 29 |
if {"$pm" == {} || ! [file isfile $pm]} { |
| 30 |
set curmess {No global photon file.} |
| 31 |
return |
| 32 |
} |
| 33 |
set hd [exec getinfo < $pm] |
| 34 |
set nv [lindex $hd [expr [lsearch $hd photons] - 1]] |
| 35 |
if {$nv > 10000 && [tk_dialog .dlg {Verification} \ |
| 36 |
"Really delete global photon map $pm\ |
| 37 |
with $nv photons?" \ |
| 38 |
questhead 0 {Delete} {Cancel}]} { |
| 39 |
return 0 |
| 40 |
} |
| 41 |
if [catch {exec rm $pm < /dev/null} curmess] {return 0} |
| 42 |
set curmess {Global photon file deleted.} |
| 43 |
return 1 |
| 44 |
} |
| 45 |
|
| 46 |
proc pcm_delete {} { # delete caustic photon map file |
| 47 |
global radvar curmess |
| 48 |
set pm [lindex $radvar(PCMAP) 0] |
| 49 |
if {"$pm" == {} || ! [file isfile $pm]} { |
| 50 |
set curmess {No caustic photon file.} |
| 51 |
return |
| 52 |
} |
| 53 |
set hd [exec getinfo < $pm] |
| 54 |
set nv [lindex $hd [expr [lsearch $hd photons] - 1]] |
| 55 |
if {$nv > 10000 && [tk_dialog .dlg {Verification} \ |
| 56 |
"Really delete caustic photon map $pm\ |
| 57 |
with $nv photons?" \ |
| 58 |
questhead 0 {Delete} {Cancel}]} { |
| 59 |
return 0 |
| 60 |
} |
| 61 |
if [catch {exec rm $pm < /dev/null} curmess] {return 0} |
| 62 |
set curmess {Caustic photon file deleted.} |
| 63 |
return 1 |
| 64 |
} |
| 65 |
|
| 66 |
proc copyopts rf { # copy option settings from another RIF |
| 67 |
load_vars [file tail $rf] {QUALITY PENUMBRAS AMBFILE PGMAP PCMAP OPTFILE REPORT \ |
| 68 |
oconv mkillum mkpmap render pfilt} |
| 69 |
} |
| 70 |
|
| 71 |
proc do_options w { # Set up options screen |
| 72 |
global radvar rifname |
| 73 |
if {"$w" == "done"} { |
| 74 |
return |
| 75 |
} |
| 76 |
frame $w |
| 77 |
# Quality |
| 78 |
label $w.qual -text Quality: |
| 79 |
place $w.qual -relx .0714 -rely .0510 |
| 80 |
radiobutton $w.quaH -text High -anchor w -relief flat \ |
| 81 |
-variable radvar(QUALITY) -value High |
| 82 |
place $w.quaH -relx .2857 -rely .0510 |
| 83 |
radiobutton $w.quaM -text Medium -anchor w -relief flat \ |
| 84 |
-variable radvar(QUALITY) -value Medium |
| 85 |
place $w.quaM -relx .5357 -rely .0510 |
| 86 |
radiobutton $w.quaL -text Low -anchor w -relief flat \ |
| 87 |
-variable radvar(QUALITY) -value Low |
| 88 |
place $w.quaL -relx .7857 -rely .0510 |
| 89 |
helplink "$w.quaH $w.quaM $w.quaL" trad options quality |
| 90 |
# Penumbras |
| 91 |
label $w.penl -text Penumbras: |
| 92 |
place $w.penl -relx .0714 -rely .1485 |
| 93 |
radiobutton $w.penT -text On -anchor w -relief flat \ |
| 94 |
-variable radvar(PENUMBRAS) -value True |
| 95 |
place $w.penT -relx .2857 -rely .1485 |
| 96 |
radiobutton $w.penF -text Off -anchor w -relief flat \ |
| 97 |
-variable radvar(PENUMBRAS) -value False |
| 98 |
place $w.penF -relx .5357 -rely .1485 |
| 99 |
helplink "$w.penT $w.penF" trad options penumbras |
| 100 |
# Global photon map |
| 101 |
label $w.pgml -text Pgmap: |
| 102 |
place $w.pgml -relx .0714 -rely .2460 |
| 103 |
entry $w.pgme -textvariable radvar(PGMAP) -relief sunken |
| 104 |
place $w.pgme -relwidth .5714 -relheight .0610 -relx .2857 -rely .2460 |
| 105 |
helplink $w.pgme trad options pgmap |
| 106 |
button $w.pgmd -text Delete -relief raised -command pgm_delete |
| 107 |
place $w.pgmd -relwidth .1071 -relheight .0610 -relx .98 -rely .2460 \ |
| 108 |
-anchor ne |
| 109 |
helplink $w.pgmd trad options pgmdelete |
| 110 |
# Caustic photon map |
| 111 |
label $w.pcml -text Pcmap: |
| 112 |
place $w.pcml -relx .0714 -rely .3341 |
| 113 |
entry $w.pcme -textvariable radvar(PCMAP) -relief sunken |
| 114 |
place $w.pcme -relwidth .5714 -relheight .0610 -relx .2857 -rely .3341 |
| 115 |
helplink $w.pcme trad options pcmap |
| 116 |
button $w.pcmd -text Delete -relief raised -command pcm_delete |
| 117 |
place $w.pcmd -relwidth .1071 -relheight .0610 -relx .98 -rely .3341 \ |
| 118 |
-anchor ne |
| 119 |
helplink $w.pcmd trad options pcmdelete |
| 120 |
# Ambfile |
| 121 |
label $w.ambl -text Ambfile: |
| 122 |
place $w.ambl -relx .0714 -rely .4222 |
| 123 |
entry $w.ambe -textvariable radvar(AMBFILE) -relief sunken |
| 124 |
place $w.ambe -relwidth .5714 -relheight .0610 -relx .2857 -rely .4222 |
| 125 |
helplink $w.ambe trad options ambfile |
| 126 |
button $w.ambd -text Delete -relief raised -command amb_delete |
| 127 |
place $w.ambd -relwidth .1071 -relheight .0610 -relx .98 -rely .4222 \ |
| 128 |
-anchor ne |
| 129 |
helplink $w.ambd trad options ambdelete |
| 130 |
# Optfile |
| 131 |
label $w.optl -text Optfile: |
| 132 |
place $w.optl -relx .0714 -rely .5103 |
| 133 |
entry $w.opte -textvariable radvar(OPTFILE) -relief sunken |
| 134 |
place $w.opte -relwidth .5714 -relheight .0610 -relx .2857 -rely .5103 |
| 135 |
helplink $w.opte trad options optfile |
| 136 |
# Report |
| 137 |
label $w.repl -text Report: |
| 138 |
place $w.repl -relx .0714 -rely .5984 |
| 139 |
entry $w.repe -textvariable radvar(REPORT) -relief sunken |
| 140 |
place $w.repe -relwidth .5714 -relheight .0610 -relx .2857 -rely .5984 |
| 141 |
helplink $w.repe trad options report |
| 142 |
# Oconv options |
| 143 |
label $w.ocol -text "oconv opts:" |
| 144 |
place $w.ocol -relx .0714 -rely .6863 |
| 145 |
entry $w.ocoe -textvariable radvar(oconv) -relief sunken |
| 146 |
place $w.ocoe -relwidth .5714 -relheight .0600 -relx .2857 -rely .6863 |
| 147 |
helplink $w.ocoe trad options oconv |
| 148 |
# Mkillum options |
| 149 |
label $w.mkil -text "mkillum opts:" |
| 150 |
place $w.mkil -relx .0714 -rely .7473 |
| 151 |
entry $w.mkie -textvariable radvar(mkillum) -relief sunken |
| 152 |
place $w.mkie -relwidth .5714 -relheight .0600 -relx .2857 -rely .7473 |
| 153 |
helplink $w.mkie trad options mkillum |
| 154 |
# Mkpmap options |
| 155 |
label $w.mkpl -text "mkpmap opts:" |
| 156 |
place $w.mkpl -relx .0714 -rely .8083 |
| 157 |
entry $w.mkpe -textvariable radvar(mkpmap) -relief sunken |
| 158 |
place $w.mkpe -relwidth .5714 -relheight .0600 -relx .2857 -rely .8083 |
| 159 |
helplink $w.mkpe trad options mkpmap |
| 160 |
# Render options |
| 161 |
label $w.renl -text "render opts:" |
| 162 |
place $w.renl -relx .0714 -rely .8693 |
| 163 |
entry $w.rene -textvariable radvar(render) -relief sunken |
| 164 |
place $w.rene -relwidth .5714 -relheight .0600 -relx .2857 -rely .8693 |
| 165 |
helplink $w.rene trad options render |
| 166 |
# Pfilt options |
| 167 |
label $w.pfil -text "pfilt opts:" |
| 168 |
place $w.pfil -relx .0714 -rely .9339 |
| 169 |
entry $w.pfie -textvariable radvar(pfilt) -relief sunken |
| 170 |
place $w.pfie -relwidth .5714 -relheight .0600 -relx .2857 -rely .9339 |
| 171 |
helplink $w.pfie trad options pfilt |
| 172 |
# Revert and Copy buttons |
| 173 |
button $w.revert -text Revert -relief raised \ |
| 174 |
-command "copyopts $rifname" |
| 175 |
place $w.revert -relwidth .1071 -relheight .0610 -relx .98 -rely .98 \ |
| 176 |
-anchor se |
| 177 |
helplink $w.revert trad options revert |
| 178 |
button $w.copy -text Copy -relief raised -command {getfile -grab \ |
| 179 |
-send copyopts -view view_txt -glob $myglob(rif)} |
| 180 |
place $w.copy -relwidth .1071 -relheight .0610 -relx .98 -rely .90 \ |
| 181 |
-anchor se |
| 182 |
helplink $w.copy trad options copy |
| 183 |
# Set focus |
| 184 |
focus $w.ambe |
| 185 |
bind $w.ambe <Return> "focus $w.opte" |
| 186 |
bind $w.opte <Return> "focus $w.repe" |
| 187 |
bind $w.repe <Return> "focus $w.ocoe" |
| 188 |
bind $w.ocoe <Return> "focus $w.mkie" |
| 189 |
bind $w.mkie <Return> "focus $w.rene" |
| 190 |
bind $w.rene <Return> "focus $w.pfie" |
| 191 |
bind $w.pfie <Return> {} |
| 192 |
} |