thomaswp / snap-replay

"Video"-like replayer for Snap logs
1 stars 1 forks source link

Empty sprite costumes #2

Closed cvetelinandreev closed 2 years ago

cvetelinandreev commented 2 years ago

When replaying or recording with a start project, the sprites' costumes are loaded but with no content. Attached is a sample project. If the same project is imported trough File -> Import the costume get loaded. On the lest side is the project imported trough the menu, on the right side is the playback page with loaded startup project (start.xml in the dist/folder)

image

start.xml.zip

cvetelinandreev commented 2 years ago

I was able to load the costumes. Here is the issue I found:

The method IDE_Morph.prototype.rawOpenProjectString is called twice. Once from Recorder.resetSnap and once from Recorder.setRecordScale. Both methods are called from Playback.resetSnap image

If Recorder.setRecordScale is commented, the project loads fine with the sprite's costumes. However doubt this is the proper fix.

thomaswp commented 2 years ago

Interesting. I'd need to do some debugging to understand why that's happening, but a simple fix would be to swap the order of the two statements. It shouldn't cause any problems and it may fix things. If not, I'm guessing it's because loading a project is asynchronous. The fix shouldn't be hard, but in the meantime all setBlockScale does is ensure that the blocks are zoomed to the same scale it was recorded under, so for testing it shouldn't be needed. In production, though, it's important to make sure points in the reply align correctly.

cvetelinandreev commented 2 years ago

Thanks for explaining why do we need the block scale set.

Swapping is a good idea since it will scale and reload an empty project before it loads the one from start.xml. However this doesn't fix the issue. It loads an empty project over the one in start.xml. How can we make the setRecordScale a sync operation?

cvetelinandreev commented 2 years ago

This seems to be fixed after the latest commits