bevy icon indicating copy to clipboard operation
bevy copied to clipboard

UI Style reuse: composition + assets

Open Weibye opened this issue 1 year ago • 3 comments

What problem does this solve or what need does it fill?

At the moment Style is incredibly verbose to use, just have a look at the UI example. In order to improve ergonomics and reduce boilerplate when dealing with UI we need to do something about it and we should strive to achieve the level of UX that we see in other parts of the engine.

What solution would you like?

In order to do so we are going to need two related but IMO orthogonal features:

  1. Style composition: bevyengine/rfcs#1
  2. Style as assets

I don't know exactly what these would look like in implementation, but I'm hoping some of you have good ideas for design-approaches that we then split out into separate issues or PRs.

This issue should be about figuring out a scope and requirements for both of these features

What alternative(s) have you considered?

  • Leave style as is and keep verbose + cumbersome UX
  • Style inheritance
  • Others?

Additional context

We might find that we are blocked on other features like scenes or reflection on some of this but in that case it is good to know exactly where the blocker is so that we can push to unblock those 😄

Weibye avatar Jul 31 '22 19:07 Weibye

Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in https://github.com/bevyengine/rfcs/pull/1

alice-i-cecile avatar Jul 31 '22 20:07 alice-i-cecile

Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in bevyengine/rfcs#1

Good point, I've updated the issue to better reflect weighing the problem in this direction

Weibye avatar Aug 01 '22 06:08 Weibye

I think inheritance would be fine and not too controversial if it was opt in

IceSentry avatar Aug 01 '22 16:08 IceSentry

Hello, I'm trying to experiment with reusable building blocks for UI, and while being relatively unfamiliar with Bevy I found this a little bit not clear: how to write reusable functions that allow for spawning bundles both as a standalone entity and as a child of another entity? Look at my code sample: image the only difference between these create_button functions is Commands and ChildBuilder types, everything else is the same, then I thought maybe there is an API that allow for using both Commands and ChildBuilder? Maybe it may improve Bevy? @alice-i-cecile what do you think?

the code that uses these functions is not particularly interesting, but I believe that we can do much better than this if we think a little bit of how to improve that API image

adsick avatar Apr 06 '23 16:04 adsick