Fix: GPv3: Frames map not saved

The copy constructor of the Layer class didn't do a copy
of the frames storage (DNA) and only a copy of the frames map (runtime).
This is fine, but we need to make sure to tag the frames storage,
because it is out of sync otherwise.
During edit mode undo, the layers were copied (but the frames storage not tagged) which meant that after undoing and then saving the file,
the frames would be gone after reloading.

The fix makes sure we tag the frames storage, so that it is properly synced.
This commit is contained in:
Falk David
2024-03-06 13:56:22 +01:00
parent 500a891ac9
commit bab3e5c442

View File

@@ -683,8 +683,6 @@ Layer::Layer(const Layer &other) : Layer()
/* TODO: duplicate masks. */
/* Note: We do not duplicate the frame storage since it is only needed for writing to file. */
this->blend_mode = other.blend_mode;
this->opacity = other.opacity;
@@ -695,8 +693,12 @@ Layer::Layer(const Layer &other) : Layer()
copy_v3_v3(this->rotation, other.rotation);
copy_v3_v3(this->scale, other.scale);
/* Note: We do not duplicate the frame storage since it is only needed for writing to file. */
this->runtime->frames_ = other.runtime->frames_;
this->runtime->sorted_keys_cache_ = other.runtime->sorted_keys_cache_;
/* Tag the frames map, so the frame storage is recreated once the DNA is saved.*/
this->tag_frames_map_changed();
/* TODO: what about masks cache? */
}