Frederic Bouvier:
This patch is there to correct a problem that prevent to load static objects when specifying a relative fg-root or a different, relative, fg-scenery. It appears that there is a mix between fg-root, fg-scenery and PLIB's model-dir. It has been reported on the list that users are not able to see the buildings, especially those running the win32 builds because they run 'runfgfs.bat' that set FG_ROOT=./DATA. I decided not to use model-dir because it just add confusion and to build a valid path earlier.
This commit is contained in:
@@ -189,19 +189,16 @@ sgLoad3DModel( const string &fg_root, const string &path,
|
|||||||
SGPropertyNode props;
|
SGPropertyNode props;
|
||||||
|
|
||||||
// Load the 3D aircraft object itself
|
// Load the 3D aircraft object itself
|
||||||
SGPath xmlpath;
|
|
||||||
SGPath modelpath = path;
|
SGPath modelpath = path;
|
||||||
if ( ulIsAbsolutePathName( path.c_str() ) ) {
|
if ( !ulIsAbsolutePathName( path.c_str() ) ) {
|
||||||
xmlpath = modelpath;
|
SGPath tmp = fg_root;
|
||||||
}
|
tmp.append(modelpath.str());
|
||||||
else {
|
modelpath = tmp;
|
||||||
xmlpath = fg_root;
|
|
||||||
xmlpath.append(modelpath.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for an XML wrapper
|
// Check for an XML wrapper
|
||||||
if (xmlpath.str().substr(xmlpath.str().size() - 4, 4) == ".xml") {
|
if (modelpath.str().substr(modelpath.str().size() - 4, 4) == ".xml") {
|
||||||
readProperties(xmlpath.str(), &props);
|
readProperties(modelpath.str(), &props);
|
||||||
if (props.hasValue("/path")) {
|
if (props.hasValue("/path")) {
|
||||||
modelpath = modelpath.dir();
|
modelpath = modelpath.dir();
|
||||||
modelpath.append(props.getStringValue("/path"));
|
modelpath.append(props.getStringValue("/path"));
|
||||||
@@ -214,7 +211,7 @@ sgLoad3DModel( const string &fg_root, const string &path,
|
|||||||
// Assume that textures are in
|
// Assume that textures are in
|
||||||
// the same location as the XML file.
|
// the same location as the XML file.
|
||||||
if (model == 0) {
|
if (model == 0) {
|
||||||
ssgTexturePath((char *)xmlpath.dir().c_str());
|
ssgTexturePath((char *)modelpath.dir().c_str());
|
||||||
model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
|
model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
|
||||||
if (model == 0)
|
if (model == 0)
|
||||||
throw sg_exception("Failed to load 3D model");
|
throw sg_exception("Failed to load 3D model");
|
||||||
|
|||||||
Reference in New Issue
Block a user