Board index FlightGear Development Canvas

Reload canvas instrumentation

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Reload canvas instrumentation

Postby mgc » Tue Jun 21, 2016 2:33 am

I'm developing a HUD using Canvas. When I make a change to my .nas file, is there a quick way to get the symbology to reload without having to do a full <shift-esc> reset (which takes a while due to reloading all the scenery)? Perhaps something in the debug menu? Everything I've tried in there so far has not resulted in reloading the .nas file.

Thank you,

Mike
mgc
 
Posts: 11
Joined: Mon Jun 13, 2016 10:44 pm

Re: Reload canvas instrumentation

Postby Hooray » Tue Jun 21, 2016 3:59 pm

actually, that's trivial to do - but you need to write your code accordingly - i.e. to reload the SVG/raster image(s) - and that can even be done for anything involving code, e.g. using io.load_nasal() and/or io.include()

In Nasal/Canvas terms, reloading an image from disk means purging all its uses (e.g. using node.removeAllChildren() and re-calling the callback that populated the group). It's basically 5 lines of code to do this.

Apart from that, you can accomplish this easily by using the UI framework, which will automatically load/run Nasal code separately, which has the same effect once you think about it
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11959
Joined: Tue Mar 25, 2008 8:40 am


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest