== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Wed, 23 Jul 2008 07:11:23 +0000 (07:11 +0000)
committerPeter Schlaile <peter@schlaile.de>
Wed, 23 Jul 2008 07:11:23 +0000 (07:11 +0000)
Fixes: [#17315] Sequencer: after undo there's no active object
closes: [#17357] fix for bug #17315 - Sequencer: after undo there's no active object
(kiemdoder: thanks for the patch, had to do it in a little bit different way,
since sort_seq will kill your sort order idea...)

source/blender/blenkernel/intern/scene.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/src/editseq.c

index 2898dca767c66406703d4f706d96bd5318885f47..553107dd2648aa782251243f34a72664ebcec1bb 100644 (file)
@@ -303,7 +303,7 @@ void set_scene_bg(Scene *sce)
        int flag;
        
        // Note: this here is defined in editseq.c (BIF_editseq.h), NOT in blenkernel! 
-       set_last_seq(NULL);
+       clear_last_seq();
        
        G.scene= sce;
        
index c0b9a6b95907fbc52be8ff4d94b2f7bdd7633f5f..7bad8ec3b44397461e990b5d94106fadc00fc721 100644 (file)
@@ -257,6 +257,7 @@ typedef struct SpeedControlVars {
 #define SEQ_USE_CROP                           131072
 #define SEQ_USE_COLOR_BALANCE                  262144
 #define SEQ_USE_PROXY_CUSTOM_DIR               524288
+#define SEQ_ACTIVE                            1048576
 
 #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
 #define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2
index f9432f8e69a8ca0e5e26499fd6776127cb1e424b..12019a9dab96379112c7e7ed823a5b8f620b5c63 100644 (file)
@@ -122,13 +122,28 @@ Sequence *get_last_seq()
        if(!_last_seq_init) {
                Editing *ed;
                Sequence *seq;
+               Sequence *l_sel = NULL;
+               Sequence *l_act = NULL;
 
                ed= G.scene->ed;
                if(!ed) return NULL;
 
-               for(seq= ed->seqbasep->first; seq; seq=seq->next)
+               for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+                       if(seq->flag & SEQ_ACTIVE)
+                               l_act = seq;
                        if(seq->flag & SELECT)
-                               _last_seq= seq;
+                               l_sel = seq;
+               }
+
+               if (l_act) {
+                       _last_seq = l_act;
+               } else {
+                       _last_seq = l_sel;
+               }
+
+               if (_last_seq) {
+                       _last_seq->flag |= SEQ_ACTIVE;
+               }
 
                _last_seq_init = 1;
        }
@@ -138,12 +153,23 @@ Sequence *get_last_seq()
 
 void set_last_seq(Sequence *seq)
 {
+       if (_last_seq_init && _last_seq) {
+               _last_seq->flag &= ~SEQ_ACTIVE;
+       }
+
        _last_seq = seq;
        _last_seq_init = 1;
+
+       if (_last_seq) {
+               _last_seq->flag |= SEQ_ACTIVE;
+       }
 }
 
-void clear_last_seq(Sequence *seq)
+void clear_last_seq()
 {
+       if (_last_seq_init && _last_seq) {
+               _last_seq->flag &= ~SEQ_ACTIVE;
+       }
        _last_seq = NULL;
        _last_seq_init = 0;
 }
@@ -2261,6 +2287,8 @@ static Sequence *dupli_seq(Sequence *seq)
                                "handled in duplicate!\nExpect a crash"
                                                " now...\n");
        }
+
+       seqn->flag &= ~SEQ_ACTIVE;
        
        return seqn;
 }