leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
275 stars 52 forks source link

[Request] Can we use animatedgif at Panel2.cfg and Panel.xml? #710

Open ginga81 opened 2 years ago

ginga81 commented 2 years ago

Description

Animated Gif support is very superior. When I set animated gif to Panel2.cfg and Panel.xml's pilotlamp, these are shown only first frame. For example, at the one-man car's LCD platform's camera display and backward's mirror, it can do to the animation. If we can use also at Panel2.cfg and Panel.xml, we are very useful. For example touchElements's display can animation! Please consider about this. Screenshot from 2021-11-21 23-42-58

leezer3 commented 2 years ago

Interesting, I would have expected that to work :/

Will hopefully take a look this week.

leezer3 commented 2 years ago

Hmm...

It's a timing issue; Specifically, we need to know the dimensions of the texture (as all Panel2 elements are sized relative to the texture dimensions), but this requires running in the main thread with an active GL context. Whilst this is happening though, the multi-frame flag is overwritten with the temp copy. Might end up being complex; I remember this being an absolute pain to get right the first time around when the panel parser moved into the plugin....

ginga81 commented 2 years ago

If that's not possible, I can't talk unreasonably because I can't programing, so please you are cancel this issue.

leezer3 commented 2 years ago

Try the build from today, should hopefully be sorted.

ginga81 commented 2 years ago

I tested the latest daily build. Short movie animated gif of from your's sample femous animation's can display at Panel.xml This's Pilotlamp. TouchElement's screen's Pilotlamp is animationing but blinking violently. Long movie, that is about 8MB's csv object is white, and This's Pilotlamp and Touchelement's Pilotlamp is both not shown. Background's long movie is gray. And Touchelement's needle is also blinking violently. This needle is screen1, so when we back to the screen0, this is must hidden. But shown and blinking violently.

leezer3 commented 2 years ago

Assuming you mean an 8mb GIF, that's never going to be very happy, and I wouldn't reccomend this. (Likely to be hundreds of frames) Couple of hundred kilobytes is probably as high as I'd go, something about 30-40 frames max.

I haven't seen any flickering in some brief testing, but will see what happens with an oversize GIF, and whether there's any room for improvement. You may also be seeing frame time related issues- If the framerate of your GIF is faster than the sim is rendering, this might get glitchy; Try a relatively slow GIF and see if that helps.

ginga81 commented 2 years ago

https://www.youtube.com/watch?v=zXzWbZ_jsbM I imagine that for example, this OpenBVE's creator's LCD display. I think that if this movie convert to animatedGIF, this animation is at lease over 30-40 frame. At the past time, I heard from him, to create this movie, he is using movie edit soft that is to synthetic movies. If this movie can use animatedGIF, he do not neccessary synthetic movies. So, I tested long movie, and I hopely that the time of animation is unlimited.

ginga81 commented 2 years ago

Crosshatch says that he want at least 5 seconds per 30 frame / sec, and if more, if you like, he want about 15 seconds needs.