]> git.mxchange.org Git - flightgear.git/commitdiff
Reset: do re-init Ghost bindings.
authorJames Turner <zakalawe@mac.com>
Sat, 23 Nov 2013 20:08:55 +0000 (20:08 +0000)
committerJames Turner <zakalawe@mac.com>
Sun, 24 Nov 2013 15:10:00 +0000 (15:10 +0000)
src/GUI/FileDialog.cxx
src/Scripting/NasalCanvas.cxx
src/Scripting/NasalHTTP.cxx
src/Scripting/NasalModelData.cxx
src/Scripting/NasalPositioned_cppbind.cxx
src/Scripting/NasalSys.cxx

index 3c6b48d83efd73a035014760c763f17cf0b23e94..200b156902a83e095a76bc7df29fddf6f672ce8d 100644 (file)
@@ -153,18 +153,16 @@ static naRef f_createFileDialog(naContext c, naRef me, int argc, naRef* args)
 
 void postinitNasalGUI(naRef globals, naContext c)
 {
-    if (!NasalFileDialog::isInit()) {
-        NasalFileDialog::init("gui._FileDialog")
-        .member("title", &FGFileDialog::getTitle,  &FGFileDialog::setTitle)
-        .member("button", &FGFileDialog::getButton,  &FGFileDialog::setButton)
-        .member("directory", &FGFileDialog::getDirectory, &FGFileDialog::setDirectory)
-        .member("show_hidden", &FGFileDialog::showHidden, &FGFileDialog::setShowHidden)
-        .member("placeholder", &FGFileDialog::getPlaceholder, &FGFileDialog::setPlaceholderName)
-        .member("pattern", &FGFileDialog::filterPatterns, &FGFileDialog::setFilterPatterns)
-        .method("open", &FGFileDialog::exec)
-        .method("close", &FGFileDialog::close)
-        .method("setCallback", &FGFileDialog::setCallbackFromNasal);
-    }
+    NasalFileDialog::init("gui._FileDialog")
+    .member("title", &FGFileDialog::getTitle,  &FGFileDialog::setTitle)
+    .member("button", &FGFileDialog::getButton,  &FGFileDialog::setButton)
+    .member("directory", &FGFileDialog::getDirectory, &FGFileDialog::setDirectory)
+    .member("show_hidden", &FGFileDialog::showHidden, &FGFileDialog::setShowHidden)
+    .member("placeholder", &FGFileDialog::getPlaceholder, &FGFileDialog::setPlaceholderName)
+    .member("pattern", &FGFileDialog::filterPatterns, &FGFileDialog::setFilterPatterns)
+    .method("open", &FGFileDialog::exec)
+    .method("close", &FGFileDialog::close)
+    .method("setCallback", &FGFileDialog::setCallbackFromNasal);
     
     nasal::Hash guiModule = nasal::Hash(globals, c).get<nasal::Hash>("gui");
     
index 8ea979998db848a6a5986c808781eabd76289d14..a8b592698c105bfc0f8a6cd8818e85ee1363a7a7 100644 (file)
@@ -204,8 +204,6 @@ naRef to_nasal_helper(naContext c, const sc::ElementWeakPtr& el)
 
 naRef initNasalCanvas(naRef globals, naContext c)
 {
-    if (!NasalEvent::isInit()) {
-    
         NasalEvent::init("canvas.Event")
     .member("type", &sc::Event::getTypeString)
     .member("target", &sc::Event::getTarget)
@@ -247,7 +245,6 @@ naRef initNasalCanvas(naRef globals, naContext c)
     .bases<NasalElement>()
     .member("_node_ghost", &elementGetNode<canvas::Window>)
     .method("_getCanvasDecoration", &canvas::Window::getCanvasDecoration);
-    }
     
   nasal::Hash globals_module(globals, c),
               canvas_module = globals_module.createHash("canvas");
index fbee30a0f7cfb6a23379421f0d457ef5a922bf18..ae55204acd1f033197ae5b627de56c5e5459aed9 100644 (file)
@@ -81,8 +81,6 @@ static naRef f_http_load(const nasal::CallContext& ctx)
 //------------------------------------------------------------------------------
 naRef initNasalHTTP(naRef globals, naContext c)
 {
-    if (!NasalRequest::isInit()) {
-
   using simgear::HTTP::Request;
   NasalRequest::init("http.Request")
     .member("url", &Request::url)
@@ -108,8 +106,6 @@ naRef initNasalHTTP(naRef globals, naContext c)
   NasalMemoryRequest::init("http.MemoryRequest")
     .bases<NasalRequest>()
     .member("response", &MemoryRequest::responseBody);
-
-    }
     
   nasal::Hash globals_module(globals, c),
               http = globals_module.createHash("http");
index 8d20d6e6699dbd1a5b18139a11213ffaa26e1209..20df177ad590e39d97bd7e808606be37ddfe3944 100644 (file)
@@ -122,12 +122,8 @@ 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", _branch);
 
   naRef arg[2];
index cc3568c4b67f8ee16984e675774f12ea3b15da28..8d51624a88ea46daed72e174daca23e53841fb9c 100644 (file)
@@ -459,8 +459,6 @@ static naRef f_sortByRange(nasal::CallContext ctx)
 //------------------------------------------------------------------------------
 naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c)
 {
-    if (!NasalPositioned::isInit()) {
-    
   NasalPositioned::init("Positioned")
     .member("id", &FGPositioned::ident)
     .member("ident", &FGPositioned::ident) // TODO to we really need id and ident?
@@ -504,7 +502,6 @@ naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c)
     .method("getStar", &FGAirport::findSTARWithIdent)
     .method("getIAP", &FGAirport::findApproachWithIdent)
     .method("tostring", &FGAirport::toString);
-  }
     
   nasal::Hash globals(globalsRef, c),
               positioned( globals.createHash("positioned") );
index f0df1aacf53531a99c71fd9274656c3c128de750..57967ebf66688aacf94bc3816b4623b9b181ad12 100644 (file)
@@ -777,15 +777,13 @@ void FGNasalSys::init()
     initNasalCondition(_globals, _context);
     initNasalHTTP(_globals, _context);
   
-    if (!NasalTimerObj::isInit()) {
-        NasalTimerObj::init("Timer")
-          .method("start", &TimerObj::start)
-          .method("stop", &TimerObj::stop)
-          .method("restart", &TimerObj::restart)
-          .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
-          .member("isRunning", &TimerObj::isRunning);
-    }
-    
+    NasalTimerObj::init("Timer")
+      .method("start", &TimerObj::start)
+      .method("stop", &TimerObj::stop)
+      .method("restart", &TimerObj::restart)
+      .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
+      .member("isRunning", &TimerObj::isRunning);
+
     // Now load the various source files in the Nasal directory
     simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
     loadScriptDirectory(nasalDir);