gree / lwf

LWF - Lightweight SWF
http://gree.github.com/lwf/
zlib License
627 stars 167 forks source link

No longer rendering timeline #156

Closed DelSystem32 closed 8 years ago

DelSystem32 commented 8 years ago

Until today I was using LWF from a couple of months ago (I downloaded it 6oct2015). Today I downloaded a new version of LWF and suddenly a flash no longer animates. It's a 3 FPS flash with two keyframes on its timeline.

lwfObject.UpdateLWF(Time.deltaTime);

Had worked fine in LWF until now. Any idea what have changed code-wise during these months?

It appears that it is indeed advancing on its timeline, just no longer rendering any changes. I've tried:

lwfObject.UpdateLWF(Time.deltaTime);
lwfObject.lwf.Render();

But it does nothing. The following...

lwfObject.UpdateLWF(Time.deltaTime);
lwfObject.lwf.ForceExecWithoutProgress();
lwfObject.lwf.Render();

...does work on a different 10 FPS flash but not on the 3 FPS flash. I have no idea why it works on one and not on the other. Also, why do I need to call ForceExecWithoutProgress? UpdateLWF was just called (with progress).

Seems like you've changed something fundamental but there's no changes appearing on the interface. What has changed, what am I doing wrong? Why isn't UpdateLWF() rendering the flash like it used to?

DelSystem32 commented 8 years ago

I just don't understand what has changed... Did you make some kind of optimization that will prevent something from rendering even though Render() is called?

I'm a little frustrated because I had just gotten things working as it should in the previous version of LWF from October and I was about to release my project today. Then it turned out something has changed internally that I can't find and I my release is delayed.

Is there something I can call that will 100% force everything to render? Even if the MovieClip hasn't been set as "dirty" or anything like that?

DelSystem32 commented 8 years ago

Found the problem, it was as I thought an optimization from these two commits:

https://github.com/gree/lwf/commit/7490ab04f4b17f89c930645b3b8abe4865d10e07 https://github.com/gree/lwf/commit/b510ddbb2aa64998f717a5e791f813a4aa80a333

If I remove this new "needsUpdate" completely there is no problem any more, it will always render.

When lwf.updateCount is 0 the needsUpdate boolean never becomes true in "lwf_uivertex_factory.cs" or "lwf_combinedmesh_factory.cs".

lwf.updateCount is only increased in lwf.Update(), which is only called from:

1) Exec() in "lwf_core.cs" if needsToUpdate is true 2) UpdateAttachedLWF() in "lwf_movie.cs" if needsUpdateAttachedLWFs is true

So it turns out that lwf.Update() is not always called even if it should be called. I dunno why. lwfObject.UpdateLWF(Time.deltaTime); should in turn call Exec(). However for some reason "needsToUpdate" inside Exec() is never set to true, even though the timeline advances for the root MovieClip.

The currentFrame in LWF.Movie changes between 1 and 2. However lwf.updateCount will not increase for some reason and therefore the new frame does not render. There is a bug here.

DelSystem32 commented 8 years ago

This issue has been fixed in my fork, please merge it with the master.