[Fixed] textprefix ignored when changing opacity through MS

Talk about ManiaLink development in this forum

Moderator: NADEO

Post Reply
User avatar
m4rcel
Posts: 650
Joined: 15 Jun 2010, 11:12
Contact:

[Fixed] textprefix ignored when changing opacity through MS

Post by m4rcel »

I came across another bug when using the new styles of ManiaLink version 2.

Description:

When a <label> gets both style and textprefix set through a <style>, then the textprefix gets ignored as soon as the opacity of the <label> is changed using ManiaScript.

This bug seems to only invole the textprefix attribute, other attributes still gets applied as intended. Additionally, it only occurs when changing the opacity of the <label>: When chaning any other attribute like the value or the position, the textprefix still gets applied.

Example ManiaLink:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<manialink version="2" navigable3d="0">
    <timeout>0</timeout>
    <stylesheet>
        <style class="styleLabel" style="TextButtonBig" textprefix="$t[I am the text prefix] " />
    </stylesheet>
    <label id="label" class="styleLabel" sizen="200 0" text="Press any key to trigger bug" />
    <script><![CDATA[
while (True) {
    yield;
    foreach (Event in PendingEvents) {
        if (Event.Type == CMlEvent::Type::KeyPress) {
            declare Label = (Page.GetFirstChild("label") as CMlLabel);
            Label.Opacity = 0.5;
        }
    }
}
]]></script>
</manialink>
Expected Behavior:

When pressing any key, the <label> becomes 50% transparent by keeping all other attributes like its text prefix and formats.

Actual behavior:

The <label> actually looses its text prefix, having the text disappear and some of the formats change which have been implicitly manipulated with the textprefix.

Workaround:

This bug can be easily workaround by adding the textprefix to the <label> itself.
ImageImage
Image
User avatar
noyranea
Nadeo
Nadeo
Posts: 187
Joined: 29 Apr 2014, 14:50
Location: Paris, France

Re: [Bug] textprefix ignored when changing opacity through M

Post by noyranea »

Hi m4rcel,

First of all, thank you for this very well constructed bug report, it was very helpful ! :)

The bug you reported was only a symptom though, and I fixed the root cause. You'd have the same problem with the textemboss attribute being removed, or while modifying the textsize instead of the opacity.
Everything works all right now.

Moreover I found that, with the stylesheet, you could use both a Style and a TextPrefix/TextEmboss, which wasn't possible in version 1. Setting the Style through the script would remove TextPrefix & TextEmboss (and this feels quite weird).
In order to stick to the previous behavior, I disabled this, so you won't be able to use TextPrefix or TextEmboss AND a Style (which was the intended behavior).

If you feel like you'd need this feature, you're welcome to ask for it here or in an other thread.

I hope this was clear enough. Have a nice day,

-- noyranea
User avatar
m4rcel
Posts: 650
Joined: 15 Jun 2010, 11:12
Contact:

Re: [Fixed] textprefix ignored when changing opacity through

Post by m4rcel »

Actually I use this feature/glitch/whatever quite often, especially when elements get manipulated with ManiaScript.

After looking through my styles, I found the following case which (currently) can only be achieved with style+textprefix: Having a black shadow on a nearly-black font. (Which looks nicer in my case than a white shadow.)
For example, I want to use TextRaceChrono to have the digits font. When using textcolor="222F", I get a white shadow, which I don't want. Instead, I use textprefix="$222$s" to get a black shadow.
Using textprefix here has a big advantage: When changing the value using ManiaScript, I do not have to bother with the color, as assigning to .Value only changes the text but not the textprefix.

(Everything else for waht I used this "feature" for seems to be achievable using textcolor/textsize/textwhatever, so this is the only case, which was not possible without style+textprefix.)


Side note:
It was possible to combine style and textprefixes in older versions of ManiaPlanet, and I used this on the Tetris ManiaLink. I think Maniaplanet Update 3 broke this "feature" and thus parts of the design of the ManiaLink. I was happy when I re-discovered the features with <style>s, and you broke it again :D
ImageImage
Image
User avatar
noyranea
Nadeo
Nadeo
Posts: 187
Joined: 29 Apr 2014, 14:50
Location: Paris, France

Re: [Fixed] textprefix ignored when changing opacity through

Post by noyranea »

I see. I'll make it work, even if I can't say when it'll be done.

I'll keep you informed in this thread.

-- noyranea
Post Reply

Return to “ManiaLink”

Who is online

Users browsing this forum: No registered users and 2 guests