Revision: 55247
          http://sourceforge.net/p/brlcad/code/55247
Author:   bob1961
Date:     2013-04-25 16:51:51 +0000 (Thu, 25 Apr 2013)
Log Message:
-----------
Just a bit of cleanup.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/archer/ShaderEdit.tcl

Modified: brlcad/trunk/src/tclscripts/archer/ShaderEdit.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ShaderEdit.tcl   2013-04-25 16:50:01 UTC 
(rev 55246)
+++ brlcad/trunk/src/tclscripts/archer/ShaderEdit.tcl   2013-04-25 16:51:51 UTC 
(rev 55247)
@@ -349,8 +349,10 @@
        method updateGlassSpec {id}
 
        method validateDouble_light {id d}
+       method validateTarget_light {id d}
        method updateLightSpec {id {unused ""}}
 
+       method validate3TupleDoubles_camo {_id _t}
        method validateDouble_camo {id d}
        method validateRgb_camo {id rgb}
        method updateCamoSpec {id}
@@ -640,30 +642,30 @@
            -validatecommand [::itcl::code $this validateRgb_camo $id %P]
     } {}
 
-    itk_component add camoT1$id\L {
-       ::ttk::label $parent.camoT1$id\L \
-           -text "Threshold 1"
+    itk_component add camoDelta$id\L {
+       ::ttk::label $parent.camoDelta$id\L \
+           -text "Noise Delta"
     } {}
 
-    itk_component add camoT1$id\E {
-       ::ttk::entry $parent.camoT1$id\E \
+    itk_component add camoDelta$id\E {
+       ::ttk::entry $parent.camoDelta$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoT1($id)] \
+           -textvariable [::itcl::scope camoDelta($id)] \
            -validate key \
-           -validatecommand [::itcl::code $this validateDouble_camo $id %P]
+           -validatecommand [::itcl::code $this validate3TupleDoubles_camo $id 
%P]
     } {}
 
-    itk_component add camoT2$id\L {
-       ::ttk::label $parent.camoT2$id\L \
-           -text "Threshold 2"
+    itk_component add camoScale$id\L {
+       ::ttk::label $parent.camoScale$id\L \
+           -text "Noise Scale"
     } {}
 
-    itk_component add camoT2$id\E {
-       ::ttk::entry $parent.camoT2$id\E \
+    itk_component add camoScale$id\E {
+       ::ttk::entry $parent.camoScale$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoT2($id)] \
+           -textvariable [::itcl::scope camoScale($id)] \
            -validate key \
-           -validatecommand [::itcl::code $this validateDouble_camo $id %P]
+           -validatecommand [::itcl::code $this validate3TupleDoubles_camo $id 
%P]
     } {}
 
     itk_component add camoSize$id\L {
@@ -679,28 +681,28 @@
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
 
-    itk_component add camoScale$id\L {
-       ::ttk::label $parent.camoScale$id\L \
-           -text "Noise Scale"
+    itk_component add camoT1$id\L {
+       ::ttk::label $parent.camoT1$id\L \
+           -text "Threshold 1"
     } {}
 
-    itk_component add camoScale$id\E {
-       ::ttk::entry $parent.camoScale$id\E \
+    itk_component add camoT1$id\E {
+       ::ttk::entry $parent.camoT1$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoScale($id)] \
+           -textvariable [::itcl::scope camoT1($id)] \
            -validate key \
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
 
-    itk_component add camoDelta$id\L {
-       ::ttk::label $parent.camoDelta$id\L \
-           -text "Noise Delta"
+    itk_component add camoT2$id\L {
+       ::ttk::label $parent.camoT2$id\L \
+           -text "Threshold 2"
     } {}
 
-    itk_component add camoDelta$id\E {
-       ::ttk::entry $parent.camoDelta$id\E \
+    itk_component add camoT2$id\E {
+       ::ttk::entry $parent.camoT2$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoDelta($id)] \
+           -textvariable [::itcl::scope camoT2($id)] \
            -validate key \
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
@@ -718,28 +720,28 @@
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
 
-    itk_component add camoOctaves$id\L {
-       ::ttk::label $parent.camoOctaves$id\L \
-           -text "Octaves"
+    itk_component add camoHval$id\L {
+       ::ttk::label $parent.camoHval$id\L \
+           -text "H Value"
     } {}
 
-    itk_component add camoOctaves$id\E {
-       ::ttk::entry $parent.camoOctaves$id\E \
+    itk_component add camoHval$id\E {
+       ::ttk::entry $parent.camoHval$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoOctaves($id)] \
+           -textvariable [::itcl::scope camoHval($id)] \
            -validate key \
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
 
-    itk_component add camoHval$id\L {
-       ::ttk::label $parent.camoHval$id\L \
-           -text "H Value"
+    itk_component add camoOctaves$id\L {
+       ::ttk::label $parent.camoOctaves$id\L \
+           -text "Octaves"
     } {}
 
-    itk_component add camoHval$id\E {
-       ::ttk::entry $parent.camoHval$id\E \
+    itk_component add camoOctaves$id\E {
+       ::ttk::entry $parent.camoOctaves$id\E \
            -width 20 \
-           -textvariable [::itcl::scope camoHval($id)] \
+           -textvariable [::itcl::scope camoOctaves($id)] \
            -validate key \
            -validatecommand [::itcl::code $this validateDouble_camo $id %P]
     } {}
@@ -877,28 +879,28 @@
            -validatecommand [::itcl::code $this 
validateDouble_$shaderType($id) $id %P]
     } {}
 
-    itk_component add phongExt$id\L {
-       ::ttk::label $parent.phongExt$id\L \
-           -text "Extinction"
+    itk_component add phongShine$id\L {
+       ::ttk::label $parent.phongShine$id\L \
+           -text "Shininess"
     } {}
 
-    itk_component add phongExt$id\E {
-       ::ttk::entry $parent.phongExt$id\E \
+    itk_component add phongShine$id\E {
+       ::ttk::entry $parent.phongShine$id\E \
            -width 5 \
-           -textvariable [::itcl::scope phongExt($id)] \
+           -textvariable [::itcl::scope phongShine($id)] \
            -validate key \
            -validatecommand [::itcl::code $this 
validateDouble_$shaderType($id) $id %P]
     } {}
 
-    itk_component add phongShine$id\L {
-       ::ttk::label $parent.phongShine$id\L \
-           -text "Shininess"
+    itk_component add phongExt$id\L {
+       ::ttk::label $parent.phongExt$id\L \
+           -text "Extinction"
     } {}
 
-    itk_component add phongShine$id\E {
-       ::ttk::entry $parent.phongShine$id\E \
+    itk_component add phongExt$id\E {
+       ::ttk::entry $parent.phongExt$id\E \
            -width 5 \
-           -textvariable [::itcl::scope phongShine($id)] \
+           -textvariable [::itcl::scope phongExt($id)] \
            -validate key \
            -validatecommand [::itcl::code $this 
validateDouble_$shaderType($id) $id %P]
     } {}
@@ -995,7 +997,7 @@
            -width 5 \
            -textvariable [::itcl::scope lightTarget($id)] \
            -validate key \
-           -validatecommand [::itcl::code $this validateDouble_light $id %P]
+           -validatecommand [::itcl::code $this validateTarget_light $id %P]
     } {}
 
     itk_component add lightLumens$id\L {
@@ -2070,7 +2072,7 @@
            }
            "em" {
                if {$notEmptyVal && [string is double $val]} {
-                   set phongEm($id) $val
+                   set phongEmiss($id) $val
                }
            }
        }
@@ -2655,43 +2657,28 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec air]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "air [list $newSpec]"]
-       }
+    finalSpecSetting air $newSpec
+}
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
+::itcl::body ShaderEdit::validateDouble_light {id d} {
+    if {![::cadwidgets::Ged::validateDouble $d]} {
+       return 0
+    }
 
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec air]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "air [list $newSpec]"]
-           }
+    if {!$ignoreShaderSpec} {
+       after idle [::itcl::code $this updateLightSpec $id]
+    }
 
-           set spec "stack [list $spec]"
-       } else {
-           set spec "air [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "air [list $newSpec]"
-    }
+    return 1
 }
 
-::itcl::body ShaderEdit::validateDouble_light {id d} {
-    if {![::cadwidgets::Ged::validateDouble $d]} {
+::itcl::body ShaderEdit::validateTarget_light {_id _d} {
+    if {![::cadwidgets::Ged::validate3TupleDoubles $_d]} {
        return 0
     }
 
     if {!$ignoreShaderSpec} {
-       after idle [::itcl::code $this updateCloudSpec $id]
+       after idle [::itcl::code $this updateLightSpec $_id]
     }
 
     return 1
@@ -2756,35 +2743,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec light]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "light [list $newSpec]"]
-       }
+    finalSpecSetting light $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec light]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "light [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "light [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "light [list $newSpec]"
-    }
-
     if {$lightShadowRays($id) > 9} {
        set s 9
     } else {
@@ -2798,6 +2758,18 @@
     }
 }
 
+::itcl::body ShaderEdit::validate3TupleDoubles_camo {_id _t} {
+    if {![::cadwidgets::Ged::validate3TupleDoubles $_t]} {
+       return 0
+    }
+
+    if {!$ignoreShaderSpec} {
+       after idle [::itcl::code $this updateCamoSpec $_id]
+    }
+
+    return 1
+}
+
 ::itcl::body ShaderEdit::validateDouble_camo {id d} {
     if {![::cadwidgets::Ged::validateDouble $d]} {
        return 0
@@ -2913,35 +2885,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec camo]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "camo [list $newSpec]"]
-       }
+    finalSpecSetting camo $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec camo]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "camo [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "camo [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "camo [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -2998,35 +2943,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec checker]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "checker [list $newSpec]"]
-       }
+    finalSpecSetting checker $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec checker]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "checker [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "checker [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "checker [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3063,35 +2981,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec cloud]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "cloud [list $newSpec]"]
-       }
+    finalSpecSetting cloud $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec cloud]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "cloud [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "cloud [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "cloud [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3176,35 +3067,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec plastic]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "plastic [list $newSpec]"]
-       }
+    finalSpecSetting plastic $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec plastic]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "plastic [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "plastic [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "plastic [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3289,35 +3153,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec mirror]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "mirror [list $newSpec]"]
-       }
+    finalSpecSetting mirror $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec mirror]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "mirror [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "mirror [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "mirror [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3402,35 +3239,8 @@
        }
     }
 
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec glass]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i "glass [list $newSpec]"]
-       }
+    finalSpecSetting glass $newSpec
 
-       set shaderSpec "stack [list $spec]"
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec glass]
-           if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "glass [list $newSpec]"]
-           }
-
-           set spec "stack [list $spec]"
-       } else {
-           set spec "glass [list $newSpec]"
-       }
-
-       set shaderSpec "envmap [list $spec]"
-    } else {
-       set shaderSpec "glass [list $newSpec]"
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3474,35 +3284,8 @@
 }
 
 ::itcl::body ShaderEdit::updatePrjSpec {id} {
-    if {$shaderType(0) == "stack"} {
-       set spec [lindex $shaderSpec 1]
-       set i [lsearch -index 0 $spec prj]
-       if {$i != -1} {
-           set spec [lreplace $spec $i $i [list prj $projectionFile($id)]]
-       }
+    finalSpecSetting prj $projectionFile($id)
 
-       set shaderSpec [list stack $spec]
-    } elseif {$shaderType(0) == "envmap"} {
-       set spec [lindex $shaderSpec 1]
-       set subType [lindex $spec 0]
-       set subSpec [lindex $spec 1]
-
-       if {$subType == "stack"} {
-           set i [lsearch -index 0 $subSpec prj]
-           if {$i != -1} {
-               set subSpec [lreplace $subSpec $i $i [list prj 
$projectionFile($id)]]
-           }
-
-           set spec [list stack $subSpec]
-       } else {
-           set spec [list prj $projectionFile($id)]
-       }
-
-       set shaderSpec [list envmap $spec]
-    } else {
-       set shaderSpec [list prj $projectionFile($id)]
-    }
-
     if {$allowCallbacks && $itk_option(-shaderChangedCallback) != ""} {
        $itk_option(-shaderChangedCallback)
     }
@@ -3532,7 +3315,7 @@
 
 
 ::itcl::body ShaderEdit::validateScale_texture {_id _s _type} {
-    if {![::cadwidgets::Ged::validate2TupleDigits $_s]} {
+    if {![::cadwidgets::Ged::validate2TupleNonZeroDigits $_s]} {
        return 0
     }
 
@@ -3602,7 +3385,7 @@
        set spec [lindex $shaderSpec 1]
        set i [lsearch -index 0 $spec $_type]
        if {$i != -1} {
-           set spec [lreplace $spec $i $i "$_type [list $_newSpec]"]
+           set spec [lreplace $spec $i $i [list $_type $_newSpec]]
        }
 
        set shaderSpec "stack [list $spec]"
@@ -3614,7 +3397,7 @@
        if {$subType == "stack"} {
            set i [lsearch -index 0 $subSpec $_type]
            if {$i != -1} {
-               set spec [lreplace $subSpec $i $i "$_type [list $_newSpec]"]
+               set spec [lreplace $subSpec $i $i [list $_type $_newSpec]]
            }
 
            set spec "stack [list $spec]"

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to