X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScripting%2FNasalModelData.cxx;h=e4f22692ba399d6c64fbbce248dc9e759fadbcce;hb=4b59c152eafb5aa52c4562838090f037c07b65e9;hp=2bf3d03d27e85e9c38edd98cd598e876980e7bdc;hpb=6b88302037889c83ac75c92edbc610f55b84b0ae;p=flightgear.git diff --git a/src/Scripting/NasalModelData.cxx b/src/Scripting/NasalModelData.cxx index 2bf3d03d2..e4f22692b 100644 --- a/src/Scripting/NasalModelData.cxx +++ b/src/Scripting/NasalModelData.cxx @@ -1,16 +1,18 @@ #include "NasalModelData.hxx" #include "NasalSys.hxx" +#include
#include
+#include +#include + #include #include #include #include #include -#include - #include #include @@ -87,8 +89,7 @@ FGNasalModelData::FGNasalModelData( SGPropertyNode *root, SG_INFO, "New model with attached script(s) " "(branch = " << branch << "," - " path = " << simgear::getNodePathString(branch) << - " thread-safe = " << branch->getThreadSafeRefUnref() << ")" + " path = " << simgear::getNodePathString(branch) << ")" ); } @@ -101,7 +102,7 @@ FGNasalModelData::~FGNasalModelData() ( SG_NASAL, SG_INFO, - "Removed model with script(s) (branch = " << _branch << ")" + "Removed model with script(s) (branch = " << _branch.get() << ")" ); } @@ -122,13 +123,9 @@ void FGNasalModelData::load() nasal::Hash module = nasalSys->getGlobals().createHash(_module); module.set("_module_id", _module_id); - if( !NasalNode::isInit() ) - { - NasalNode::init("osg.Node") + NasalNode::init("osg.Node") .method("getPose", &f_node_getPose); - } - - module.set("_model", NodeRef(_branch)); + module.set("_model", _branch); naRef arg[2]; arg[0] = nasalSys->propNodeGhost(_root); @@ -164,7 +161,7 @@ void FGNasalModelData::unload() //------------------------------------------------------------------------------ osg::Node* FGNasalModelData::getNode() { - return _branch; + return _branch.get(); } //------------------------------------------------------------------------------ @@ -198,6 +195,9 @@ void FGNasalModelDataProxy::modelLoaded( const std::string& path, SGPropertyNode *prop, osg::Node *branch ) { + if( fgGetBool("/sim/disable-embedded-nasal") ) + return; + if(!prop) return;