Hi,

I am wondering if there is a good reason that osgDB::writeNodeFile does not 
behave in the same manner as osgDB::readNodeFile in the sense that the former 
returns a bool when the latter returns an osg::Node*.

This prevents using pseudo-writers as pseudo-loaders 
(http://trac.openscenegraph.org/projects/osg//wiki/Support/KnowledgeBase/PseudoLoader)
 and to chain plugins calls.
Imagine I want to write an obfuscator plugin; I would like to call
  osgconv mymodel.fmt myobfuscatedmodel.fmt.obfuscator
to obfuscate data and 
  osgconv mybfuscatedmodel.fmt.obfuscator myunobfuscatedmodel.fmt
to un-obfuscate it.

I can manually achieve that with something like


Code:

      std::string realFileName = osgDB::getNameLessExtension(fileName);
      if(realFileName.empty())
          return WriteResult::FILE_NOT_HANDLED;

      // obfuscator
      ref_ptr<Node> obfuscatedNode = obfuscateModel(node, 
parseOptions(options));

      // forward writing to the "real" plugin
      ref_ptr<ReaderWriter> rw = getReaderWriter(realFileName);
      if(rw) {
          return rw->writeNode(*obfuscatedNode, realFileName, options);
      }
      else {
          return WriteResult::ERROR_IN_WRITING_FILE;
      }




but it doesn't feel totally right.

Note that I could use 2 seperate plugins, one for obfuscation and one for 
de-obfuscation, however, I might want my code to run *after* the osg::Optimizer 
and this requires for the plugin to be called at write time.

Could we change osgDB::writeNodeFile signature or is it a bad idea? 


Thank you!

Cheers,
Marc

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60205#60205





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to