Reset: do re-init Ghost bindings.
This commit is contained in:
parent
57c9ed1ae3
commit
d99109c9e4
6 changed files with 18 additions and 36 deletions
|
@ -153,18 +153,16 @@ static naRef f_createFileDialog(naContext c, naRef me, int argc, naRef* args)
|
||||||
|
|
||||||
void postinitNasalGUI(naRef globals, naContext c)
|
void postinitNasalGUI(naRef globals, naContext c)
|
||||||
{
|
{
|
||||||
if (!NasalFileDialog::isInit()) {
|
NasalFileDialog::init("gui._FileDialog")
|
||||||
NasalFileDialog::init("gui._FileDialog")
|
.member("title", &FGFileDialog::getTitle, &FGFileDialog::setTitle)
|
||||||
.member("title", &FGFileDialog::getTitle, &FGFileDialog::setTitle)
|
.member("button", &FGFileDialog::getButton, &FGFileDialog::setButton)
|
||||||
.member("button", &FGFileDialog::getButton, &FGFileDialog::setButton)
|
.member("directory", &FGFileDialog::getDirectory, &FGFileDialog::setDirectory)
|
||||||
.member("directory", &FGFileDialog::getDirectory, &FGFileDialog::setDirectory)
|
.member("show_hidden", &FGFileDialog::showHidden, &FGFileDialog::setShowHidden)
|
||||||
.member("show_hidden", &FGFileDialog::showHidden, &FGFileDialog::setShowHidden)
|
.member("placeholder", &FGFileDialog::getPlaceholder, &FGFileDialog::setPlaceholderName)
|
||||||
.member("placeholder", &FGFileDialog::getPlaceholder, &FGFileDialog::setPlaceholderName)
|
.member("pattern", &FGFileDialog::filterPatterns, &FGFileDialog::setFilterPatterns)
|
||||||
.member("pattern", &FGFileDialog::filterPatterns, &FGFileDialog::setFilterPatterns)
|
.method("open", &FGFileDialog::exec)
|
||||||
.method("open", &FGFileDialog::exec)
|
.method("close", &FGFileDialog::close)
|
||||||
.method("close", &FGFileDialog::close)
|
.method("setCallback", &FGFileDialog::setCallbackFromNasal);
|
||||||
.method("setCallback", &FGFileDialog::setCallbackFromNasal);
|
|
||||||
}
|
|
||||||
|
|
||||||
nasal::Hash guiModule = nasal::Hash(globals, c).get<nasal::Hash>("gui");
|
nasal::Hash guiModule = nasal::Hash(globals, c).get<nasal::Hash>("gui");
|
||||||
|
|
||||||
|
|
|
@ -204,8 +204,6 @@ naRef to_nasal_helper(naContext c, const sc::ElementWeakPtr& el)
|
||||||
|
|
||||||
naRef initNasalCanvas(naRef globals, naContext c)
|
naRef initNasalCanvas(naRef globals, naContext c)
|
||||||
{
|
{
|
||||||
if (!NasalEvent::isInit()) {
|
|
||||||
|
|
||||||
NasalEvent::init("canvas.Event")
|
NasalEvent::init("canvas.Event")
|
||||||
.member("type", &sc::Event::getTypeString)
|
.member("type", &sc::Event::getTypeString)
|
||||||
.member("target", &sc::Event::getTarget)
|
.member("target", &sc::Event::getTarget)
|
||||||
|
@ -247,7 +245,6 @@ naRef initNasalCanvas(naRef globals, naContext c)
|
||||||
.bases<NasalElement>()
|
.bases<NasalElement>()
|
||||||
.member("_node_ghost", &elementGetNode<canvas::Window>)
|
.member("_node_ghost", &elementGetNode<canvas::Window>)
|
||||||
.method("_getCanvasDecoration", &canvas::Window::getCanvasDecoration);
|
.method("_getCanvasDecoration", &canvas::Window::getCanvasDecoration);
|
||||||
}
|
|
||||||
|
|
||||||
nasal::Hash globals_module(globals, c),
|
nasal::Hash globals_module(globals, c),
|
||||||
canvas_module = globals_module.createHash("canvas");
|
canvas_module = globals_module.createHash("canvas");
|
||||||
|
|
|
@ -81,8 +81,6 @@ static naRef f_http_load(const nasal::CallContext& ctx)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
naRef initNasalHTTP(naRef globals, naContext c)
|
naRef initNasalHTTP(naRef globals, naContext c)
|
||||||
{
|
{
|
||||||
if (!NasalRequest::isInit()) {
|
|
||||||
|
|
||||||
using simgear::HTTP::Request;
|
using simgear::HTTP::Request;
|
||||||
NasalRequest::init("http.Request")
|
NasalRequest::init("http.Request")
|
||||||
.member("url", &Request::url)
|
.member("url", &Request::url)
|
||||||
|
@ -108,8 +106,6 @@ naRef initNasalHTTP(naRef globals, naContext c)
|
||||||
NasalMemoryRequest::init("http.MemoryRequest")
|
NasalMemoryRequest::init("http.MemoryRequest")
|
||||||
.bases<NasalRequest>()
|
.bases<NasalRequest>()
|
||||||
.member("response", &MemoryRequest::responseBody);
|
.member("response", &MemoryRequest::responseBody);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
nasal::Hash globals_module(globals, c),
|
nasal::Hash globals_module(globals, c),
|
||||||
http = globals_module.createHash("http");
|
http = globals_module.createHash("http");
|
||||||
|
|
|
@ -122,12 +122,8 @@ void FGNasalModelData::load()
|
||||||
nasal::Hash module = nasalSys->getGlobals().createHash(_module);
|
nasal::Hash module = nasalSys->getGlobals().createHash(_module);
|
||||||
module.set("_module_id", _module_id);
|
module.set("_module_id", _module_id);
|
||||||
|
|
||||||
if( !NasalNode::isInit() )
|
NasalNode::init("osg.Node")
|
||||||
{
|
|
||||||
NasalNode::init("osg.Node")
|
|
||||||
.method("getPose", &f_node_getPose);
|
.method("getPose", &f_node_getPose);
|
||||||
}
|
|
||||||
|
|
||||||
module.set("_model", _branch);
|
module.set("_model", _branch);
|
||||||
|
|
||||||
naRef arg[2];
|
naRef arg[2];
|
||||||
|
|
|
@ -459,8 +459,6 @@ static naRef f_sortByRange(nasal::CallContext ctx)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c)
|
naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c)
|
||||||
{
|
{
|
||||||
if (!NasalPositioned::isInit()) {
|
|
||||||
|
|
||||||
NasalPositioned::init("Positioned")
|
NasalPositioned::init("Positioned")
|
||||||
.member("id", &FGPositioned::ident)
|
.member("id", &FGPositioned::ident)
|
||||||
.member("ident", &FGPositioned::ident) // TODO to we really need id and 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("getStar", &FGAirport::findSTARWithIdent)
|
||||||
.method("getIAP", &FGAirport::findApproachWithIdent)
|
.method("getIAP", &FGAirport::findApproachWithIdent)
|
||||||
.method("tostring", &FGAirport::toString);
|
.method("tostring", &FGAirport::toString);
|
||||||
}
|
|
||||||
|
|
||||||
nasal::Hash globals(globalsRef, c),
|
nasal::Hash globals(globalsRef, c),
|
||||||
positioned( globals.createHash("positioned") );
|
positioned( globals.createHash("positioned") );
|
||||||
|
|
|
@ -777,15 +777,13 @@ void FGNasalSys::init()
|
||||||
initNasalCondition(_globals, _context);
|
initNasalCondition(_globals, _context);
|
||||||
initNasalHTTP(_globals, _context);
|
initNasalHTTP(_globals, _context);
|
||||||
|
|
||||||
if (!NasalTimerObj::isInit()) {
|
NasalTimerObj::init("Timer")
|
||||||
NasalTimerObj::init("Timer")
|
.method("start", &TimerObj::start)
|
||||||
.method("start", &TimerObj::start)
|
.method("stop", &TimerObj::stop)
|
||||||
.method("stop", &TimerObj::stop)
|
.method("restart", &TimerObj::restart)
|
||||||
.method("restart", &TimerObj::restart)
|
.member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
|
||||||
.member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
|
.member("isRunning", &TimerObj::isRunning);
|
||||||
.member("isRunning", &TimerObj::isRunning);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now load the various source files in the Nasal directory
|
// Now load the various source files in the Nasal directory
|
||||||
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
|
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
|
||||||
loadScriptDirectory(nasalDir);
|
loadScriptDirectory(nasalDir);
|
||||||
|
|
Loading…
Add table
Reference in a new issue