Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-11 12:52:25 +0300
committerJacques Lucke <jacques@blender.org>2020-09-11 12:52:37 +0300
commitf8ef7f045c289a86a141b2fc952e3e070f7679f1 (patch)
tree899d0b1febdd07293fcc8da86ae9f1076b85dd07 /source/blender/blenloader
parent55efa1795f62bb99dcf4becc046269117032015e (diff)
Refactor: move Sound .blend I/O to IDTypeInfo callbacks
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c54
-rw-r--r--source/blender/blenloader/intern/writefile.c21
2 files changed, 3 insertions, 72 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c6217b56565..d1dfee0e779 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6201,44 +6201,6 @@ static void fix_relpaths_library(const char *basepath, Main *main)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Read ID: Sound
- * \{ */
-
-static void direct_link_sound(BlendDataReader *reader, bSound *sound)
-{
- sound->tags = 0;
- sound->handle = NULL;
- sound->playback_handle = NULL;
-
- /* versioning stuff, if there was a cache, then we enable caching: */
- if (sound->cache) {
- sound->flags |= SOUND_FLAGS_CACHING;
- sound->cache = NULL;
- }
-
- if (BLO_read_data_is_undo(reader)) {
- sound->tags |= SOUND_TAGS_WAVEFORM_NO_RELOAD;
- }
-
- sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
- BLI_spin_init(sound->spinlock);
-
- /* clear waveform loading flag */
- sound->tags &= ~SOUND_TAGS_WAVEFORM_LOADING;
-
- BKE_packedfile_blend_read(reader, &sound->packedfile);
- BKE_packedfile_blend_read(reader, &sound->newpackedfile);
-}
-
-static void lib_link_sound(BlendLibReader *reader, bSound *sound)
-{
- BLO_read_id_address(
- reader, sound->id.lib, &sound->ipo); // XXX deprecated - old animation system
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name Read Library Data Block
* \{ */
@@ -6403,9 +6365,6 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_LI:
direct_link_library(fd, (Library *)id, main);
break;
- case ID_SO:
- direct_link_sound(&reader, (bSound *)id);
- break;
case ID_GR:
direct_link_collection(&reader, (Collection *)id);
break;
@@ -6447,6 +6406,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_PT:
case ID_VO:
case ID_SIM:
+ case ID_SO:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -7076,9 +7036,6 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_GR:
lib_link_collection(&reader, (Collection *)id);
break;
- case ID_SO:
- lib_link_sound(&reader, (bSound *)id);
- break;
case ID_CF:
lib_link_cachefiles(&reader, (CacheFile *)id);
break;
@@ -7118,6 +7075,7 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_PT:
case ID_VO:
case ID_SIM:
+ case ID_SO:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -8049,11 +8007,6 @@ static void expand_cachefile(BlendExpander *UNUSED(expander), CacheFile *UNUSED(
{
}
-static void expand_sound(BlendExpander *expander, bSound *snd)
-{
- BLO_expand(expander, snd->ipo); // XXX deprecated - old animation system
-}
-
static void expand_workspace(BlendExpander *expander, WorkSpace *workspace)
{
LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
@@ -8110,9 +8063,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_SCE:
expand_scene(&expander, (Scene *)id);
break;
- case ID_SO:
- expand_sound(&expander, (bSound *)id);
- break;
case ID_GR:
expand_collection(&expander, (Collection *)id);
break;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 8bbdee78381..70d68ef5262 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2055,23 +2055,6 @@ static void write_screen(BlendWriter *writer, bScreen *screen, const void *id_ad
}
}
-static void write_sound(BlendWriter *writer, bSound *sound, const void *id_address)
-{
- if (sound->id.us > 0 || BLO_write_is_undo(writer)) {
- /* Clean up, important in undo case to reduce false detection of changed datablocks. */
- sound->tags = 0;
- sound->handle = NULL;
- sound->playback_handle = NULL;
- sound->spinlock = NULL;
-
- /* write LibData */
- BLO_write_id_struct(writer, bSound, id_address, &sound->id);
- BKE_id_blend_write(writer, &sound->id);
-
- BKE_packedfile_blend_write(writer, sound->packedfile);
- }
-}
-
static void write_cachefile(BlendWriter *writer, CacheFile *cache_file, const void *id_address)
{
if (cache_file->id.us > 0 || BLO_write_is_undo(writer)) {
@@ -2374,9 +2357,6 @@ static bool write_file_handle(Main *mainvar,
case ID_SCE:
write_scene(&writer, (Scene *)id_buffer, id);
break;
- case ID_SO:
- write_sound(&writer, (bSound *)id_buffer, id);
- break;
case ID_GR:
write_collection(&writer, (Collection *)id_buffer, id);
break;
@@ -2418,6 +2398,7 @@ static bool write_file_handle(Main *mainvar,
case ID_PT:
case ID_VO:
case ID_SIM:
+ case ID_SO:
/* Do nothing, handled in IDTypeInfo callback. */
break;
case ID_LI: