When I draw on a frame with Pencil2D and that frame is followed by say three undefined frames.
By convention these following frames are the same image is the frame I’ve drawn on.
When I press play all four frames display as the same image, the one I drew in the first frame.
Sometimes by accident I select the frame, the first of the empty frames in front of the one I drew on. Pencil2D allows me to edit the image, as if I was on the frame I drew on.
How is this possible?
Is there an internal working file that is used during playback?
How does this relate to the drawn frame?
Keep up the excellent work Pencil2D team
There is an object representing each keyframe which contains information about it such as it’s position in the timeline, position on the canvas, and the image data as a bitmap. There are no objects used to represent empty or held frames. Rather, when rendering the currently selected framed, it simply draws the bitmaps of the last keyframes on or before the current frame on each layer.
When it comes to editing, when you start a brush stroke or other modification, it first checks what preference you have set under Preferences > Timeline > Drawing. If you have that set to keep drawing on the previous key-frame, it will search for the last keyframe on or before the current frame and apply any modifications to that object. If one of the other options are selected, it will create/duplicate the last keyframe if necessary, and then do the same thing.
For the most part, images are worked on in-memory. An extracted version of your project is used for loading/saving and for storing unmodified frames, and this is located in your systems temporary file directory while Pencil2D is running.
Hope this answers your questions. If you are familiar with programming, Pencil2D is open source and you can study how this all works in more detail here: GitHub - pencil2d/pencil: Pencil2D is an easy, intuitive tool to make 2D hand-drawn animations. Pencil2D is open source and cross-platform..
Thanks for the explanation