[Bf-blender-cvs] [c5d9938adcf] master: Fix T104073: Unable to add more than two strips in one channel

Richard Antalik noreply at git.blender.org
Tue Jan 24 23:31:40 CET 2023


Commit: c5d9938adcffe9f552d84fc10cdcf7c0c305144e
Author: Richard Antalik
Date:   Tue Jan 24 23:17:32 2023 +0100
Branches: master
https://developer.blender.org/rBc5d9938adcffe9f552d84fc10cdcf7c0c305144e

Fix T104073: Unable to add more than two strips in one channel

Originally, function `sequencer_generic_invoke_xy_guess_channel`
looked in what channel the last strip of the same type is and the
channel used for new strip placement. This was changed as a workaround
when sound strips were added below movie strips
(58bea005c58956674c7f4a9a7a85ff943c140f03).
Now these workarounds aren't necessary, but the function was left
unchanged.

Current logic is for adding movie strip to channel 1 is:
- Sound is added to channel 1
- Video is added to channel 2
- If there is only video, it is added to channel 1

Since movie may, or may not contain sound, it is not possible to align
added strips in a way that was done before, unless timeline is analyzed
more in detail, but this would be quite inefficient.
Also, note, that the code did not work, if strip is added next to
previous one, so it mostly did not work as intended.

This commit changes:
- Fix alignment not working when strip is added right next to previous
  strip
- Assume that movie strips have sound strip underneath it, so channel
  below last movie strip is picked
- For other strip types, pick channel of the last strip of same type

Ultimately, the code is still rather weak, and better system, like using
channel where strip was manually moved, or concept of "typed channels"
would improve this feature.

===================================================================

M	source/blender/editors/space_sequencer/sequencer_add.c

===================================================================

diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 2613df11c42..872a9afd89f 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -201,7 +201,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
 
   for (seq = ed->seqbasep->first; seq; seq = seq->next) {
     const int strip_end = SEQ_time_right_handle_frame_get(scene, seq);
-    if (ELEM(type, -1, seq->type) && (strip_end < timeline_frame) &&
+    if (ELEM(type, -1, seq->type) && (strip_end <= timeline_frame) &&
         (timeline_frame - strip_end < proximity)) {
       tgt = seq;
       proximity = timeline_frame - strip_end;
@@ -209,7 +209,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
   }
 
   if (tgt) {
-    return tgt->machine + 1;
+    return (type == SEQ_TYPE_MOVIE) ? tgt->machine - 1 : tgt->machine;
   }
   return 1;
 }



More information about the Bf-blender-cvs mailing list