Lua API for GUI

Everything about development and the OpenMW source code.
User avatar
urm
Posts: 83
Joined: 02 Jun 2017, 16:05
Gitlab profile: https://gitlab.com/uramer

Re: Lua API for GUI

Post by urm »

Status update:

I've thought more about the before mentioned positioning issue, and I don't see any way to make it work without handling it on per-widget basis. It is not actually that much work, as most of the widgets which change position/size of themselves or other widgets have been added by OpenMW anyway.
I'll keep it as it is for now, and come back to it when it's clear if we must have it or not, and how many widgets would have to be adjusted.

I've also started looking into supporting what MyGUI calls skins (can also be thought of as templates or components). It seems to be relatively straightforward, but sadly the necessary methods are private. So without changes to MyGUI the only way would be hacky solution with generating XML nodes. I've currently waiting for a response from Altren about the appropriate course of action.

So to revisit the list of features I've posted above:
Remaining planned features:
1. Setting widget properties as appropriate Lua objects, instead of all of them being strings, as they are in MyGUI
2. Set position and size of child widgets in proportion to the parent, rather than only in absolute pixels
3. Decide whether there should be a way to read widget properties directly (they could be changed by the widget itself), or if a propertyChanged event is good enough
4. Either support MyGUI skins, or build an alternative system
5. Allow to create custom widget types and skins (maybe those should be the same thing?)
6. Prepare a minimal set of widgets to be exposed to the Lua API, with support for non-string properties and event arguments
1. Implemented in a basic form, but I will make it more structured before adding more widget types in step 6.
2. Made a prototype, will require more work in step 6.
3. This won't really work well due to the delayed execution of Lua.
4. See the paragraph about skins above. The first iteration could probably be merged without this.
5. Won't be very useful without executing on the main thread. Maybe we should have a different API later on, which will run separately from other Lua scripts, on the UI thread. It would be a lower level API involving reading properties (3.) too.
6. Will come last when all the core concepts are ready.
Post Reply