1
0
Fork 0

Allow an empty virtual model, to which other submodels can be attached

(when no path is specified).
This commit is contained in:
david 2002-06-19 03:25:40 +00:00
parent 9569c43126
commit 6df9479415

View file

@ -197,16 +197,19 @@ FG3DModel::init (const string &path)
modelpath = modelpath.dir(); modelpath = modelpath.dir();
modelpath.append(props.getStringValue("/path")); modelpath.append(props.getStringValue("/path"));
} else { } else {
throw sg_exception("No path for model"); if (_model == 0)
_model = new ssgBranch;
} }
} }
// Assume that textures are in // Assume that textures are in
// the same location as the XML file. // the same location as the XML file.
ssgTexturePath((char *)xmlpath.dir().c_str()); if (_model == 0) {
_model = (ssgBranch *)ssgLoad((char *)modelpath.c_str()); ssgTexturePath((char *)xmlpath.dir().c_str());
if (_model == 0) _model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
throw sg_exception("Failed to load 3D model"); if (_model == 0)
throw sg_exception("Failed to load 3D model");
}
// Set up the alignment node // Set up the alignment node
ssgTransform * align = new ssgTransform; ssgTransform * align = new ssgTransform;