Changeset 4381


Ignore:
Timestamp:
Jun 10, 2014, 10:49:12 PM (10 years ago)
Author:
ldelgass
Message:

opacity style setting fixes for VTK viewers (expect vtkvolumeviewer which does
not yet support the style setting). Also note that nanovisviewer (and
flowvisviewer?) have a regression which changes the -opacity style to [0,100]
instead of [0,1]

Location:
trunk/gui/scripts
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkglyphviewer.tcl

    r4344 r4381  
    118118    # heightmaps displayed.
    119119    private variable _currentColormap ""
    120     private variable _currentOpacity ""
    121120
    122121    private variable _dataset2style    ;# maps dataobj-component to transfunc
     
    21822181
    21832182    if { $_changed(glyphOpacity) } {
    2184         set style(-opacity) $_settings(glyphOpacity)
     2183        set style(-opacity) [expr $_settings(glyphOpacity) * 0.01]
    21852184    }
    21862185    if { $_changed(colormap) } {
     
    21902189        $itk_component(colormap) value $style(-colormap)
    21912190    }
    2192     set _currentOpacity $style(-opacity)
    21932191    SendCmd "glyphs add $style(-shape) $tag"
    21942192    set _settings(glyphShape) $style(-shape)
     
    22352233    SendCmd "glyphs linewidth $style(-linewidth) $tag"
    22362234    SendCmd "glyphs ptsize $style(-ptsize) $tag"
    2237     SendCmd "glyphs opacity $_currentOpacity $tag"
    2238     set _settings(glyphOpacity) $style(-opacity)
     2235    SendCmd "glyphs opacity $style(-opacity) $tag"
     2236    set _settings(glyphOpacity) [expr $style(-opacity) * 100.0]
    22392237    SendCmd "glyphs wireframe $style(-wireframe) $tag"
    22402238    set _settings(glyphWireframe) $style(-wireframe)
    2241     set _settings(glyphOpacity) [expr $style(-opacity) * 100.0]
    22422239}
    22432240
  • trunk/gui/scripts/vtkheightmapviewer.tcl

    r4344 r4381  
    123123    private variable _currentColormap ""
    124124    private variable _currentNumIsolines -1
    125     private variable _currentOpacity ""
    126125
    127126    private variable _maxScale 100;     # This is the # of times the x-axis
     
    22632262        -color BCGYR
    22642263        -levels 10
    2265         -opacity 100
     2264        -opacity 1.0
    22662265    }
    22672266    set stylelist [$dataobj style $comp]
     
    22792278
    22802279    if { $_changed(opacity) } {
    2281         set style(-opacity) $_settings(opacity)
     2280        set style(-opacity) [expr $_settings(opacity) * 0.01]
    22822281    }
    22832282    if { $_changed(numIsolines) } {
     
    22942293        AdjustSetting stretchToFit
    22952294    }
    2296     set _currentOpacity $style(-opacity)
    22972295    if { $_currentNumIsolines != $style(-levels) } {
    22982296        set _currentNumIsolines $style(-levels)
     
    23162314    SendCmd "heightmap isolines $_settings(isolinesVisible) $tag"
    23172315    SendCmd "heightmap surface $_settings(colormapVisible) $tag"
     2316    SendCmd "heightmap opacity $style(-opacity) $tag"
     2317    set _settings(opacity) [expr $style(-opacity) * 100.0]
    23182318}
    23192319
  • trunk/gui/scripts/vtkimageviewer.tcl

    r4344 r4381  
    118118    private variable _currentColormap ""
    119119    private variable _currentNumIsolines -1
    120     private variable _currentOpacity ""
    121120
    122121    private variable _maxScale 100;     # This is the # of times the x-axis
     
    20432042    array set style {
    20442043        -color none
    2045         -opacity 100
     2044        -opacity 1.0
    20462045    }
    20472046    set stylelist [$dataobj style $comp]
     
    20592058
    20602059    if { $_changed(opacity) } {
    2061         set style(-opacity) $_settings(opacity)
     2060        set style(-opacity) [expr $_settings(opacity) * 0.01]
    20622061    }
    20632062    if { $_changed(colormap) } {
     
    20712070        AdjustSetting stretchToFit
    20722071    }
    2073     set _currentOpacity $style(-opacity)
    20742072    SendCmd "outline add $tag"
    20752073    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     
    20792077    set color [$itk_component(backingcolor) value]
    20802078    SendCmd "image color [Color2RGB $color] $tag"
     2079    SendCmd "image opacity $style(-opacity) $tag"
     2080    set _settings(opacity) [expr $style(-opacity) * 100.0]
    20812081}
    20822082
  • trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r4352 r4381  
    120120    private variable _currentColormap ""
    121121    private variable _currentNumContours -1
    122     private variable _currentOpacity ""
    123122
    124123    private variable _dataset2style    ;# maps dataobj-component to transfunc
     
    238237        -isosurfacelighting             1
    239238        -isosurfaceopacity              60
    240         -isosurfaceoutline              0
    241239        -isosurfacevisible              1
    242240        -isosurfacewireframe            0
    243241        -legendvisible                  1
    244242        -numcontours                    10
     243        -outline                        0
    245244        -xaxisgrid                      0
    246245        -xcutplaneposition              50
     
    341340    $itk_component(contour) select
    342341    Rappture::Tooltip::for $itk_component(contour) \
    343         "Don't display the isosurface"
     342        "Hide the isosurface"
    344343    pack $itk_component(contour) -padx 2 -pady 2
    345344
     
    352351    }
    353352    Rappture::Tooltip::for $itk_component(cutplane) \
    354         "Show/Hide cutplanes"
     353        "Show the cutplanes"
    355354    pack $itk_component(cutplane) -padx 2 -pady 2
    356355
     
    969968    }
    970969    set _first ""
    971     SendCmd "contour3d visible 0"
     970    SendCmd "dataset visible 0"
    972971    foreach dataobj [get -objects] {
    973972        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
     
    10031002            lappend _obj2datasets($dataobj) $tag
    10041003            if { [info exists _obj2ovride($dataobj-raise)] } {
    1005                 # Setting dataset visible enables outline
    1006                 # and contour3d
    10071004                SendCmd "contour3d visible 1 $tag"
    10081005            }
     
    10391036        $itk_component(field) value $_curFldLabel
    10401037    }
    1041     InitSettings -cutplanesvisible -isosurfacevisible -isosurfaceoutline
     1038    InitSettings -cutplanesvisible -isosurfacevisible -outline
    10421039    if { $_reset } {
    10431040        # These are settings that rely on a dataset being loaded.
     
    14421439            SendCmd "contour3d edges $bool"
    14431440        }
    1444         "-isosurfaceoutline" {
     1441        "-outline" {
    14451442            set bool $_settings($what)
    14461443            SendCmd "outline visible $bool"
     
    16131610    checkbutton $inner.outline \
    16141611        -text "Outline" \
    1615         -variable [itcl::scope _settings(-isosurfaceoutline)] \
    1616         -command [itcl::code $this AdjustSetting -isosurfaceoutline] \
     1612        -variable [itcl::scope _settings(-outline)] \
     1613        -command [itcl::code $this AdjustSetting -outline] \
    16171614        -font "Arial 9"
    16181615
     
    21292126
    21302127    if { $_changed(-isosurfaceopacity) } {
    2131         set style(-opacity) $_settings(-isosurfaceopacity)
     2128        set style(-opacity) [expr $_settings(-isosurfaceopacity) * 0.01]
    21322129    }
    21332130    if { $_changed(-numcontours) } {
     
    21412138        $itk_component(colormap) value $style(-color)
    21422139    }
    2143     set _currentOpacity $style(-opacity)
    21442140    if { $_currentNumContours != $style(-levels) } {
    21452141        set _currentNumContours $style(-levels)
     
    21632159    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
    21642160    SendCmd "outline visible $style(-outline) $tag"
    2165     set _settings(-isosurfaceoutline) $style(-outline)
     2161    set _settings(-outline) $style(-outline)
    21662162    set _settings(-isosurfaceedges) $style(-edges)
    21672163    #SendCmd "contour3d color [Color2RGB $settings(-color)] $tag"
     
    21702166    SendCmd "contour3d linecolor [Color2RGB $style(-edgecolor)] $tag"
    21712167    SendCmd "contour3d linewidth $style(-linewidth) $tag"
    2172     SendCmd "contour3d opacity $_currentOpacity $tag"
    2173     set _settings(-isosurfaceopacity) $style(-opacity)
     2168    SendCmd "contour3d opacity $style(-opacity) $tag"
     2169    set _settings(-isosurfaceopacity) [expr $style(-opacity) * 100.0]
    21742170    SetCurrentColormap $style(-color)
    21752171    SendCmd "contour3d wireframe $style(-wireframe) $tag"
    21762172    set _settings(-isosurfacewireframe) $style(-wireframe)
    2177     set _settings(-isosurfaceopacity) [expr $style(-opacity) * 100.0]
    21782173}
    21792174
  • trunk/gui/scripts/vtksurfaceviewer.tcl

    r4344 r4381  
    117117    private variable _currentColormap ""
    118118    private variable _currentNumContours -1
    119     private variable _currentOpacity ""
    120119
    121120    private variable _dataset2style    ;# maps dataobj-component to transfunc
     
    19061905
    19071906    if { $_changed(-surfaceopacity) } {
    1908         set style(-opacity) $_settings(-surfaceopacity)
     1907        set style(-opacity) [expr $_settings(-surfaceopacity) * 0.01]
    19091908    }
    19101909    if { $_changed(-numcontours) } {
     
    19181917        $itk_component(colormap) value $style(-color)
    19191918    }
    1920     set _currentOpacity $style(-opacity)
    19211919    if { $_currentNumContours != $style(-levels) } {
    19221920        set _currentNumContours $style(-levels)
     
    19441942    SendCmd "polydata linecolor [Color2RGB $style(-edgecolor)] $tag"
    19451943    SendCmd "polydata linewidth $style(-linewidth) $tag"
    1946     SendCmd "polydata opacity $_currentOpacity $tag"
    1947     set _settings(-surfaceopacity) $style(-opacity)
     1944    SendCmd "polydata opacity $style(-opacity) $tag"
     1945    set _settings(-surfaceopacity) [expr $style(-opacity) * 100.0]
    19481946    SetCurrentColormap $style(-color)
    19491947    SendCmd "polydata wireframe $style(-wireframe) $tag"
    19501948    set _settings(-surfacewireframe) $style(-wireframe)
    1951     set _settings(-surfaceopacity) [expr $style(-opacity) * 100.0]
    19521949}
    19531950
Note: See TracChangeset for help on using the changeset viewer.