| Caution The feature documented below, in its current form, is currently being discussed/expected (or scheduled) to be significantly updated, or phased out, in future FlightGear versions. This should be taken into account if you're interested in working on the feature or developing it further. If in doubt, please get in touch via the devel list first.
(PUI is likely to be removed to help improve compatibility with OSG/OpenGL 3.x and improve performance by phasing out legacy OpenGL code. Therefore, people should be careful when using/extending the PUI based legacy GUI engine and coordinate any related work with the devel mailing list-this applies particularly to adding any additional hard-coded PUI widgets.)
PUI is the standard GUI engine used in FlightGear, it is part of PLIB and is using raw, fixed-pipeline, OpenGL code internally (no OpenSceneGraph). PUI provides a fairly basic, but robust, set of widgets. PUI is also used for rendering the Menubar:
As of 03/2020, the PLIB replacement was reported to be in the backlog .
The new GUI has been incubating for a few years, but there's apparently been a lot of progress as of 10/2019.
It is likely the new GUI will be a user opt-in feature - at least initially. The sunset of the PLIB library _could_ happen relatively soon, but people will need to see the new GUI and react to it before we could commit to PLIB removal .
Originally, James was hoping to land the PUI replacement GUI in the last dev cycle in 2017 (at least as a proof-of-concept, probably not as the default UI), so wouldn’t expend lots of effort on things like collapsible sections which might be a lot of work with the current PUI/Canvas approaches, but are trivial with the new QtQuick based UI scheme.
Once the basic new UI is in place we can experiment with different re-arrangements easily, without being limited by PUI. (James expects PUI to live on as the default / alternate UI while this happens)
Technically, this entails replacing dialog.cxx with some code which builds up some special ‘PUI-Emulation’ QtQuick controls, so that existing dialogs (especially from Aircraft) continue to work. This mode will look somewhat ugly but hopefully no more ugly than PUI! And it helps that the set of widgets we have in PUI is limited, and the ‘tricky’ widgets (map, scrolling list, etc) are in the dialogs will will replace with new ones first.
This PUI emulation isn't going to use any code from PLIB, so what will remain from it in FG afterwards will be the FNT and JS components (reworked).
In FlightGear, PUI dialogs are standard PropertyList XML Files that are stored in $FG_ROOT/gui/dialogs, they can contain the widgets mentioned in $FG_ROOT/Docs/README.gui, using a simple layout engine discussed in $FG_ROOT/Docs/README.layout, and bindings using a combination of so called fgcommands operating on properties (see $FG_ROOT/Docs/README.commands) and custom Nasal (FlightGear scripting) code.
In addition, each PUI/XML dialog may contain Nasal script sections that are executed when opening/closing the dialog, a feature which is commonly used for procedurally creating/updating widgets using the cmdarg() API, which allows the dialog tree to be traversed and manipulated prior to the dialog being rendered.
Widgets can be conditionally hidden/shown using a wrapper for SGCondition in props.nas
canvas widget also supports its own embedded Nasal code section to execute arbitrary widget specific Nasal code upon opening/closing the dialog/widget.
PUI/XML dialogs can be loaded, dynamically created, updated and closed using a handful of fgcommands:
However, improving the frame-rate and modernised 3D rendering, can’t be worked on until the PUI code, 2D panels and Shiva are removed, but doing so is a frustrating slow path
Besides, while most people seem to agree PUI needs to be replaced, it sounds as if the fallout from doing so would be more painful (cumulatively) than the pain its existence causes.
But given that with many graphics drivers PUI doesn't render correctly when higher shader quality is on, graphics folks are also convinced it needs to be replaced.
|Note We use the GUI code from PLIB, which doesn't know anything about OSG. See the SGPuDrawable class in $FG_SRC/Viewer/renderer.cxx for the implementation. The one catch is that OSG has a strong notion of separation between the update of a "scene" and its rendering, and that might not play well with arbitrary existing OpenGL code.|
As of late 2015, there is heavy activity towards providing alternatives to a PUI-based UI:
- Integrated Web GUI (external, browser-based - fully asynchronous)
- Howto:Processing legacy PUI dialogs using Canvas (internal, using the Canvas system and a simple Nasal parser to deal with existing PUI/XML dialogs)