- sequence strips without scenes would crash on display
authorCampbell Barton <ideasman42@gmail.com>
Fri, 18 Dec 2009 13:28:03 +0000 (13:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 18 Dec 2009 13:28:03 +0000 (13:28 +0000)
- appending scenes would not append the sound and scene ID's for sequence strips
- reload button in sequence header now reloads sounds as well.
- redrawing the sequence image view didnt work while plaing (unless play was activated from that region)
- generic functions for running a callback on sequence strips recursively. seqbase_recursive_apply() and seq_recursive_apply()
- bind marker with camera was set to home key, use Ctrl+B instead.

source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/makesrna/intern/rna_sequencer.c

index 7c74dd5b3d36167996dee76488383e3143fb3d9c..c078b92af2d868309f1e14db342dbb137caa3488 100644 (file)
@@ -137,6 +137,10 @@ struct SeqEffectHandle {
 /* sequence.c */
 void printf_strip(struct Sequence *seq);
 
+/* apply functions recursively */
+void seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
+void seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
+
 // extern
 void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
 void seq_free_strip(struct Strip *strip);
index c92640e295e6be269641ac77b25ea12e682647ae..84458b0e921542a20b625a10dd5b0ed4b4b5893a 100644 (file)
@@ -87,6 +87,20 @@ void printf_strip(Sequence *seq)
        fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0));
 }
 
+void seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
+{
+       Sequence *iseq;
+       for(iseq= seqbase->first; iseq; iseq= iseq->next) {
+               seq_recursive_apply(iseq, apply_func, arg);
+       }
+}
+
+void seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg)
+{
+       if(apply_func(seq, arg) && seq->seqbase.first)
+               seqbase_recursive_apply(&seq->seqbase, apply_func, arg);
+}
+
 /* **********************************************************************
    alloc / free functions
    ********************************************************************** */
@@ -252,7 +266,7 @@ void seq_free_editing(Scene *scene)
 {
        Editing *ed = scene->ed;
        MetaStack *ms;
-       Sequence *seq, *nseq;
+       Sequence *seq;
 
        if(ed==NULL)
                return;
@@ -689,28 +703,22 @@ void sort_seq(Scene *scene)
 }
 
 
-void clear_scene_in_allseqs(Scene *sce)
+static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt)
 {
-       Scene *sce1;
-       Editing *ed;
-       Sequence *seq;
-
-       /* when a scene is deleted: test all seqs */
-
-       sce1= G.main->scene.first;
-       while(sce1) {
-               if(sce1!=sce && sce1->ed) {
-                       ed= sce1->ed;
-
-                       SEQ_BEGIN(ed, seq) {
+       if(seq->scene==(Scene *)arg_pt)
+               seq->scene= NULL;
+       return 1;
+}
 
-                               if(seq->scene==sce) seq->scene= 0;
+void clear_scene_in_allseqs(Scene *scene)
+{
+       Scene *scene_iter;
 
-                       }
-                       SEQ_END
+       /* when a scene is deleted: test all seqs */
+       for(scene_iter= G.main->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
+               if(scene_iter != scene && scene_iter->ed) {
+                       seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene);
                }
-
-               sce1= sce1->id.next;
        }
 }
 
@@ -2033,9 +2041,14 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
                Render *re;
                RenderResult rres;
                char scenename[64];
-               int have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
-               int sce_valid =sce && (sce->camera || have_seq);
-                       
+               int have_seq= FALSE;
+               int sce_valid= FALSE;
+
+               if(sce) {
+                       have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
+                       sce_valid= (sce->camera || have_seq);
+               }
+
                if (se->ibuf == NULL && sce_valid && !build_proxy_run) {
                        se->ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
                        if (se->ibuf) {
@@ -3217,6 +3230,23 @@ static void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo)
 }
 #endif
 
+static int seq_sound_reload_cb(Sequence *seq, void *arg_pt)
+{
+       if (seq->type==SEQ_SOUND && seq->sound) {
+               Scene *scene= (Scene *)arg_pt;
+               if(seq->sound_handle)
+                       sound_delete_handle(scene, seq->sound_handle);
+
+               seq->sound_handle = sound_new_handle(scene, seq->sound, seq->start, seq->start + seq->strip->len, 0);
+               return 0;
+       }
+       return 1; /* recurse meta's */
+}
+void seqbase_sound_reload(Scene *scene, ListBase *seqbase)
+{
+       seqbase_recursive_apply(seqbase, seq_sound_reload_cb, (void *)scene);
+}
+
 /* seq funcs's for transforming internally
  notice the difference between start/end and left/right.
 
index f2621a1b4491eccba11d336cf8b198714538c3a9..9548db3278a5dc93d642bff54c34da76123a96d3 100644 (file)
@@ -4232,6 +4232,7 @@ static void lib_link_scene(FileData *fd, Main *main)
                                if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
                                if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
                                if(seq->sound) {
+                                       seq->sound_handle= NULL;
                                        if(seq->type == SEQ_HD_SOUND)
                                                seq->type = SEQ_SOUND;
                                        else
@@ -11281,6 +11282,16 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
        if(sce->gpd)
                expand_doit(fd, mainvar, sce->gpd);
 
+       if(sce->ed) {
+               Sequence *seq;
+
+               SEQ_BEGIN(sce->ed, seq) {
+                       if(seq->scene) expand_doit(fd, mainvar, seq->scene);
+                       if(seq->sound) expand_doit(fd, mainvar, seq->sound);
+               }
+               SEQ_END
+       }
+
 #ifdef DURIAN_CAMERA_SWITCH
        {
                TimeMarker *marker;
index 0d519c87a9777fd9df61cf391ea430f098c3360c..4cc3a8d343f04f673c6dfa5d7e9543ff3c8c7b4f 100644 (file)
@@ -1062,7 +1062,6 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
 #ifdef DURIAN_CAMERA_SWITCH
-       WM_keymap_add_item(keymap, "MARKER_OT_camera_bind", HOMEKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "MARKER_OT_camera_bind", BKEY, KM_PRESS, KM_CTRL, 0);
 #endif
-       
 }
index 977d04a7f45e64b7127b19c951782dafffe1d658..55a977da663d17b4be0b376e4efd36b0828f631e 100644 (file)
@@ -2332,6 +2332,14 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
                if(spacetype==SPACE_TIME)
                        return 1;
        }
+       else if (regiontype==RGN_TYPE_PREVIEW) {
+               switch (spacetype) {
+                       case SPACE_SEQ:
+                               if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+                                       return 1;
+                               break;
+               }
+       }
        return 0;
 }
 
index 0a12ea2e202949c9d55f70a5016b1c58607e55b0..6704cf0ef62283a9d7902a988e36b4e7f9039d02 100644 (file)
@@ -1672,6 +1672,8 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
 
        free_imbuf_seq(scene, &ed->seqbase, FALSE);
 
+       seqbase_sound_reload(scene, &ed->seqbase);
+
        WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
 
        return OPERATOR_FINISHED;
index c1ca156c9bfb19e3e6aa05ea91865c66f28c561c..767da5dc04271555b42850ccb8a5bab7f3d76dc2 100644 (file)
@@ -235,9 +235,9 @@ static int rna_Sequence_name_length(PointerRNA *ptr)
 static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
 {
        Scene *scene= (Scene*)ptr->id.data;
-       Editing *ed= seq_give_editing(scene, FALSE);
+//     Editing *ed= seq_give_editing(scene, FALSE);
        Sequence *seq= (Sequence*)ptr->data;
-       Sequence *iseq;
+//     Sequence *iseq;
        BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2);
 
        seqUniqueName(&scene->ed->seqbase, seq);