[Solved] Complex 3D nodes in lemur not rendering correctly

Well, because if you set the size of a BitmapText and then ask it for its size then it will give you the size you just gave it. Since we are trying to calculate the size it wants to be then we have to clear the forced size first.

Your code snippet does show me one thing, though. I already implemented a maxWidth, apparently. You could set that instead of modifying the code… then it will wrap the text and grow/shrink vertically as needed.

Once the text has a limit in terms of width the all-in-one-line width is completely irrelevant until that limit is again removed. Caring about that width is what breaks everything.

I noticed that it was already there once I started to add my own system so I scrapped my early efforts and rather fixed your broken implementation. I’m generally not so retarded that I wouldn’t use something if it exists and works.
As I said, the way you determine the max one line length in calculatePreferredSize removes the box altogether and leaves all text in just one line even though you set the maxWidth param. And this is a rough fix for it with those two line removals my only changes.

Consider this a bug report I suppose.

I didn’t say you were retarded… but you do have a bit of an attitude. I hadn’t realized in earlier conversations with several people that I’d already implemented something to solve this issue. That fact that it’s broken is fine to know. Your “fix” breaks it even more… so thanks for nothing.

So, yeah, I’ll hurry up and get right on this… when I calm down and decide to be nice again.

If you decide you want to be helpful, the intent for calculatePreferredSize() is to leave the text box as it was before the method was called. It does not change the bitmap text at all as it’s supposed to put it back the way it was, which was set earlier or was already null.

reshape() is the method that will set the text box based on the size that was calculated.

When the method was written, BitmapText would return a proper multiline height if given a text box that couldn’t fit vertically (but was clamped horizontally).

So, that method is supposed to clear the text box (or set it to a maxWidth text box), calculate a proper size for the caller, then set the text box back to what it was before calculatePreferredSize() was called. That’s what it looks like it does. If you have more information about why it doesn’t then that would be helpful.

If you know that bitmapText.getHeight() is broken then that would also be helpful.

My reading of the method is that it is correct without the commented lines.

The size will then be passed to reshape() and a new text box will be created… unless something else is screwing up the size before it gets to reshape.

At one time, this did work as I’ve used it myself. So there may be something else at play.

Sample code:

Result:

So for me it seems to be working as expected with the code as it is in git right now.

Edit: I upgraded the label demo to use a window instead of just a raw label to show if the layout is working properly or not.

Original code in case the above gets replaced in the GIT snippet:

protected void onEnable() {

    String s = "This is an example of long text that should be word-wrapped if it"
               + " exceeds a certain maximum width.  Once it exceeds that width then"
               + " it should grow down and the layout should function appropriately."
               + " If it's working correctly, that is.";
    Label label = new Label(s);
    label.setMaxWidth(400);
    label.setLocalTranslation(400, 400, 100);
     
    getState(PopupState.class).showPopup(label, closeCommand);    
}

And if it doesn’t, latest code:

And latest screen shot:

Found the problem!

Loaded up the example and it worked fine:

Works fine with a custom size and font:

But when you add a shadow color:


Welp, there’s yer problem.

label.setShadowColor(ColorRGBA.Red);

Is that not how i’m supposed to add a shadow?

P.S.
While the example works, there doesn’t seem to be any such thing as a CallMethodAction class in my libs. Is it new?

It’s in Lemur-proto… where the ActionButton is and many of the other things the demo relies on.

It’s likely that the bug is that the shadow text is not picking up the maximum width setting.

Edit: just committed a fix… I don’t have time to test it right now:

…it’s pretty straight-forward though.

Oh. I somehow missed that one when grabbing the jars.

Anyhow, thanks for the help :slight_smile:

Note: edited my last message with the link to the commit that should fix the issue.