Note for NeoLemmix users: this bug is also present in the NeoLemmix Editor, and has been for a while. If I can get it resolved in the SLX Editor, I'll absolutely provide the fix for the NL Editor as well.
The problemSteps to reproduce:
1 Find a level that has some pieces in it that are definitely not present in the styles folder (perhaps temporarily remove the level's style from the styles folder for testing)
2 Open this level in the Editor
A dialog similar to this one should pop up:
Any attempt to move past this dialog (either by clicking OK or [X]) results in the same dialog popping up again. You either have to reach for Windows Task Manager (
), or if you have enough patience (and a rapid-fire button on your mouse!), you can repeatedly click it up to 40-50 times and it will eventually close, and the level will load.
This should clearly not happen. Ideally, the dialog disappears after a single click.
With that said - if the level is missing
multiple pieces, this dialog appears
per piece. So, even if a single click closes the dialog, this is still very inconvenient if you have to click through many missing pieces.
The fixIt's a very easy fix, thankfully. If we remove the code that causes the dialog to open and silently log the exception instead, it turns out that the Editor code already features a much better way of handling missing pieces; it shows a much more user-friendly dialog with a list of all missing pieces, and explains that the image files cannot be found:
Please note that I have already modified this dialog in the latest working copy of the SLX Editor, but the original version was essentially the same; I've simply added some line breaks for readability, and a Cancel button. The reason being, clicking "OK" closes the dialog and loads the level, albeit with the missing pieces; the user should also be able to cancel the loading of the level altogether at this point.
I do wonder, though - what
is the most desirable behaviour here? Should the level load with missing pieces? This is not necessarily a good result; if the level is saved at that point, the missing pieces will have disappeared unrecoverably.
I suggest it would be far better to simply not load the level, instead preserving it as it whilst encouraging the user to gather the missing style pieces so that the level can be opened properly.
Offering the choice (as the working copy currently aims to do - I haven't quite finished it yet) seems like a happy medium, but maybe preserving the level file should be top priority here. I feel like an extra step should be necessary to open the level with missing pieces (an "are you sure?" dialog with a warning, perhaps), and cancelling loading the level should be an easier default.
Thoughts on this? Should it be a choice? Should the level never load with missing pieces? Should it always load with missing pieces?
One thing is for sure - the repeatedly-opening dialog is GONE, so
the bug is fixed. We just need to figure out what is the best thing to do with the "missing pieces level" from that point.