diff --git a/src/Model/model_panel.cxx b/src/Model/model_panel.cxx index 1c9994ed7..692270138 100644 --- a/src/Model/model_panel.cxx +++ b/src/Model/model_panel.cxx @@ -102,16 +102,6 @@ fgLoad3DModelPanel( const string &fg_root, const string &path, model->addKid(panel); } - // Load animations - vector animation_nodes = props.getChildren("animation"); - for (i = 0; i < animation_nodes.size(); i++) { - const char * name = animation_nodes[i]->getStringValue("name", 0); - vector name_nodes = - animation_nodes[i]->getChildren("object-name"); - sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i], - sim_time_sec); - } - // Load sub-models vector model_nodes = props.getChildren("model"); for (i = 0; i < model_nodes.size(); i++) { @@ -130,9 +120,20 @@ fgLoad3DModelPanel( const string &fg_root, const string &path, ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"), prop_root, sim_time_sec ); align->addKid(kid); + align->setName(node->getStringValue("name", "")); model->addKid(align); } + // Load animations + vector animation_nodes = props.getChildren("animation"); + for (i = 0; i < animation_nodes.size(); i++) { + const char * name = animation_nodes[i]->getStringValue("name", 0); + vector name_nodes = + animation_nodes[i]->getChildren("object-name"); + sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i], + sim_time_sec); + } + return alignmainmodel; }