From acf359777eb58b06c20d8843afd6fb261a347894 Mon Sep 17 00:00:00 2001 From: Daniel Emminizer Date: Thu, 14 Jun 2018 07:33:08 -0400 Subject: [PATCH] FLT: Missing optional attr files on textures no longer generates a console warning. --- src/osgPlugins/OpenFlight/PaletteRecords.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/OpenFlight/PaletteRecords.cpp b/src/osgPlugins/OpenFlight/PaletteRecords.cpp index 659736a4e..cdffe75af 100644 --- a/src/osgPlugins/OpenFlight/PaletteRecords.cpp +++ b/src/osgPlugins/OpenFlight/PaletteRecords.cpp @@ -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 attr = osgDB::readRefFile(attrname,document.getOptions()); if (attr.valid()) {