diff options
author | Peter Schlaile <peter@schlaile.de> | 2008-03-24 20:35:01 +0300 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2008-03-24 20:35:01 +0300 |
commit | 8d2a0a566f88c3af3dbce774d013afad539bab27 (patch) | |
tree | 09d94173e04a0785be3e6bce8c0249f95772f234 /source/blender/src/sequence.c | |
parent | 2b7e4f4d4a31544669cd92db6fe588d25ce12a48 (diff) |
== Sequencer ==
A lot of fixes for anim_startofs / anim_endofs:
* crashed when striplen was 0 and startstill / endstill still in use
* made it work for Audio (HD and RAM)
* made it work for Image Sequences
* added a new cutting tool, that uses anim_startofs / endofs instead of
startofs / endofs. This is now the default and called "hard cut"
* moved old cutting method to "Shift-K" and renamed it "soft cut"
Diffstat (limited to 'source/blender/src/sequence.c')
-rw-r--r-- | source/blender/src/sequence.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index 667fb15e913..c6843557f52 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -420,23 +420,33 @@ void reload_sequence_new_file(Sequence * seq) char str[FILE_MAXDIR+FILE_MAXFILE]; if (!(seq->type == SEQ_MOVIE || seq->type == SEQ_IMAGE || - seq->type == SEQ_HD_SOUND || seq->type == SEQ_SCENE || - seq->type == SEQ_META)) { + seq->type == SEQ_HD_SOUND || seq->type == SEQ_RAM_SOUND || + seq->type == SEQ_SCENE || seq->type == SEQ_META)) { return; } new_tstripdata(seq); - if (seq->type == SEQ_IMAGE) { - return; - } - - if (seq->type != SEQ_SCENE && seq->type != SEQ_META) { + if (seq->type != SEQ_SCENE && seq->type != SEQ_META && + seq->type != SEQ_IMAGE) { strncpy(str, seq->strip->dir, FILE_MAXDIR-1); strncat(str, seq->strip->stripdata->name, FILE_MAXFILE-1); + + BLI_convertstringcode(str, G.sce, G.scene->r.cfra); } - if (seq->type == SEQ_MOVIE) { + if (seq->type == SEQ_IMAGE) { + /* Hack? */ + int olen = MEM_allocN_len(seq->strip->stripdata) + / sizeof(struct StripElem); + seq->len = olen; + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + seq->strip->len = seq->len; + } else if (seq->type == SEQ_MOVIE) { if(seq->anim) IMB_free_anim(seq->anim); seq->anim = openanim(str, IB_rect); @@ -462,8 +472,22 @@ void reload_sequence_new_file(Sequence * seq) return; } - seq->strip->len = seq->len - = sound_hdaudio_get_duration(seq->hdaudio, FPS); + seq->len = sound_hdaudio_get_duration(seq->hdaudio, FPS) + - seq->anim_startofs - seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + seq->strip->len = seq->len; + } else if (seq->type == SEQ_RAM_SOUND) { + seq->len = (int) ( ((float)(seq->sound->streamlen-1)/ + ((float)G.scene->audio.mixrate*4.0 )) + * FPS); + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + seq->strip->len = seq->len; } else if (seq->type == SEQ_SCENE) { Scene * sce = G.main->scene.first; int nr = 1; @@ -477,6 +501,8 @@ void reload_sequence_new_file(Sequence * seq) if (sce) { seq->scene = sce; + } else { + sce = seq->scene; } strncpy(seq->name + 2, sce->id.name + 2, @@ -794,7 +820,7 @@ static int give_stripelem_index(Sequence *seq, int cfra) int nr; if(seq->startdisp >cfra || seq->enddisp <= cfra) return -1; - + if(seq->len == 0) return -1; if(seq->flag&SEQ_REVERSE_FRAMES) { /*reverse frame in this sequence */ if(cfra <= seq->start) nr= seq->len-1; @@ -1101,6 +1127,9 @@ static void seq_proxy_build_frame(Sequence * seq, int cfra) } se = give_tstripelem(seq, cfra); + if (!se) { + return; + } if(se->ibuf) { IMB_freeImBuf(se->ibuf); @@ -2045,6 +2074,10 @@ static TStripElem* do_build_seq_array_recursively( se = give_tstripelem(seq_arr[count - 1], cfra); + if (!se) { + return 0; + } + test_and_auto_discard_ibuf(se); if (se->ibuf_comp != 0) { |