Page MenuHome

VSE: Add menus for the new Transform tools and other VSE 3.0 UI fixes.
AbandonedPublic

Authored by Peter Fog (tintwotin) on Sep 16 2021, 2:33 PM.
Tokens
"Love" token, awarded by Andrea_Monzini."Love" token, awarded by AndyCuccaro."Love" token, awarded by jc4d."Like" token, awarded by mal_cando.

Details

Summary

This patch adds menus and shortcuts for the Transform Tools and reverts rBf0d20198b290338a9f58392f98ee43957b0bad61 as it causes a context mess, 3 unresolved FIXMEs, and 2 TODOs to the code, a mess of the UI script and a Script menu for adding transforms, and an Image menu for removing them.

The Current:
All menu select functions in Sequencer/Preview are selected in Preview mode since that's where the menus are(selecting in the sequencer context is impossible through the menu):

Strange UI in the current implementation: change transforms through one top-level menu, and clear the same transforms in another top-level menu. And what does strip mean in the Preview?

This patch:
This patch is a simpler solution, as it just uses macros for the Preview context versions of "double" operators in Sequencer/Preview, and expose them both in an organized way.

Ex.
From the menu, the select operators need to work differently if they are executed from the Image menu(only at the current frame) or from the Strip menu(all strips):

From the menu, the duplicate function needs to work differently if it is executed from the Image menu or from the Strip menu:

Added menus and functions:

Preview Select Menu:

  • Select All
  • Select None
  • Select Inverted
  • Box Select

Preview Image Menu:

  • Move
  • Rotate
  • Scale
  • Clear
    • Move
    • Rotate
    • Scale
    • All
  • Copy
  • Paste
  • Duplicate
  • Delete
  • Fit/Fill
    • Scale to Fit
    • Scale to Fill
    • Stretch to Fill

In Sequencer/Preview:

  • Preview
    • Select All
    • Select None
    • Select Inverted
    • Box Select

Context Menu:

  • Move
  • Rotate
  • Scale
  • Clear
    • Move
    • Rotate
    • Scale
    • All
  • Copy
  • Paste
  • Duplicate
  • Delete
  • Fit/Fill
    • Scale to Fit
    • Scale to Fill
    • Stretch to Fill

Menu clean-ups:

  • Rename "Box Select" to Box Select Strips" and "Box Select(include handles)" to "Box Select Handles", since the first only allows selection of strips and the latter only handles.
  • Remove redundant use of the word Strip in the "Strip" menus. Ex. "Snap Strips to Current Frame", also allows snapping of handles to the current frame, which isn't covered by the previous name.

Old Demo:

Notes:

  • Shortcut keys and functions are added in consistency with similar tools across Blender.
  • The additional functions are added as macros for simplicity.
  • Image selection is based on current frame position, since these elements are visible at current time.
  • The Strip > Image Transform has been moved into the Preview Image menu.

Known Issues:

  • Invert Selection also selects to the left outside of the current frame - this is a bug in the "Side of frame/left" operator when called as a macro(unrelated to this patch). This causes some of the select macros to end up with selected strips to the left of the current frame, and should be fixed, but this is low level stuff, out of my abilities.

Diff Detail

Event Timeline

Peter Fog (tintwotin) requested review of this revision.Sep 16 2021, 2:33 PM
Peter Fog (tintwotin) created this revision.
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Sep 16 2021, 3:28 PM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Sep 16 2021, 9:04 PM

This looks very promising! I suggest to wait until the base patch is merged to actually review this. A couple of questions in the meantime:

  • What happens when copy-pasting across different points in the timeline?
  • What happens to duplicated strips when all channels are full?
  • What happens when copy-pasting across different points in the timeline?

As it is now, is it pasting at the same position as it is copied from, but in the next free channel. It could paste at the playhead position, but my guess is that it'll be more useful to paste at the same position in this specific scenario.

  • What happens to duplicated strips when all channels are full?

The same thing as normal paste, with several strips, it'll fail, but that's related to the paste operator and unrelated to this patch:


Reported here: T91478

Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Sep 16 2021, 11:05 PM

Remove Select menu when in Sequencer/Preview mode.

Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Sep 20 2021, 10:07 AM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)

Rebase.

Peter Fog (tintwotin) updated this revision to Diff 42152.EditedSep 21 2021, 12:52 PM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)

Expose missing pivot.
Move pivot to right hand side.
Expose "Image Selection" menu when in Sequencer/Preview mode.

I think it is good idea to have operators like these accessible in preview. After quick discussion, some problems will appear:

Transform operator uses same logic as VSE render pipeline to get list of strips to be rendered. This seems reasonable to me as you expect to manipulate only images you see. So movie with 3 effects attached, would result in 3 selectable strips - effects, because you can't see original movie, and if you transform it, even unselected images would move. I assume other operators should follow this logic.

Respecting the above rule this with keyboard shortcuts is easy - operator can detect in what region it was invoked and choose on what it will operate.

However using menu items in combined timeline+preview mode would be problematic, because operator has no idea on what it should operate. Not sure how this could be resolved easily without duplicating menu items. Perhaps there could be some flag indicating where (last) selection was made, but not sure if this would result in predictable behavior. Probably not, because this could interfere with normal manipulation in timeline. Alternative could be to keep operators in combined view to work only on all selected strips.

Transform operator uses same logic as VSE render pipeline to get list of strips to be rendered. This seems reasonable to me as you expect to manipulate only images you see. So movie with 3 effects attached, would result in 3 selectable strips - effects, because you can't see original movie, and if you transform it, even unselected images would move. I assume other operators should follow this logic.

I don't understand how this relates to this patch and what to do about it?

However using menu items in combined timeline+preview mode would be problematic, because operator has no idea on what it should operate. Not sure how this could be resolved easily without duplicating menu items. Perhaps there could be some flag indicating where (last) selection was made, but not sure if this would result in predictable behavior. Probably not, because this could interfere with normal manipulation in timeline. Alternative could be to keep operators in combined view to work only on all selected strips.

Above there is a gif showing the preview select functions exposed as a select-sub-menu when in sequencer&preview.

Just noticed, that this patch adds macros to transform some operators as different with specific purpose. I don't think this is great idea. I would propose something like this as example:

diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index aa6599a7c53..2b115d2717e 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -406,17 +406,32 @@ static void sequencer_select_do_updates(bContext *C, Scene *scene)
 /** \name (De)select All Operator
  * \{ */

+static SeqCollection *seq_all_strips_from_context(bContext *C)
+{
+  Scene *scene = CTX_data_scene(C);
+  Editing *ed = SEQ_editing_get(scene);
+  ARegion *region = CTX_wm_region(C);
+  SeqCollection *strips;
+  if (region->regiontype == RGN_TYPE_PREVIEW) {
+    strips = SEQ_query_rendered_strips(SEQ_active_seqbase_get(ed), CFRA, 0);
+  }
+  else {
+    strips = SEQ_query_all_strips(SEQ_active_seqbase_get(ed));
+  }
+  return strips;
+}
+
 static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
 {
   int action = RNA_enum_get(op->ptr, "action");

   Scene *scene = CTX_data_scene(C);
-  Editing *ed = SEQ_editing_get(scene);
-  Sequence *seq;
+  SeqCollection *strips = seq_all_strips_from_context(C);

   if (action == SEL_TOGGLE) {
     action = SEL_SELECT;
-    for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+    Sequence *seq;
+    SEQ_ITERATOR_FOREACH (seq, strips) {
       if (seq->flag & SEQ_ALLSEL) {
         action = SEL_DESELECT;
         break;
@@ -424,7 +439,8 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
     }
   }

-  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+  Sequence *seq;
+  SEQ_ITERATOR_FOREACH (seq, strips) {
     switch (action) {
       case SEL_SELECT:
         seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);

Now you can use seq_all_strips_from_context() in all operator that iterated over whole ed->seqbasep and they would automatically operate either in preview or timeline context without need for any macro or custom property forcing it to operate in either context. That said seq_all_strips_from_timeline_or_preview() would be probably better name for the function.

Transform operator uses same logic as VSE render pipeline to get list of strips to be rendered. This seems reasonable to me as you expect to manipulate only images you see. So movie with 3 effects attached, would result in 3 selectable strips - effects, because you can't see original movie, and if you transform it, even unselected images would move. I assume other operators should follow this logic.

I don't understand how this relates to this patch and what to do about it?

If selection is to be handled differently in preview, then all operators should probably follow same logic.

However using menu items in combined timeline+preview mode would be problematic, because operator has no idea on what it should operate. Not sure how this could be resolved easily without duplicating menu items. Perhaps there could be some flag indicating where (last) selection was made, but not sure if this would result in predictable behavior. Probably not, because this could interfere with normal manipulation in timeline. Alternative could be to keep operators in combined view to work only on all selected strips.

Above there is a gif showing the preview select functions exposed as a select-sub-menu when in sequencer&preview.

These menu items are effectively duplicate, so if there are not too many of them and they apply to image "properties" only, I guess that is also viable alternative but I am not aware of this approach used elsewhere.

One solution has been presented here in this patch. @Richard Antalik (ISS) wants a different solution.

That's fine, but this means I'll not continue this patch.

@Richard Antalik (ISS) This breaks selection in the Preview:

Just noticed, that this patch adds macros to transform some operators as different with specific purpose. I don't think this is great idea. I would propose something like this as example:

diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index aa6599a7c53..2b115d2717e 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -406,17 +406,32 @@ static void sequencer_select_do_updates(bContext *C, Scene *scene)
 /** \name (De)select All Operator
  * \{ */

+static SeqCollection *seq_all_strips_from_context(bContext *C)
+{
+  Scene *scene = CTX_data_scene(C);
+  Editing *ed = SEQ_editing_get(scene);
+  ARegion *region = CTX_wm_region(C);
+  SeqCollection *strips;
+  if (region->regiontype == RGN_TYPE_PREVIEW) {
+    strips = SEQ_query_rendered_strips(SEQ_active_seqbase_get(ed), CFRA, 0);
+  }
+  else {
+    strips = SEQ_query_all_strips(SEQ_active_seqbase_get(ed));
+  }
+  return strips;
+}
+
 static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
 {
   int action = RNA_enum_get(op->ptr, "action");

   Scene *scene = CTX_data_scene(C);
-  Editing *ed = SEQ_editing_get(scene);
-  Sequence *seq;
+  SeqCollection *strips = seq_all_strips_from_context(C);

   if (action == SEL_TOGGLE) {
     action = SEL_SELECT;
-    for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+    Sequence *seq;
+    SEQ_ITERATOR_FOREACH (seq, strips) {
       if (seq->flag & SEQ_ALLSEL) {
         action = SEL_DESELECT;
         break;
@@ -424,7 +439,8 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
     }
   }

-  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+  Sequence *seq;
+  SEQ_ITERATOR_FOREACH (seq, strips) {
     switch (action) {
       case SEL_SELECT:
         seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);

Now you can use seq_all_strips_from_context() in all operator that iterated over whole ed->seqbasep and they would automatically operate either in preview or timeline context without need for any macro or custom property forcing it to operate in either context. That said seq_all_strips_from_timeline_or_preview() would be probably better name for the function.

I'm reviving this patch, as the suggested code from @Richard Antalik (ISS) is breaking preview selection, and imo is unnecessary. The macos added are working fine and are only triggered it the right context. Also, this patch offers a much more comprehensive solution compared to D12808, as it is also adding select menu with vertical selection, adding shortcut keys and deals with Sequencer&Preview mode for the additional functions.

This patch didn't make it into 3.0. As I do not have anymore time or motivation for a continued investment in the Blender project, I'm giving up on this patch for now.

Peter Fog (tintwotin) updated this revision to Diff 45232.EditedNov 24 2021, 7:11 PM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)

Revert rBf0d20198b290338a9f58392f98ee43957b0bad61 as it causes a context mess, 3 unresolved FIXMEs, and 2 TODOs to the code, a mess of the UI script and a Script menu for adding transforms, and an Image menu for removing them.

This patch is a simpler solution, as it just uses macros for the Preview context versions of "double" operators.

Ex.
From the menu, the select operators need to work differently if they are executed from the Image menu(only at the current frame) or from the Strip menu(all strips):

From the menu, the duplicate function needs to work differently if it is executed from the Image menu or from the Strip menu:

The multiple context operators are exposed twice, as this is IMO a better and simpler solution than removing the very useful Sequencer/Preview mode:

In Sequencer/Preview:

Preview Select Menu:

Preview Image Menu:

Also, the otherwise empty context menu has been populated:

Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Nov 24 2021, 7:22 PM
Peter Fog (tintwotin) retitled this revision from VSE: Add menus for the new Transform tools to VSE: Add menus for the new Transform tools and other 3.0 UI fixes..
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)

Menu clean-ups:

  • Rename "Box Select" to Box Select Strips" and "Box Select(include handles)" to "Box Select Handles", since the first only allows selection of strips and the latter only handles.
  • Remove redundant use of the word Strip in the "Strip" menus. Ex. "Snap Strips to Current Frame", also allows snapping of handles to the current frame, which isn't covered by the previous name.
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Nov 24 2021, 8:29 PM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)Nov 24 2021, 8:43 PM
Peter Fog (tintwotin) edited the summary of this revision. (Show Details)
Peter Fog (tintwotin) retitled this revision from VSE: Add menus for the new Transform tools and other 3.0 UI fixes. to VSE: Add menus for the new Transform tools and other VSE 3.0 UI fixes..Nov 24 2021, 8:48 PM

I don't think it is good idea to have 2 menu items for 1 function, but in 2 different contexts. For this particular view type, solution proposed in second paragraph in https://developer.blender.org/T92584#1251401 would be more optimal I think.

In any case we shouldn't fix features by replacing them witn new different features, if it's broken in current state it should be reverted or disabled for this view type.

I don't think it is good idea to have 2 menu items for 1 function, but in 2 different contexts. For this particular view type, solution proposed in second paragraph in https://developer.blender.org/T92584#1251401 would be more optimal I think.

It is not clear to me what you mean in that paragraph? I don't think removing features in Sequencer/Preview is a better alternative than exposing similar named but ultimately different functions in different top menus, if that's what you mean?
This is much better than not having those functions:

Currently, in Image(preview), basic functions like copy/paste/duplicate etc. are not even implemented as shortcuts in the Preview, nor UI(this patch):

Also, currently, the Image(preview) context menu only holds a Rename operator. This patch:

Anyway, this macro solution/"double exposure" solution is imo to be preferred as a placeholder, over the current broken implementation, until it is decided on the major UI changes you and Campbell are aiming at. What does @Francesco Siddi (fsiddi) think?

In any case we shouldn't fix features by replacing them with new different features, if it's broken in the current state it should be reverted or disabled for this view type.

The included features in this patch were already there in my original patch from the 16. of september. As mentioned copy, paste, duplicate, selection y shortcut etc. are basic functions, which users would expect to work in the Preview.

If it needs to be cut in stone, in Sequencer/Preview all functions relating to the Preview could be collected in a top-level menu called Preview:

Peter Fog (tintwotin) updated this revision to Diff 45264.EditedNov 25 2021, 9:54 AM

Change the Image menu to Preview, since this makes it more clear that everything in the Preview is for manipulating the preview.

Sequencer/Preview:

Preview: