Search all resources when adding models at runtime.
geo.put-model / add-model mechanism now supports resolving paths using all the defined locations, including aircraft dirs and additional data dirs,
This commit is contained in:
parent
c6541e9c8f
commit
2a1e33863a
1 changed files with 4 additions and 3 deletions
|
@ -69,13 +69,14 @@ FGModelMgr::add_model (SGPropertyNode * node)
|
|||
SG_LOG(SG_AIRCRAFT, SG_INFO,
|
||||
"Adding model " << node->getStringValue("name", "[unnamed]"));
|
||||
|
||||
const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
|
||||
const char *model_path = node->getStringValue("path", "Models/Geometry/glider.ac");
|
||||
osg::Node *object;
|
||||
|
||||
try {
|
||||
object = SGModelLib::loadDeferredModel(path, globals->get_props());
|
||||
std::string fullPath = simgear::SGModelLib::findDataFile(model_path);
|
||||
object = SGModelLib::loadDeferredModel(fullPath, globals->get_props());
|
||||
} catch (const sg_throwable& t) {
|
||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Error loading " << path << ":\n "
|
||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Error loading " << model_path << ":\n "
|
||||
<< t.getFormattedMessage() << t.getOrigin());
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue