bugfix [#21085] Sequencer file selector for movies is strange
authorCampbell Barton <ideasman42@gmail.com>
Sat, 8 May 2010 16:36:28 +0000 (16:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 8 May 2010 16:36:28 +0000 (16:36 +0000)
elubie fixed the first part, this fixes the internal data updating while keeping the frame range.

source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/makesrna/intern/rna_sequencer.c

index 2bf6eee..3546380 100644 (file)
@@ -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));
index 4a96240..245de62 100644 (file)
@@ -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);
 }
 
index 1154ed0..164ca6c 100644 (file)
@@ -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);
                        }
 
                }
index 4af4727..bbcc1f8 100644 (file)
@@ -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);