]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/SGPagedLOD.cxx
Provide something more sensible for the properties root
[simgear.git] / simgear / scene / model / SGPagedLOD.cxx
index b45af2046b9a55ecbca47272058c088896336dd3..545aadb72b91e8d38833ba11731db8dded3d4a3c 100644 (file)
@@ -50,19 +50,14 @@ bool SGPagedLOD::addChild(osg::Node *child)
 
     setRadius(getBound().radius());
     setCenter(getBound().center());
-    // if the model was an .xml-file it will have UserData set
-    osg::ref_ptr<SGModelData> d = dynamic_cast<SGModelData*>(child->getUserData());
-    if (d.valid())
-        d->modelLoaded(getFileName(getNumChildren()-1), d->getProperties(), this);
-    else // this calls modelLoaded for non-xml models
+    SGReaderWriterXMLOptions* opts;
+    opts = dynamic_cast<SGReaderWriterXMLOptions*>(_readerWriterOptions.get());
+    if(opts)
     {
-        SGReaderWriterXMLOptions *o=dynamic_cast<SGReaderWriterXMLOptions*>(_readerWriterOptions.get());
-        if(o)
-        {
-            d = o->getModelData();
-            if(d.valid())
-                d->modelLoaded(getFileName(getNumChildren()-1), 0, this);
-        }
+        osg::ref_ptr<SGModelData> d = opts->getModelData();
+        if(d.valid())
+            d->modelLoaded(getFileName(getNumChildren()-1), opts->getPropRoot(),
+                           this);
     }
     return true;
 }