Browse Source

print warning when file not found

David Rose 19 years ago
parent
commit
79f9e04e26
3 changed files with 18 additions and 14 deletions
  1. 0 13
      panda/src/pnmimage/pnmImage.I
  2. 17 0
      panda/src/pnmimage/pnmImage.cxx
  3. 1 1
      panda/src/pnmimage/pnmImage.h

+ 0 - 13
panda/src/pnmimage/pnmImage.I

@@ -27,19 +27,6 @@ PNMImage() {
   _alpha = NULL;
   _alpha = NULL;
 }
 }
 
 
-////////////////////////////////////////////////////////////////////
-//     Function: PNMImage::Constructor
-//       Access: Published
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE PNMImage::
-PNMImage(const Filename &filename, PNMFileType *type) {
-  _array = NULL;
-  _alpha = NULL;
-
-  read(filename, type);
-}
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PNMImage::Constructor
 //     Function: PNMImage::Constructor
 //       Access: Published
 //       Access: Published

+ 17 - 0
panda/src/pnmimage/pnmImage.cxx

@@ -21,6 +21,23 @@
 #include "pnmWriter.h"
 #include "pnmWriter.h"
 #include "config_pnmimage.h"
 #include "config_pnmimage.h"
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PNMImage::Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+PNMImage::
+PNMImage(const Filename &filename, PNMFileType *type) {
+  _array = NULL;
+  _alpha = NULL;
+
+  bool result = read(filename, type);
+  if (!result) {
+    pnmimage_cat.error()
+      << "Could not read image " << filename << "\n";
+  }    
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PNMImage::clear
 //     Function: PNMImage::clear
 //       Access: Published
 //       Access: Published

+ 1 - 1
panda/src/pnmimage/pnmImage.h

@@ -59,7 +59,7 @@ class PNMFileType;
 class EXPCL_PANDA PNMImage : public PNMImageHeader {
 class EXPCL_PANDA PNMImage : public PNMImageHeader {
 PUBLISHED:
 PUBLISHED:
   INLINE PNMImage();
   INLINE PNMImage();
-  INLINE PNMImage(const Filename &filename, PNMFileType *type = NULL);
+  PNMImage(const Filename &filename, PNMFileType *type = NULL);
   INLINE PNMImage(int x_size, int y_size, int num_channels = 3,
   INLINE PNMImage(int x_size, int y_size, int num_channels = 3,
                   xelval maxval = 255, PNMFileType *type = NULL);
                   xelval maxval = 255, PNMFileType *type = NULL);
   INLINE PNMImage(const PNMImage &copy);
   INLINE PNMImage(const PNMImage &copy);