diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-03 17:55:13 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-03 18:01:21 +0300 |
commit | 1bdabd7b4f0d2db9b06110ad4ca92522d782f5dc (patch) | |
tree | 7d845dadffceaedc443ad47ecbf28e392a50636b /source | |
parent | 1019c9f582f2cb588eea16ac0e23abea71de6308 (diff) |
Move MovieClip to new undo cache management system.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 18 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 28 |
2 files changed, 18 insertions, 28 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index f0efc9b8c50..d36f5ed0329 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -129,6 +129,23 @@ static void movie_clip_foreach_id(ID *id, LibraryForeachIDData *data) } } +static void movie_clip_foreach_cache(ID *id, + IDTypeForeachCacheFunctionCallback function_callback, + void *user_data) +{ + MovieClip *movie_clip = (MovieClip *)id; + IDCacheKey key = { + .id_session_uuid = id->session_uuid, + .offset_in_ID = offsetof(MovieClip, cache), + .cache_v = movie_clip->cache, + }; + function_callback(id, &key, (void **)&movie_clip->cache, user_data); + + key.offset_in_ID = offsetof(MovieClip, tracking.camera.intrinsics); + key.cache_v = movie_clip->tracking.camera.intrinsics; + function_callback(id, &key, (void **)&movie_clip->tracking.camera.intrinsics, user_data); +} + IDTypeInfo IDType_ID_MC = { .id_code = ID_MC, .id_filter = FILTER_ID_MC, @@ -144,6 +161,7 @@ IDTypeInfo IDType_ID_MC = { .free_data = movie_clip_free_data, .make_local = NULL, .foreach_id = movie_clip_foreach_id, + .foreach_cache = movie_clip_foreach_cache, }; /*********************** movieclip buffer loaders *************************/ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 880a854acfc..d9dcd72b0b6 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2013,22 +2013,10 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain) { - MovieClip *clip = oldmain->movieclips.first; Scene *sce = oldmain->scenes.first; fd->movieclipmap = oldnewmap_new(); - for (; clip; clip = clip->id.next) { - if (clip->cache) { - oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0); - } - - if (clip->tracking.camera.intrinsics) { - oldnewmap_insert( - fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0); - } - } - for (; sce; sce = sce->id.next) { if (sce->nodetree) { bNode *node; @@ -2058,8 +2046,6 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) } for (; clip; clip = clip->id.next) { - clip->cache = newmclipadr(fd, clip->cache); - clip->tracking.camera.intrinsics = newmclipadr(fd, clip->tracking.camera.intrinsics); BLI_freelistN(&clip->runtime.gputextures); } @@ -8470,20 +8456,6 @@ static void direct_link_movieclip(BlendDataReader *reader, MovieClip *clip) BLO_read_data_address(reader, &clip->adt); - if (reader->fd->movieclipmap) { - clip->cache = newmclipadr(reader->fd, clip->cache); - } - else { - clip->cache = NULL; - } - - if (reader->fd->movieclipmap) { - clip->tracking.camera.intrinsics = newmclipadr(reader->fd, clip->tracking.camera.intrinsics); - } - else { - clip->tracking.camera.intrinsics = NULL; - } - direct_link_movieTracks(reader, &tracking->tracks); direct_link_moviePlaneTracks(reader, &tracking->plane_tracks); direct_link_movieReconstruction(reader, &tracking->reconstruction); |