1
0
Fork 0

Reset: do re-init Ghost bindings.

This commit is contained in:
James Turner 2013-11-23 20:08:55 +00:00
parent 57c9ed1ae3
commit d99109c9e4
6 changed files with 18 additions and 36 deletions

View 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");

View 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");

View 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");

View 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];

View 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") );

View 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);