diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-08 20:46:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-08 20:46:40 +0400 |
commit | a0a67d298416946fff9ac824c9d9d7907a903fb5 (patch) | |
tree | e123e6950d3ca2bd66c8c4f14982939180e19e4c /source/blender/blenkernel/intern | |
parent | 2a78c2d30405d17d804125e903e3fbec0f10d582 (diff) |
Sequencer: initial support of refreshing only changed sequences
Before this the the whole sequencer cache would be invalidated
when hanging sequence settings.
This was completely annoying because changing color balance
settings would re-load image file for which color balance
is happening on every change,
In fact it's still an issue if color balance is changing for
image strip itself, but if this strip has got effect and
color balance is changing for it file wouldn't be reloaded.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/seqcache.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 27 |
2 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 4f2eaba82a5..a4ea5d1fb26 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -170,6 +170,19 @@ void BKE_sequencer_cache_cleanup(void) } } +static int seqcache_key_check_seq(void *userkey, void *userdata) +{ + SeqCacheKey *key = (SeqCacheKey *) userkey; + Sequence *seq = (Sequence *) userdata; + + return key->seq == seq; +} + +void BKE_sequencer_cache_cleanup_sequence(Sequence *seq) +{ + IMB_moviecache_cleanup(moviecache, seqcache_key_check_seq, seq); +} + struct ImBuf *BKE_sequencer_cache_get(SeqRenderData context, Sequence *seq, float cfra, seq_stripelem_ibuf_t type) { if (moviecache && seq) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index d5a766ef97e..1488c1c2188 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2711,6 +2711,33 @@ static void free_anim_seq(Sequence *seq) } } +void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq) +{ + Editing *ed = scene->ed; + Sequence *cur; + int left = seq->start, right = seq->start + seq->len; + + /* invalidate cache for current sequence */ + BKE_sequencer_cache_cleanup_sequence(seq); + + /* invalidate cache for all dependent sequences */ + SEQ_BEGIN (ed, cur) + { + int cur_left = cur->start, cur_right = cur->start + cur->len; + + /* sequence is outside of changed one, shouldn't be invalidated */ + if (cur_right < left || cur_left > right) + continue; + + /* sequence is below changed one, not dependent on it */ + if (cur->machine < seq->machine) + continue; + + BKE_sequencer_cache_cleanup_sequence(cur); + } + SEQ_END +} + void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles) { Sequence *seq; |