From Chris Hanson, " Remove vestigial (and because it was undocumented, potentially harmful) code to ignore
filenames starting with a dash "-" character from the (std::vector<std::string>&) version of osgDB::readNodeFiles. Handling of argument strings is properly implemented in the osgDB::readNodeFiles(osg::ArgumentParser& arguments,const Options* options) variant, which most code uses. The (std::vector<std::string>&) version is only called by the osgconv utility, which does its own argument handling and stripping prior to calling readNodeFiles(). Also, documented this behaviour in the header comments. I believe this code removal is a meritful change because leavign the code in causes an unexpected and undocumented behaviour (ignoring any filename starting with a dash) that could bite users in the future. This behaviour is not needed for existing functionality because existing code uses other APIs to handle dash-prefixed arguments anyway. "
This commit is contained in:
@@ -72,29 +72,23 @@ Node* osgDB::readNodeFile(const std::string& filename,const Options* options)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Node* osgDB::readNodeFiles(std::vector<std::string>& commandLine,const Options* options)
|
||||
Node* osgDB::readNodeFiles(std::vector<std::string>& fileList,const Options* options)
|
||||
{
|
||||
typedef std::vector<osg::Node*> NodeList;
|
||||
NodeList nodeList;
|
||||
|
||||
// note currently doesn't delete the loaded file entries from the command line yet...
|
||||
|
||||
for(std::vector<std::string>::iterator itr=commandLine.begin();
|
||||
itr!=commandLine.end();
|
||||
for(std::vector<std::string>::iterator itr=fileList.begin();
|
||||
itr!=fileList.end();
|
||||
++itr)
|
||||
{
|
||||
if ((*itr)[0]!='-')
|
||||
osg::Node *node = osgDB::readNodeFile( *itr , Registry::instance()->getOptions() );
|
||||
|
||||
if( node != (osg::Node *)0L )
|
||||
{
|
||||
// not an option so assume string is a filename.
|
||||
osg::Node *node = osgDB::readNodeFile( *itr , options );
|
||||
|
||||
if( node != (osg::Node *)0L )
|
||||
{
|
||||
if (node->getName().empty()) node->setName( *itr );
|
||||
nodeList.push_back(node);
|
||||
}
|
||||
|
||||
if (node->getName().empty()) node->setName( *itr );
|
||||
nodeList.push_back(node);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (nodeList.empty())
|
||||
|
||||
Reference in New Issue
Block a user