]> git.mxchange.org Git - flightgear.git/commitdiff
Allow an empty virtual model, to which other submodels can be attached
authordavid <david>
Wed, 19 Jun 2002 03:25:40 +0000 (03:25 +0000)
committerdavid <david>
Wed, 19 Jun 2002 03:25:40 +0000 (03:25 +0000)
(when no path is specified).

src/Model/model.cxx

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