Load submodels before animations, so that we can animate submodels.
Allow submodels to be named when they are loaded.
This commit is contained in:
parent
8d44c8cecc
commit
ef12314346
1 changed files with 11 additions and 10 deletions
|
@ -102,16 +102,6 @@ fgLoad3DModelPanel( const string &fg_root, const string &path,
|
||||||
model->addKid(panel);
|
model->addKid(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load animations
|
|
||||||
vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
|
|
||||||
for (i = 0; i < animation_nodes.size(); i++) {
|
|
||||||
const char * name = animation_nodes[i]->getStringValue("name", 0);
|
|
||||||
vector<SGPropertyNode_ptr> name_nodes =
|
|
||||||
animation_nodes[i]->getChildren("object-name");
|
|
||||||
sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
|
|
||||||
sim_time_sec);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load sub-models
|
// Load sub-models
|
||||||
vector<SGPropertyNode_ptr> model_nodes = props.getChildren("model");
|
vector<SGPropertyNode_ptr> model_nodes = props.getChildren("model");
|
||||||
for (i = 0; i < model_nodes.size(); i++) {
|
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"),
|
ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"),
|
||||||
prop_root, sim_time_sec );
|
prop_root, sim_time_sec );
|
||||||
align->addKid(kid);
|
align->addKid(kid);
|
||||||
|
align->setName(node->getStringValue("name", ""));
|
||||||
model->addKid(align);
|
model->addKid(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load animations
|
||||||
|
vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
|
||||||
|
for (i = 0; i < animation_nodes.size(); i++) {
|
||||||
|
const char * name = animation_nodes[i]->getStringValue("name", 0);
|
||||||
|
vector<SGPropertyNode_ptr> name_nodes =
|
||||||
|
animation_nodes[i]->getChildren("object-name");
|
||||||
|
sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
|
||||||
|
sim_time_sec);
|
||||||
|
}
|
||||||
|
|
||||||
return alignmainmodel;
|
return alignmainmodel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue