diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-03 13:55:50 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-03 13:56:21 +0300 |
commit | aab41401f9e911f417039c06a28e948d75cbcdaf (patch) | |
tree | 8240bc9e89782c321c7b43de5b86d3e2e7fadb58 /source/blender | |
parent | ae5529c848127b0c87809e17516a1fe283e49a69 (diff) |
Move bSound cache handling during undo to new system.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 15 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 |
3 files changed, 16 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index a293bc55073..18fd8a10cc1 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -112,6 +112,20 @@ static void sound_free_data(ID *id) } } +static void sound_foreach_cache(ID *id, + IDTypeForeachCacheFunctionCallback function_callback, + void *user_data) +{ + bSound *sound = (bSound *)id; + IDCacheKey key = { + .id_session_uuid = id->session_uuid, + .offset_in_ID = offsetof(bSound, waveform), + .cache_v = sound->waveform, + }; + + function_callback(id, &key, &sound->waveform, user_data); +} + IDTypeInfo IDType_ID_SO = { .id_code = ID_SO, .id_filter = FILTER_ID_SO, @@ -128,6 +142,7 @@ IDTypeInfo IDType_ID_SO = { .free_data = sound_free_data, .make_local = NULL, .foreach_id = NULL, + .foreach_cache = sound_foreach_cache, }; #ifdef WITH_AUDASPACE diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index a6fe99b2974..4af9399573a 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -399,9 +399,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, /* makes lookup of existing video clips in old main */ blo_make_movieclip_pointer_map(fd, oldmain); - /* make lookups of existing sound data in old main */ - blo_make_sound_pointer_map(fd, oldmain); - /* make lookups of existing volume data in old main */ blo_make_volume_pointer_map(fd, oldmain); @@ -422,9 +419,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, /* ensures relinked movie clips are not freed */ blo_end_movieclip_pointer_map(fd, oldmain); - /* ensures relinked sounds are not freed */ - blo_end_sound_pointer_map(fd, oldmain); - /* ensures relinked volumes are not freed */ blo_end_volume_pointer_map(fd, oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a24ccdc2dc1..31843efaaf8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8408,13 +8408,9 @@ static void direct_link_sound(BlendDataReader *reader, bSound *sound) sound->cache = NULL; } - if (reader->fd->soundmap) { - sound->waveform = newsoundadr(reader->fd, sound->waveform); + if (reader->fd->memfile != NULL) { sound->tags |= SOUND_TAGS_WAVEFORM_NO_RELOAD; } - else { - sound->waveform = NULL; - } sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); BLI_spin_init(sound->spinlock); |