Make sure ecostats toggling run just once to avoid flickering on player camera toggle. #3856
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work done
Make sure hideEcostats and showEcostats is only run once to avoid flicker on spectator HUD reInit().
This happens when toggling player view as spec. Also seems to sometimes trigger missing backgrounds for some meter elements on the spectator hud.
The fix fixes the ecostats flicker issue, while possibly fixing the missing backgrounds (at least makes them much more unlikely, not sure where they come from tbh).
Test steps
Screenshots:
Since this is a rapidly changing condition screenshot doesn't do much, but the problem can be observed at the following youtube video: https://www.youtube.com/watch?v=k-ZhX2Vu8CQ.
At 3:50 the flickering can be observed. (better to watch it at 0.25x to be able to note the flicker)
At 4:27 spectator HUD losing background for one of it's meters can be observed (the background actually appears, but dissapears in a few seconds).
Notes:
The missing backgrounds issue can be due to something else but this fix seems to make them much more unlikely. I can reproduce missing backgrounds without the fix, but not with it applied.
The missing background itself seems to be some kind of memory corruption/race condition issue, since it shows but then dissapears in a few seconds after the lua has done it's things... I'm guessing the lua side should not be doing that but not totally sure... maybe further investigation would be warranted on the engine side, not sure tbh, don't want to be alarmist but looks bad.