]> git.mxchange.org Git - simgear.git/commitdiff
SGMaterialAnimation: Better handling of missing texture
authorTorsten Dreyer <torsten@t3r.de>
Fri, 27 Nov 2015 10:07:52 +0000 (11:07 +0100)
committerTorsten Dreyer <torsten@t3r.de>
Fri, 27 Nov 2015 10:09:16 +0000 (11:09 +0100)
Don't retry loading a missing texture on every frame.
Emit a warning message instead and retry on the next
change of the textures name.

simgear/scene/model/SGMaterialAnimation.cxx

index cc5c660c6ae93355779e3f8600e1e6c2791b3f0c..0169f574ba23f8c10d37a32b03d15b21a0cc0c1f 100644 (file)
@@ -364,6 +364,8 @@ public:
       if (_textureProp) {
         std::string textureName = _textureProp->getStringValue();
         if (_textureName != textureName) {
+          _textureName = textureName;
+
           while (stateSet->getTextureAttribute(0,
                                               osg::StateAttribute::TEXTURE)) {
             stateSet->removeTextureAttribute(0, osg::StateAttribute::TEXTURE);
@@ -377,8 +379,12 @@ public:
                                            osg::StateAttribute::OVERRIDE);
               stateSet->setTextureMode(0, GL_TEXTURE_2D,
                                        osg::StateAttribute::ON);
-              _textureName = textureName;
             }
+          } else {
+              SG_LOG(SG_IO, SG_WARN, "texture animation: requested texture : " << textureName << " not found. Searched paths:" );
+              for( osgDB::FilePathList::iterator it = _texturePathList.begin(); it != _texturePathList.end(); ++it ) {
+                SG_LOG(SG_IO, SG_WARN, " - " << *it );
+              }
           }
         }
       }