{
for(ShaderMap::iterator sitr = shaderMap.begin(); sitr != shaderMap.end(); ++sitr)
{
- Shader *shader = sitr->second.get();
+ Shader *shader = sitr->second.get();
string fileName = SGModelLib::findDataFile(sitr->first.first);
if (!fileName.empty()) {
- shader->loadShaderSourceFromFile(fileName);
+ shader->loadShaderSourceFromFile(fileName);
}
}
}
const SGPropertyNode* pImage
= getEffectPropertyChild(effect, props, "image");
string imageName;
+ string absFileName;
if (pImage)
+ {
imageName = pImage->getStringValue();
- string absFileName = SGModelLib::findDataFile(imageName, options);
+ absFileName = SGModelLib::findDataFile(imageName, options);
+ if (absFileName.empty())
+ {
+ SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '"
+ << imageName << "'");
+ }
+ }
const SGPropertyNode* pMipmapControl
= getEffectPropertyChild(effect, props, "mipmap-control");
copyProperties(overlay, props);
if (props->hasValue("/path")) {
- modelpath = SGModelLib::findDataFile(props->getStringValue("/path"), NULL, modelDir);
+ string modelPathStr = props->getStringValue("/path");
+ modelpath = SGModelLib::findDataFile(modelPathStr, NULL, modelDir);
+ if (modelpath.isNull())
+ throw sg_io_exception("Model file not found: '" + modelPathStr + "'",
+ path.str());
+
if (props->hasValue("/texture-path")) {
- texturepath = SGModelLib::findDataFile(props->getStringValue("/texture-path"), NULL, modelDir);
+ string texturePathStr = props->getStringValue("/texture-path");
+ texturepath = SGModelLib::findDataFile(texturePathStr, NULL, modelDir);
+ if (texturepath.isNull())
+ throw sg_io_exception("Texture file not found: '" + texturePathStr + "'",
+ path.str());
}
} else {
model = new osg::Node;
SGPath submodelpath;
osg::ref_ptr<osg::Node> submodel;
- SGPath submodelPath = SGModelLib::findDataFile(sub_props->getStringValue("path"),
+ string subPathStr = sub_props->getStringValue("path");
+ SGPath submodelPath = SGModelLib::findDataFile(subPathStr,
NULL, modelDir);
+ if (submodelPath.isNull()) {
+ SG_LOG(SG_INPUT, SG_ALERT, "Failed to load file: \"" << subPathStr << "\"");
+ continue;
+ }
+
osg::ref_ptr<SGReaderWriterXMLOptions> options;
options = new SGReaderWriterXMLOptions(*options_);
options->setPropRoot(prop_root);