From 5afeb44cec75deebf91a12dd9ba1a05ecb06676c Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 25 May 2022 10:35:31 +0100 Subject: [PATCH] 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. --- simgear/scene/material/makeEffect.cxx | 2 +- simgear/scene/model/SGReaderWriterXML.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simgear/scene/material/makeEffect.cxx b/simgear/scene/material/makeEffect.cxx index 9855f371..b0ead006 100644 --- a/simgear/scene/material/makeEffect.cxx +++ b/simgear/scene/material/makeEffect.cxx @@ -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; diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index 55de8b19..af1e6f7b 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -801,7 +801,7 @@ sgLoad3DModel_internal(const SGPath& path, makeEffectAnimations(animation_nodes, effect_nodes); { ref_ptr modelWithEffects = instantiateEffects(group.get(), effect_nodes, options.get(), - path.dirPath()); + path); group = static_cast(modelWithEffects.get()); }