Frame[0] what art thou purpose?
Porting the LED Matrix Studio to C++ has so far been a fun process, but along the way I've stumbled upon decisions that current me can't fathom.
I have a feeling historical me could shed some light on the reasoning behind those decisions, but he's not here.
So, what's the purpose of Frame[0]?
LED Matrix Studio stores each frame of animation in a frame container. Each layer has its own frame container. That's it. There are other containers for user memories and a couple of buffers for building the output display, but those frame containers store everything that's being worked on.
The first frame is Frame[0], the second, Frame[1], etc.
For some unknown reason, Frame[0] is special. The animation data you see on screen all start at Frame[1]. Everything within the application that displays, modifies, or in any way, references stored matrix data has to start from 1*.
The display in the animation toolbar that shows the frame being displayed and the number of frames in total (eg 1 / 10) is actually the number of frames available minus 1 - because of the mysterious Frame[0].
Except for when this frame is created, I can see no reference to it anywhere in the code. Nothing uses the frame. It's not special.
I thought it might once have been an undo buffer or something like that, but there's no sign it's ever been used.
I've been through code dating back to 2015(!) and I still can't find any code that's ever used it.
It's very odd, and I'll keep digging around, but for now, it's a mystery.
I'll be refactoring the code over the next few days to get rid of this "feature".
Porting is still going well, still a lot to do, but I think all of the code will be ported within the next week, then it's just testing and more testing.
* Well, the function that draws to every frame at once starts at zero instead of one.