- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG.cpp
r11912 r13041 156 156 { 157 157 std::string ext = osgDB::getLowerCaseFileExtension(file); 158 158 159 159 if (equalCaseInsensitive(ext,"osgs")) 160 { 160 { 161 161 std::istringstream fin(osgDB::getNameLessExtension(file)); 162 162 if (fin) return readNode(fin,opt); 163 163 return ReadResult::ERROR_IN_READING_FILE; 164 } 165 164 } 165 166 166 if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; 167 167 … … 169 169 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 170 170 171 // code for setting up the database path so that internally referenced file are searched for on relative paths. 171 // code for setting up the database path so that internally referenced file are searched for on relative paths. 172 172 osg::ref_ptr<Options> local_opt = opt ? static_cast<Options*>(opt->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 173 173 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); … … 179 179 } 180 180 return 0L; 181 } 181 } 182 182 183 183 virtual ReadResult readObject(std::istream& fin, const Options* options) const … … 190 190 fr.attach(&fin); 191 191 fr.setOptions(options); 192 192 193 193 typedef std::vector<osg::Object*> ObjectList; 194 194 ObjectList objectList; … … 221 221 222 222 if (equalCaseInsensitive(ext,"osgs")) 223 { 223 { 224 224 std::istringstream fin(osgDB::getNameLessExtension(file)); 225 225 if (fin) return readNode(fin,opt); 226 226 return ReadResult::ERROR_IN_READING_FILE; 227 } 228 227 } 228 229 229 if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; 230 230 … … 232 232 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 233 233 234 // code for setting up the database path so that internally referenced file are searched for on relative paths. 234 // code for setting up the database path so that internally referenced file are searched for on relative paths. 235 235 osg::ref_ptr<Options> local_opt = opt ? static_cast<Options*>(opt->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 236 236 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); … … 242 242 } 243 243 return 0L; 244 245 } 246 244 245 } 246 247 247 virtual ReadResult readNode(std::istream& fin, const Options* options) const 248 248 { … … 254 254 fr.attach(&fin); 255 255 fr.setOptions(options); 256 256 257 257 typedef std::vector<osg::Node*> NodeList; 258 258 NodeList nodeList; … … 297 297 while (iss >> opt) 298 298 { 299 if(opt=="PRECISION" || opt=="precision") 299 if(opt=="PRECISION" || opt=="precision") 300 300 { 301 301 int prec; … … 313 313 } 314 314 } 315 } 315 } 316 316 317 317 virtual WriteResult writeObject(const Object& obj, const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
