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");
naRef initNasalCanvas(naRef globals, naContext c)
{
- if (!NasalEvent::isInit()) {
-
NasalEvent::init("canvas.Event")
.member("type", &sc::Event::getTypeString)
.member("target", &sc::Event::getTarget)
.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");
//------------------------------------------------------------------------------
naRef initNasalHTTP(naRef globals, naContext c)
{
- if (!NasalRequest::isInit()) {
-
using simgear::HTTP::Request;
NasalRequest::init("http.Request")
.member("url", &Request::url)
NasalMemoryRequest::init("http.MemoryRequest")
.bases<NasalRequest>()
.member("response", &MemoryRequest::responseBody);
-
- }
nasal::Hash globals_module(globals, c),
http = globals_module.createHash("http");
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];
//------------------------------------------------------------------------------
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?
.method("getStar", &FGAirport::findSTARWithIdent)
.method("getIAP", &FGAirport::findApproachWithIdent)
.method("tostring", &FGAirport::toString);
- }
nasal::Hash globals(globalsRef, c),
positioned( globals.createHash("positioned") );
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);