Using world rotation in lemur layouts

I’m trying to have a layout where the childs are to be always with an identity rotation. I’m trying to re-adjust it rotation on the reshape(Vector3f pos, Vector3f size) method, but it seems that their current rotation (a rotation set by an ancestor layout) isn’t yet set for the child when the method is called. So, I assume that the reshapes are called from down to up, from children to ancestors (Is what I think it does looking at the GuiControl’s reshape code). Am I right?

To be more clear:


  • There is a layout-0 that have containers and rotate them.
  • This containers have children, some of whom:
    • Are containers with a layout-1 that counter-rotate it children to let them always as without rotation.


That counter-rotation can’t be set because when the **layout-**1 is called, the layout-0 hasn’t done the rotation yet.

If this is the case, is there any “correct” way in lemur to achieve this?.

The docs talk about how the layout is performed for components here:

I don’t know if it answers your question but somewhere in there it definitely talks about the order of calculate versus reshape.

As to the other, I’m still not really sure what you are trying to do so I cannot say if there is a better way or not.

Ok, I’m not sure is the “correct” way but it works xD. I tried before to calculate the “layout-1 counter-rotation” in the calculate but not the “layout-0 rotation”. So… it works with:

  1. ‘Ancestor layout’ rotates it children in calculate.
  2. ‘Children layout’ counter-rotates in reshape.

And doesn’t work:

  1. ‘Ancestor layout’ rotates it children in reshape.
  2. ‘Children layout’ counter-rotates in reshape.

So… I’ll say that the docs are quite confusing, as I understand it, it says the opposite thing.

I did my best to explain it :frowning: . Pretty sure it would be clearer with an image. Something like:

Not exactly the same thing but kind of. I’ve created a layout that positionates all childs in the center and rotating them to distribute evenly in a circle (just like if every panel were a clock hand. Thats fine, but in every hand I want a panel (ie: the last one), to be “not-rotated”, so, I put them on another layout that ignores the worldrotation for them (applying them a local counter-rotation).

Looks cool.

Something to remember in the end: these are just spatials and a Lemur layout is not always the best way to lay things out. It’s nice when it is but the farther one gets from a standard UI layout the less appropriate it starts to become.

For example, for a radial menu, I’m personally not sure I’d use a layout for it… especially if I wanted to animate the opening/closing, rotation during selection, etc… It’s really easy to animate a spatial hierarchy and much harder to animate a layout. (Lemur’s animation library already gives you a bunch of spatial animation stuff but no layout stuff at all… and there’s a reason for that. :slight_smile: )

It is possible to know the reason?.

I though just on a center-to-position animation for each element, what I could achieve just changing the preferredSize of every “clock hand”.
I’m not sure about the limitation of creating a layout for it in animating-terms (Using non-lemur-anim-library animations for it isn’t incompatible with a layout, is it?). Hm… I’ll think it better xD. I wasn’t sure of it at an start and you made me less sure now. Too much things to think about xD.

The reasons Lemur’s animation system doesn’t already have methods for animating layouts is for the reasons I already stated: Lemur layouts are hard to animate. I actually can’t even think of a good use-case using the currently layouts and the contrived ones I can’t think of how I’d do it.

Edit: note: I have animated GUI elements in layouts but it does it despite the layout instead of through the layout. (ie: I can pulse them and stuff without telling the layout I’m doing it… they’re just spatials after all.)

I just got it working perfectly. Having a mess withing calculate and reshape and one calling the other and things like that xD. I’ll clean it a bit and I’ll try (for first time) the lemur animation system. The ui stuff was delegated to me after the visual-creator in my team decided “no more coding” xD so I can’t talk about lemur’s tweens yet.

Thanks for your help :smiley: