diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-05-08 20:36:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-05-08 20:36:28 +0400 |
commit | 5371c54a4cc9043fc300834c57855117f5553ad3 (patch) | |
tree | eeafa197ed2b22789568e8b16a405c7e5c4871ea /source/blender | |
parent | 9c1a9d93792ae1edfa384f5672473b288d170024 (diff) |
bugfix [#21085] Sequencer file selector for movies is strange
elubie fixed the first part, this fixes the internal data updating while keeping the frame range.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 14 |
4 files changed, 37 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 2bf6eee5e6b..354638013ec 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -154,7 +154,7 @@ void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, i void calc_sequence(struct Scene *scene, struct Sequence *seq); void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); void new_tstripdata(struct Sequence *seq); -void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq); +void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range); void sort_seq(struct Scene *scene); void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq, int (*test_func)(struct Sequence * seq)); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4a9624036ff..245de6213d5 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -566,9 +566,12 @@ void calc_sequence(Scene *scene, Sequence *seq) } } -void reload_sequence_new_file(Scene *scene, Sequence * seq) +/* note: caller should run calc_sequence(scene, seq) */ +void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) { char str[FILE_MAXDIR+FILE_MAXFILE]; + int prev_startdisp, prev_enddisp; + /* note: dont rename the strip, will break animation curves */ if (!(seq->type == SEQ_MOVIE || seq->type == SEQ_IMAGE || seq->type == SEQ_SOUND || @@ -576,6 +579,14 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) return; } + if(lock_range) { + /* keep so we dont have to move the actual start and end points (only the data) */ + calc_sequence_disp(scene, seq); + prev_startdisp= seq->startdisp; + prev_enddisp= seq->enddisp; + } + + new_tstripdata(seq); if (seq->type != SEQ_SCENE && seq->type != SEQ_META && @@ -587,6 +598,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) if (seq->type == SEQ_IMAGE) { /* Hack? */ size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem); + seq->len = olen; seq->len -= seq->anim_startofs; seq->len -= seq->anim_endofs; @@ -621,6 +633,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) } seq->strip->len = seq->len; } else if (seq->type == SEQ_SCENE) { + /* 'seq->scenenr' should be replaced with something more reliable */ Scene * sce = G.main->scene.first; int nr = 1; @@ -637,9 +650,6 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) } else { sce = seq->scene; } - - BLI_strncpy(seq->name+2, sce->id.name + 2, SEQ_NAME_MAXSTR-2); - seqbase_unique_name_recursive(&scene->ed->seqbase, seq); seq->len= seq->scene->r.efra - seq->scene->r.sfra + 1; seq->len -= seq->anim_startofs; @@ -652,6 +662,12 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) free_proxy_seq(seq); + if(lock_range) { + seq_tx_set_final_left(seq, prev_startdisp); + seq_tx_set_final_right(seq, prev_enddisp); + seq_single_fix(seq); + } + calc_sequence(scene, seq); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 1154ed02a3e..164ca6c21b0 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -946,7 +946,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) } } - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); if (!skip_dup) { @@ -985,8 +985,8 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) seqn->startstill = 0; } - reload_sequence_new_file(scene, seqn); - calc_sequence(scene, seqn); + reload_sequence_new_file(scene, seqn, FALSE); + calc_sequence(scene, seq); } return seqn; } @@ -1178,7 +1178,8 @@ void set_filter_seq(Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); + calc_sequence(scene, seq); } } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 4af4727b43c..bbcc1f82826 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -137,7 +137,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs); - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -148,7 +148,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs); - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -431,6 +431,14 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Sequence_update(bmain, scene, ptr); } +static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Sequence *seq= (Sequence*)(ptr->data); + reload_sequence_new_file(scene, seq, TRUE); + calc_sequence(scene, seq); + rna_Sequence_update(bmain, scene, ptr); +} + /* do_versions? */ static float rna_Sequence_opacity_get(PointerRNA *ptr) { return ((Sequence*)(ptr->data))->blend_opacity / 100.0f; @@ -1014,7 +1022,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "File", ""); RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", "rna_Sequence_filepath_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update"); rna_def_filter_video(srna); rna_def_proxy(srna); |