Effects: pass model XML file path, not dir path

Pass the full path to the XML file, not is containg directory, through
effects, so that it's available for error reporting. Convert to an
actual directory when using the path to lookup other resources.
This commit is contained in:
James Turner 2022-05-25 10:35:31 +01:00
parent e0e3456a68
commit 5afeb44cec
2 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ Effect* makeEffect(const string& name,
}
string effectFileName(name);
effectFileName += ".eff";
string absFileName = SGModelLib::findDataFile(effectFileName, options, modelPath);
string absFileName = SGModelLib::findDataFile(effectFileName, options, modelPath.dir());
if (absFileName.empty()) {
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::LoadEffectsShaders, "Couldn't find Effect:" + effectFileName);
return nullptr;

View File

@ -801,7 +801,7 @@ sgLoad3DModel_internal(const SGPath& path,
makeEffectAnimations(animation_nodes, effect_nodes);
{
ref_ptr<Node> modelWithEffects = instantiateEffects(group.get(), effect_nodes, options.get(),
path.dirPath());
path);
group = static_cast<Group*>(modelWithEffects.get());
}