Sequencer: add missed cache invalidation
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 13 Sep 2012 10:51:18 +0000 (10:51 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 13 Sep 2012 10:51:18 +0000 (10:51 +0000)
Invalidation was missed for:

- Strip (Un)Muting
- Changing speed effect
- Strip translating

source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/transform/transform_generics.c

index 5a201dbc962e19b88c9235c315f549053a0a6829..69e10d1426b8cf24be2f43ca129340010f784560 100644 (file)
@@ -297,6 +297,7 @@ int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char
 
 int BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur);
 void BKE_sequence_invalidate_cache(struct Scene *scene, struct Sequence *seq);
+void BKE_sequence_invalidate_deendent(struct Scene *scene, struct Sequence *seq);
 void BKE_sequence_invalidate_cache_for_modifier(struct Scene *scene, struct Sequence *seq);
 
 void BKE_sequencer_update_sound_bounds_all(struct Scene *scene);
index 7d0c080a9181bb648cfd5ed1c477596c7f9d89f6..b191b25be625d7a520a1629b8f44dc9ddfe99ea6 100644 (file)
@@ -2948,13 +2948,18 @@ int BKE_sequence_check_depend(Sequence *seq, Sequence *cur)
        return TRUE;
 }
 
-static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_preprocess)
+static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_self, int invalidate_preprocess)
 {
        Editing *ed = scene->ed;
        Sequence *cur;
 
        /* invalidate cache for current sequence */
-       BKE_sequencer_cache_cleanup_sequence(seq);
+       if (invalidate_self)
+               BKE_sequencer_cache_cleanup_sequence(seq);
+
+       /* if invalidation is invoked from sequence free routine, effectdata would be NULL here */
+       if (seq->effectdata && seq->type == SEQ_TYPE_SPEED)
+               BKE_sequence_effect_speed_rebuild_map(scene, seq, TRUE);
 
        if (invalidate_preprocess)
                BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
@@ -2975,12 +2980,17 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat
 
 void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
 {
-       sequence_invalidate_cache(scene, seq, TRUE);
+       sequence_invalidate_cache(scene, seq, TRUE, TRUE);
+}
+
+void BKE_sequence_invalidate_deendent(Scene *scene, Sequence *seq)
+{
+       sequence_invalidate_cache(scene, seq, FALSE, TRUE);
 }
 
 void BKE_sequence_invalidate_cache_for_modifier(Scene *scene, Sequence *seq)
 {
-       sequence_invalidate_cache(scene, seq, FALSE);
+       sequence_invalidate_cache(scene, seq, TRUE, FALSE);
 }
 
 void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
index 06b508cc488c9fef80a03b5c2371bd60ea29d9f0..828376654bed87cad5318a00fb5d7b27b65dd590 100644 (file)
@@ -1141,12 +1141,16 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
        for (seq = ed->seqbasep->first; seq; seq = seq->next) {
                if ((seq->flag & SEQ_LOCK) == 0) {
                        if (selected) { /* mute unselected */
-                               if (seq->flag & SELECT)
+                               if (seq->flag & SELECT) {
                                        seq->flag |= SEQ_MUTE;
+                                       BKE_sequence_invalidate_deendent(scene, seq);
+                               }
                        }
                        else {
-                               if ((seq->flag & SELECT) == 0)
+                               if ((seq->flag & SELECT) == 0) {
                                        seq->flag |= SEQ_MUTE;
+                                       BKE_sequence_invalidate_deendent(scene, seq);
+                               }
                        }
                }
        }
@@ -1188,12 +1192,16 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
        for (seq = ed->seqbasep->first; seq; seq = seq->next) {
                if ((seq->flag & SEQ_LOCK) == 0) {
                        if (selected) { /* unmute unselected */
-                               if (seq->flag & SELECT)
+                               if (seq->flag & SELECT) {
                                        seq->flag &= ~SEQ_MUTE;
+                                       BKE_sequence_invalidate_deendent(scene, seq);
+                               }
                        }
                        else {
-                               if ((seq->flag & SELECT) == 0)
+                               if ((seq->flag & SELECT) == 0) {
                                        seq->flag &= ~SEQ_MUTE;
+                                       BKE_sequence_invalidate_deendent(scene, seq);
+                               }
                        }
                }
        }
index 5dd6b08b99c160ecc81a763162362f111097beb2..325dbe639b4b93fb4a95a3cc6776d2fbadb72eef 100644 (file)
@@ -900,7 +900,9 @@ static void recalcData_sequencer(TransInfo *t)
 
        SEQ_BEGIN(ed, seq)
        {
-               BKE_sequencer_cache_cleanup_sequence(seq);
+               if (seq->flag & SELECT) {
+                       BKE_sequence_invalidate_deendent(t->scene, seq);
+               }
        }
        SEQ_END