Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2386 - in trunk: Model/Materials SwigInterface scenes/csafe/python scenes/csafe/src


Chronological Thread 
  • From:
  • To:
  • Subject: [Manta] r2386 - in trunk: Model/Materials SwigInterface scenes/csafe/python scenes/csafe/src
  • Date: Mon, 16 Mar 2009 05:28:21 -0600 (MDT)

Author: brownlee
Date: Mon Mar 16 05:28:17 2009
New Revision: 2386

Added:
   trunk/SwigInterface/CSpin.py
Modified:
   trunk/Model/Materials/Volume.cc
   trunk/SwigInterface/BackgroundFrame.py
   trunk/SwigInterface/CameraFrame.py
   trunk/SwigInterface/FloatSpin.py
   trunk/SwigInterface/LightFrame.py
   trunk/SwigInterface/MantaCameraPath.py
   trunk/SwigInterface/MantaCapture.py
   trunk/SwigInterface/ThreadsFrame.py
   trunk/scenes/csafe/python/Configuration.py
   trunk/scenes/csafe/python/Histogram.py
   trunk/scenes/csafe/python/SceneInfo.py
   trunk/scenes/csafe/python/SceneMenus.py
   trunk/scenes/csafe/python/TransferF.py
   trunk/scenes/csafe/python/csafe_scene.py
   trunk/scenes/csafe/src/CDTest.h
Log:
M    scenes/csafe/python/SceneInfo.py
  adding additional state variables
M    scenes/csafe/python/TransferF.py
  adding check if there is no histogram in the scene
M    scenes/csafe/python/Histogram.py
  fixing setting color min max values in measurementframe
M    scenes/csafe/python/csafe_scene.py
  disable forward/backward buttons correctly
  disable UDA loading as people have been having trouble with it
  changing location of about/add/remove menu options
  correctly enabling generating scene if nrrd files specified
  automatically add histograms from nrrd file metadata if available
  adding range data to slider
  update slider as animation plays
M    scenes/csafe/python/SceneMenus.py
  added option to automatically add histograms from nrrd files
  added esc to close window option
M    scenes/csafe/python/Configuration.py
  no longer add default transfer functions
  added try, except blocks over reading of data
M    scenes/csafe/src/CDTest.h
  added keyvalue pair accessors
  added frame accessors
M    SwigInterface/BackgroundFrame.py
  added esc to close window option

M    SwigInterface/FloatSpin.py
  change background color to red if user has typed a value in to
indicate it hasn't changed until they hit enter
M    SwigInterface/CameraFrame.py
  added esc to close window option

M    SwigInterface/ThreadsFrame.py
  added esc to close
  added a CSPin object
A    SwigInterface/CSpin.py
  custom spinctrl that changes color to denote that a typed value hasn't
been set yet
M    SwigInterface/LightFrame.py
  added esc to close window option

M    SwigInterface/MantaCapture.py
  added esc to close window option

M    SwigInterface/MantaCameraPath.py
  added esc to close window option

M    Model/Materials/Volume.cc
  fixing rainbow colormap




Modified: trunk/Model/Materials/Volume.cc
==============================================================================
--- trunk/Model/Materials/Volume.cc     (original)
+++ trunk/Model/Materials/Volume.cc     Mon Mar 16 05:28:17 2009
@@ -48,18 +48,18 @@
     case Rainbow:
       {
         float p = 1.0f/11.0f;
-        _slices.push_back(ColorSlice(p*0, RGBAColor(Color(RGB(1, 0, 0)), 
1)));
-        _slices.push_back(ColorSlice(p*1, RGBAColor(Color(RGB(1, 0.40000001, 
0)), 1)));
-        _slices.push_back(ColorSlice(p*2, RGBAColor(Color(RGB(0, 0.80000001, 
0)), 1)));
-        _slices.push_back(ColorSlice(p*3, RGBAColor(Color(RGB(1, 0.91764706, 
0)), 1)));
-        _slices.push_back(ColorSlice(p*4, RGBAColor(Color(RGB(0.80000001, 1, 
0)), 1)));
-        _slices.push_back(ColorSlice(p*5, RGBAColor(Color(RGB(0.40000001, 1, 
0)), 1)));
-        _slices.push_back(ColorSlice(p*6, RGBAColor(Color(RGB(0, 1, 0)), 
1)));
-        _slices.push_back(ColorSlice(p*7, RGBAColor(Color(RGB(0, 1, 
0.40000001)), 1)));
-        _slices.push_back(ColorSlice(p*8, RGBAColor(Color(RGB(0, 1, 
0.80000001)), 1)));
-        _slices.push_back(ColorSlice(p*9, RGBAColor(Color(RGB(0, 0.80000001, 
1)), 1)));
+        _slices.push_back(ColorSlice(p*11, RGBAColor(Color(RGB(0, 0, 1)), 
1)));
         _slices.push_back(ColorSlice(p*10, RGBAColor(Color(RGB(0, 
0.40000001, 1)), 1)));
-        _slices.push_back(ColorSlice(p*11, RGBAColor(Color(RGB(1, 0, 0)), 
1)));
+        _slices.push_back(ColorSlice(p*9, RGBAColor(Color(RGB(0, 0.80000001, 
1)), 1)));
+        _slices.push_back(ColorSlice(p*8, RGBAColor(Color(RGB(0, 1, 
0.80000001)), 1)));
+        _slices.push_back(ColorSlice(p*7, RGBAColor(Color(RGB(0, 1, 
0.40000001)), 1)));
+        _slices.push_back(ColorSlice(p*6, RGBAColor(Color(RGB(0, 1, 0)), 
1)));
+        _slices.push_back(ColorSlice(p*5, RGBAColor(Color(RGB(0.40000001, 1, 
0)), 1)));
+        _slices.push_back(ColorSlice(p*4, RGBAColor(Color(RGB(0.80000001, 1, 
0)), 1)));
+        _slices.push_back(ColorSlice(p*3, RGBAColor(Color(RGB(1, 0.91764706, 
0)), 1)));
+        _slices.push_back(ColorSlice(p*2, RGBAColor(Color(RGB(1, 0.80000001, 
0)), 1)));
+        _slices.push_back(ColorSlice(p*1, RGBAColor(Color(RGB(1, 0.40000001, 
0)), 1)));
+        _slices.push_back(ColorSlice(p*0, RGBAColor(Color(RGB(1, 0, 0)), 
1)));
         break;
       }
     case InvBlackBody:

Modified: trunk/SwigInterface/BackgroundFrame.py
==============================================================================
--- trunk/SwigInterface/BackgroundFrame.py      (original)
+++ trunk/SwigInterface/BackgroundFrame.py      Mon Mar 16 05:28:17 2009
@@ -52,6 +52,14 @@
         panel.SetupScrolling()
         panel.Refresh()
         self.Refresh()
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+        panel.SetFocus()
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
         
     def addSpinner(self, where, value, id=wx.ID_ANY):
         floatspin = FS.FloatSpin(where, id,

Added: trunk/SwigInterface/CSpin.py
==============================================================================
--- (empty file)
+++ trunk/SwigInterface/CSpin.py        Mon Mar 16 05:28:17 2009
@@ -0,0 +1,21 @@
+import wx;
+
+class CSpin(wx.SpinCtrl):
+    def __init__(self, parent, id=-1, label="", size=wx.DefaultSize, 
pos=wx.DefaultPosition, value= 0, min_val=0, max_val=100):
+        wx.SpinCtrl.__init__(self,parent,id,label, size)
+        self.SetRange(min_val,max_val)
+        self.SetValue(value)
+        self.Bind(wx.EVT_TEXT, self.OnText)
+        self.Bind(wx.EVT_SPINCTRL, self.OnSpin)
+        self.color_set = False
+
+    def OnText(self, evt):
+        if self.color_set:  
+          self.SetBackgroundColour(wx.Colour(220,220,220))
+        self.color_set = True
+        evt.Skip()
+
+    def OnSpin(self, evt):
+        self.SetBackgroundColour(wx.Colour(255,255,255))
+        evt.Skip()
+        

Modified: trunk/SwigInterface/CameraFrame.py
==============================================================================
--- trunk/SwigInterface/CameraFrame.py  (original)
+++ trunk/SwigInterface/CameraFrame.py  Mon Mar 16 05:28:17 2009
@@ -16,7 +16,8 @@
 class CameraFrame(wx.Frame):
     def __init__(self, parent, engine):
         wx.Frame.__init__(self, parent=parent, title="Camera")
-        
+        panel = wx.Panel(self,-1)        
+       
         data = engine.getCamera(0).getBasicCameraData()
         eye = data.eye
         lookat = data.lookat
@@ -30,71 +31,72 @@
         vsizer = wx.BoxSizer(wx.VERTICAL)
         gsizer = wx.GridBagSizer(6,4);
         
-        self.channelST = wx.StaticText(self, -1, "Channel: ")
-        self.channelSP = wx.SpinCtrl(self, -1, "", (30,50))
+        self.channelST = wx.StaticText(panel, -1, "Channel: ")
+        self.channelSP = wx.SpinCtrl(panel, -1, "", (30,50))
         self.channelSP.SetRange(0,100)
         self.channelSP.SetValue(0)
         gsizer.Add(self.channelST, (0,0))
         gsizer.Add(self.channelSP, (0,1))
 
-        self.eyeST = wx.StaticText(self, -1, "eye: " )
-        self.eyeXSP = self.addSpinner(self, eye.x())
-        self.eyeYSP = self.addSpinner(self, eye.y())
-        self.eyeZSP = self.addSpinner(self, eye.z())
+        self.eyeST = wx.StaticText(panel, -1, "eye: " )
+        self.eyeXSP = self.addSpinner(panel, eye.x())
+        self.eyeYSP = self.addSpinner(panel, eye.y())
+        self.eyeZSP = self.addSpinner(panel, eye.z())
         gsizer.Add(self.eyeST, (1,0))
         gsizer.Add(self.eyeXSP, (1,1))
         gsizer.Add(self.eyeYSP, (1,2))
         gsizer.Add(self.eyeZSP, (1,3))
         
-        self.lookatST =  wx.StaticText(self, -1, "lookat: ")
-        self.lookXSP = self.addSpinner(self, lookat.x())
-        self.lookYSP = self.addSpinner(self, lookat.y())
-        self.lookZSP = self.addSpinner(self,lookat.z())
-        # self.lookZTCL = wx.TextCtrl(self, -1, str(lookat.z()), 
size=(125,-1))        
+        self.lookatST =  wx.StaticText(panel, -1, "lookat: ")
+        self.lookXSP = self.addSpinner(panel, lookat.x())
+        self.lookYSP = self.addSpinner(panel, lookat.y())
+        self.lookZSP = self.addSpinner(panel, lookat.z())
+        # self.lookZTCL = wx.TextCtrl(panel, -1, str(lookat.z()), 
size=(125,-1))       
         gsizer.Add(self.lookatST, (2,0))
         gsizer.Add(self.lookXSP, (2,1))
         gsizer.Add(self.lookYSP, (2,2))
         gsizer.Add(self.lookZSP, (2,3))
         
-        self.upST = wx.StaticText(self, -1, "up: ")
-        self.upXSP = self.addSpinner(self, up.x())
-        self.upYSP = self.addSpinner(self, up.y())
-        self.upZSP = self.addSpinner(self, up.z())
+        self.upST = wx.StaticText(panel, -1, "up: ")
+        self.upXSP = self.addSpinner(panel, up.x())
+        self.upYSP = self.addSpinner(panel, up.y())
+        self.upZSP = self.addSpinner(panel, up.z())
         gsizer.Add(self.upST, (3,0))
         gsizer.Add(self.upXSP, (3,1))
         gsizer.Add(self.upYSP, (3,2))
         gsizer.Add(self.upZSP, (3,3))
         
-        gsizer.Add(wx.StaticText(self, -1, "fov horiz: "), (4,0))
-        self.fovXSP = self.addSpinner(self, hfov)
+        gsizer.Add(wx.StaticText(panel, -1, "fov horiz: "), (4,0))
+        self.fovXSP = self.addSpinner(panel, hfov)
         gsizer.Add(self.fovXSP, (4,1))
 
-        gsizer.Add(wx.StaticText(self, -1, "vert: "), (4,2))
-        self.fovYSP = self.addSpinner(self, vfov)
+        gsizer.Add(wx.StaticText(panel, -1, "vert: "), (4,2))
+        self.fovYSP = self.addSpinner(panel, vfov)
         gsizer.Add(self.fovYSP, (4,3))
         vsizer.Add(gsizer, 0, wx.ALIGN_CENTER )
 
-        vsizer.Add(wx.StaticText(self,-1,"Enter camera description:"), 0, 
wx.ALIGN_LEFT );
+        vsizer.Add(wx.StaticText(panel,-1,"Enter camera description:"), 0, 
wx.ALIGN_LEFT );
 
-        self.stringTCL = wx.TextCtrl(self, -1, "camera string", 
size=(-1,50), style=wx.TE_MULTILINE)
+        self.stringTCL = wx.TextCtrl(panel, -1, "camera string", 
size=(-1,50), style=wx.TE_MULTILINE)
         self.ComputeString()
-        self.stringB = wx.Button(self, -1, "Set")
+        self.stringB = wx.Button(panel, -1, "Set")
         vsizer.Add(self.stringTCL, 1, wx.EXPAND )
         vsizer.Add(self.stringB, 0, wx.ALIGN_RIGHT)
 
         hsizer = wx.BoxSizer( wx.HORIZONTAL );
-        self.okButton = wx.Button(self, wx.ID_OK)
-        self.applyButton = wx.Button(self, wx.ID_APPLY)
+        self.okButton = wx.Button(panel, wx.ID_OK)
+        self.applyButton = wx.Button(panel, wx.ID_APPLY)
         hsizer.Add(self.okButton, 0, wx.ALIGN_CENTER)
         hsizer.Add(self.applyButton, 0, wx.ALIGN_CENTER)
         
-        closeButton = wx.Button(self, wx.ID_CLOSE)
+        closeButton = wx.Button(panel, wx.ID_CLOSE)
         hsizer.Add(closeButton, 0, wx.ALIGN_CENTER|wx.ALL, 0)
         self.Bind(wx.EVT_BUTTON, self.OnCloseWindow, closeButton)
-        vsizer.Add(hsizer, 0, wx.ALIGN_CENTER);
-
+        vsizer.Add(hsizer, 0, wx.ALIGN_CENTER|wx.EXPAND);
 
-        self.SetSizerAndFit(vsizer);
+        #vsizer.Add(panel,0,wx.EXPAND)
+        panel.SetSizerAndFit(vsizer);
+        self.SetClientSize(panel.GetSize())
         
         self.Bind(wx.EVT_BUTTON, self.OnClickOK, self.okButton)        
         self.Bind(wx.EVT_BUTTON, self.OnClickApply, self.applyButton)
@@ -104,6 +106,16 @@
         # Double bind mouse events in the Manta canvas.
         EventManager.Register( self.OnManipulation, wx.EVT_MOTION, 
self.parent.canvas );
         EventManager.Register( self.OnManipulation, wx.EVT_MOUSEWHEEL, 
self.parent.canvas );
+
+        self.SetAutoLayout(True)
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+        panel.SetFocus()
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
 
     def OnManipulation(self,event):
 

Modified: trunk/SwigInterface/FloatSpin.py
==============================================================================
--- trunk/SwigInterface/FloatSpin.py    (original)
+++ trunk/SwigInterface/FloatSpin.py    Mon Mar 16 05:28:17 2009
@@ -205,7 +205,6 @@
 
     def OnChar(self, event):
         """ Handles The wx.EVT_CHAR Event By Passing It To FloatSpin. """
-
         if self._parent:
             self._parent.OnChar(event)
 
@@ -323,12 +322,16 @@
         self._textctrl.SetValue(strs)
 
         self.Bind(wx.EVT_SPIN_UP, self.OnSpinUp)
+        self.Bind(wx.EVT_CHAR, self.OnChar)
+        self.Bind(wx.EVT_TEXT, self.OnText)
         self.Bind(wx.EVT_SPIN_DOWN, self.OnSpinDown)
         self.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
         self.Bind(wx.EVT_SET_FOCUS, self.OnFocus)
         self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
         self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
         self._spinbutton.Bind(wx.EVT_LEFT_DOWN, self.OnSpinMouseDown)
+        self.SetBackgroundColour(wx.Colour(255,255,255))
+        self.color_set = 0
         
 
     def OnDestroy(self, event):
@@ -385,6 +388,7 @@
         eventOut.SetPosition(int(value + 0.5))
         eventOut.SetEventObject(self)
         self.GetEventHandler().ProcessEvent(eventOut)
+        self.SetBackgroundColour(wx.Colour(255,255,255))
 
 
     def OnSpinMouseDown(self, event):
@@ -435,9 +439,13 @@
         event.Skip()
 
 
+    def OnText(self, event):
+        if self.color_set > 1:  
+          self.SetBackgroundColour(wx.Colour(128,0,0))
+        self.color_set += 1
+        
     def OnChar(self, event):
         """ Handles The wx.EVT_CHAR For The Underline wx.TextCtrl. """
-
         modifier = FixedPoint(str(1.0), 20)
         if event.m_shiftDown:
             modifier = modifier*2.0
@@ -630,11 +638,11 @@
     
     def SetIncrement(self, increment):
         """ Sets The Increment For Every EVT_FLOATSPIN Event. """
-        sci_not = abs(self._value)/pow(10.0,int(math.log(abs(self._value))))
-        print "val: " + str(self._value)
-        print "sci_not: " + str(sci_not)
-        print "check: " + str(abs(self._value)/10.0**self._digits/sci_not)
-        if increment < abs(self._value)/(10.0**self._digits)/sci_not:
+        if (self._value == 0.0):
+           sci_not = 1.0
+        else:
+          sci_not = 
abs(self._value)/pow(10.0,int(math.log(abs(self._value))))
+          if increment < abs(self._value)/(10.0**self._digits)/sci_not:
             raise "\nERROR: Increment Should Be Greater Or Equal To 
value/(10**digits)."
         
         self._increment = FixedPoint(str(increment), 20)

Modified: trunk/SwigInterface/LightFrame.py
==============================================================================
--- trunk/SwigInterface/LightFrame.py   (original)
+++ trunk/SwigInterface/LightFrame.py   Mon Mar 16 05:28:17 2009
@@ -20,23 +20,23 @@
 
         self.engine = engine
         self.colorButtonRefs = {}
+        panel= wx.Panel(self, -1)
 
         vsizer = wx.BoxSizer( wx.VERTICAL );
 
         hsizer = wx.BoxSizer( wx.HORIZONTAL );
-        hsizer.Add( wx.StaticText( self, -1, "Changes applied interactively" 
), 0, wx.ALIGN_CENTER );
+        hsizer.Add( wx.StaticText( panel, -1, "Changes applied 
interactively" ), 0, wx.ALIGN_CENTER );
         vsizer.Add( hsizer );
 
-        panel= wx.Panel(self, -1)
         gbs = wx.GridBagSizer(5,7)
         
         lights = engine.getScene().getLights()
         for i in range(lights.numLights()):
             gbs.Add( self.addLight(panel, lights.getLight(i)), (i, 0), 
flag=wx.ALIGN_CENTER_VERTICAL )
 
-        mlteButton = wx.Button(self, -1, "Move Light To Eye")
+        mlteButton = wx.Button(panel, -1, "Move Light To Eye")
 
-        closeButton = wx.Button(self, -1, "Close")
+        closeButton = wx.Button(panel, -1, "Close")
         panel.SetSizer(gbs)
 
         vsizer.Add( panel, 0, wx.EXPAND );
@@ -48,9 +48,17 @@
         vsizer.Add( hsizer, 0, wx.ALIGN_CENTER );
         self.SetSizerAndFit( vsizer );
 
-        self.Bind( wx.EVT_BUTTON, self.MoveLightToEye, mlteButton)
-        self.Bind( wx.EVT_BUTTON, self.OnClose, closeButton)
-        self.Bind( wx.EVT_CLOSE,  self.OnClose )
+        panel.Bind( wx.EVT_BUTTON, self.MoveLightToEye, mlteButton)
+        panel.Bind( wx.EVT_BUTTON, self.OnClose, closeButton)
+        panel.Bind( wx.EVT_CLOSE,  self.OnClose )
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+        panel.SetFocus()
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
 
     def MoveLightToEye(self, event):
         point_light = PointLight.fromLight( 
self.engine.getScene().getLights().getLight(0) )

Modified: trunk/SwigInterface/MantaCameraPath.py
==============================================================================
--- trunk/SwigInterface/MantaCameraPath.py      (original)
+++ trunk/SwigInterface/MantaCameraPath.py      Mon Mar 16 05:28:17 2009
@@ -554,6 +554,14 @@
         self.SetClientSize(self.panel.GetSize()+(0,50))
 
         self.Bind(wx.EVT_CLOSE,  self.OnCloseWindow)
+        panel.SetFocus()
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
 
 
 

Modified: trunk/SwigInterface/MantaCapture.py
==============================================================================
--- trunk/SwigInterface/MantaCapture.py (original)
+++ trunk/SwigInterface/MantaCapture.py Mon Mar 16 05:28:17 2009
@@ -182,6 +182,14 @@
         self.Bind(wx.EVT_BUTTON, self.OnStopButton,    self.stop_button)
         self.Bind(wx.EVT_BUTTON, self.OnCaptureButton, self.capture_button)
         self.Bind(wx.EVT_CLOSE,  self.OnCloseWindow)
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+        panel.SetFocus()
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
 
     def OnStartButton( self, event ):
 

Modified: trunk/SwigInterface/ThreadsFrame.py
==============================================================================
--- trunk/SwigInterface/ThreadsFrame.py (original)
+++ trunk/SwigInterface/ThreadsFrame.py Mon Mar 16 05:28:17 2009
@@ -1,6 +1,7 @@
 import wx;
 import re;
 
+import CSpin
 from manta import *
 from pycallback import *
 from wx.lib.evtmgr import eventManager as EventManager;
@@ -10,7 +11,8 @@
 class ThreadsFrame(wx.Frame):
     def __init__(self, parent, engine):
         wx.Frame.__init__(self, parent=parent, title="Threads")
-
+        
+        panel = wx.Panel(self,-1)
         self.engine = engine;
         self.parent = parent;
 
@@ -18,20 +20,30 @@
 
         # Rendering threads.
         hsizer = wx.BoxSizer(wx.HORIZONTAL);
-        hsizer.Add(wx.StaticText(self,-1,"Rendering threads: "), 0, 
wx.ALIGN_CENTER);
-        spin = wx.SpinCtrl(self,-1, "", (30,50));
+        hsizer.Add(wx.StaticText(panel,-1,"Rendering threads: "), 0, 
wx.ALIGN_CENTER);
+        spin = CSpin.CSpin(panel,-1, "", (30,50));
         spin.SetRange(1,1024);
         spin.SetValue(engine.numWorkers().value)
         self.Bind(wx.EVT_SPINCTRL, self.OnThreadsSpin, spin )
         hsizer.Add(spin, 0, wx.ALIGN_CENTER );
-        hsizer.Add(wx.StaticText(self,-1,"(%d cores)" % 
Thread.numProcessors()), 0, wx.ALIGN_CENTER);
+        hsizer.Add(wx.StaticText(panel,-1,"(%d cores)" % 
Thread.numProcessors()), 0, wx.ALIGN_CENTER);
         vsizer.Add(hsizer);
 
         self.Bind( wx.EVT_CLOSE, self.OnClose )
 
         # Rendering time.
         
-        self.SetSizerAndFit( vsizer );
+        panel.SetSizerAndFit( vsizer );
+        self.SetClientSize(panel.GetSize())
+        panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+        panel.SetFocus()
+        self.color_set = 0
+
+    def OnKeyDown(self, evt):
+        keycode = evt.GetKeyCode()
+        if (keycode == wx.WXK_ESCAPE):
+           self.Show(False)
+        evt.Skip()
 
     # Change the number of workers.
     def OnThreadsSpin(self,event):

Modified: trunk/scenes/csafe/python/Configuration.py
==============================================================================
--- trunk/scenes/csafe/python/Configuration.py  (original)
+++ trunk/scenes/csafe/python/Configuration.py  Mon Mar 16 05:28:17 2009
@@ -92,7 +92,7 @@
     f.close()
 
 def ReadConfiguration(scene, filename):
-
+    scene.readConfiguration = True
     try:
         f = open(filename, 'r')
     except IOError, (errno, strerror):
@@ -101,124 +101,126 @@
         print ""
         os._exit( -1 ) # We're done... force exit.
 
-    ### Clear old values
-    # for i in range(len(scene.frame.transferFunctions)):
-    #    scene.frame.transferFunctions[i].Destroy()
-    scene.frame.transferFunctions = []
-    for i in range(len(scene.frame.histoGroups)):
-        scene.frame.histoGroups[i].Destroy()
-    scene.frame.histoGroups = []
-    scene.nrrdFiles = []
-    scene.nrrdFiles2 = []
-
-    ### Read in new values
-    lines = f.readlines()
-    currentHistogramIndex = 0
-    currentParticleHistogramIndex = 0
-    for i in range(len(lines)):
-        ##### Transfer Function####
-        if lines[i].find("[Transfer Function]") != -1:
-            i+=1
-            name = lines[i].strip();     i += 1
-            id = int(lines[i].strip());  i += 1
-            num = int(lines[i].strip()); i += 1
-            colors = []
-            slices = manta_new(vector_ColorSlice())
-            for j in range(num):
-                line = lines[i].split(); i += 1
-                pos = float(line[0])
-                r = float(line[1])
-                g = float(line[2])
-                b = float(line[3])
-                a = float(line[4])
-                #colors.append( (pos, r, g, b, a) )
-                slices.push_back(ColorSlice(pos, 
RGBAColor(Color(RGBColor(r,g,b)), a)))
-                
-            
scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, colors, 
id, name, manta_new(RGBAColorMap(slices))))
-
-        #### Current Histogram ####
-        elif lines[i].find("[currentHistogram]") != -1:
-            i +=1
-            currentHistogramIndex = int( lines[i].strip() )
-
-        #### Current Histogram ####
-        elif lines[i].find("[currentParticleHistogram]") != -1:
-            i +=1
-            currentParticleHistogramIndex = int( lines[i].strip() )
-
-        #### Histogram ####
-        elif lines[i].find("[Histogram]") != -1:
-            i +=1
-            name = lines[i].strip();               i += 1
-            index = int(float(lines[i].strip()));  i += 1
-            group = int(float(lines[i].strip()));  i += 1
-            zoomInto = lines[i].split();           i += 1
-            zoomIntoMin = float(zoomInto[0])
-            zoomIntoMax = float(zoomInto[1])
-            cropDisplay = lines[i].split();        i += 1
-            cropDisplayMin = float(cropDisplay[0])
-            cropDisplayMax = float(cropDisplay[1])
-            cropColor = lines[i].split();          i += 1
-            cropColorMin = float(cropColor[0])
-            cropColorMax = float(cropColor[1])
-            transferFID = int(lines[i].strip())
-            histValues1 = []
-            for i in range(scene.histogramBuckets):
-                histValues1.append(5.0)
-            histoGroup = Histogram.HistogramGroup(scene.frame.panel, scene, 
index, name, transferFID)
-            histoGroup.SetBackgroundColour(wx.Colour(90,90,90))
-            histoGroup.group = group
-
-            if( len( scene.frame.histoGroups ) == currentHistogramIndex ) :
-                scene.currentHistogram = histoGroup
-
-            if( len( scene.frame.histoGroups ) == 
currentParticleHistogramIndex ) :
-                scene.currentParticleHistogram = histoGroup
-
-            scene.frame.histoGroups.append(histoGroup)
-
-            #TODO: read these in
-            if (group == 1):
-                
scene.test.setVolCMap(scene.frame.transferFunctions[transferFID].cmap)
-                
scene.frame.transferFunctions[transferFID].cmap.scaleAlphas(.00125)
-            # if (group == 0):
-            #     scene.test.setClipMinMax(index, cropDisplayMin, 
cropDisplayMax)
-            #     scene.test.setSphereCMinMax(index, cropColorMin, 
cropColorMax)
-            # else:
-            #     scene.test.setVolCMinMax(cropColorMin, cropColorMax)
-
-            print "sending values: " + str(zoomIntoMin) + " " + 
str(zoomIntoMax) + " " + str(cropDisplayMin) + " " + str(cropDisplayMax) + " 
" + str(cropColorMin) + " " + str(cropColorMax)
-            
-            histoGroup.SendValues(zoomIntoMin, zoomIntoMax, cropDisplayMin, 
cropDisplayMax, cropColorMin, cropColorMax)
+    try:
 
-        ##### Eye (Camera) ####
-        elif lines[i].find("[Eye]") != -1:
-            i += 1
-            line = lines[i].split();                 i += 1
-            x = float(line[0])
-            y = float(line[1])
-            z = float(line[2])
-            eye = manta_new( Vector(x, y, z) )
-
-            line = lines[i].split();                 i += 1
-            x = float(line[0])
-            y = float(line[1])
-            z = float(line[2])
-            lookat = manta_new( Vector(x, y, z) )
-
-            line = lines[i].split();                 i += 1
-            x = float(line[0])
-            y = float(line[1])
-            z = float(line[2])
-            up     = manta_new( Vector(x, y, z) )
-
-            line = lines[i].split()
-            h = float(line[0]) # h-fov
-            v = float(line[1]) # v-fov
-
-            cbArgs = ( manta_new( BasicCameraData( eye, lookat, up, h, v ) 
), )
-            scene.engine.addTransaction( "Set basic camera data",
-                                         manta_new( createMantaTransaction( 
scene.engine.getCamera(0).setBasicCameraData,
+        ### Clear old values
+        # for i in range(len(scene.frame.transferFunctions)):
+        #    scene.frame.transferFunctions[i].Destroy()
+        scene.frame.transferFunctions = []
+        for i in range(len(scene.frame.histoGroups)):
+            scene.frame.histoGroups[i].Destroy()
+        scene.frame.histoGroups = []
+        scene.nrrdFiles = []
+        scene.nrrdFiles2 = []
+
+        ### Read in new values
+        lines = f.readlines()
+        currentHistogramIndex = 0
+        currentParticleHistogramIndex = 0
+        for i in range(len(lines)):
+            ##### Transfer Function####
+            if lines[i].find("[Transfer Function]") != -1:
+                i+=1
+                name = lines[i].strip();     i += 1
+                id = int(lines[i].strip());  i += 1
+                num = int(lines[i].strip()); i += 1
+                colors = []
+                slices = manta_new(vector_ColorSlice())
+                for j in range(num):
+                    line = lines[i].split(); i += 1
+                    pos = float(line[0])
+                    r = float(line[1])
+                    g = float(line[2])
+                    b = float(line[3])
+                    a = float(line[4])
+                    #colors.append( (pos, r, g, b, a) )
+                    slices.push_back(ColorSlice(pos, 
RGBAColor(Color(RGBColor(r,g,b)), a)))
+
+                
scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, colors, 
id, name, manta_new(RGBAColorMap(slices))))
+
+            #### Current Histogram ####
+            elif lines[i].find("[currentHistogram]") != -1:
+                i +=1
+                currentHistogramIndex = int( lines[i].strip() )
+
+            #### Current Histogram ####
+            elif lines[i].find("[currentParticleHistogram]") != -1:
+                i +=1
+                currentParticleHistogramIndex = int( lines[i].strip() )
+
+            #### Histogram ####
+            elif lines[i].find("[Histogram]") != -1:
+                i +=1
+                name = lines[i].strip();               i += 1
+                index = int(float(lines[i].strip()));  i += 1
+                group = int(float(lines[i].strip()));  i += 1
+                zoomInto = lines[i].split();           i += 1
+                zoomIntoMin = float(zoomInto[0])
+                zoomIntoMax = float(zoomInto[1])
+                cropDisplay = lines[i].split();        i += 1
+                cropDisplayMin = float(cropDisplay[0])
+                cropDisplayMax = float(cropDisplay[1])
+                cropColor = lines[i].split();          i += 1
+                cropColorMin = float(cropColor[0])
+                cropColorMax = float(cropColor[1])
+                transferFID = int(lines[i].strip())
+                histValues1 = []
+                for i in range(scene.histogramBuckets):
+                    histValues1.append(5.0)
+                histoGroup = Histogram.HistogramGroup(scene.frame.panel, 
scene, index, name, transferFID)
+                histoGroup.SetBackgroundColour(wx.Colour(90,90,90))
+                histoGroup.group = group
+
+                if( len( scene.frame.histoGroups ) == currentHistogramIndex 
) :
+                    scene.currentHistogram = histoGroup
+
+                if( len( scene.frame.histoGroups ) == 
currentParticleHistogramIndex ) :
+                    scene.currentParticleHistogram = histoGroup
+
+                scene.frame.histoGroups.append(histoGroup)
+
+                #TODO: read these in
+                if (group == 1):
+                    
scene.test.setVolCMap(scene.frame.transferFunctions[transferFID].cmap)
+                    
scene.frame.transferFunctions[transferFID].cmap.scaleAlphas(.00125)
+                # if (group == 0):
+                #     scene.test.setClipMinMax(index, cropDisplayMin, 
cropDisplayMax)
+                #     scene.test.setSphereCMinMax(index, cropColorMin, 
cropColorMax)
+                # else:
+                #     scene.test.setVolCMinMax(cropColorMin, cropColorMax)
+
+                print "sending values: " + str(zoomIntoMin) + " " + 
str(zoomIntoMax) + " " + str(cropDisplayMin) + " " + str(cropDisplayMax) + " 
" + str(cropColorMin) + " " + str(cropColorMax)
+
+                histoGroup.SendValues(zoomIntoMin, zoomIntoMax, 
cropDisplayMin, cropDisplayMax, cropColorMin, cropColorMax)
+
+            ##### Eye (Camera) ####
+            elif lines[i].find("[Eye]") != -1:
+                i += 1
+                line = lines[i].split();                 i += 1
+                x = float(line[0])
+                y = float(line[1])
+                z = float(line[2])
+                eye = manta_new( Vector(x, y, z) )
+
+                line = lines[i].split();                 i += 1
+                x = float(line[0])
+                y = float(line[1])
+                z = float(line[2])
+                lookat = manta_new( Vector(x, y, z) )
+
+                line = lines[i].split();                 i += 1
+                x = float(line[0])
+                y = float(line[1])
+                z = float(line[2])
+                up     = manta_new( Vector(x, y, z) )
+
+                line = lines[i].split()
+                h = float(line[0]) # h-fov
+                v = float(line[1]) # v-fov
+
+                cbArgs = ( manta_new( BasicCameraData( eye, lookat, up, h, v 
) ), )
+                scene.engine.addTransaction( "Set basic camera data",
+                                             manta_new( 
createMantaTransaction( scene.engine.getCamera(0).setBasicCameraData,
                                                                             
cbArgs)))
 
         ##### Scene Properties ####
@@ -235,97 +237,98 @@
         #  nrrd name(s)
         # numParticle files
         #  nrrd name(s)
-        elif lines[i].find("[Scene Properties]") != -1:
-            i+=1
-            scene.forceDataMin = float(lines[i].strip());    i += 1
-            scene.forceDataMax = float(lines[i].strip());    i += 1
-            if (scene.forceDataMin != scene.forceDataMax):
-                scene.test.setVolColorMinMax(scene.forceDataMin, 
scene.forceDataMax)
-            scene.duration = float(lines[i].strip());        i += 1
-            scene.test.setDuration(scene.duration)
-            scene.ridx = int(float(lines[i].strip()));       i += 1
-            scene.test.setRidx(scene.ridx)
-            scene.radius = float(lines[i].strip());          i += 1
-            scene.test.setRadius(scene.radius)
-            scene.cidx = int(float(lines[i].strip()));       i += 1
-            scene.test.setCidx(scene.cidx)
-            scene.numThreads = int(float(lines[i].strip())); i += 1
-            scene.engine.changeNumWorkers(scene.numThreads)
-            minBound = lines[i].split();                     i += 1
-            maxBound = lines[i].split();                     i += 1
-            for j in range(3):
-                scene.volumeMinBound[j] = float(minBound[j])
-                scene.volumeMaxBound[j] = float(maxBound[j])
-            minVector = Vector(scene.volumeMinBound[0], 
scene.volumeMinBound[1], scene.volumeMinBound[2])
-            maxVector = Vector(scene.volumeMaxBound[0], 
scene.volumeMaxBound[1], scene.volumeMaxBound[2])
-            scene.test.setVolumeMinMaxBounds(minVector, maxVector)
-            print "setting numWorkers to: " + str(scene.numThreads)
-            numVol = int(float(lines[i].strip()));           i += 1
-
-            for j in range(numVol):
-                nrrd = lines[i].strip();                     i += 1
-                if not os.path.exists( nrrd ) :
-                    print ""
-                    print "ERROR file '" + nrrd + "' does not exist.  Config 
file appears to be invalid.  Goodbye."
-                    print ""
-                    os._exit( -1 ) # We're done... force exit.
-                scene.nrrdFiles2.append( nrrd )
-
-            numSphere = int(float(lines[i].strip()));        i += 1
-            for j in range(numSphere):
-                nrrd = lines[i].strip();                     i += 1
-                if not os.path.exists( nrrd ) :
-                    print ""
-                    print "ERROR file '" + nrrd + "' does not exist.  Config 
file appears to be invalid.  Goodbye."
-                    print ""
-                    os._exit( -1 ) # We're done... force exit.
-                scene.nrrdFiles.append( nrrd )
-
-    id = len(scene.frame.transferFunctions)
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id,   "InvRainbowIso", manta_new(RGBAColorMap(0))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+1, "InvRainbow",    manta_new(RGBAColorMap(1))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+2, "Rainbow",       manta_new(RGBAColorMap(2))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+3, "InvGrayscale",  manta_new(RGBAColorMap(3))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+4, "InvBlackBody",  manta_new(RGBAColorMap(4))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+5, "BlackBody",     manta_new(RGBAColorMap(5))))
-    scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, 
[], id+6, "GreyScale",     manta_new(RGBAColorMap(6))))
+            elif lines[i].find("[Scene Properties]") != -1:
+                i+=1
+                scene.forceDataMin = float(lines[i].strip());    i += 1
+                scene.forceDataMax = float(lines[i].strip());    i += 1
+                if (scene.forceDataMin != scene.forceDataMax):
+                    scene.test.setVolColorMinMax(scene.forceDataMin, 
scene.forceDataMax)
+                scene.duration = float(lines[i].strip());        i += 1
+                scene.test.setDuration(scene.duration)
+                scene.ridx = int(float(lines[i].strip()));       i += 1
+                scene.test.setRidx(scene.ridx)
+                scene.radius = float(lines[i].strip());          i += 1
+                scene.test.setRadius(scene.radius)
+                scene.cidx = int(float(lines[i].strip()));       i += 1
+                scene.test.setCidx(scene.cidx)
+                scene.numThreads = int(float(lines[i].strip())); i += 1
+                scene.engine.changeNumWorkers(scene.numThreads)
+                minBound = lines[i].split();                     i += 1
+                maxBound = lines[i].split();                     i += 1
+                for j in range(3):
+                    scene.volumeMinBound[j] = float(minBound[j])
+                    scene.volumeMaxBound[j] = float(maxBound[j])
+                minVector = Vector(scene.volumeMinBound[0], 
scene.volumeMinBound[1], scene.volumeMinBound[2])
+                maxVector = Vector(scene.volumeMaxBound[0], 
scene.volumeMaxBound[1], scene.volumeMaxBound[2])
+                scene.test.setVolumeMinMaxBounds(minVector, maxVector)
+                print "setting numWorkers to: " + str(scene.numThreads)
+                numVol = int(float(lines[i].strip()));           i += 1
+
+                for j in range(numVol):
+                    nrrd = lines[i].strip();                     i += 1
+                    if not os.path.exists( nrrd ) :
+                        print ""
+                        print "ERROR file '" + nrrd + "' does not exist.  
Config file appears to be invalid.  Goodbye."
+                        print ""
+                        os._exit( -1 ) # We're done... force exit.
+                    scene.nrrdFiles2.append( nrrd )
+
+                numSphere = int(float(lines[i].strip()));        i += 1
+                for j in range(numSphere):
+                    nrrd = lines[i].strip();                     i += 1
+                    if not os.path.exists( nrrd ) :
+                        print ""
+                        print "ERROR file '" + nrrd + "' does not exist.  
Config file appears to be invalid.  Goodbye."
+                        print ""
+                        os._exit( -1 ) # We're done... force exit.
+                    scene.nrrdFiles.append( nrrd )
+
+        scene.frame.LayoutWindow()
+        if scene.nrrdFiles > 1 or scene.nrrdFiles2 > 1:
+            scene.frame.generateMenuItem.Enable(True)
+        print "Done reading Configuration file"
 
-    scene.frame.LayoutWindow()
-    print "Done reading Configuration file"
+    except:
+        print "ERROR: unable to read Configuration file"
 
 
 def ReadNRRDList(scene, filename):
-    f = open(filename, 'r')
+    try:
+        f = open(filename, 'r')
 
-    ###clear old values
-    scene.nrrdFiles = []
-    scene.nrrdFiles2 = []
-
-    ###read in new values
-    lines = f.readlines()
-    i = 0
-    while i in range(len(lines)-1):
-        sphere = ""
-        vol = ""
-        vol = lines[i].strip()
-        i += 1
-        while (vol == "" and i < len(lines)-1):
+        ###clear old values
+        scene.nrrdFiles = []
+        scene.nrrdFiles2 = []
+
+        ###read in new values
+        lines = f.readlines()
+        i = 0
+        while i in range(len(lines)-1):
+            sphere = ""
+            vol = ""
             vol = lines[i].strip()
             i += 1
-        sphere = lines[i].strip()
-        i += 1
-        while(sphere == "" and i < len(lines) -1):
-          sphere = lines[i].strip()
-          i += 1
-        if (sphere == "" or vol == ""):
-            return
-        if (sphere[len(sphere)-1] == "w") : #raw file look for nhdr
-            sphere = sphere.strip(".raw")
-            sphere = sphere + ".nhdr"
-
-        print "volume file: " + str(vol) + " sphere file: " + str(sphere)
-        scene.nrrdFiles.append(sphere)
-        scene.nrrdFiles2.append(vol)
+            while (vol == "" and i < len(lines)-1):
+                vol = lines[i].strip()
+                i += 1
+            sphere = lines[i].strip()
+            i += 1
+            while(sphere == "" and i < len(lines) -1):
+              sphere = lines[i].strip()
+              i += 1
+            if (sphere == "" or vol == ""):
+                return
+            if (sphere[len(sphere)-1] == "w") : #raw file look for nhdr
+                sphere = sphere.strip(".raw")
+                sphere = sphere + ".nhdr"
+
+            print "volume file: " + str(vol) + " sphere file: " + str(sphere)
+            scene.nrrdFiles.append(sphere)
+            scene.nrrdFiles2.append(vol)
+            if scene.nrrdFiles > 1 or scene.nrrdFiles2 > 1:
+              scene.frame.generateMenuItem.Enable(True)
+    except:
+        print "ERROR: This appears to be an invalid NRRDList"
 
 def WriteNRRDList(scene, filename):
     f = open(filename, 'w')

Modified: trunk/scenes/csafe/python/Histogram.py
==============================================================================
--- trunk/scenes/csafe/python/Histogram.py      (original)
+++ trunk/scenes/csafe/python/Histogram.py      Mon Mar 16 05:28:17 2009
@@ -754,7 +754,8 @@
             if self.transferFPanel.transferFPanel.histogramGroup == self:
                 
self.scene.test.setSphereColorMinMax(self.histogram.varIndex, colorMin, 
colorMax)
         else:
-                self.scene.test.setVolColorMinMax(colorMin, colorMax)
+                print "setting colorminmax vals: " + str(colorMin) + " " + 
str(colorMax)
+                self.scene.test.setVolColorMinMax(float(colorMin), 
float(colorMax))
                 
self.scene.test.setVolClipMinMax(self.histogram.absoluteDMin, 
self.histogram.absoluteDMax, cropMin, cropMax)
         
     def OnClickZoomIn(self, evt):
@@ -916,7 +917,7 @@
     def OnKeyDown(self, evt):
         keycode = evt.GetKeyCode()
         if (keycode == wx.WXK_ESCAPE):
-           self.Close()
+           self.Show(False)
         evt.Skip()
 
     def addSpinner(self, where, value, id=wx.ID_ANY):

Modified: trunk/scenes/csafe/python/SceneInfo.py
==============================================================================
--- trunk/scenes/csafe/python/SceneInfo.py      (original)
+++ trunk/scenes/csafe/python/SceneInfo.py      Mon Mar 16 05:28:17 2009
@@ -9,6 +9,7 @@
                self.radius = 0.001
                self.cidx = -1
                self.nrrdFiles2 = []
+                self.numFrames = 0
                self.engine = None
                self.duration = 10.0
                self.numThreads = 1
@@ -41,4 +42,5 @@
                 self.forceDataMax = float(0)
                 self.stepSize = float(0.0016)
                 self.currentHistogram = None
-
+                self.autoBuildHistograms = True
+                self.readConfiguration = False

Modified: trunk/scenes/csafe/python/SceneMenus.py
==============================================================================
--- trunk/scenes/csafe/python/SceneMenus.py     (original)
+++ trunk/scenes/csafe/python/SceneMenus.py     Mon Mar 16 05:28:17 2009
@@ -323,17 +323,15 @@
 
        sizer.Layout()
        panel.SetSizer(sizer)
-       panel.Refresh()
-       self.Refresh()
 
-       self.Bind( wx.EVT_CLOSE, self.OnCloseWindow )
-       panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        panel.SetFocus()
+       panel.Bind( wx.EVT_CLOSE, self.OnCloseWindow )
+       panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
 
     def OnKeyDown(self, evt):
         keycode = evt.GetKeyCode()
         if (keycode == wx.WXK_ESCAPE):
-           self.Close()
+           self.Show(False)
         evt.Skip()
 
 
@@ -403,6 +401,7 @@
                      float(max[1] - min[1]),
                      float(max[2] - min[2]))
         self.scene.test.setVolumePositionSize(pos, size)
+        event.Skip()
 
 
 
@@ -490,7 +489,12 @@
        self.showVolumeCB = wx.CheckBox(panel, -1, "Show Volume Data")
        self.showVolumeCB.SetValue(self.scene.showVolume)
        sizer.Add(self.showVolumeCB,0,wx.ALL|wx.ALIGN_CENTER,5)
-       
+
+       self.autoHistoCB = wx.CheckBox(panel, -1, "Automatically Add 
Histograms From NRRDS")
+       self.autoHistoCB.SetValue(self.scene.autoBuildHistograms)
+       sizer.Add(self.autoHistoCB,0,wx.ALL|wx.ALIGN_CENTER,5)
+
+       self.Bind(wx.EVT_CHECKBOX, self.OnClickAutoHisto, self.autoHistoCB)
        self.Bind(wx.EVT_CHECKBOX, self.OnClickShowSpheres, 
self.showSpheresCB)
        self.Bind(wx.EVT_CHECKBOX, self.OnClickShowVolume, self.showVolumeCB)
 
@@ -592,7 +596,10 @@
 
     def OnClickShowVolume(self, evt):
        self.scene.showVolume = evt.IsChecked()
-        self.scene.test.setVisibility(self.scene.showSpheres, 
self.scene.showVolume)    
+        self.scene.test.setVisibility(self.scene.showSpheres, 
self.scene.showVolume)
+
+    def OnClickAutoHisto(self, evt):
+        self.scene.autoBuildHistograms = evt.IsChecked()
    
     def OnClickAO(self, evt):
         self.scene.test.useAO(evt.IsChecked())

Modified: trunk/scenes/csafe/python/TransferF.py
==============================================================================
--- trunk/scenes/csafe/python/TransferF.py      (original)
+++ trunk/scenes/csafe/python/TransferF.py      Mon Mar 16 05:28:17 2009
@@ -37,7 +37,7 @@
             if empty == False:
                 slices = manta_new(vector_ColorSlice())
                 for i in range(len(colorsn)):
-                    slices.push_back(ColorSlice(colorsn[0], colorsn[1], 
colorsn[2], colorsn[3], colorsn[4]))
+                    
slices.push_back(manta_new(ColorSlice(float(colorsn[i][0]), 
manta_new(RGBAColor(float(colorsn[i][1]), float(colorsn[i][2]), 
float(colorsn[i][3]), float(colorsn[i][4]))))))
                 cmap = manta_new(RGBAColorMap(slices))
             else:
                 cmap = manta_new(RGBAColorMap(1))
@@ -311,7 +311,7 @@
 
         # Determine if this is a Particle historgram... and if so, don't 
allow modification of the
         # opacity.
-        if self.histogramGroup.group == 0:
+        if self.histogramGroup != None and self.histogramGroup.group == 0:
             y = 0
 
         if self.selected != None:
@@ -594,7 +594,7 @@
                     
slices.push_back(ColorSlice(c[0],RGBAColor(Color(RGBColor(c[1],c[2],c[3])), 
c[4])))
                     colors.append(c)
                 cmap = 
self.scene.frame.sphereVolCMaps.append(manta_new(RGBAColorMap(slices, 64)))
-                t = TransferF(self.parentC, colors, index, name, cmap)
+                t = TransferF(self.scene.frame, colors, index, name, cmap)
                 self.scene.frame.transferFunctions.append(t)
                 self.SetTransferF(t)
         else:

Modified: trunk/scenes/csafe/python/csafe_scene.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_scene.py    (original)
+++ trunk/scenes/csafe/python/csafe_scene.py    Mon Mar 16 05:28:17 2009
@@ -90,11 +90,12 @@
         self.SetBackgroundColour(self.scene.bgColor)
         menuBar = wx.MenuBar()
         menuFile = wx.Menu()
-        menuFile.Append(101, "&About", "")
-        menuFile.Append(102, "&Save", "")
-        menuFile.Append(103, "Save As...", "")
+        menuFile.Append(102, "&Save Configuration", "")
+        menuFile.Append(103, "Save Configuration As...", "")
         menuFile.Append(104, "Load Configuration", "")
-        menuFile.Append(110, "Load UDA", "Uintah Dataset")
+        loadUDA = menuFile.Append(110, "Load UDA", "Uintah Dataset")
+        loadUDA.Enable(False)
+        self.addRemoveDataFilesMenu = menuFile.Append(201, "&Add/Remove Data 
Files", "Add and remove Nrrd files for the scene")
         menuFile.Append(107, "Import NrrdList")
         menuFile.Append(108, "Export NrrdList")
         menuFile.Append(106, "Import Transfer Function")
@@ -102,7 +103,6 @@
         menuFile.Append(109, "&Quit", "")
         
         menuScene = wx.Menu()
-        self.addRemoveDataFilesMenu = menuScene.Append(201, "&Add/Remove 
Data Files", "Add and remove Nrrd files for the scene")
         menuScene.Append(204, "Add &Histogram", "Add a histogram to the 
panel")
         menuScene.Append(202, "Scene Preferences")
         menuScene.Append(205, "Cutting Bounding Box")
@@ -118,6 +118,7 @@
         # Keep track of toggleTooltipsMenuItem so it can be updated as 
needed.
         self.toggleTooltipsMenuItem = menuHelp.Append( 207, "Turn Off 
Tooltips" )
         menuHelp.AppendSeparator()
+        menuHelp.Append(101, "&About", "")
         menuHelp.Append( ZOOM_HELP_ID, "Help on Zooming" )
         menuHelp.Append( COLORMAP_HELP_ID, "Help on Colormaps" )
 
@@ -255,7 +256,7 @@
                              style=wx.OPEN|wx.CHANGE_DIR )
         if dlg.ShowModal() == wx.ID_OK:
             filename = dlg.GetPath()
-            Configuration.ReadConfiguration(self.scene, filename) 
+            Configuration.ReadConfiguration(self.scene, filename)
             self.scene.sceneWD = dlg.GetDirectory()
             self.scene.sceneName = dlg.GetFilename()
             print "filename: " + self.scene.sceneName
@@ -344,15 +345,36 @@
 
         #self.test.loadVolNrrds()
 
+        if self.scene.autoBuildHistograms:
+            for i in range(self.test.getNumKeyValuePairs()):
+                key = self.test.getKey(i)
+                if key.find(".") > 0:
+                    name = key.strip(" index:=")
+                    index = int(self.test.getValue(i))
+                    hist = 
Histogram.HistogramGroup(self.panel,self.scene,index,name,3)
+                    self.histoGroups.append(hist)
+                    
+                    
+        self.LayoutWindow()
         self.BuildHistograms()
-        self.slider.SetRange(1, int(max(len(self.scene.nrrdFiles), 
len(self.scene.nrrdFiles2))))
+        self.scene.numFrames = len(self.scene.nrrdFiles)
+        if (len(self.scene.nrrdFiles2) > self.scene.numFrames):
+          self.scene.numFrames = len(self.scene.nrrdFiles2)
+        self.slider.SetRange(1, self.scene.numFrames)
+        self.slider.SetValue(1)
+        self.numFramesTxt.SetLabel(" / " + str(self.scene.numFrames))
         self.scene.mantaApp.frame.StartEngine()
-        if self.scene.nrrdFiles > 1 or self.scene.nrrdFiles2 > 1:
+        
+        if self.scene.numFrames > 1:
            self.forwardB.Enable(True)
            self.backB.Enable(True)
 
     def BuildHistograms(self):
         for i in range(len(self.histoGroups)):
+            index = self.histoGroups[i].varIndex
+            if index >= self.test.getNumVars():
+                print "ERROR: histogram index out of range"
+                continue
             print "building histogram: " + self.histoGroups[i].title
             vol = False
             if self.histoGroups[i].group == 1:
@@ -504,38 +526,21 @@
 
         engine.setScene( scene )
 
-        #################init the GUI######################
-
-        colors = []
-        colors2 = []
-        colors3 = []
-        colors4 = []
-        colors5 = []
-        colors6 = []
-        colors7 = []
-        colors8 = []
-        colors9 = []
+        ################
         self.sphereVolCMaps = []
         for j in range(8):
             self.sphereVolCMaps.append(manta_new(RGBAColorMap(1)))
-        self.t0 = t0 = TransferF.TransferF(self, colors9, 0, "volume", 
self.volCMap)
-        self.defaultTransferF = TransferF.TransferF(self, colors, 1, 
"empty", self.sphereVolCMaps[0])
-        t1 = TransferF.TransferF(self, [], 0, "InvRainbowIso", 
manta_new(RGBAColorMap(RGBAColorMap.InvRainbowIso)))
-        t2 = TransferF.TransferF(self, [], 0, "InvRainbow", 
manta_new(RGBAColorMap(RGBAColorMap.InvRainbow)))
-        t3 = TransferF.TransferF(self, [], 0, "Rainbow", 
manta_new(RGBAColorMap(RGBAColorMap.Rainbow)))
-        t4 = TransferF.TransferF(self, [], 0, "InvGreyScale", 
manta_new(RGBAColorMap(RGBAColorMap.InvGreyScale)))
-        t5 = TransferF.TransferF(self, [], 0, "InvBlackBody", 
manta_new(RGBAColorMap(RGBAColorMap.InvBlackBody)))
-        t6 = TransferF.TransferF(self, [], 0, "BlackBody", 
manta_new(RGBAColorMap(RGBAColorMap.BlackBody)))
-        t7 = TransferF.TransferF(self, [], 0, "GreyScale", 
manta_new(RGBAColorMap(RGBAColorMap.GreyScale)))
+        self.defaultTransferF = TransferF.TransferF(self, [], 1, "empty", 
manta_new(RGBAColorMap(2)))
         self.transferFunctions = []
-        self.transferFunctions.append(self.t0)
-        self.transferFunctions.append(t1)
-        self.transferFunctions.append(t2)
-        self.transferFunctions.append(t3)
-        self.transferFunctions.append(t4)
-        self.transferFunctions.append(t5)
-        self.transferFunctions.append(t6)
-        self.transferFunctions.append(t7)
+        if True:
+            id = 0
+            self.transferFunctions.append(TransferF.TransferF(self, [], id,  
 "InvRainbowIso", manta_new(RGBAColorMap(0))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+1, "InvRainbow",    manta_new(RGBAColorMap(1))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+2, "Rainbow",       manta_new(RGBAColorMap(2))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+3, "InvGrayscale",  manta_new(RGBAColorMap(3))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+4, "InvBlackBody",  manta_new(RGBAColorMap(4))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+5, "BlackBody",     manta_new(RGBAColorMap(5))))
+            self.transferFunctions.append(TransferF.TransferF(self, [], 
id+6, "GreyScale",     manta_new(RGBAColorMap(6))))
 
         self.tPanel = tPanel = TransferF.TransferFGroup(self.panel, 300, 
100, self.defaultTransferF, "empty", self.scene)
         self.scene.tPanel = tPanel
@@ -549,11 +554,7 @@
         color = self.scene.bgColor
         self.scene.histoVS = hvs = wx.BoxSizer(wx.VERTICAL)
         self.scene.frame = self
-        histoGroup0 = Histogram.HistogramGroup(self.panel, self.scene, 8, 
"volume")
-        histoGroup0.group = 1
-        tPanel.transferFPanel.SetHistogramGroup(histoGroup0)
         self.histoGroups = []
-        self.histoGroups.append(histoGroup0)
         vs.Add(hvs,0,wx.ALIGN_TOP|wx.ALL,1)
         vs.Add(tPanel,0,wx.ALIGN_TOP|wx.ALL,1)
 
@@ -577,7 +578,11 @@
 
         self.slider = wx.Slider(self.panel, 100, 0, 0, 0, (30, 60), (250, 
-1), wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS )
         self.slider.SetTickFreq(1,1)
+        self.numFramesTxt = wx.StaticText(self.panel, -1, str(" / " + 
str(self.scene.numFrames)), (30,60))
         self.Bind(wx.EVT_SLIDER, self.OnSlider, self.slider)
+        self.Bind(wx.EVT_TIMER, self.OnTimer)
+        self.timer = wx.Timer(self)
+        self.timer.Start(500)
 
         vs.Layout()
 
@@ -590,6 +595,10 @@
         self.scene.cidx = 4
         self.volCMap.scaleAlphas(0.00125)
 
+    def OnTimer(self, evt):
+        frame = self.scene.test.getFrame()
+        self.slider.SetValue(frame+1)
+
     def OnResize(self, evt):
         try:
             size = evt.GetSize()
@@ -615,7 +624,10 @@
         hvs2.Add(self.playB,0,wx.ALIGN_CENTER,2)
         hvs2.Add(self.forwardB,0,wx.ALIGN_CENTER,2)
         vs.Add(hvs2,0,wx.ALIGN_BOTTOM|wx.ALIGN_CENTER)
-        vs.Add(self.slider, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 1)
+        hs = wx.BoxSizer(wx.HORIZONTAL)
+        hs.Add(self.slider, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
+        hs.Add(self.numFramesTxt, 0, wx.ALIGN_CENTER, 1)
+        vs.Add(hs, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 1)
         #TODO: can't get the staticbox to friggin work with the buttons
 #        vs.Add( animCtrlSizer, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
         #if (self.scene.mantaFrame != None):
@@ -645,12 +657,14 @@
             self.playB.SetBitmapFocus(self.playBmp)
             self.playB.SetBitmapLabel(self.playBmp)
             self.playB.SetBitmapDisabled(self.playBmp)
+            self.timer.Stop()
         else:
             self.test.resumeAnimation()
             self.scene.isPlaying = True
             self.playB.SetBitmapFocus(self.pauseBmp)
             self.playB.SetBitmapLabel(self.pauseBmp)
             self.playB.SetBitmapDisabled(self.pauseBmp)
+            self.timer.Start(500)
 
     def OnClickForward(self, evt):
         self.test.forwardAnimation()
@@ -855,20 +869,22 @@
     if (setup.nrrdlist != ""):
         Configuration.ReadNRRDList(frame1.scene, setup.nrrdlist)
     if (setup.uda != ""):
-        frame1.scene.test.readUDAHeader(str(setup.uda))
-        frame1.scene.test.loadUDA(str(setup.uda), str(setup.udaVol))
-        t0 = TransferF.TransferF(frame1, [], 1, "x")
-        histoGroup0 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 0, "x")
-        frame1.scene.frame.histoGroups.append(histoGroup0)
-        histoGroup1 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 1, "y")
-        frame1.scene.frame.histoGroups.append(histoGroup1)
-        histoGroup2 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 2, "z")
-        frame1.scene.frame.histoGroups.append(histoGroup2)
-        
-        frame1.scene.frame.LayoutWindow()
-        frame1.BuildHistograms()
-        frame1.slider.SetRange(1, 1)
-        frame1.scene.mantaApp.frame.StartEngine()
+        print "UDA Loading currently disabled, use NRRDs instead"
+        if False:
+            frame1.scene.test.readUDAHeader(str(setup.uda))
+            frame1.scene.test.loadUDA(str(setup.uda), str(setup.udaVol))
+            t0 = TransferF.TransferF(frame1, [], 1, "x")
+            histoGroup0 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 0, "x")
+            frame1.scene.frame.histoGroups.append(histoGroup0)
+            histoGroup1 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 1, "y")
+            frame1.scene.frame.histoGroups.append(histoGroup1)
+            histoGroup2 = Histogram.HistogramGroup(frame1.scene.frame.panel, 
frame1.scene, 2, "z")
+            frame1.scene.frame.histoGroups.append(histoGroup2)
+
+            frame1.scene.frame.LayoutWindow()
+            frame1.BuildHistograms()
+            frame1.slider.SetRange(1, 1)
+            frame1.scene.mantaApp.frame.StartEngine()
 
     frame1.scene.numThreads = setup.num_workers
     frame1.scene.engine.changeNumWorkers(frame1.scene.numThreads)

Modified: trunk/scenes/csafe/src/CDTest.h
==============================================================================
--- trunk/scenes/csafe/src/CDTest.h     (original)
+++ trunk/scenes/csafe/src/CDTest.h     Mon Mar 16 05:28:17 2009
@@ -104,6 +104,7 @@
       _minBound = volumeMinBound;
       _maxBound = volumeMaxBound;
       _stepSize = 0.0015;
+      _num_vars = 0;
     }
 
   ~CDTest()
@@ -195,9 +196,6 @@
       _cuts[5] = new CuttingPlane(Vector(0,0,0), Vector(0,0,-1), _cuts[4]);
       _sphereAnimationCut->add(_cuts[0]);
     }
-  Group* _sphereAnimationCut;
-  CuttingPlane* _cuts[6]; //up down left right forward back
-  bool _useClippingBBox, _spheresVisible, _volVisible;
   void setVolumePositionSize(Vector position, Vector size)
     {
       _volPosition = position;
@@ -342,6 +340,7 @@
          cout << "Loading Nrrd file: " << *itr << "...\n";
          ParticleNRRD* pnrrd = new ParticleNRRD();
          pnrrd->readFile(*itr);
+          _num_vars = int(pnrrd->getNVars());
          if (_cidx >= int(pnrrd->getNVars())) {
            cerr << "error: color index not in data, settting to index 0\n";
            _cidx = 0;
@@ -355,10 +354,10 @@
            exit(2);
          }
           int xindex = 0;
-          std::vector<std::pair<string, string> >& keyValuePairs = 
pnrrd->getKeyValuePairs();
-          for(size_t i =0; i < keyValuePairs.size(); i++) {
-            if (keyValuePairs[i].first == "p.x (x) index") {
-              stringstream stream(keyValuePairs[i].second);
+          key_value_pairs = pnrrd->getKeyValuePairs();
+          for(size_t i =0; i < key_value_pairs.size(); i++) {
+            if (key_value_pairs[i].first == "p.x (x) index") {
+              stringstream stream(key_value_pairs[i].second);
               stream >> xindex;
               cout << "found xindex: " << xindex << endl;
             }
@@ -749,6 +748,9 @@
          *max = std::max(float(nmax), *max);
          cout << "compared min/max: " << nmin << " " << nmax << endl;
        }
+      if (int(_vols.size()) == 0) {
+        *min = *max = 0.0;
+      }
       cout << "histogram computed: min/max: " << *min << " " << *max << endl;
     }
 
@@ -814,12 +816,9 @@
   */
   void setClipMinMax(int index, float min, float max)
     {
-      cout << "setclip called index: " << index << " sphereminssize: " << 
_sphereMins.size() << "\n";
       if (index >= int(_sphereMins.size()))
        return;
-      cout << "2\n";
 #if USE_GRIDSPHERES
-      cout << "setting clips\n";
       for(int i = 0; i < int(_sphereGrids.size()); i++)
        if (_sphereGrids[i]) _sphereGrids[i]->setClipMinMax(index, min, max);
 #else
@@ -1001,11 +1000,40 @@
     _cidx = cidx; 
   }
 
+  int getFrame()
+    {
+      if(!_sphereAnimation)
+        return 0;
+      else
+        return 
static_cast<int>(_sphereAnimation->getTime()/duration*numFrames);
+    }
+
+  int getNumKeyValuePairs()
+    {
+      return key_value_pairs.size();
+    }
+
+  string getKey(int i)
+    {
+      if (i >= getNumKeyValuePairs() || i < 0)
+        return "";
+      return key_value_pairs[i].first;
+    }
+
+  string getValue(int i)
+    {
+      if (i >= getNumKeyValuePairs() || i < 0)
+        return "";
+      return key_value_pairs[i].second;
+    }
+
   //! get color index
   /*!
     \return color index
   */
   int getCidx() { return _cidx; }
+
+  int getNumVars() { return _num_vars; }
         
   //! set to use ambient occlusion on spheres
   void useAO(bool st)
@@ -1062,6 +1090,9 @@
       }
     }
 
+  Group* _sphereAnimationCut;
+  CuttingPlane* _cuts[6]; //up down left right forward back
+  bool _useClippingBBox, _spheresVisible, _volVisible;
   MantaInterface* _manta_interface;
   RGBAColorMap* _volCMap;
   LinearColormap<float>* _sphereCMap;
@@ -1075,7 +1106,7 @@
   float _radius;
   float duration;  //number of seconds for animation
   int numFrames;   //number of keyframes
-  int numFrames1, numFrames2;
+  int numFrames1, numFrames2;  //number of frames for sphere/vol data
   ReadContext* _readContext;
   vector<string> _nrrdFilenames;
   vector<string> _nrrdFilenames2;
@@ -1101,6 +1132,8 @@
   float* _sphereDMins, *_sphereDMaxs;
   Vector _volPosition, _volSize;
   float _stepSize;
+  int _num_vars;
+  std::vector<std::pair<string, string> > key_value_pairs;
 };
 
 #endif


  • [Manta] r2386 - in trunk: Model/Materials SwigInterface scenes/csafe/python scenes/csafe/src, brownlee, 03/16/2009

Archive powered by MHonArc 2.6.16.

Top of page