From ab722cf7b1aa596867cbbcbc0940aec37dfc22bb Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Wed, 23 Jul 2008 07:11:23 +0000 Subject: [PATCH] == Sequencer == 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 | 2 +- source/blender/makesdna/DNA_sequence_types.h | 1 + source/blender/src/editseq.c | 34 ++++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2898dca767c..553107dd264 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -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; diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index c0b9a6b9590..7bad8ec3b44 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -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 diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index f9432f8e69a..12019a9dab9 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -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; }