Replies: 2 comments 3 replies
-
I designed Transform in UI
In any case, I think your proposition is incomplete. You say:
But you don't provide an alternative in a world without You say:
This is false. Just last week I answered a question in the bevy discord regarding animations. Animations control skinned mesh bone This also uncovers an interesting link between animation and layouting. But I don't care to dig into this right now. Finally. The issue we have here is not of using Hierarchy in UII really like 1DEDARY's solution though. Currently, hierarchy in bevy suck. (I can already hear Yoggi & sanders say "but it's better with relations"). And a solution that enables abstracting the hierarchy into its own module would allow avoiding that. But maybe this also is blaming the victim for the actions of the perpetrator. Is it because Hierarchies in UI are useful beyond just layouting stuff.
Now, I agree it's an absolute misery to spawn UI elements using Synthesis and tout le tra-la-laWhat we learned:
|
Beta Was this translation helpful? Give feedback.
-
Hello guys. Even though Bevy_Lunex is not finished, I decided to open source my code ahead of time due to the interest it created. I think it might be beneficial for these who want to see how I did it. They might spot some shortcomings down the road or just get a better picture of what is it really about. Plus I would appreciate some feedback before I spend hours working on something that has no future, just because I was unaware of something 😄 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is inspired by the work of @IDEDARY from this Showcase thread on Discord. They wrote a UI which uses a novel path-based approach for UI positioning. One take away from the discussion was that the
Parent
andTransform
hierarchy commonly used elsewhere actually get in the way when it comes to UI:UiStack
.Transform
of aNode
is not directly related to its actual position on screen. In fact, if you look at the code to calculate theNode
's relative position used by the system updating theRelativeCursorPosition
component, you will find that it's using theWindow
, theNode
, theGlobalTransform
, and theCalculatedClip
. That conversion is very much non-trivial, and not exposed anywhere, although it's relatively common to have to know the absolute position of a node on screen for various operations (especially mouse cursor interaction, drag-and-drop, hovering, etc.). The value of theTransform
appears completely random to users, unrelated to what they set withStyle
.Transform
on UI nodes is auto-generated instead of being user set. This is quite confusing.Transform
propagation to parents to calculateGlobalTransform
is entirely redundant with the layouting of UI, which already involves calculating the position of nodes relative to their parents, and can calculate an absolute position at the same time.The proposal here would be to accept that
Transform
is just not the right tool for the job of positioning UI nodes, andParent
not the right tool to build a UI node hierarchy, and stop using them in the UI definition. It's possible that we still want to convert UI node in the mainWorld
to something else in the renderWorld
that'sTransform
-based, because we probably want to keepGlobalTransform
for rendering. But for users in the mainWorld
it's probably more confusing than anything at the minute.Beta Was this translation helpful? Give feedback.
All reactions