]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/acmodel.cxx
- move exception handling from init() and childAdded() to add_model()
[flightgear.git] / src / Model / acmodel.cxx
index 271382d03313459ce9041802a915ea9e930bd0cc..d3af3b4be5e0d34544ee2a53bc33cd159c4f5cc6 100644 (file)
@@ -42,10 +42,6 @@ FGAircraftModel::FGAircraftModel ()
 
 FGAircraftModel::~FGAircraftModel ()
 {
-  // Unregister that one at the scenery manager
-  if (_aircraft)
-    globals->get_scenery()->unregister_placement_transform(_aircraft->getTransform());
-
   delete _aircraft;
                                // SSG will delete it
   globals->get_scenery()->get_aircraft_branch()->removeChild(_selector.get());
@@ -76,7 +72,8 @@ FGAircraftModel::init ()
                                            liveryPath);
     _aircraft->init( model );
   } catch (const sg_exception &ex) {
-    SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path);
+    SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path << ':');
+    SG_LOG(SG_GENERAL, SG_ALERT, "  " << ex.getFormattedMessage());
     SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)");
     osg::Node *model = fgLoad3DModelPanel( globals->get_fg_root(),
                                            "Models/Geometry/glider.ac",
@@ -85,13 +82,10 @@ FGAircraftModel::init ()
                                            liveryPath);
     _aircraft->init( model );
   }
-  _selector->addChild(_aircraft->getSceneGraph());
+  _selector->addChild(_aircraft->getSceneGraph(), true);
   // Do not do altitude computations with that model
   _selector->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
   globals->get_scenery()->get_aircraft_branch()->addChild(_selector.get());
-
-  // Register that one at the scenery manager
-  globals->get_scenery()->register_placement_transform(_aircraft->getTransform());
 }
 
 void