From fa5178e36612890c62294547369d915662fbc54c Mon Sep 17 00:00:00 2001 From: John Kiril Swenson Date: Wed, 11 Jun 2025 04:03:17 +0200 Subject: [PATCH] Cleanup: VSE: Remove Legacy Handle Tweaking This patch removes the older handle selection and transformation logic, which was accessible through user preferences by switching off the default "simple tweaking" mode in Editing -> Video Sequencer. There was some initial bugginess with the new handle behavior, hence the option to revert to legacy mode, but with recent updates this no longer applies. With the new system, all selection workflows are still possible -- this just drops older code to make things simpler. No functional changes intended. Pull Request: https://projects.blender.org/blender/blender/pulls/140031 --- release/datafiles/userdef/userdef_default.c | 2 +- .../blenloader/intern/versioning_userdef.cc | 4 ---- source/blender/editors/animation/anim_ops.cc | 4 ---- .../space_sequencer/sequencer_drag_drop.cc | 14 ++++++------- .../space_sequencer/sequencer_intern.hh | 7 ++----- .../space_sequencer/sequencer_select.cc | 21 ++++++------------- .../sequencer_timeline_draw.cc | 17 +++------------ .../space_sequencer/space_sequencer.cc | 5 ----- .../editors/transform/transform_input.cc | 4 ---- .../transform_mode_edge_seq_slide.cc | 3 --- source/blender/gpu/GPU_shader_shared.hh | 5 +---- .../gpu_shader_sequencer_strips_frag.glsl | 4 ++-- source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesrna/intern/rna_userdef.cc | 6 ------ 14 files changed, 23 insertions(+), 75 deletions(-) diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index dbf9f37a22e..166261831ba 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -232,7 +232,7 @@ const UserDef U_default = { .statusbar_flag = STATUSBAR_SHOW_VERSION | STATUSBAR_SHOW_EXTENSIONS_UPDATES, .file_preview_type = USER_FILE_PREVIEW_AUTO, - .sequencer_editor_flag = USER_SEQ_ED_SIMPLE_TWEAKING | USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT, + .sequencer_editor_flag = USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT, .runtime = { diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index a43beffe446..066002f0ad5 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -1350,10 +1350,6 @@ void blo_do_versions_userdef(UserDef *userdef) } } - if (!USER_VERSION_ATLEAST(402, 51)) { - userdef->sequencer_editor_flag |= USER_SEQ_ED_SIMPLE_TWEAKING; - } - if (!USER_VERSION_ATLEAST(402, 56)) { BKE_preferences_extension_repo_add_default_system(userdef); } diff --git a/source/blender/editors/animation/anim_ops.cc b/source/blender/editors/animation/anim_ops.cc index 29cc11709be..239ce62aaba 100644 --- a/source/blender/editors/animation/anim_ops.cc +++ b/source/blender/editors/animation/anim_ops.cc @@ -624,10 +624,6 @@ static bool use_playhead_snapping(bContext *C) static bool sequencer_skip_for_handle_tweak(const bContext *C, const wmEvent *event) { - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - return false; - } - const Scene *scene = CTX_data_scene(C); if (!blender::seq::editing_get(scene)) { return false; diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.cc b/source/blender/editors/space_sequencer/sequencer_drag_drop.cc index 05822b0d933..42e327b34b7 100644 --- a/source/blender/editors/space_sequencer/sequencer_drag_drop.cc +++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.cc @@ -359,7 +359,7 @@ static void get_drag_path(const bContext *C, wmDrag *drag, char r_path[FILE_MAX] } } -static void draw_seq_in_view(bContext *C, wmWindow * /*win*/, wmDrag *drag, const int xy[2]) +static void draw_strip_in_view(bContext *C, wmWindow * /*win*/, wmDrag *drag, const int xy[2]) { SeqDropCoords *coords = &g_drop_coords; if (!coords->in_use) { @@ -438,12 +438,12 @@ static void draw_seq_in_view(bContext *C, wmWindow * /*win*/, wmDrag *drag, cons strip_color[3] = 204; data.col_outline = color_pack(strip_color); - const bool use_thin_handle = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) != 0; - const float handle_size = use_thin_handle ? 5.0f : 8.0f; + /* Taken from strip_handle_draw_size_get(). */ + const float handle_size = pixelx * (5.0f * U.pixelsize); /* Calculate height needed for drawing text on strip. */ float text_margin_y = y2 - min_ff(0.40f, 20 * UI_SCALE_FAC * pixely); - float text_margin_x = 2.0f * (pixelx * handle_size) * U.pixelsize; + float text_margin_x = 2.0f * handle_size; rctf rect; rect.xmin = x1 + text_margin_x; @@ -667,7 +667,7 @@ static void sequencer_dropboxes_add_to_lb(ListBase *lb) drop = WM_dropbox_add( lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy, nullptr, nullptr); drop->draw_droptip = nop_draw_droptip_fn; - drop->draw_in_view = draw_seq_in_view; + drop->draw_in_view = draw_strip_in_view; drop->on_enter = image_drop_on_enter; drop->on_exit = sequencer_drop_on_exit; @@ -676,7 +676,7 @@ static void sequencer_dropboxes_add_to_lb(ListBase *lb) drop = WM_dropbox_add( lb, "SEQUENCER_OT_movie_strip_add", movie_drop_poll, sequencer_drop_copy, nullptr, nullptr); drop->draw_droptip = nop_draw_droptip_fn; - drop->draw_in_view = draw_seq_in_view; + drop->draw_in_view = draw_strip_in_view; drop->on_enter = movie_drop_on_enter; drop->on_exit = sequencer_drop_on_exit; @@ -685,7 +685,7 @@ static void sequencer_dropboxes_add_to_lb(ListBase *lb) drop = WM_dropbox_add( lb, "SEQUENCER_OT_sound_strip_add", sound_drop_poll, sequencer_drop_copy, nullptr, nullptr); drop->draw_droptip = nop_draw_droptip_fn; - drop->draw_in_view = draw_seq_in_view; + drop->draw_in_view = draw_strip_in_view; drop->on_enter = sound_drop_on_enter; drop->on_exit = sequencer_drop_on_exit; } diff --git a/source/blender/editors/space_sequencer/sequencer_intern.hh b/source/blender/editors/space_sequencer/sequencer_intern.hh index 35349c9f3f5..d471b03976f 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.hh +++ b/source/blender/editors/space_sequencer/sequencer_intern.hh @@ -125,6 +125,8 @@ struct TimelineDrawContext { /* `sequencer_timeline_draw.cc` */ +/* Get handle width in frames (viewspace). */ +float strip_handle_draw_size_get(const Scene *scene, Strip *strip, float pixelx); void draw_timeline_seq(const bContext *C, ARegion *region); void draw_timeline_seq_display(const bContext *C, ARegion *region); @@ -137,13 +139,8 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region); * region. */ void sequencer_preview_region_draw(const bContext *C, ARegion *region); - -bool sequencer_draw_get_transform_preview(SpaceSeq *sseq, Scene *scene); int sequencer_draw_get_transform_preview_frame(const Scene *scene); - void sequencer_special_update_set(Strip *strip); -/* Get handle width in 2d-View space. */ -float strip_handle_draw_size_get(const Scene *scene, Strip *strip, float pixelx); /* UNUSED */ /* void seq_reset_imageofs(SpaceSeq *sseq); */ diff --git a/source/blender/editors/space_sequencer/sequencer_select.cc b/source/blender/editors/space_sequencer/sequencer_select.cc index 2ec3a3d84e2..9be591a9ea3 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.cc +++ b/source/blender/editors/space_sequencer/sequencer_select.cc @@ -999,14 +999,10 @@ bool can_select_handle(const Scene *scene, const Strip *strip, const View2D *v2d return false; } - /* This ensures clickable handles are deactivated when the strip gets too small (25 or 15 - * frames). Since the full handle size for a small strip is 1/3 of the strip size (see - * `inner_clickable_handle_size_get`), this means handles cannot be smaller than 25/3 = 8px for - * simple tweaking, 15/3 = 5px for legacy behavior. */ + /* This ensures clickable handles are deactivated when the strip gets too small + * (25 pixels). Since the full handle size for a small strip is 1/3 of the strip size (see + * `inner_clickable_handle_size_get`), this means handles cannot be smaller than 25/3 = 8px. */ int min_len = 25 * U.pixelsize; - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - min_len = 15 * U.pixelsize; - } const float pixelx = 1 / UI_view2d_scale_get_x(v2d); const int strip_len = seq::time_right_handle_frame_get(scene, strip) - @@ -1176,7 +1172,7 @@ StripSelection pick_strip_and_handle(const Scene *scene, const View2D *v2d, floa selection.strip1 = strips[0]; selection.handle = strip_handle_under_cursor_get(scene, selection.strip1, v2d, mouse_co); - if (strips.size() == 2 && (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) != 0 && + if (strips.size() == 2 && is_mouse_over_both_handles_of_adjacent_strips(scene, strips, v2d, mouse_co)) { selection.strip2 = strips[1]; @@ -1325,8 +1321,7 @@ wmOperatorStatus sequencer_select_exec(bContext *C, wmOperator *op) VectorSet copy_to; /* True if the user selects either handle of a strip that is already selected, meaning that * handles should be propagated to all currently selected strips. */ - bool copy_handles_to_sel = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) && - (selection.handle != STRIP_HANDLE_NONE) && + bool copy_handles_to_sel = (selection.handle != STRIP_HANDLE_NONE) && (selection.strip1->flag & SELECT); /* TODO(john): Dual handle propagation is not supported for now due to its complexity, @@ -1478,9 +1473,9 @@ void SEQUENCER_OT_select(wmOperatorType *ot) /** \name Select Handle Operator * \{ */ +/** This operator is only used in the RCS keymap by default and is not exposed in any menus. */ static wmOperatorStatus sequencer_select_handle_exec(bContext *C, wmOperator *op) { - /* This operator is only used in the RCS keymap by default and is not exposed in any menus. */ const View2D *v2d = UI_view2d_fromcontext(C); Scene *scene = CTX_data_scene(C); Editing *ed = seq::editing_get(scene); @@ -1489,10 +1484,6 @@ static wmOperatorStatus sequencer_select_handle_exec(bContext *C, wmOperator *op return OPERATOR_CANCELLED; } - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; - } - MouseCoords mouse_co(v2d, RNA_int_get(op->ptr, "mouse_x"), RNA_int_get(op->ptr, "mouse_y")); StripSelection selection = pick_strip_and_handle(scene, v2d, mouse_co.view); diff --git a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc index 0160d48ecf5..dcac6293e0d 100644 --- a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc @@ -773,12 +773,10 @@ static void draw_handle_transform_text(const TimelineDrawContext *timeline_ctx, float strip_handle_draw_size_get(const Scene *scene, Strip *strip, const float pixelx) { - const bool use_thin_handle = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) != 0; - const float handle_size = use_thin_handle ? 5.0f : 8.0f; - const float maxhandle = (pixelx * handle_size) * U.pixelsize; + const float handle_size = pixelx * (5.0f * U.pixelsize); - /* Ensure that handle is not wider, than quarter of strip. */ - return min_ff(maxhandle, + /* Ensure that the handle is not wider than a quarter of the strip. */ + return min_ff(handle_size, (float(seq::time_right_handle_frame_get(scene, strip) - seq::time_left_handle_frame_get(scene, strip)) / 4.0f)); @@ -1456,21 +1454,12 @@ static void strip_data_handle_flags_set(const StripDrawContext &strip, { const Scene *scene = timeline_ctx->scene; const bool selected = strip.strip->flag & SELECT; - const bool show_handles = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0; /* Handles on left/right side. */ if (!seq::transform_is_locked(timeline_ctx->channels, strip.strip) && can_select_handle(scene, strip.strip, timeline_ctx->v2d)) { const bool selected_l = selected && handle_is_selected(strip.strip, STRIP_HANDLE_LEFT); const bool selected_r = selected && handle_is_selected(strip.strip, STRIP_HANDLE_RIGHT); - const bool show_l = show_handles || selected_l; - const bool show_r = show_handles || selected_r; - if (show_l) { - data.flags |= GPU_SEQ_FLAG_DRAW_LH; - } - if (show_r) { - data.flags |= GPU_SEQ_FLAG_DRAW_RH; - } if (selected_l) { data.flags |= GPU_SEQ_FLAG_SELECTED_LH; } diff --git a/source/blender/editors/space_sequencer/space_sequencer.cc b/source/blender/editors/space_sequencer/space_sequencer.cc index bad20a387ca..844eb81a7d5 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.cc +++ b/source/blender/editors/space_sequencer/space_sequencer.cc @@ -679,11 +679,6 @@ static void sequencer_main_cursor(wmWindow *win, ScrArea *area, ARegion *region) return; } - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - WM_cursor_set(win, wmcursor); - return; - } - const View2D *v2d = ®ion->v2d; if (UI_view2d_mouse_in_scrollers(region, v2d, win->eventstate->xy)) { WM_cursor_set(win, wmcursor); diff --git a/source/blender/editors/transform/transform_input.cc b/source/blender/editors/transform/transform_input.cc index 45961928b20..4a222df61e2 100644 --- a/source/blender/editors/transform/transform_input.cc +++ b/source/blender/editors/transform/transform_input.cc @@ -307,10 +307,6 @@ static int transform_seq_slide_strip_cursor_get(const Strip *strip) static int transform_seq_slide_cursor_get(TransInfo *t) { - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - return WM_CURSOR_NSEW_SCROLL; - } - const Scene *scene = t->scene; VectorSet strips = vse::selected_strips_from_context(t->context); diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.cc b/source/blender/editors/transform/transform_mode_edge_seq_slide.cc index 605fb67b5d3..ccdc8d1ee11 100644 --- a/source/blender/editors/transform/transform_mode_edge_seq_slide.cc +++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.cc @@ -143,9 +143,6 @@ static void initSeqSlide(TransInfo *t, wmOperator *op) bool transform_mode_edge_seq_slide_use_restore_handle_selection(const TransInfo *t) { - if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { - return false; - } SeqSlideParams *ssp = static_cast(t->custom.mode.data); if (ssp == nullptr) { return false; diff --git a/source/blender/gpu/GPU_shader_shared.hh b/source/blender/gpu/GPU_shader_shared.hh index 9f7d27a1d91..0e73d52efc9 100644 --- a/source/blender/gpu/GPU_shader_shared.hh +++ b/source/blender/gpu/GPU_shader_shared.hh @@ -122,12 +122,9 @@ enum eGPUSeqFlags : uint32_t { GPU_SEQ_FLAG_BORDER = (1u << 10u), GPU_SEQ_FLAG_SELECTED_LH = (1u << 11u), GPU_SEQ_FLAG_SELECTED_RH = (1u << 12u), - GPU_SEQ_FLAG_DRAW_LH = (1u << 13u), - GPU_SEQ_FLAG_DRAW_RH = (1u << 14u), GPU_SEQ_FLAG_OVERLAP = (1u << 15u), - GPU_SEQ_FLAG_ANY_HANDLE = GPU_SEQ_FLAG_SELECTED_LH | GPU_SEQ_FLAG_SELECTED_RH | - GPU_SEQ_FLAG_DRAW_LH | GPU_SEQ_FLAG_DRAW_RH + GPU_SEQ_FLAG_ANY_HANDLE = GPU_SEQ_FLAG_SELECTED_LH | GPU_SEQ_FLAG_SELECTED_RH }; /* VSE per-strip data for timeline rendering. */ diff --git a/source/blender/gpu/shaders/gpu_shader_sequencer_strips_frag.glsl b/source/blender/gpu/shaders/gpu_shader_sequencer_strips_frag.glsl index 4571a17556a..2bdb390cf9a 100644 --- a/source/blender/gpu/shaders/gpu_shader_sequencer_strips_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_sequencer_strips_frag.glsl @@ -68,10 +68,10 @@ void main() if ((strip.flags & GPU_SEQ_FLAG_ANY_HANDLE) != 0) { float handle_width = strip.handle_width; /* Take left/right handle from horizontal sides. */ - if ((strip.flags & GPU_SEQ_FLAG_DRAW_LH) != 0) { + if ((strip.flags & GPU_SEQ_FLAG_SELECTED_LH) != 0) { pos1.x += handle_width; } - if ((strip.flags & GPU_SEQ_FLAG_DRAW_RH) != 0) { + if ((strip.flags & GPU_SEQ_FLAG_SELECTED_RH) != 0) { pos2.x -= handle_width; } /* Reduce vertical size by outline width. */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 71a2c1b5fcf..bd3bd9d9fec 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1125,7 +1125,7 @@ typedef enum eUserpref_SeqProxySetup { } eUserpref_SeqProxySetup; typedef enum eUserpref_SeqEditorFlags { - USER_SEQ_ED_SIMPLE_TWEAKING = (1 << 0), + USER_SEQ_ED_UNUSED_0 = (1 << 0), /* Dirty. */ USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT = (1 << 1), } eUserpref_SeqEditorFlags; diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index e7e0aa9927c..23ca95d2156 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5866,12 +5866,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sculpt/Paint Overlay Color", "Color of texture overlay"); /* VSE */ - prop = RNA_def_property(srna, "use_sequencer_simplified_tweaking", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna( - prop, nullptr, "sequencer_editor_flag", USER_SEQ_ED_SIMPLE_TWEAKING); - RNA_def_property_ui_text( - prop, "Tweak Handles", "Allows dragging handles without selecting them first"); - prop = RNA_def_property(srna, "connect_strips_by_default", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna( prop, nullptr, "sequencer_editor_flag", USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT);