SGMaterialAnimation: Better handling of missing texture
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.
This commit is contained in:
@@ -364,6 +364,8 @@ public:
|
|||||||
if (_textureProp) {
|
if (_textureProp) {
|
||||||
std::string textureName = _textureProp->getStringValue();
|
std::string textureName = _textureProp->getStringValue();
|
||||||
if (_textureName != textureName) {
|
if (_textureName != textureName) {
|
||||||
|
_textureName = textureName;
|
||||||
|
|
||||||
while (stateSet->getTextureAttribute(0,
|
while (stateSet->getTextureAttribute(0,
|
||||||
osg::StateAttribute::TEXTURE)) {
|
osg::StateAttribute::TEXTURE)) {
|
||||||
stateSet->removeTextureAttribute(0, osg::StateAttribute::TEXTURE);
|
stateSet->removeTextureAttribute(0, osg::StateAttribute::TEXTURE);
|
||||||
@@ -377,8 +379,12 @@ public:
|
|||||||
osg::StateAttribute::OVERRIDE);
|
osg::StateAttribute::OVERRIDE);
|
||||||
stateSet->setTextureMode(0, GL_TEXTURE_2D,
|
stateSet->setTextureMode(0, GL_TEXTURE_2D,
|
||||||
osg::StateAttribute::ON);
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user