add Nasal/Listener hooks for adding/removing AI/MP models. Things like
MP chat or Nasal/xml based radar instruments need that. It uses fgSetString, because this is in a very "cold path" and shouldn't clutter the AIBase.
This commit is contained in:
parent
56d8181da3
commit
79abf11466
1 changed files with 4 additions and 1 deletions
|
@ -75,8 +75,10 @@ FGAIBase::~FGAIBase() {
|
|||
}
|
||||
if (props) {
|
||||
SGPropertyNode* parent = props->getParent();
|
||||
if (parent)
|
||||
if (parent) {
|
||||
fgSetString("/ai/models/model-removed", props->getPath());
|
||||
parent->removeChild(props->getName(), props->getIndex(), false);
|
||||
}
|
||||
}
|
||||
delete fp;
|
||||
fp = 0;
|
||||
|
@ -138,6 +140,7 @@ bool FGAIBase::init() {
|
|||
globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
|
||||
// Register that one at the scenery manager
|
||||
globals->get_scenery()->register_placement_transform(aip.getTransform());
|
||||
fgSetString("/ai/models/model-added", props->getPath());
|
||||
} else {
|
||||
if (!model_path.empty()) {
|
||||
SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
|
||||
|
|
Loading…
Add table
Reference in a new issue