Addon: Difference between revisions

Jump to navigation Jump to search
313 bytes added ,  4 December 2018
no edit summary
mNo edit summary
No edit summary
Line 96: Line 96:


== API ==
== API ==
We now have a simple API to add addons to FlightGear without the need to mess around with FGData/Nasal or FGHome/Nasal directories. FlightGear now accepts the command line switch --addon=/path/to/some/addon (note: command line switch is just that: a command line switch - not an option to be entered into the launcher). fgfs (through options.cxx) takes care of  
We now have a simple API to add addons to FlightGear without the need to mess around with FGData/Nasal or FGHome/Nasal directories. FlightGear now accepts the command line switch --addon=/path/to/some/addon (note: command line switch is just that: a command line switch - not an option to be entered into the launcher). fgfs (through options.cxx) takes care of  
* creating a property under /addons/by-id/org.flightgear.addons.<addonName>/
* creating a property subtree under /addons for each addon
* adding /path/to/some/addon/addon-config.xml as a config file (same as --config=/path/to/some/addon/addon-config.xml)  
* adding /path/to/some/addon/addon-config.xml as a config file (same as --config=/path/to/some/addon/addon-config.xml)  
* adding /path/to/some/addon to the list of allowed directories (same as --fg-aircraft=/path/to/some/addon)  
* adding /path/to/some/addon to the list of allowed directories (same as --fg-aircraft=/path/to/some/addon)  
Line 105: Line 104:
* addon-config.xml - a standard PropertyList to be used to populate or modify the property tree. (Same as to be used in --config=foo.xml)  
* addon-config.xml - a standard PropertyList to be used to populate or modify the property tree. (Same as to be used in --config=foo.xml)  
* addon-main.nas - the Nasal hook for the logic. This file needs a function called main() which will be called from the global addon initialier (FGData/addons.nas)  
* addon-main.nas - the Nasal hook for the logic. This file needs a function called main() which will be called from the global addon initialier (FGData/addons.nas)  
Additional files:
* addon-menubar-items.xml to add a menu for the addon (see chapter 6 in [https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Docs/README.add-ons README.add-ons])


It is pretty simple but does it's job nicely. There is a /very/ simple Skeleton addon available to be used as a boilerplate here: https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Skeleton/ As always: feedback is much appreciated. <ref>{{cite web
It is pretty simple but does it's job nicely. There is a /very/ simple Skeleton addon available to be used as a boilerplate here: https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Skeleton/ As always: feedback is much appreciated. <ref>{{cite web
Line 146: Line 148:


== Implementation ==
== Implementation ==
For the time being, the addon.nas module will:
For the time being, the addons.nas module will:
* initialize addons configured with --addon=foobar command line switch
* initialize addons configured with --addon=foobar command line switch
* get the list of registered add-ons
* get the list of registered add-ons
Line 155: Line 157:


== List of Addons ==
== List of Addons ==
You can find the official repository [https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/ on sourceforge.net (fgaddon/Addons)]
* [[Landing Rate addon]] [https://forum.flightgear.org/viewtopic.php?f=6&t=33101&p=327787#p327787]
* [[Landing Rate addon]] [https://forum.flightgear.org/viewtopic.php?f=6&t=33101&p=327787#p327787]
* [[YASim Development Tools]] (by jsb)
* [[YASim Development Tools]] (by jsb)
266

edits

Navigation menu