Fix image datablock losing movie metadata on undo

The anims data is a runtime cache similar to the image buffer or GPU texture
and needs to be preserved through undo in the same way.

Found as part of D15042 development.
This commit is contained in:
Brecht Van Lommel 2022-11-14 13:14:45 +01:00
parent 8447ab606e
commit 4f5f8622f9
1 changed files with 5 additions and 0 deletions

View File

@ -234,6 +234,11 @@ static void image_foreach_cache(ID *id,
key.offset_in_ID = offsetof(Image, cache);
function_callback(id, &key, (void **)&image->cache, 0, user_data);
key.offset_in_ID = offsetof(Image, anims.first);
function_callback(id, &key, (void **)&image->anims.first, 0, user_data);
key.offset_in_ID = offsetof(Image, anims.last);
function_callback(id, &key, (void **)&image->anims.last, 0, user_data);
auto gputexture_offset = [image](int target, int eye) {
constexpr size_t base_offset = offsetof(Image, gputexture);
struct GPUTexture **first = &image->gputexture[0][0];