== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Mon, 19 Jul 2010 20:01:18 +0000 (20:01 +0000)
committerPeter Schlaile <peter@schlaile.de>
Mon, 19 Jul 2010 20:01:18 +0000 (20:01 +0000)
Bugfix: free_imbuf_seq() was closing IMB anim handles on nearly every
change of RNA variables. This can be *very* slow, if you twiddle with
parameters during playback. Especially multicam editing...

Now: we close IMB anim handles only on refresh_all() and filepath
changes.

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
source/blender/render/intern/source/pipeline.c

index 002a1958a131d6880016baed23181bed1091be7a..c5417e04780266ddef806107d45146d895375138 100644 (file)
@@ -191,13 +191,13 @@ void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to);
 int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene);
 int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
 int seqbase_isolated_sel_check(struct ListBase *seqbase);
-void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
+void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles);
 struct Sequence        *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq, int dupe_flag);
 int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
 
 void seq_update_sound(struct Scene* scene, struct Sequence *seq);
 void seq_update_muting(struct Scene* scene, struct Editing *ed);
-void seqbase_sound_reload(Scene *scene, ListBase *seqbase);
+void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase);
 void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
 void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
 
index de4e7a5ccbedae26e8d8d166cecc690eeb1aa297..f631e42e05af982dca4353b3fefa9a3548495760 100644 (file)
@@ -3267,59 +3267,8 @@ static void free_anim_seq(Sequence *seq)
        }
 }
 
-#if 0
-static void free_imbuf_seq_except(Scene *scene, int cfra)
-{
-       Editing *ed= seq_give_editing(scene, FALSE);
-       Sequence *seq;
-       TStripElem *se;
-       int a;
-
-       if(ed==NULL) return;
-
-       SEQ_BEGIN(ed, seq) {
-               if(seq->strip) {
-                       TStripElem * curelem = give_tstripelem(seq, cfra);
-
-                       for(a = 0, se = seq->strip->tstripdata; 
-                               a < seq->strip->len && se; a++, se++) {
-                               if(se != curelem) {
-                                       free_imbuf_strip_elem(se);
-                               }
-                       }
-                       for(a = 0, se = seq->strip->tstripdata_startstill;
-                               a < seq->strip->startstill && se; a++, se++) {
-                               if(se != curelem) {
-                                       free_imbuf_strip_elem(se);
-                               }
-                       }
-                       for(a = 0, se = seq->strip->tstripdata_endstill;
-                               a < seq->strip->endstill && se; a++, se++) {
-                               if(se != curelem) {
-                                       free_imbuf_strip_elem(se);
-                               }
-                       }
-                       if(seq->strip->ibuf_startstill) {
-                               IMB_freeImBuf(seq->strip->ibuf_startstill);
-                               seq->strip->ibuf_startstill = 0;
-                       }
-
-                       if(seq->strip->ibuf_endstill) {
-                               IMB_freeImBuf(seq->strip->ibuf_endstill);
-                               seq->strip->ibuf_endstill = 0;
-                       }
-
-                       if(seq->type==SEQ_MOVIE)
-                               if(seq->startdisp > cfra || seq->enddisp < cfra)
-                                       free_anim_seq(seq);
-                       free_proxy_seq(seq);
-               }
-       }
-       SEQ_END
-}
-#endif
-
-void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage)
+void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
+                   int keep_file_handles)
 {
        Sequence *seq;
        TStripElem *se;
@@ -3374,14 +3323,15 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage)
                                seq->strip->ibuf_endstill = 0;
                        }
 
-                       if(seq->type==SEQ_MOVIE)
+                       if(seq->type==SEQ_MOVIE && !keep_file_handles)
                                free_anim_seq(seq);
                        if(seq->type==SEQ_SPEED) {
                                sequence_effect_speed_rebuild_map(scene, seq, 1);
                        }
                }
                if(seq->type==SEQ_META) {
-                       free_imbuf_seq(scene, &seq->seqbase, FALSE);
+                       free_imbuf_seq(scene, &seq->seqbase, FALSE,
+                                      keep_file_handles);
                }
                if(seq->type==SEQ_SCENE) {
                        /* FIXME: recurs downwards, 
index b320deb85e360d788636a898ec5ac48fdda1eee5..1b9b793ebdde259e451790fc9d77174e3b736196 100644 (file)
@@ -1415,7 +1415,7 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
        Scene *scene= CTX_data_scene(C);
        Editing *ed= seq_give_editing(scene, FALSE);
 
-       free_imbuf_seq(scene, &ed->seqbase, FALSE);
+       free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 
        WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
 
index 4becd3b065ee8d2d96b1034d4619d52c80b1cfaa..ec8b45db306dea927ac73137473b069df7361c4e 100644 (file)
@@ -460,7 +460,7 @@ static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        Editing *ed= seq_give_editing(scene, FALSE);
 
-       free_imbuf_seq(scene, &ed->seqbase, FALSE);
+       free_imbuf_seq(scene, &ed->seqbase, FALSE, TRUE);
 
        if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
                seq_update_sound(scene, ptr->data);
index 258abe9a0fc96b6dfa0602567b1ef04c8b3e841c..f27698752f1fbb19a9f7f66e9a40d9e6cf3f06f1 100644 (file)
@@ -2510,7 +2510,7 @@ static void do_render_seq(Render * re)
                if (recurs_depth == 0) { /* with nested scenes, only free on toplevel... */
                        Editing * ed = re->scene->ed;
                        if (ed) {
-                               free_imbuf_seq(re->scene, &ed->seqbase, TRUE);
+                               free_imbuf_seq(re->scene, &ed->seqbase, TRUE, TRUE);
                        }
                }
        }