Page MenuHome

VSE: Add slip tool
Needs ReviewPublic

Authored by Richard Antalik (ISS) on Sun, Mar 8, 9:05 PM.

Details

Summary

Add tool for moving content inside strips

Only passthrough check has been added to operator in this patch

Diff Detail

Repository
rB Blender
Branch
tool-slip (branched from master)
Build Status
Buildable 7119
Build 7119: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.EditedMon, Mar 9, 5:46 AM

This change raises a design issue with sequencer tools.

Since this only operates on one strip at a time - for an action where you might reasonably want to operate on multiple items at once.

If this convention is uses across all other tools, it means anyone who wants to make multiple edits will have to perform them on each strip - or give up on using tools and use direct key shortcuts.


Design Task: T74561: Proposal for sequencer tool interactions

source/blender/editors/space_sequencer/sequencer_edit.c
1494–1505

Should be moved into a utility function, similar to find_nearest_seq but checking for cursor inside the sequence instead of nearest.

This revision now requires changes to proceed.Mon, Mar 9, 5:46 AM

This change raises a design issue with sequencer tools.
Since this only operates on one strip at a time - for an action where you might reasonably want to operate on multiple items at once.

Even with this implementation you can select more strips and operate on selection.
I will change behavior to check if tweak is done on selected strip to start action, otherwise passthrough to selection.

Even better would be to draw and use gizmo I guess, I could try to do it so I understand the system better. It's still a bit foggy for me. But I still should be focused on triaging, so can't promise, that I will do it.

  • Make tool passthrough if it doesn't operate on selection
  • Add seq_get_sequence_mouse_over() function to get strip under cursor

Tested and this seems to work.

This makes the slip tool work the same as tweak, so you can select, border select as well as slipping multiple strips.

1diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
2index 5aff2a75e03..856f7fe1f46 100644
3--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
4+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
5@@ -6137,6 +6137,19 @@ def km_sequencer_editor_tool_blade(_params):
6 )
7
8
9+def km_sequencer_editor_tool_slip(params):
10+ return (
11+ "Sequencer Tool: Slip",
12+ {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
13+
14+ {"items": [
15+ ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'},
16+ {"properties": [("extend", False), ("deselect_all", not params.legacy)]}),
17+ ("sequencer.slip", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
18+ ]},
19+ )
20+
21+
22 # ------------------------------------------------------------------------------
23 # Full Configuration
24
25@@ -6353,6 +6366,7 @@ def generate_keymaps(params=None):
26 km_sequencer_editor_tool_select(params),
27 km_sequencer_editor_tool_select_box(params),
28 km_sequencer_editor_tool_blade(params),
29+ km_sequencer_editor_tool_slip(params)
30 ]
31
32 # ------------------------------------------------------------------------------
33diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
34index 63fb72a71bd..d54d1142615 100644
35--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
36+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
37@@ -1740,6 +1740,16 @@ class _defs_sequencer_generic:
38 keymap="Sequencer Tool: Blade",
39 draw_settings=draw_settings,
40 )
41+ @ToolDef.from_fn
42+ def slip():
43+ return dict(
44+ idname="builtin.slip",
45+ label="Blade",
46+ icon=None,
47+ widget=None,
48+ keymap="Sequencer Tool: Slip",
49+ draw_settings=None,
50+ )
51
52
53 class _defs_sequencer_select:
54@@ -2272,11 +2282,13 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
55 'SEQUENCER': [
56 *_tools_select,
57 _defs_sequencer_generic.blade,
58+ _defs_sequencer_generic.slip,
59 ],
60 'SEQUENCER_PREVIEW': [
61 *_tools_select,
62 *_tools_annotate,
63 _defs_sequencer_generic.blade,
64+ _defs_sequencer_generic.slip,
65 ],
66 }
67
68diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
69index ca2a5eaa54f..1bd5c7134fe 100644
70--- a/source/blender/editors/space_sequencer/sequencer_edit.c
71+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
72@@ -1487,7 +1487,12 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve
73 num_seq = slip_count_sequences_rec(ed->seqbasep, true);
74
75 if (num_seq == 0) {
76- return OPERATOR_CANCELLED;
77+ if (ISTWEAK(event->type)) {
78+ return OPERATOR_PASS_THROUGH;
79+ }
80+ else {
81+ return OPERATOR_CANCELLED;
82+ }
83 }
84
85 data = op->customdata = MEM_mallocN(sizeof(SlipData), "trimdata");

Reposting my comment here, so there aren't 10 threads

Personally I would preffer to use check if tweak is done on selected sequence, just because there is not much of visual indication of what's going on...
But yeah I would be OK to do it like this.

Do you mean it's not clear that slip has been activated?

In this case it could:

  • Show the offsets during slip.
  • Use a grab mouse cursor while the operator runs (or even before the operator runs).
  • Set G.moving while the operator runs (draws outlines brighter - also used for transforming).
  • Slip tool based on P1286 + enabled visual representation of ongoing action by setting sseq->draw_flag |= SEQ_DRAW_OFFSET_EXT and G.moving |= G_TRANSFORM_SEQ
Richard Antalik (ISS) marked an inline comment as done.Thu, Mar 12, 2:19 PM