Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetText() not always rendering new value #150

Open
DelSystem32 opened this issue Dec 8, 2015 · 2 comments
Open

SetText() not always rendering new value #150

DelSystem32 opened this issue Dec 8, 2015 · 2 comments

Comments

@DelSystem32
Copy link
Contributor

Say that there's a text field named "fieldname" that has the value "0".

I now change that "0" to a "1":
lwf.SetText("fieldname", "1");

When calling lwf.GetText("fieldname") it does in fact return "1", so the value is stored successfully, however it is not updated visually.

If I continue to change the valule from 1 to 2 to 3 etc nothing updates visually until 10 is hit. Then it reflects the actual value. But 11, 12 etc is not reflected.

Seems like it only renders the new value of the text field if it has changed in string length?

If I change the x/y position of the MovieClip that contains the textfield it also successfully displays the actual value in the text field.

I assume the problem is just that you've forgotten to set the text field as being "dirty" when a new value is received, unless the new value has a different string length. I haven't exactly worked out how to workaround this problem yet though, I had hoped I could just set the root movie's x property to the same as it was previously but that doesn't make LWF update the visuals unfortunately.

@DelSystem32
Copy link
Contributor Author

Seems like the problem is in lwf_combinedmesh_text.cs

Inside:

public override void Render(Matrix matrix, ColorTransform colorTransform, int renderingIndex, int renderingCount, bool visible)

There is the followng:

int z = renderingCount - renderingIndex;
if (m_z != z) {
    m_updated = true;
    m_z = z;
}

If I remove the length check the text field works as it should:

int z = renderingCount - renderingIndex;
//if (m_z != z) {
    m_updated = true;
    m_z = z;
//}

I don't know why that check is there in the first place (trying to save performance?) but without it things actually work like expected.

Can someone that has more insight in LWF than me remove the check from the LWF source code? Unless of course you discover that the problem is elsewhere.

@DelSystem32
Copy link
Contributor Author

Until this is fixed in LWF here's a workaround:

lwf.SetText(textInstanceName, newText +"!");
lwf.ForceExecWithoutProgress();
lwf.Render();
lwf.SetText(textInstanceName, newText);

This will make sure that the current text value is shown the next time LWF is rendered, even if it had the same length as the old text value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant