Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r998 - trunk/Engine/Control


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r998 - trunk/Engine/Control
  • Date: Mon, 3 Apr 2006 14:13:51 -0600 (MDT)

Author: abe
Date: Mon Apr  3 14:13:50 2006
New Revision: 998

Modified:
   trunk/Engine/Control/RTRT.cc
Log:

Fixed readMOStack to match the implementation of readMOScene (which
can handle both relative and absolute paths, as well as searching the
scene path).

M    RTRT.cc


Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc        (original)
+++ trunk/Engine/Control/RTRT.cc        Mon Apr  3 14:13:50 2006
@@ -1287,52 +1287,46 @@
 // This dynamically loads code to configure the manta rendering stack.
 void RTRT::readMOStack(const string& name, const vector<string>& args, bool 
printErrors )
 {
+
+  // Assume an absolute path by default
+  string fullname = name;
+  
   vector<string> dirs = split_string(scenePath, ':');
   for(vector<string>::iterator dir = dirs.begin(); dir != dirs.end(); dir++){
 
+    fullname = *dir + "/"+name;
+    
     // Check to see if the file exists in the directory.
-    string fullname = *dir + "/"+name;
     struct stat statbuf;
     if(stat(fullname.c_str(), &statbuf) != 0){
-      // if(printErrors){
-      //   cerr << "Error reading " << fullname << ": " << strerror(errno) 
<< '\n';
-      // }
-      continue;
+      break;
     }
-
-    // Open the file.
-    void* handle=dlopen(fullname.c_str(), RTLD_NOW);
-    if(!handle){
-      if(printErrors){
-        cerr << "Error opening scene: " << fullname << '\n';
-        cerr << dlerror() << '\n';
-        throw InputError( "Could not load stack" );
-      }
-      continue;
-    }
-
-    // Access the make_stack symbol
-    void* stack_fn=dlsym(handle, "make_stack");
-    if(!stack_fn){
-      if(printErrors){
-        cerr << "Stack configuration file found, but make_stack() function 
not found\n";
-      }
-      // If we get here, we fail so that we don't keep searching the path
-      // for another library
-      return;
+  }
+  
+  // Open the file.
+  void* handle=dlopen(fullname.c_str(), RTLD_NOW);
+  if(!handle){
+    throw InputError( "Could not load stack" );
+  }
+  
+  // Access the make_stack symbol
+  void* stack_fn=dlsym(handle, "make_stack");
+  if(!stack_fn){
+    if(printErrors){
+      cerr << "Stack configuration file found, but make_stack() function not 
found\n";
     }
-
-    
///////////////////////////////////////////////////////////////////////////
-    // Invoke the function.
-    
-    typedef void (*MakerType)(ReadContext &, const vector<string>&);
-    MakerType make_stack = (MakerType)(stack_fn);
-    ReadContext context(this);
-
-    // Call the function.
-    (*make_stack)(context, args);
-        
+    return;
   }
+  
+  ///////////////////////////////////////////////////////////////////////////
+  // Invoke the function.  
+  typedef void (*MakerType)(ReadContext &, const vector<string>&);
+  MakerType make_stack = (MakerType)(stack_fn);
+  ReadContext context(this);
+  
+  // Call the function.
+  (*make_stack)(context, args);
+  
 }
 
 UserInterface* RTRT::createUserInterface(const string& spec)




  • [MANTA] r998 - trunk/Engine/Control, abe, 04/03/2006

Archive powered by MHonArc 2.6.16.

Top of page