Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2343 - in trunk: Image SwigInterface scenes/csafe/python scenes/csafe/src scenes/csafe/swig


Chronological Thread 
  • From:
  • To:
  • Subject: [Manta] r2343 - in trunk: Image SwigInterface scenes/csafe/python scenes/csafe/src scenes/csafe/swig
  • Date: Wed, 29 Oct 2008 15:39:29 -0600 (MDT)

Author: dav
Date: Wed Oct 29 15:39:28 2008
New Revision: 2343

Modified:
   trunk/Image/CMakeLists.txt
   trunk/SwigInterface/CMakeLists.txt
   trunk/SwigInterface/LightFrame.py
   trunk/scenes/csafe/python/SceneMenus.py
   trunk/scenes/csafe/python/csafe_demo.py
   trunk/scenes/csafe/src/CDTest.h
   trunk/scenes/csafe/swig/CMakeLists.txt
Log:
M    scenes/csafe/python/SceneMenus.py

Many _basic_ usability enhancements, including:

- Place the add/remove file dialog near the mouse cursor.
- Better wording on some GUI elements.
- Disabled some buttons that should not be pressed until other things have 
happened.  
    When the qualifying event occurs, enables the button.
    This isn't quite done (as it doesn't handle correctly all cases).
- Default to only showing .nhdr files in the file dialog.
- If a user chooses a particle file, then automatically try to determine if 
there is
    a corresponding volume file and add it too.  This needs to be updated to 
do the
    same thing for when a user picks a volume file first.

M    scenes/csafe/python/csafe_demo.py

- Always place the original window in the same screen location... got tired of
    chasing it all over the monitors.
- Updated menu items to be more explicit about what they do.
- Disable the 'generate' menu until data is specified.  (Need to fix this to
    correctly handle the use of command line args.)
- This is no-longer the "CSAFE (sic) Demo", it is the "C-SAFE 
Particle/Volume" tool.
- Filter open config files dialog to default to showing only config files.
- Remove the hard coding of the radius index.
    (FIXME: this needs to be fixed to automatically try to determine which
     index is for radius and set it appropriately!)

M    scenes/csafe/src/CDTest.h

- Hack to show volumes... If this line is left in, then the clipping field
    is much too small and we only see a tiny fraction of the data.  Carson
    is looking into a permenent fix.  (Unfortunately I think this breaks
    the ability to clip the data dynamically via user/GUI interaction.)

M    scenes/csafe/swig/CMakeLists.txt

- Very strange... but some versions of SWIG (Mac OSX via fink?) output
    the -version to stderr... so trap both stderr and stdout when looking
    for the version
- Check the return code of the swig command to verify that it ran correctly.
- Verify that the version string returned from the swig -version command
    is not empty... (Don't know why python things it is 2 characters when it 
is
    empty, but oh well, this seems to work.  (Perhaps it is counting \n\r?))
- Place '' around the swig-output variable so that if it is blank, at least
    we don't get a bizarre CMake error about missing operands.

M    Image/CMakeLists.txt

- It is necessary, when teem is not a shared lib, to link vs all the libs
    that teem links against.  If it is a shared lib, this doesn't hurt.

M    SwigInterface/LightFrame.py

- Add the ability to easily move the light to the eye point.  This is 
    just a first hack at it... Don't know python/wx very well so perhaps
    there is a better way.  Also, this probably should be modified to
    add this button to every light, not just a generic button.  Also need
    to update the spinner to have the new value, but didn't quite know
    how to do this.  Finally, it appears that manta creates a new/separate
    light dialog every time the light menu is selected.  This is bad.  It
    should just re-use the same one over and over.  If not, then when ever
    a light moves, then all the dialogs need to be updated to reflect the
    current position.

M    SwigInterface/CMakeLists.txt

- Indentation is your friend...




Modified: trunk/Image/CMakeLists.txt
==============================================================================
--- trunk/Image/CMakeLists.txt  (original)
+++ trunk/Image/CMakeLists.txt  Wed Oct 29 15:39:28 2008
@@ -89,7 +89,11 @@
 ENDIF(OpenEXR_FOUND)
                     
 IF(FOUND_TEEM)
-  TARGET_LINK_LIBRARIES(Manta_Image ${TEEM_LIBRARY})
+  # teem_LIB_DEPENDS comes from the TEEM intall CMake file
+  # (TEEMLibraryDepends.cmake).  It is necessary to explicitly list
+  # these files (to link against) when TEEM doesn't provide a shared
+  # library.  (It doesn't hurt if TEEM does provide a shared lib.)
+  TARGET_LINK_LIBRARIES(Manta_Image ${TEEM_LIBRARY} ${teem_LIB_DEPENDS})
 ENDIF(FOUND_TEEM)
 
 IF(APPLE)

Modified: trunk/SwigInterface/CMakeLists.txt
==============================================================================
--- trunk/SwigInterface/CMakeLists.txt  (original)
+++ trunk/SwigInterface/CMakeLists.txt  Wed Oct 29 15:39:28 2008
@@ -2,153 +2,154 @@
 # Since SWIG support wasn't added to CMake until version 2.0, only do
 # the check if we have a new enough version.
 SET(BUILD_SWIG_INTERFACE 0 CACHE BOOL "Check for swig/python")
+
 IF(BUILD_SWIG_INTERFACE)
-IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
-  # This will dump all the interface files in the library path.  Note
-  # that this needs to be set before you try to find swig.
-  SET(CMAKE_SWIG_OUTDIR ${LIBRARY_OUTPUT_PATH})
-  # Only process the swig directory if we have swig stuff
-
-  # Search for swig in the system path.
-  FIND_PATH(SWIG_DIR swig)
-  FIND_PACKAGE(SWIG)
-  IF (SWIG_FOUND)
 
-    EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
-      OUTPUT_VARIABLE swig-output
+  IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+
+    # This will dump all the interface files in the library path.  Note
+    # that this needs to be set before you try to find swig.
+    SET(CMAKE_SWIG_OUTDIR ${LIBRARY_OUTPUT_PATH})
+    # Only process the swig directory if we have swig stuff
+
+    # Search for swig in the system path.
+    FIND_PATH(SWIG_DIR swig)
+    FIND_PACKAGE(SWIG)
+    IF (SWIG_FOUND)
+
+      EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
+        OUTPUT_VARIABLE swig-output ERROR_VARIABLE swig-output
+        )
+      # string looks like: SWIG Version 1.3.31
+      STRING(REGEX MATCH "SWIG Version ${MANTA_THREE_PART_VERSION_REGEX}" 
version-string ${swig-output})
+      STRING(REGEX MATCH ${MANTA_THREE_PART_VERSION_REGEX} version-string 
${version-string})
+
+      COMPARE_VERSION_STRINGS(${version-string} "1.3.31" 
swig-version-compare)
+      IF(swig-version-compare GREATER 0)
+        # version > 1.3.31
+        SET(warning_extra "-Wextra")
+      ENDIF(swig-version-compare GREATER 0)
+
+      
###############################################################################
+      FIND_PACKAGE(PythonLibs)
+      INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+
+      # Use our local copy instead of the system one
+      INCLUDE(${CMAKE_SOURCE_DIR}/CMake/MantaUseSWIG.cmake)
+
+      INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+      SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON)
+
+      # OK, some versions of CMAKE need you to specify the SWIG_FLAGS
+      # parameter.  You can't use a variable set to "", because that will
+      # get replaced with a null string and the SET_SOURCE_FILES_PROPERTIES
+      # macro will barf.
+
+      # SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "`echo 
\"\"`")
+      # SWIG_ADD_MODULE(example python example.i example.cc)
+      # SWIG_LINK_LIBRARIES(example ${PYTHON_LIBRARIES})
+
+      # X11 flag
+      IF(MANTA_ENABLE_X11)
+        SET(X11_FLAG "-DMANTA_ENABLE_X11=1")
+      ELSE(MANTA_ENABLE_X11)
+        SET(X11_FLAG "-DMANTA_ENABLE_X11=0")
+      ENDIF(MANTA_ENABLE_X11)
+
+      # -Wall : Turn on all the warnings.
+      # -w512 : Turn off warning 512.  Overloaded declaration const ignored. 
Non-const method at file:line used.
+      # -w312 : Turn off nested class warning.
+      SET(MANTA_SWIG_FLAGS ${warning_extra} -w512 -w312 ${X11_FLAG}) # Don't 
put quotes around it.  It needs to be a list.
+
+      ############################################################
+      # Manta Interface.
+      SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES CPLUSPLUS ON)
+      SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
+
+      SWIG_ADD_MODULE(mantainterface python mantainterface.i manta.cc 
manta.h)
+
+      SWIG_LINK_LIBRARIES(mantainterface
+        ${PYTHON_LIBRARIES}
+        ${MANTA_TARGET_LINK_LIBRARIES}
       )
-    # string looks like: SWIG Version 1.3.31
-    STRING(REGEX MATCH "SWIG Version ${MANTA_THREE_PART_VERSION_REGEX}" 
version-string ${swig-output})
-    STRING(REGEX MATCH ${MANTA_THREE_PART_VERSION_REGEX} version-string 
${version-string})
-
-    COMPARE_VERSION_STRINGS(${version-string} "1.3.31" swig-version-compare)
-    IF(swig-version-compare GREATER 0)
-      # version > 1.3.31
-      SET(warning_extra "-Wextra")
-    ENDIF(swig-version-compare GREATER 0)
-
-###############################################################################
-FIND_PACKAGE(PythonLibs)
-INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
-
-# Use our local copy instead of the system one
-INCLUDE(${CMAKE_SOURCE_DIR}/CMake/MantaUseSWIG.cmake)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON)
-
-# OK, some versions of CMAKE need you to specify the SWIG_FLAGS
-# parameter.  You can't use a variable set to "", because that will
-# get replaced with a null string and the SET_SOURCE_FILES_PROPERTIES
-# macro will barf.
-
-# SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "`echo \"\"`")
-# SWIG_ADD_MODULE(example python example.i example.cc)
-# SWIG_LINK_LIBRARIES(example ${PYTHON_LIBRARIES})
-
-# X11 flag
-IF(MANTA_ENABLE_X11)
-  SET(X11_FLAG "-DMANTA_ENABLE_X11=1")
-ELSE(MANTA_ENABLE_X11)
-  SET(X11_FLAG "-DMANTA_ENABLE_X11=0")
-ENDIF(MANTA_ENABLE_X11)
-
-# -Wall : Turn on all the warnings.
-# -w512 : Turn off warning 512.  Overloaded declaration const ignored. 
Non-const method at file:line used.
-# -w312 : Turn off nested class warning.
-SET(MANTA_SWIG_FLAGS ${warning_extra} -w512 -w312 ${X11_FLAG}) # Don't put 
quotes around it.  It needs to be a list.
-
-############################################################
-# Manta Interface.
-SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
-
-SWIG_ADD_MODULE(mantainterface python mantainterface.i manta.cc manta.h)
-
-SWIG_LINK_LIBRARIES(mantainterface
-  ${PYTHON_LIBRARIES}
-  ${MANTA_TARGET_LINK_LIBRARIES}
-  )
-ADD_DEPENDENCIES(_mantainterface ${MANTA_TARGET_LINK_LIBRARIES})
-
-IF (APPLE_LEOPARD_LD)
-  SET_TARGET_PROPERTIES(_mantainterface PROPERTIES 
-    LINK_FLAGS 
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
-    )
-ENDIF (APPLE_LEOPARD_LD)
-
-############################################################
-# Manta Runtime.
-SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
-
-SWIG_ADD_MODULE(manta python manta.i manta.cc manta.h)
-
-# Squash some warnings
-SET(swig_generated_file_extra_flags)
-IF   (USING_GCC)
-  SET(swig_generated_file_extra_flags ${swig_generated_file_extra_flags}
-    -Wno-uninitialized)
-ENDIF(USING_GCC)
-
-IF(swig_generated_file_extra_flags)
-  SET_SOURCE_FILES_PROPERTIES(${swig_generated_sources}
-    COMPILE_FLAGS ${swig_generated_file_extra_flags}
-    )
-ENDIF(swig_generated_file_extra_flags)
-
-SWIG_LINK_LIBRARIES(manta
-  ${PYTHON_LIBRARIES}
-  ${MANTA_TARGET_LINK_LIBRARIES}
-  )
-ADD_DEPENDENCIES(_manta ${MANTA_TARGET_LINK_LIBRARIES})
-
-
-IF (APPLE_LEOPARD_LD)
-  SET_TARGET_PROPERTIES(_manta PROPERTIES 
-    LINK_FLAGS 
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
-    )
-ENDIF (APPLE_LEOPARD_LD)
-
-############################################################
-# wxManta Swig/Python
-
-# SET_SOURCE_FILES_PROPERTIES(wxManta_helper.i PROPERTIES CPLUSPLUS ON)
-# SET_SOURCE_FILES_PROPERTIES(wxManta_helper.i PROPERTIES SWIG_FLAGS 
"-Wall;-DSCI_NOPERSISTENT")
-# SWIG_ADD_MODULE(wxmanta_helper python wxManta_helper.i wxManta.cc 
wxManta.h)
-
-############################################################
-# Python callback code
-SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
-SWIG_ADD_MODULE(pycallback python pycallback.i pycallback.cc pycallback.h)
-SWIG_LINK_LIBRARIES(pycallback ${PYTHON_LIBRARIES})
-
-############################################################
-# Output a helper script for setting up path variables.
-INCLUDE(${CMAKE_SOURCE_DIR}/CMake/PythonInvoke.cmake)
-
-PYTHON_ADD_EXECUTABLE(runwxmanta
-  ${CMAKE_CURRENT_SOURCE_DIR}/runwxmanta.py
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${LIBRARY_OUTPUT_PATH}
-  )
-
-PYTHON_ADD_EXECUTABLE(objviewer
-  ${CMAKE_CURRENT_SOURCE_DIR}/objviewer.py
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${LIBRARY_OUTPUT_PATH}
-  )
-
-
-
-FILE(WRITE ${CMAKE_BINARY_DIR}/bin/pythonpath.csh 
-  "setenv PYTHONPATH 
${CMAKE_SOURCE_DIR}/SwigInterface:${CMAKE_BINARY_DIR}/lib\n\n")
-FILE(WRITE ${CMAKE_BINARY_DIR}/bin/pythonpath.sh 
-  "export 
PYTHONPATH=${CMAKE_SOURCE_DIR}/SwigInterface:${CMAKE_BINARY_DIR}/lib\n\n")
-
-###############################################################################
-ENDIF (SWIG_FOUND)
-ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+      ADD_DEPENDENCIES(_mantainterface ${MANTA_TARGET_LINK_LIBRARIES})
+
+      MESSAGE( "got to here" )
+      IF (APPLE_LEOPARD_LD)
+        SET_TARGET_PROPERTIES(_mantainterface PROPERTIES 
+          LINK_FLAGS 
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
+        )
+      ENDIF (APPLE_LEOPARD_LD)
+
+      ############################################################
+      # Manta Runtime.
+      SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES CPLUSPLUS ON)
+      SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
+
+      SWIG_ADD_MODULE(manta python manta.i manta.cc manta.h)
+
+      # Squash some warnings
+      SET(swig_generated_file_extra_flags)
+      IF   (USING_GCC)
+        SET(swig_generated_file_extra_flags 
${swig_generated_file_extra_flags}
+          -Wno-uninitialized)
+      ENDIF(USING_GCC)
+
+      IF(swig_generated_file_extra_flags)
+        SET_SOURCE_FILES_PROPERTIES(${swig_generated_sources}
+          COMPILE_FLAGS ${swig_generated_file_extra_flags}
+          )
+      ENDIF(swig_generated_file_extra_flags)
+
+      SWIG_LINK_LIBRARIES(manta
+        ${PYTHON_LIBRARIES}
+        ${MANTA_TARGET_LINK_LIBRARIES}
+        )
+      ADD_DEPENDENCIES(_manta ${MANTA_TARGET_LINK_LIBRARIES})
+
+      IF (APPLE_LEOPARD_LD)
+        SET_TARGET_PROPERTIES(_manta PROPERTIES 
+          LINK_FLAGS 
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
+          )
+      ENDIF (APPLE_LEOPARD_LD)
+
+      ############################################################
+      # wxManta Swig/Python
+
+      # SET_SOURCE_FILES_PROPERTIES(wxManta_helper.i PROPERTIES CPLUSPLUS ON)
+      # SET_SOURCE_FILES_PROPERTIES(wxManta_helper.i PROPERTIES SWIG_FLAGS 
"-Wall;-DSCI_NOPERSISTENT")
+      # SWIG_ADD_MODULE(wxmanta_helper python wxManta_helper.i wxManta.cc 
wxManta.h)
+
+      ############################################################
+      # Python callback code
+      SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES CPLUSPLUS ON)
+      SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES SWIG_FLAGS 
"${MANTA_SWIG_FLAGS}")
+      SWIG_ADD_MODULE(pycallback python pycallback.i pycallback.cc 
pycallback.h)
+      SWIG_LINK_LIBRARIES(pycallback ${PYTHON_LIBRARIES})
+
+      ############################################################
+      # Output a helper script for setting up path variables.
+      INCLUDE(${CMAKE_SOURCE_DIR}/CMake/PythonInvoke.cmake)
+
+      PYTHON_ADD_EXECUTABLE(runwxmanta
+        ${CMAKE_CURRENT_SOURCE_DIR}/runwxmanta.py
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${LIBRARY_OUTPUT_PATH}
+        )
+
+      PYTHON_ADD_EXECUTABLE(objviewer
+        ${CMAKE_CURRENT_SOURCE_DIR}/objviewer.py
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${LIBRARY_OUTPUT_PATH}
+        )
+
+      FILE(WRITE ${CMAKE_BINARY_DIR}/bin/pythonpath.csh 
+        "setenv PYTHONPATH 
${CMAKE_SOURCE_DIR}/SwigInterface:${CMAKE_BINARY_DIR}/lib\n\n")
+      FILE(WRITE ${CMAKE_BINARY_DIR}/bin/pythonpath.sh 
+        "export 
PYTHONPATH=${CMAKE_SOURCE_DIR}/SwigInterface:${CMAKE_BINARY_DIR}/lib\n\n")
+
+      
###############################################################################
+    ENDIF (SWIG_FOUND)
+  ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
 ENDIF(BUILD_SWIG_INTERFACE)

Modified: trunk/SwigInterface/LightFrame.py
==============================================================================
--- trunk/SwigInterface/LightFrame.py   (original)
+++ trunk/SwigInterface/LightFrame.py   Wed Oct 29 15:39:28 2008
@@ -34,20 +34,38 @@
         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")
+
         button = wx.Button(self, -1, "Close")
         panel.SetSizer(gbs)
 
         vsizer.Add( panel, 0, wx.EXPAND );
 
         hsizer = wx.BoxSizer( wx.HORIZONTAL );
+        hsizer.Add( mlteButton, 0, wx.ALIGN_CENTER );
         hsizer.Add( button, 0, wx.ALIGN_CENTER );
         
         vsizer.Add( hsizer, 0, wx.ALIGN_CENTER );
         self.SetSizerAndFit( vsizer );
 
+        self.Bind(wx.EVT_BUTTON, self.MoveLightToEye, mlteButton)
         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)        
 
+    def MoveLightToEye(self, event):
+        point_light = PointLight.fromLight( 
self.engine.getScene().getLights().getLight(0) )
+
+        data = self.engine.getCamera(0).getBasicCameraData()
+
+        newPosition = Vector( data.eye.x(), data.eye.y(), data.eye.z() )
+
+        print "new eye position is: " + str(data.eye.x()) + ", " + 
str(data.eye.y()) + ", " + str(data.eye.z())
+        cbArgs = ( newPosition, )
+        self.engine.addTransaction("Light Position",
+                                   
manta_new(createMantaTransaction(point_light.setPosition, cbArgs)))
+        # FIXME: Update spinner with new values.
+        #        Probably need to add this button every spinner frame...
+
     def OnCloseMe(self, event):
         self.Close(True)
 
@@ -113,7 +131,6 @@
         gbs.Add( colorWidgets["colorButton"], (0,4), 
flag=wx.ALIGN_CENTER_VERTICAL)
         gbs.Add( wx.StaticText(where, -1, "Color Scale"), (0,5), 
flag=wx.ALIGN_CENTER_VERTICAL)
         gbs.Add( colorWidgets["colorScaleSpinner"], (0,6), 
flag=wx.ALIGN_CENTER_VERTICAL )
-        
 
         panel.SetSizer(gbs)
         return panel

Modified: trunk/scenes/csafe/python/SceneMenus.py
==============================================================================
--- trunk/scenes/csafe/python/SceneMenus.py     (original)
+++ trunk/scenes/csafe/python/SceneMenus.py     Wed Oct 29 15:39:28 2008
@@ -1,4 +1,4 @@
-import sys, os, time, traceback, types
+import sys, os, time, traceback, types, re, glob
 import wx
 import SceneInfo
 import Histogram
@@ -11,19 +11,20 @@
 
 class AddRemoveFilesFrame(wx.Frame):
     def __init__(self, parent, id, title, scene):
-       wx.Frame.__init__(self, parent, id, title, None, (700, 700))
+
+       wx.Frame.__init__(self, parent, id, title, 
(wx.GetMouseState().GetX(),wx.GetMouseState().GetY()), (700, 700))
        self.scene = scene
        self.parent = parent;
        panel = scrolled.ScrolledPanel(self,-1, style= wx.TAB_TRAVERSAL)
        self.lb1 = wx.ListBox(panel, -1, (0, 0), (600, 200), [], 
wx.LB_EXTENDED)
 
-
        sizer = wx.BoxSizer(wx.VERTICAL)
-       sizer.Add(wx.StaticText(panel,-1, "Sphere data nrrds/nhdrs: "))
+       sizer.Add(wx.StaticText(panel,-1, "Particle data nrrds/nhdrs: "))
        sizer.Add(self.lb1, -1, wx.ALL|wx.ALIGN_CENTER, 5)
        hSizer1 = wx.BoxSizer(wx.HORIZONTAL)
-       self.addParticlesButton = wx.Button(panel,-1, "Add Particles File")
-       self.removeButton = wx.Button(panel, -1,"Remove Particles")
+       self.addParticlesButton = wx.Button(panel,-1, "Add Particle File(s)")
+       self.removeButton = wx.Button(panel, -1,"Remove Particle File")
+       self.removeButton.Disable()
        hSizer1.Add(self.addParticlesButton, 0, wx.ALL, 3)
        hSizer1.Add(self.removeButton, 0, wx.ALL, 3)
        sizer.Add(hSizer1, 0, wx.ALL|wx.ALIGN_CENTER, 5)
@@ -33,8 +34,9 @@
        sizer.Add(self.lb2, -1, wx.ALL|wx.ALIGN_CENTER, 5)
        hSizer2 = wx.BoxSizer(wx.HORIZONTAL)
        
-       self.addVolumeButton = wx.Button(panel,-1, "Add Volume File")
-       self.removeButton2 = wx.Button(panel, -1, "Remove Volume")
+       self.addVolumeButton = wx.Button(panel,-1, "Add Volume File(s)")
+       self.removeButton2 = wx.Button(panel, -1, "Remove Volume File")
+       self.removeButton2.Disable()
        hSizer2.Add(self.addVolumeButton, 0, wx.ALL, 3)
        hSizer2.Add(self.removeButton2, 0, wx.ALL, 3)
        sizer.Add(hSizer2, 0, wx.ALL|wx.ALIGN_CENTER, 5)                
@@ -83,6 +85,9 @@
                print str(self.scene.nrrdFiles2[i])
        print "end nrrdFiles2."
 
+        if self.lb1.GetCount() != 0 or self.lb2.GetCount() != 0 :
+            self.parent.generateMenuItem.Enable( True );
+
     def OnClickCancel(self, evt):
         self.Close(True)
 
@@ -92,6 +97,8 @@
             try:
                 self.lb1.Delete(i - offset)
                 offset+=1
+                if self.lb1.GetCount() == 0:
+                    self.removeButton.Disable();
             except:
                 continue
     
@@ -101,6 +108,8 @@
             try:
                 self.lb2.Delete(i - offset)
                 offset+=1
+                if self.lb2.GetCount() == 0:
+                    self.removeButton2.Disable();
             except:
                 continue
         
@@ -111,13 +120,42 @@
         dlg = wx.FileDialog(self, message="Choose a Particle file(s)",
            defaultDir=os.getcwd(), defaultFile="",wildcard=wildcard,
            style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR)
+
+        dlg.SetFilterIndex( 2 ); # Default to only seeing nhdr files...
+
+        # See if there is a location that the user wants the file dialog to 
default to...
+        csafe_data_dir = os.environ.get( "CSAFE_DATA_DIR" )
+        if csafe_data_dir:
+            if os.path.isdir( csafe_data_dir ):
+                dlg.SetDirectory( csafe_data_dir );
+
         if dlg.ShowModal() == wx.ID_OK:
+
+            # Enable the remove button for particles
+            self.removeButton.Enable()
+
             paths = dlg.GetPaths()
             selected = self.lb1.GetSelections()
             index = int(self.lb1.GetCount())
             if len(selected) > 0:
                 index = int(selected[0])
             for path in paths:
+                # See if there is a corresponding volume file: (Search for 
t????? where ? are digits, eg: t00803)
+                pattern = re.compile( "t\d+" )
+                result = pattern.search( path )
+
+                if result:
+                    full_path = os.path.dirname( path )
+                    timestep = result.group()
+                    # Note, this is kinda hacky right now... assuming that 
volumes have .nrrd extension...
+                    volume_file = glob.glob( full_path + "/*" + timestep + 
"*.nrrd" )
+
+                    if len( volume_file ) == 1  : # If we found one (and 
only one) match.
+                        if self.lb2.FindString( volume_file[0] ) == -1 : # 
Make sure it is not already in the list...
+                            self.lb2.Insert( volume_file[0], index)
+                            # Enable the remove button for volumes
+                            self.removeButton2.Enable()
+
                 self.lb1.Insert(path, index)
                 index = index+1
 

Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py     (original)
+++ trunk/scenes/csafe/python/csafe_demo.py     Wed Oct 29 15:39:28 2008
@@ -63,7 +63,7 @@
 class MyFrame(wx.Frame):
     def __init__(self, parent, ID, title):
         wx.Frame.__init__(self, parent, ID, title, 
-        wx.DefaultPosition, wx.Size(400, 450))
+        wx.Point(20,20), wx.Size(400, 450))
         self.panel = scrolled.ScrolledPanel(self,-1, style= wx.TAB_TRAVERSAL)
         self.scene = SceneInfo.Scene()
         self.SetBackgroundColour(self.scene.bgColor)
@@ -72,7 +72,7 @@
         menuFile.Append(101, "&About", "")
         menuFile.Append(102, "&Save", "")
         menuFile.Append(103, "Save As...", "")
-        menuFile.Append(104, "Load", "")
+        menuFile.Append(104, "Load Configuration", "")
         menuFile.Append(110, "Load UDA", "Uintah Dataset")
        menuFile.Append(107, "Import NrrdList")
        menuFile.Append(108, "Export NrrdList")
@@ -82,13 +82,16 @@
         menuBar.Append(menuFile, "File")
         
         menuScene = wx.Menu()
-        menuScene.Append(201, "&Add/Remove Files", "Add and remove Nrrd 
files to the scene")
+        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")
         menuScene.Append(206, "Volume Position/Size")
-        menuScene.Append(203, "&Generate")
+
+        self.generateMenuItem = menuScene.Append(203, "&Generate")
         menuBar.Append(menuScene, "Scene")
+
+        self.generateMenuItem.Enable( False );
         
         menuHelp = wx.Menu()
         menuBar.Append(menuHelp, "Help")
@@ -155,7 +158,7 @@
             
     def Menu101(self, evt):
         info = wx.AboutDialogInfo()
-        info.Name = "Manta - CSAFE Demo"
+        info.Name = "Manta - C-SAFE Particle/Volume Scene"
         info.Version = "0.1"
         info.Copyright = "(C) 2008 Steven G Parker"
         info.Description = "A program for running and modifying particle and 
volume datasets. By: Steve Parker, James Bigler, Carson Brownlee. MIT 
License."
@@ -183,10 +186,13 @@
 
     def Menu104(self,evt):
         self.SetFocus()
-       dlg = wx.FileDialog(self, message="Open file",
+        wildcard = "Config File (*.cfg)|*.cfg|" \
+                   "All files (*.*)|*.*" \
+
+       dlg = wx.FileDialog(self, message="Open Configuration File",
                defaultDir=os.getcwd(),
                defaultFile="",
-               wildcard="*",
+               wildcard=wildcard,
                style=wx.OPEN|wx.CHANGE_DIR)
        if dlg.ShowModal() == wx.ID_OK:
                filename = dlg.GetPath()
@@ -228,7 +234,7 @@
 
        ################ Add/Remove Files #################
     def Menu201(self, evt):
-        frame = SceneMenus.AddRemoveFilesFrame(self, -1, "Add/Remove Files", 
self.scene)
+        frame = SceneMenus.AddRemoveFilesFrame(self, -1, "Add/Remove Data 
Files", self.scene)
        frame.Show(True)
 
        ################ Scene Properties #################
@@ -494,7 +500,6 @@
         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.Bind(wx.EVT_SLIDER, self.OnSlider, self.slider)
-       
 
        vs.Layout()
 
@@ -503,7 +508,7 @@
        self.SetBackgroundColour(self.scene.bgColor)
        self.LayoutWindow()
 #TODO: values hardcoded for now
-       self.scene.ridx = 6
+       #self.scene.ridx = 6
        self.scene.cidx = 4
        self.volCMap.scaleAlphas(0.00125)
 
@@ -763,12 +768,13 @@
             sys.exit(2)
 
 
-    frame1 = MyFrame(None, -1, "CSAFE Demo")
+    frame1 = MyFrame(None, -1, "C-SAFE Particle/Volume Visualizer")
     frame1.scene.mantaFrame = app.frame
     frame1.Show(True)  
     frame1.InitializeScene(app.frame, app.frame.engine)
     frame1.LayoutWindow()
     frame1.scene.mantaApp = app
+
     print "cfg: " + str(setup.cfg)
     if (setup.cfg != ""):
         Configuration.ReadConfiguration(frame1.scene, setup.cfg)

Modified: trunk/scenes/csafe/src/CDTest.h
==============================================================================
--- trunk/scenes/csafe/src/CDTest.h     (original)
+++ trunk/scenes/csafe/src/CDTest.h     Wed Oct 29 15:39:28 2008
@@ -216,7 +216,7 @@
   void setClippingBBox(Vector min, Vector max)
     {
       tempMin = min; tempMax = max;
-      _manta_interface->addOneShotCallback(MantaInterface::Relative, 1, 
Callback::create(this, &CDTest::setClippingBBoxHelper));
+      //_manta_interface->addOneShotCallback(MantaInterface::Relative, 1, 
Callback::create(this, &CDTest::setClippingBBoxHelper));
     }
   void setClippingBBoxHelper(int, int)
     {

Modified: trunk/scenes/csafe/swig/CMakeLists.txt
==============================================================================
--- trunk/scenes/csafe/swig/CMakeLists.txt      (original)
+++ trunk/scenes/csafe/swig/CMakeLists.txt      Wed Oct 29 15:39:28 2008
@@ -33,13 +33,25 @@
 FIND_PACKAGE(SWIG REQUIRED)
 
 EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
-  OUTPUT_VARIABLE swig-output
-  )
+                RESULT_VARIABLE status ERROR_VARIABLE swig-output
+                OUTPUT_VARIABLE swig-output )
+
+IF(status EQUAL 0)
+ELSE(status EQUAL 0)
+  MESSAGE( FATAL_ERROR "Running SWIG command (${SWIG_EXECUTABLE} -version) 
failed with error: ${status}" )
+ENDIF(status EQUAL 0)
+
+STRING( LENGTH '${swig-output}' length )
+
+IF(length LESS 3)
+  MESSAGE(FATAL_ERROR "SWIG did not return a valid version string: 
'${swig-output}'")
+ENDIF(length LESS 3)
+
 # string looks like: SWIG Version 1.3.31
-STRING(REGEX MATCH "SWIG Version ${MANTA_THREE_PART_VERSION_REGEX}" 
version-string ${swig-output})
-STRING(REGEX MATCH ${MANTA_THREE_PART_VERSION_REGEX} version-string 
${version-string})
+STRING(REGEX MATCH "SWIG Version ${MANTA_THREE_PART_VERSION_REGEX}" 
version-string '${swig-output}' )
+STRING(REGEX MATCH ${MANTA_THREE_PART_VERSION_REGEX} version-string 
'${version-string}' )
 
-COMPARE_VERSION_STRINGS(${version-string} "1.3.31" swig-version-compare)
+COMPARE_VERSION_STRINGS( '${version-string}' "1.3.31" swig-version-compare)
 IF(swig-version-compare GREATER 0)
   # version > 1.3.31
   SET(warning_extra "-Wextra")


  • [Manta] r2343 - in trunk: Image SwigInterface scenes/csafe/python scenes/csafe/src scenes/csafe/swig, dav, 10/29/2008

Archive powered by MHonArc 2.6.16.

Top of page