Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2405 - in trunk: CMake scenes/csafe/python


Chronological Thread 
  • From:
  • To:
  • Subject: [Manta] r2405 - in trunk: CMake scenes/csafe/python
  • Date: Mon, 27 Apr 2009 14:57:42 -0600

Author: brownlee
Date: Mon Apr 27 14:57:42 2009
New Revision: 2405

Modified:
   trunk/CMake/PythonInvoke.cmake
   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
Log:
TransferF.py:
  fixed text positions when make text bigger option was specified.
  now selects volume as well as highlighted particle histogram
SceneMenus.pu:
  couldn't add tooltip to disabled item for changing radius, instead a
text control was added
SceneInfo.py
  changing color for highlighted particles/volumes
csafe_scene.py
  adding selection for volumes
  scene calls autoview to center on scene when loaded
  making scene preferences and bbox only have one window at a time
  changed default colormap for volume to rainbow
  fixing issue where manta wasn't updating volume colormap for some
strange reason
CMake/PythonInvoke.cmake
  adding WX code used to generate pythonpath.csh
Histogram.py
  mousewheel now zooms into the center
  if user has an older version of wx it draws bars instead of
transparent rectangle



Modified: trunk/CMake/PythonInvoke.cmake
==============================================================================
--- trunk/CMake/PythonInvoke.cmake      (original)
+++ trunk/CMake/PythonInvoke.cmake      Mon Apr 27 14:57:42 2009
@@ -73,7 +73,21 @@
            ENDIF(WIN32)
       SET(PY_SEARCH_PATH "${PY_SEARCH_PATH}\nsetenv PYTHONPATH 
\"$PYTHONPATH\":${path}")
     ENDFOREACH(path)
+    SET(PY_SEARCH_PATH "${PY_SEARCH_PATH}
 
+if ( $?WXPATH ) then
+  setenv PYTHONPATH $WXPATH\\:$PYTHONPATH
+endif
+
+if ( $?WXLIB ) then
+  if ( $?LD_LIBRARY_PATH ) then
+    setenv LD_LIBRARY_PATH $WXLIB\\:$LD_LIBRARY_PATH
+  else
+    setenv LD_LIBRARY_PATH $WXLIB
+  endif
+endif
+\n"
+)
     CONFIGURE_FILE (
       ${CMAKE_SOURCE_DIR}/CMake/python_invoke.csh.CMakeTemplate
       ${CMAKE_BINARY_DIR}/bin/${python_target}

Modified: trunk/scenes/csafe/python/Configuration.py
==============================================================================
--- trunk/scenes/csafe/python/Configuration.py  (original)
+++ trunk/scenes/csafe/python/Configuration.py  Mon Apr 27 14:57:42 2009
@@ -47,6 +47,13 @@
        f.write("None")
     f.write('\n\n')
 
+    f.write('[currentVolumeHistogram]\n')
+    if (scene.currentVolumeHistogram != None):
+       f.write( str( scene.frame.histoGroups.index( 
scene.currentVolumeHistogram ) ) )
+    else :
+       f.write("None")
+    f.write('\n\n')
+
     for i in range(len(histoGroups)):
         h = histoGroups[i]
         f.write('[Histogram]\n')
@@ -121,6 +128,7 @@
         lines = f.readlines()
         currentHistogramIndex = -1
         currentParticleHistogramIndex = -1
+        currentVolumeHistogramIndex = -1
         for i in range(len(lines)):
             ##### Transfer Function####
             if lines[i].find("[Transfer Function]") != -1:
@@ -156,6 +164,13 @@
                 if line != "None":
                   currentParticleHistogramIndex = int( line )
 
+            #### Current Histogram ####
+            elif lines[i].find("[currentVolumeHistogram]") != -1:
+                i +=1
+                line = lines[i].strip()
+                if line != "None":
+                  currentVolumeHistogramIndex = int( line )
+
             #### Histogram ####
             elif lines[i].find("[Histogram]") != -1:
                 i +=1
@@ -185,6 +200,9 @@
                 if( len( scene.frame.histoGroups ) == 
currentParticleHistogramIndex ) :
                     scene.currentParticleHistogram = histoGroup
 
+                if( len( scene.frame.histoGroups ) == 
currentVolumeHistogramIndex ) :
+                    scene.currentVolumeHistogram = histoGroup
+
                 scene.frame.histoGroups.append(histoGroup)
 
                 #TODO: read these in

Modified: trunk/scenes/csafe/python/Histogram.py
==============================================================================
--- trunk/scenes/csafe/python/Histogram.py      (original)
+++ trunk/scenes/csafe/python/Histogram.py      Mon Apr 27 14:57:42 2009
@@ -96,7 +96,8 @@
         self.Update()
 
     def OnMouseWheel(self, evt):
-        pos = float(evt.GetPosition().x - 
self.paddingW/2.0)/float(self.width)
+#        pos = float(evt.GetPosition().x - 
self.paddingW/2.0)/float(self.width)
+        pos = 0.5
         delta = evt.GetWheelDelta()
         rot = evt.GetWheelRotation()/delta
         # zoom in if rot > 0, out if ro < 0
@@ -424,10 +425,12 @@
     def OnPaint(self, evt=None):
         pdc = wx.PaintDC(self)
         # pdc.Clear()
+        oldwx = False
         try:
           dc = wx.GCDC(pdc)
         except:
           dc = pdc
+          oldwx = True
         # gc = wx.GraphicsContext.Create(dc)       
         dc.SetPen(wx.Pen("BLACK", 1) )
         # dc.DrawRectangle( 0, 0, width, height) 
@@ -447,7 +450,16 @@
             cropMax = 1.0
         cropWidth = (float(cropMax) - float(cropMin))*float(self.width)
         if (self.dMin != self.dMax):
-            dc.DrawRectangle(float(cropMin)*float(self.width) + 
self.paddingW/2.0 , 0, cropWidth, self.height)
+            if oldwx == False:
+              dc.DrawRectangle(float(cropMin)*float(self.width) + 
self.paddingW/2.0 , 0, cropWidth, self.height)
+            else:
+              penColor = wx.Colour(0,0,0)
+              dc.SetPen(wx.Pen(penColor, 5))
+              xpos = float(cropMin)*float(self.width) + self.paddingW/2.0
+              dc.DrawLine( xpos, 0, xpos, self.height)
+              dc.DrawLine( xpos, self.height/2, xpos+cropWidth, 
self.height/2)
+              xpos += cropWidth
+              dc.DrawLine( xpos, 0, xpos, self.height)
         
         # draw cropping texta
         dc.SetTextForeground(wx.Colour(255,255,255))

Modified: trunk/scenes/csafe/python/SceneInfo.py
==============================================================================
--- trunk/scenes/csafe/python/SceneInfo.py      (original)
+++ trunk/scenes/csafe/python/SceneInfo.py      Mon Apr 27 14:57:42 2009
@@ -45,6 +45,8 @@
     self.autoBuildHistograms = True
     self.readConfiguration = False
     self.measurementsFrame = None
-    self.selectedBGColor = wx.Color(70,70,70)
+    self.selectedBGColor = wx.Color(20,70,120)
     self.labels = True
-    self.loaded = False   
+    self.loaded = False
+    self.currentParticleHistogram = None
+    self.currentVolumeHistogram = None

Modified: trunk/scenes/csafe/python/SceneMenus.py
==============================================================================
--- trunk/scenes/csafe/python/SceneMenus.py     (original)
+++ trunk/scenes/csafe/python/SceneMenus.py     Mon Apr 27 14:57:42 2009
@@ -527,7 +527,8 @@
        sizer.Add(hSizer4,0,wx.ALL|wx.ALIGN_CENTER,5)          
 
        hSizer5 = wx.BoxSizer(wx.HORIZONTAL)
-       self.radText = wx.StaticText(panel, -1, "Default Radius: ")
+       self.radText = wx.StaticText(panel, -1, "Default Radius (Can't change 
when scene is loaded): ")
+       self.radText.SetForegroundColour(wx.Colour(200, 0, 0))
        self.radTcl = wx.TextCtrl(panel,-1,str(scene.radius),size=(125,-1))
        if (self.scene.loaded == True):
           self.radTcl.Enable(False)

Modified: trunk/scenes/csafe/python/TransferF.py
==============================================================================
--- trunk/scenes/csafe/python/TransferF.py      (original)
+++ trunk/scenes/csafe/python/TransferF.py      Mon Apr 27 14:57:42 2009
@@ -267,6 +267,10 @@
           if self.scene.currentParticleHistogram != None:
             self.scene.currentParticleHistogram.Deselect()
           histo.Select()
+        else:
+          if self.scene.currentVolumeHistogram != None:
+              self.scene.currentVolumeHistogram.Deselect()
+          histo.Select()
         self.histogramGroup = histo
         
     def UpdateHistogram(self):
@@ -495,9 +499,9 @@
         dc.DrawTextPoint(string, (xpos,ypos))
         
         # draw min/max text
-        ypos += extent[1] 
+        ypos += extent[1]
         if self.scene.biggify:
-              ypos = self.height
+              ypos -= 2
         string = ""
         if (self.scene.labels == True):
           string += "color min: "
@@ -524,6 +528,8 @@
         string += str("%1.4g" % self.mouse_value)
         extent = dc.GetTextExtent(string)
         xpos = self.paddingW/2.0 + self.width/2.0 - extent[0]/2.0
+        if self.scene.biggify:
+            ypos += 2
         dc.DrawTextPoint(string, (xpos,ypos))
 
 class TransferFGroup(wx.Panel):

Modified: trunk/scenes/csafe/python/csafe_scene.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_scene.py    (original)
+++ trunk/scenes/csafe/python/csafe_scene.py    Mon Apr 27 14:57:42 2009
@@ -158,6 +158,8 @@
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 
         self.SetBackgroundColour(self.scene.bgColor)
+        self.scenePropertiesFrame = None
+        self.bboxFrame = None
 
     def ShowHelp( self, evt ) :
         id = evt.GetId()
@@ -175,12 +177,12 @@
         wx.ToolTip.Enable( setup.tooltipsOn )
 
     def Menu205(self, evt):
-        #if( self.BBoxFrameMenuItem == None ) :
-        self.BBoxFrameMenuItem = SceneMenus.BBoxFrame(self, -1, "Bounding 
Box", self.scene)
+        if( self.bboxFrame == None ) :
+          self.bboxFrame = SceneMenus.BBoxFrame(self, -1, "Bounding Box", 
self.scene)
 
-        moveToMouse( self.BBoxFrameMenuItem )
-        self.BBoxFrameMenuItem.Raise()
-        self.BBoxFrameMenuItem.Show(True)
+        moveToMouse( self.bboxFrame )
+        self.bboxFrame.Raise()
+        self.bboxFrame.Show(True)
 
     def MenuVolPositionSize(self, evt):
         if( self.volPosSizeFrame == None ) :
@@ -317,8 +319,11 @@
 
     ################ Scene Properties #################
     def Menu202(self, evt):
-        frame = SceneMenus.ScenePropertiesFrame(self, -1, "Scene 
Preferences", self.scene)
-        frame.Show(True)
+      if (self.scenePropertiesFrame == None):
+        self.scenePropertiesFrame = SceneMenus.ScenePropertiesFrame(self, 
-1, "Scene Preferences", self.scene)
+      self.scenePropertiesFrame.Show(True)
+      moveToMouse( self.scenePropertiesFrame )
+      self.scenePropertiesFrame.Raise()
 
     ################ Generate Scene #################
     def Menu203(self, evt):
@@ -420,10 +425,19 @@
           self.scene.currentParticleHistogram = histo
           if (self.scene.currentHistogram == None):
             self.scene.currentHistogram = histo
-        else:
-          print "found one " + 
str(self.scene.currentParticleHistogram.title) 
+
+        if self.scene.currentVolumeHistogram == None:
+          histo = None
+          for j in range(len(self.histoGroups)):
+            if self.histoGroups[j].group == 1:
+              histo = self.histoGroups[j]
+              break
+          self.scene.currentVolumeHistogram = histo
+
+        if self.scene.currentVolumeHistogram != None:
+          self.scene.currentVolumeHistogram.OnClickColor(None)
+            
         if self.scene.currentParticleHistogram != None:
-          print "seeting histo to selected"
           self.scene.currentParticleHistogram.OnClickColor(None)
 
         self.scene.mantaApp.frame.StartEngine( self )
@@ -431,10 +445,15 @@
         if self.scene.numFrames > 1:
            self.forwardB.Enable(True)
            self.backB.Enable(True)
+           self.playB.Enable(True)
+           self.slider.Enable(True)
            
         for i in range(len(info)):
           
self.histoGroups[i].SendValues(info[i][0],info[i][1],info[i][2],info[i][3],info[i][4],info[i][5])
         self.scene.loaded = True
+        self.scene.mantaApp.frame.OnAutoView(None)
+        if self.scene.currentVolumeHistogram != None:
+          
self.test.setVolCMap(self.scene.currentVolumeHistogram.transferF.cmap)
 
     def BuildHistograms(self):
         for i in range(len(self.histoGroups)):
@@ -556,23 +575,23 @@
 
         self.colorMap1 = colorMap1 = manta_new(RGBAColorMap())
 
-        slices = manta_new(vector_ColorSlice());
-        div = 1.0/255.0;
-        a = 1.0;
-        slices.push_back(ColorSlice(0.0, RGBAColor(Color(RGBColor(0.0, 0.0, 
0.0)), 0*a)));
-        slices.push_back(ColorSlice(0.109804, 
RGBAColor(Color(RGBColor(52*div, 0*div, 0*div)), 0*a)));
-        slices.push_back(ColorSlice(0.2, RGBAColor(Color(RGBColor(102*div, 
2*div, 0)), 0.1*a)));
-        slices.push_back(ColorSlice(0.328571, 
RGBAColor(Color(RGBColor(153*div, 18*div, 0)), 0.216667*a)));
-        slices.push_back(ColorSlice(0.4, RGBAColor(Color(RGBColor(200*div, 
41*div, 0)), 0.23*a)));
-        slices.push_back(ColorSlice(0.5, RGBAColor(Color(RGBColor(230*div, 
71*div, 0)), 0.27*a)));
-        slices.push_back(ColorSlice(0.618367, 
RGBAColor(Color(RGBColor(255*div, 120*div, 0)) , 0.3375*a)));
-        slices.push_back(ColorSlice(0.68, RGBAColor(Color(RGBColor(255*div, 
163*div, 20*div)) , 0.35*a)));
-        slices.push_back(ColorSlice(0.72, RGBAColor(Color(RGBColor(255*div, 
204*div, 55*div)) , 0.37*a)));
-        slices.push_back(ColorSlice(0.79, RGBAColor(Color(RGBColor(255*div, 
228*div, 80*div)) , 0.39*a)));
-        slices.push_back(ColorSlice(0.85, RGBAColor(Color(RGBColor(255*div, 
247*div, 120*div)), 0.43*a)));
-        slices.push_back(ColorSlice(0.92, RGBAColor(Color(RGBColor(255*div, 
255*div, 180*div)), 0.47*a)));
-        slices.push_back(ColorSlice(1.0, RGBAColor(Color(RGBColor(255*div, 
255*div, 255*div)) , 0.5*a)));
-        self.volCMap = manta_new(RGBAColorMap(slices, 64));
+#        slices = manta_new(vector_ColorSlice());
+#        div = 1.0/255.0;
+#        a = 1.0;
+#        slices.push_back(ColorSlice(0.0, RGBAColor(Color(RGBColor(0.0, 0.0, 
0.0)), 0*a)));
+#        slices.push_back(ColorSlice(0.109804, 
RGBAColor(Color(RGBColor(52*div, 0*div, 0*div)), 0*a)));
+#        slices.push_back(ColorSlice(0.2, RGBAColor(Color(RGBColor(102*div, 
2*div, 0)), 0.1*a)));
+#        slices.push_back(ColorSlice(0.328571, 
RGBAColor(Color(RGBColor(153*div, 18*div, 0)), 0.216667*a)));
+#        slices.push_back(ColorSlice(0.4, RGBAColor(Color(RGBColor(200*div, 
41*div, 0)), 0.23*a)));
+#        slices.push_back(ColorSlice(0.5, RGBAColor(Color(RGBColor(230*div, 
71*div, 0)), 0.27*a)));
+#        slices.push_back(ColorSlice(0.618367, 
RGBAColor(Color(RGBColor(255*div, 120*div, 0)) , 0.3375*a)));
+#        slices.push_back(ColorSlice(0.68, RGBAColor(Color(RGBColor(255*div, 
163*div, 20*div)) , 0.35*a)));
+#        slices.push_back(ColorSlice(0.72, RGBAColor(Color(RGBColor(255*div, 
204*div, 55*div)) , 0.37*a)));
+#        slices.push_back(ColorSlice(0.79, RGBAColor(Color(RGBColor(255*div, 
228*div, 80*div)) , 0.39*a)));
+#        slices.push_back(ColorSlice(0.85, RGBAColor(Color(RGBColor(255*div, 
247*div, 120*div)), 0.43*a)));
+#        slices.push_back(ColorSlice(0.92, RGBAColor(Color(RGBColor(255*div, 
255*div, 180*div)), 0.47*a)));
+#        slices.push_back(ColorSlice(1.0, RGBAColor(Color(RGBColor(255*div, 
255*div, 255*div)) , 0.5*a)));
+        self.volCMap = manta_new(RGBAColorMap(1));
 
 
         minBound = Vector(self.scene.volumeMinBound[0], 
self.scene.volumeMinBound[1], self.scene.volumeMinBound[2])
@@ -605,7 +624,7 @@
         self.transferFunctions = []
         if self.scene.readConfiguration == False:
             id = 0
-            self.t0 = TransferF.TransferF(self, [], id, "volume", 
self.volCMap)
+            self.t0 = TransferF.TransferF(self, [], id, "volume", 
manta_new(RGBAColorMap(1)))
             self.transferFunctions.append(self.t0)
             self.transferFunctions.append(TransferF.TransferF(self, [], 
id+1,   "InvRainbowIso", manta_new(RGBAColorMap(0))))
             self.transferFunctions.append(TransferF.TransferF(self, [], 
id+2, "InvRainbow",    manta_new(RGBAColorMap(1))))
@@ -640,7 +659,8 @@
         self.playB = wx.BitmapButton(self.panel, -1, self.pauseBmp, (40,40), 
style=wx.NO_BORDER)
         self.playB.SetToolTip( wx.ToolTip( "Press to start playback." ) )
         self.playB.SetBackgroundColour(self.scene.bgColor)
-
+        self.playB.Enable(False)
+        
         self.forwardB = wx.BitmapButton(self.panel, -1, self.forwardBmp, 
(20,20), style=wx.NO_BORDER)
         self.forwardB.SetToolTip( wx.ToolTip( "Forward" ) )
         self.forwardB.Enable(False)
@@ -651,6 +671,7 @@
 
         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.slider.Enable(False)
         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)


  • [Manta] r2405 - in trunk: CMake scenes/csafe/python, brownlee, 04/27/2009

Archive powered by MHonArc 2.6.16.

Top of page