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:
parent
255f6dda41
commit
40d46a8687
@ -109,14 +109,15 @@ inline osg::Node* readNodeFile(const std::string& filename)
|
||||
|
||||
/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
|
||||
* than one subgraph has been loaded.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.*/
|
||||
extern OSGDB_EXPORT osg::Node* readNodeFiles(std::vector<std::string>& commandLine,const Options* options);
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
* Does NOT ignore strings beginning with a dash '-' character. */
|
||||
extern OSGDB_EXPORT osg::Node* readNodeFiles(std::vector<std::string>& fileList,const Options* options);
|
||||
|
||||
/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
|
||||
* than one subgraph has been loaded.*/
|
||||
inline osg::Node* readNodeFiles(std::vector<std::string>& commandLine)
|
||||
inline osg::Node* readNodeFiles(std::vector<std::string>& fileList)
|
||||
{
|
||||
return readNodeFiles(commandLine,Registry::instance()->getOptions());
|
||||
return readNodeFiles(fileList,Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user