GUI Editor: export JS module with control accessors

Working with GUI controls is easy, if you have the right magic string containing the name of the control. This is easy and relatively effortless, but I think we can go even further in making this easy for developers!

When the GUI is exported, it should be relatively simple to walk the control tree and use it to generate a JS module containing constants for the control names and potentially even get accessors for them. The resulting code then can be used by the consuming app, helping to keep it DRY.

Perhaps this exhibits in the editor as an additional export option; in that case the JSON of the GUI could be combined with the JS module

2 Likes

Adding @msDestiny14 and @PirateJC

1 Like

@jelster

Can you please stop coming up with good ideas!

:wink:

Kidding of course! Great feedback! I’ll chat through this with @msDestiny14 and see what we can come up with.

4 Likes

NO! But only because you asked so nicely :wink::grin:

2 Likes

Thing through this some more, here are some refinements:

  1. ES6 module format!

  2. Module should expose an async initialize API that internally loads the GUI up and preps it for use

  3. Exposing update methods as observers - perhaps we generate Observer functions that can subscribe to Observables producing updated values for the control. If set accessors are suited that would work better. Example: onScoreChangedObservable.add(guiModule.score.onUpdate)

  4. (Optional) allow or provide pre-set AnimationGroups and/or Animations for actions like fade in/out, etc.

  5. (Optional) expose control life cycle events like onResize as further sets of Observables

2 Likes