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:
authorSebastian Parborg <darkdefende@gmail.com>2021-08-20 17:30:34 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-08-25 18:30:39 +0300
commitf49d438ced7c5874dbf43976d9901a462176f541 (patch)
treefae7b745eaf1e793b53119f3ec27c34621727c58 /source/blender/editors/sound
parent796035ad930383c26302ab6a57e8e6c90394603b (diff)
Cleanup and remove SEQ_ALL_BEGIN macro
We now use a for_each function with callback to iterate through all sequences in the scene. This has the benefit that we now only loop over the sequences in the scene once. Before we would loop over them twice and allocate memory to store temporary data. The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop. The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once. Reviewed By: Richard Antalik, Bastien Montagne Differential Revision: http://developer.blender.org/D12278
Diffstat (limited to 'source/blender/editors/sound')
-rw-r--r--source/blender/editors/sound/sound_ops.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index fe0a53ae964..85f6647ddd0 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -207,7 +207,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
static void sound_update_animation_flags(Scene *scene);
-static int sound_update_animation_flags_fn(Sequence *seq, void *user_data)
+static bool sound_update_animation_flags_fn(Sequence *seq, void *user_data)
{
struct FCurve *fcu;
Scene *scene = (Scene *)user_data;
@@ -244,24 +244,22 @@ static int sound_update_animation_flags_fn(Sequence *seq, void *user_data)
sound_update_animation_flags(seq->scene);
}
- return 0;
+ return true;
}
static void sound_update_animation_flags(Scene *scene)
{
struct FCurve *fcu;
bool driven;
- Sequence *seq;
if (scene->id.tag & LIB_TAG_DOIT) {
return;
}
scene->id.tag |= LIB_TAG_DOIT;
- SEQ_ALL_BEGIN (scene->ed, seq) {
- SEQ_recursive_apply(seq, sound_update_animation_flags_fn, scene);
+ if (scene->ed != NULL) {
+ SEQ_for_each_callback(&scene->ed->seqbase, sound_update_animation_flags_fn, scene);
}
- SEQ_ALL_END;
fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
if (fcu || driven) {