Associate submodels with parent AI Objects.
Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
parent
2758f07df0
commit
b22960ffff
1 changed files with 14 additions and 30 deletions
|
@ -78,9 +78,6 @@ void FGSubmodelMgr::init()
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
//_model_added_node = fgGetNode("ai/models/model-added", true);
|
|
||||||
//_model_added_node->addChangeListener(this, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGSubmodelMgr::postinit() {
|
void FGSubmodelMgr::postinit() {
|
||||||
|
@ -300,7 +297,7 @@ bool FGSubmodelMgr::release(submodel *sm, double dt)
|
||||||
ballist->setZoffset(sm->z_offset);
|
ballist->setZoffset(sm->z_offset);
|
||||||
ballist->setPitchoffset(sm->pitch_offset);
|
ballist->setPitchoffset(sm->pitch_offset);
|
||||||
ballist->setYawoffset(sm->yaw_offset);
|
ballist->setYawoffset(sm->yaw_offset);
|
||||||
ballist->setParentNode(_selected_ac);
|
ballist->setParentNodes(_selected_ac);
|
||||||
ballist->setContentsNode(sm->contents_node);
|
ballist->setContentsNode(sm->contents_node);
|
||||||
ballist->setWeight(sm->weight);
|
ballist->setWeight(sm->weight);
|
||||||
ai->attach(ballist);
|
ai->attach(ballist);
|
||||||
|
@ -821,48 +818,35 @@ void FGSubmodelMgr::setOffsetPos(){
|
||||||
|
|
||||||
void FGSubmodelMgr::valueChanged(SGPropertyNode *prop)
|
void FGSubmodelMgr::valueChanged(SGPropertyNode *prop)
|
||||||
{
|
{
|
||||||
// cout << "LISTENER: " << endl;
|
return; // this isn't working atm
|
||||||
|
|
||||||
const char* _model_added = _model_added_node->getStringValue();
|
const char* _model_added = _model_added_node->getStringValue();
|
||||||
|
|
||||||
basic_string <char>::size_type indexCh2b;
|
basic_string <char>::size_type indexCh2b;
|
||||||
|
|
||||||
string str2 = _model_added;
|
string str2 = _model_added;
|
||||||
const char *cstr2b = "ballistic";
|
const char *cstr2b = "multiplayer";
|
||||||
indexCh2b = str2.find( cstr2b, 0 );
|
indexCh2b = str2.find( cstr2b, 0 );
|
||||||
|
|
||||||
// cout << "model added - " << str2 <<" now do something "<< endl;
|
|
||||||
|
|
||||||
if (indexCh2b != string::npos ){ // we will ignore Ballistic Objects - there are potentially too many
|
if (indexCh2b != string::npos ){ // we will ignore Ballistic Objects - there are potentially too many
|
||||||
return;
|
|
||||||
} else {
|
//cout << "Submodels: model added - " << str2 <<" read path "<< endl;
|
||||||
|
//return;
|
||||||
SGPropertyNode *a_node = fgGetNode(_model_added, true );
|
SGPropertyNode *a_node = fgGetNode(_model_added, true);
|
||||||
SGPropertyNode *sub_node = a_node->getChild("submodels", 0, true);
|
SGPropertyNode *sub_node = a_node->getChild("sim", 0, true);
|
||||||
SGPropertyNode_ptr path_node = sub_node->getChild("path", 0, true);
|
SGPropertyNode_ptr path_node = sub_node->getChild("path", 0, true);
|
||||||
|
SGPropertyNode_ptr callsign_node = a_node->getChild("callsign", 0, true);
|
||||||
|
|
||||||
string path = path_node->getStringValue();
|
string callsign = callsign_node->getStringValue();
|
||||||
|
|
||||||
if (path.empty()){
|
//cout << "Submodels: model added - " << callsign <<" read callsign "<< endl;
|
||||||
// nothing to do - return
|
|
||||||
//cout << "subpath empty - return" << endl << endl;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//cout << "subpath found - loading" << endl << endl;
|
cout << "model added - " << str2 <<" returning "<< endl;
|
||||||
SGPropertyNode_ptr ident_node = a_node->getChild("id", 0, true);
|
return;
|
||||||
int id = ident_node->getIntValue();
|
|
||||||
|
|
||||||
setData(id, path, true);
|
|
||||||
|
|
||||||
_found_sub = true;
|
|
||||||
|
|
||||||
while (_found_sub)
|
|
||||||
loadSubmodels();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGSubmodelMgr::setParentNode(int id) {
|
void FGSubmodelMgr::setParentNode(int id) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue