- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ive/ReaderWriterIVE.cpp
r11493 r13041 15 15 { 16 16 public: 17 17 18 18 ReaderWriterIVE() 19 19 { … … 31 31 supportsOption("OutputTextureFiles","Write out the texture images to file"); 32 32 } 33 33 34 34 virtual const char* className() const { return "IVE Reader/Writer"; } 35 35 … … 58 58 return readImage(istream, local_opt.get()); 59 59 } 60 60 61 61 virtual ReadResult readNode(const std::string& file, const Options* options) const 62 62 { … … 67 67 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 68 68 69 // code for setting up the database path so that internally referenced file are searched for on relative paths. 69 // code for setting up the database path so that internally referenced file are searched for on relative paths. 70 70 osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 71 71 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); … … 74 74 return readNode(istream,local_opt.get()); 75 75 } 76 76 77 77 virtual ReadResult readObject(std::istream& fin, const Options* options) const 78 78 { … … 83 83 { 84 84 ive::DataInputStream in(&fin, options); 85 if (in.getException()) 85 if (in.getException()) 86 86 { 87 87 return in.getException()->getError(); … … 95 95 // Create datainputstream. 96 96 ive::DataInputStream in(&fin, options); 97 if (in.getException()) 97 if (in.getException()) 98 98 { 99 99 return in.getException()->getError(); … … 116 116 std::string ext = getFileExtension(fileName); 117 117 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 118 // code for setting up the database path so that internally referenced file are searched for on relative paths. 118 // code for setting up the database path so that internally referenced file are searched for on relative paths. 119 119 osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 120 120 if(local_opt->getDatabasePathList().empty()) … … 135 135 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 136 136 137 // code for setting up the database path so that internally referenced file are searched for on relative paths. 137 // code for setting up the database path so that internally referenced file are searched for on relative paths. 138 138 osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 139 139 if(local_opt->getDatabasePathList().empty()) … … 144 144 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 145 145 if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; 146 146 147 147 WriteResult result = writeNode(node, fout, local_opt.get()); 148 148 fout.close(); 149 149 return result; 150 150 } 151 151 152 152 virtual WriteResult writeObject(const Object& object,std::ostream& fout, const osgDB::ReaderWriter::Options* options) const 153 153 { … … 164 164 out.writeImage(ive::IMAGE_INCLUDE_DATA, const_cast<osg::Image*>(&image)); 165 165 if (fout.fail()) return WriteResult::ERROR_IN_WRITING_FILE; 166 if (out.getException()) 166 if (out.getException()) 167 167 { 168 168 OSG_WARN<<"Error writing IVE image: "<< out.getException()->getError() << std::endl; … … 179 179 180 180 if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE; 181 if (out.getException()) 181 if (out.getException()) 182 182 { 183 183 OSG_WARN<<"Error writing IVE image: "<< out.getException()->getError() << std::endl;
