Merge pull request #555 from emminizer/fix-noisy-flt-loading

FLT: Missing optional attr files on textures no longer generates a co…
This commit is contained in:
OpenSceneGraph git repository 2018-06-14 14:44:16 +01:00 committed by GitHub
commit 9171f12069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -344,8 +344,13 @@ protected:
texture->setImage(image.get());
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
// Read attribute file
// Since the .attr file is optional according to the OpenFlight spec, check to see
// if the file exists before reading it, to avoid printing an unnecessary warning.
std::string attrname = filename + ".attr";
if (!osgDB::fileExists(attrname))
return stateset;
// Read optional attribute file
osg::ref_ptr<AttrData> attr = osgDB::readRefFile<AttrData>(attrname,document.getOptions());
if (attr.valid())
{