Fix trim tools metastrip borders not getting updated correctly.
authorAntony Riakiotakis <kalast@gmail.com>
Mon, 20 Oct 2014 15:37:13 +0000 (17:37 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Mon, 20 Oct 2014 15:37:13 +0000 (17:37 +0200)
source/blender/editors/space_sequencer/sequencer_edit.c

index 7f802f4dafecb0346390514ffcafab29541b3696..1f87d6180f072c60380d90231915c303d1d77821 100644 (file)
@@ -1280,15 +1280,14 @@ static int trim_add_sequences_rec(ListBase *seqbasep, Sequence **seq_array, bool
 
        for (seq = seqbasep->first; seq; seq = seq->next) {
                if ((((seq->type & SEQ_TYPE_EFFECT) == 0) || !do_trim) && (seq->flag & SELECT)) {
+                       seq_array[offset + num_items] = seq;
+                       trim[offset + num_items] = do_trim;
+                       num_items++;
+
                        if (seq->type == SEQ_TYPE_META) {
                                /* trim the sub-sequences */
                                num_items += trim_add_sequences_rec(&seq->seqbase, seq_array, trim, num_items + offset, false);
                        }
-                       else {
-                               seq_array[offset + num_items] = seq;
-                               trim[offset + num_items] = do_trim;
-                               num_items++;
-                       }
                }
        }
 
@@ -1301,13 +1300,12 @@ static int trim_count_sequences_rec(ListBase *seqbasep, bool first_level) {
 
        for (seq = seqbasep->first; seq; seq = seq->next) {
                if ((((seq->type & SEQ_TYPE_EFFECT) == 0) || !first_level) && (seq->flag & SELECT)) {
+                       trimmed_sequences++;
+
                        if (seq->type == SEQ_TYPE_META) {
                                /* trim the sub-sequences */
                                trimmed_sequences += trim_count_sequences_rec(&seq->seqbase, false);
                        }
-                       else {
-                               trimmed_sequences++;
-                       }
                }
        }
 
@@ -1361,7 +1359,8 @@ static bool sequencer_trim_recursively(Scene *scene, TrimData *data, int offset)
                Editing *ed = BKE_sequencer_editing_get(scene, false);
                int i;
 
-               for (i = 0; i < data->num_seq; i++) {
+               /* we iterate in reverse so metastrips are iterated after their children */
+               for (i = data->num_seq - 1; i >= 0; i--) {
                        Sequence *seq = data->seq_array[i];
                        int endframe;
                        /* we have the offset, do the terrible math */