[Bf-blender-cvs] [b9a578a] : Fix T39083: speakers were evaluated multiple times when used in sets
Campbell Barton
noreply at git.blender.org
Wed Mar 12 18:22:21 CET 2014
Commit: b9a578ab051818eb3fc4bb0c8d087dbd98b3869d
Author: Campbell Barton
Date: Tue Mar 11 14:44:13 2014 +1100
https://developer.blender.org/rBb9a578ab051818eb3fc4bb0c8d087dbd98b3869d
Fix T39083: speakers were evaluated multiple times when used in sets
also skip checking all objects for speakers when no speakers are in the
blend file.
===================================================================
M source/blender/blenkernel/BKE_sound.h
M source/blender/blenkernel/intern/scene.c
M source/blender/blenkernel/intern/sound.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 64f0b97..eb0aec5 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -134,7 +134,7 @@ void sound_free_waveform(struct bSound *sound);
void sound_read_waveform(struct bSound *sound);
-void sound_update_scene(struct Scene *scene);
+void sound_update_scene(struct Main *bmain, struct Scene *scene);
void *sound_get_factory(void *sound);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index da2eda0..6d62d97 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1537,9 +1537,6 @@ static void scene_update_tagged_recursive(EvaluationContext *eval_ctx, Main *bma
/* scene drivers... */
scene_update_drivers(bmain, scene);
- /* update sound system animation */
- sound_update_scene(scene);
-
/* update masking curves */
BKE_mask_update_scene(bmain, scene);
@@ -1573,6 +1570,8 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
* in the future this should handle updates for all datablocks, not
* only objects and scenes. - brecht */
scene_update_tagged_recursive(eval_ctx, bmain, scene, scene);
+ /* update sound system animation (TODO, move to depsgraph) */
+ sound_update_scene(bmain, scene);
/* extra call here to recalc scene animation (for sequencer) */
{
@@ -1678,6 +1677,8 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
/* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(eval_ctx, bmain, sce, sce);
+ /* update sound system animation (TODO, move to depsgraph) */
+ sound_update_scene(bmain, sce);
scene_depsgraph_hack(eval_ctx, sce, sce);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 3a8754e..1fe73a1 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -681,7 +681,7 @@ void sound_read_waveform(bSound *sound)
}
}
-void sound_update_scene(struct Scene *scene)
+void sound_update_scene(Main *bmain, struct Scene *scene)
{
Object *ob;
Base *base;
@@ -694,6 +694,11 @@ void sound_update_scene(struct Scene *scene)
void *handle;
float quat[4];
+ /* cheap test to skip looping over all objects (no speakers is a common case) */
+ if (BLI_listbase_is_empty(&bmain->speaker)) {
+ goto skip_speakers;
+ }
+
for (SETLOOPER(scene, sce_it, base)) {
ob = base->object;
if (ob->type == OB_SPEAKER) {
@@ -743,6 +748,9 @@ void sound_update_scene(struct Scene *scene)
}
}
+
+skip_speakers:
+
while ((handle = AUD_getSet(scene->speaker_handles))) {
AUD_removeSequence(scene->sound_scene, handle);
}
@@ -808,7 +816,7 @@ void sound_read_waveform(struct bSound *sound) { (void)sound; }
void sound_init_main(struct Main *bmain) { (void)bmain; }
void sound_set_cfra(int cfra) { (void)cfra; }
void sound_update_sequencer(struct Main *main, struct bSound *sound) { (void)main; (void)sound; }
-void sound_update_scene(struct Scene *scene) { (void)scene; }
+void sound_update_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) { }
void sound_update_scene_sound(void *handle, struct bSound *sound) { (void)handle; (void)sound; }
void sound_update_scene_listener(struct Scene *scene) { (void)scene; }
void sound_update_fps(struct Scene *scene) { (void)scene; }
More information about the Bf-blender-cvs
mailing list