Fix #129630: Inconsistent marker selection #129841

Merged
Sybren A. Stüvel merged 4 commits from ideasman42/blender:pr-timeline-shortcut-fix into main 2024-11-12 10:38:16 +01:00
  • Modifications for marker selection to use the same behavior as
    key selection in the dopesheet.
  • Animation editors now mask out events for the timeline (when there are markers).
  • Resolve logical conflicts with the Dope sheet keymap.
  • Add Shift Drag & Ctrl Drag for box select & de-select.

Note that the prevents timeline over the tineline from being handled in the underlying region.
I made the change after investigating clicking and dragging issues between the dope-sheet & markers.
While it would be possible to make dragging events work between them, as far as I can see it would be difficult to manage and result in event handling being quite fragile (the dope sheet being aware of event handling state of markers for e.g.).

- Modifications for marker selection to use the same behavior as key selection in the dopesheet. - Animation editors now mask out events for the timeline (when there are markers). - Resolve logical conflicts with the Dope sheet keymap. - Add Shift Drag & Ctrl Drag for box select & de-select. ---- Note that the prevents timeline over the tineline from being handled in the underlying region. I made the change after investigating clicking and dragging issues between the dope-sheet & markers. While it would be possible to make dragging events work between them, as far as I can see it would be difficult to manage and result in event handling being quite fragile (the dope sheet being aware of event handling state of markers for e.g.).

While it would be possible to make dragging events work between them, as far as I can see it would be difficult to manage and result in event handling being quite fragile (the dope sheet being aware of event handling state of markers for e.g.).

Let's not address this for now. The Animation & Rigging module will be doing much more invasive changes to the dope sheet & other animation editors for the Layered Animation project anyway. And apart from that, I think it's quite OK to either do operations on the markers, or on the rest of the editor contents.

> While it would be possible to make dragging events work between them, as far as I can see it would be difficult to manage and result in event handling being quite fragile (the dope sheet being aware of event handling state of markers for e.g.). Let's not address this for now. The Animation & Rigging module will be doing much more invasive changes to the dope sheet & other animation editors for the Layered Animation project anyway. And apart from that, I think it's quite OK to either do operations on the markers, or on the rest of the editor contents.
Sybren A. Stüvel requested changes 2024-11-05 10:45:16 +01:00
@ -1354,2 +1316,4 @@
View2D *v2d = UI_view2d_fromcontext(C);
int ret_val = OPERATOR_FINISHED;
TimeMarker *nearest_marker = region_position_is_over_marker(v2d, markers, mval[0]);
bool found = (nearest_marker != nullptr);

const bool

`const bool`
ideasman42 marked this conversation as resolved
@ -1355,1 +1317,4 @@
int ret_val = OPERATOR_FINISHED;
TimeMarker *nearest_marker = region_position_is_over_marker(v2d, markers, mval[0]);
bool found = (nearest_marker != nullptr);
bool is_selected = (nearest_marker && nearest_marker->flag & SELECT);

const bool

`const bool`
ideasman42 marked this conversation as resolved
@ -1358,3 +1322,1 @@
float frame_at_mouse_position = UI_view2d_region_to_view_x(v2d, mval[0]);
int cfra = ED_markers_find_nearest_marker_time(markers, frame_at_mouse_position);
ret_val = select_timeline_marker_frame(markers, cfra, extend, wait_to_deselect_others);
float frame_at_mouse_position = UI_view2d_region_to_view_x(v2d, mval[0]);

const float

`const float`
ideasman42 marked this conversation as resolved
@ -1359,2 +1322,2 @@
int cfra = ED_markers_find_nearest_marker_time(markers, frame_at_mouse_position);
ret_val = select_timeline_marker_frame(markers, cfra, extend, wait_to_deselect_others);
float frame_at_mouse_position = UI_view2d_region_to_view_x(v2d, mval[0]);
int cfra = ED_markers_find_nearest_marker_time(markers, frame_at_mouse_position);

const int

`const int`
ideasman42 marked this conversation as resolved
@ -197,6 +197,14 @@ bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event)
return BLI_rcti_isect_pt_v(&rect, event->xy);
}
bool ED_time_scrub_event_in_region_poll(const wmWindow * /*win*/,

I'd add a comment that this function needs to fit the signature WM_event_add_keymap_handler_poll() expects, so that it's clear why it's calling a function with the exact same signature (except the two unused parameters).

I'd add a comment that this function needs to fit the signature `WM_event_add_keymap_handler_poll()` expects, so that it's clear why it's calling a function with the exact same signature (except the two unused parameters).
ideasman42 marked this conversation as resolved
@ -35,2 +36,4 @@
* \{ */
/**
* Public API for getting markers from the scene & area.

Document what kind of pointer the ListBase contains, so that the function is usable without inspecting its implementation.

Document what kind of pointer the `ListBase` contains, so that the function is usable without inspecting its implementation.
ideasman42 marked this conversation as resolved
@ -477,2 +480,4 @@
wmKeyMap *keymap,
EventHandlerPoll poll);
bool WM_event_handler_region_v2d_mask_test(const wmWindow *win,

Document what this function returns/tests for.

Also: What's the reason this is a "test" function, while it's being used as a "poll" parameter and the other functions in this family are also named "poll"?

If these really are different categories, some documentation to explain the difference would be nice. If they are the same, then use the same terminology.

Document what this function returns/tests for. Also: What's the reason this is a "test" function, while it's being used as a "poll" parameter and the other functions in this family are also named "poll"? If these really are different categories, some documentation to explain the difference would be nice. If they are the same, then use the same terminology.
Author
Owner

They're the same, renaming _test(..) to _poll(..).

They're the same, renaming `_test(..)` to `_poll(..)`.
ideasman42 marked this conversation as resolved
@ -479,0 +484,4 @@
const ScrArea *area,
const ARegion *region,
const wmEvent *event);
bool WM_event_handler_region_v2d_mask_no_marker_test(const wmWindow *win,

Document what this function returns/tests for.

Document what this function returns/tests for.
ideasman42 marked this conversation as resolved
@ -4842,0 +4859,4 @@
const_cast<ScrArea *>(area));
if (markers && !BLI_listbase_is_empty(markers)) {
rcti rect = region->winrct;
rect.ymax = rect.ymin + UI_MARKER_MARGIN_Y;

This seems to be tightly coupled to the drawing code. Add a comment here that says which code this has to be in sync with, and also add a comment at the other code that it has to be in sync with this function.

This seems to be tightly coupled to the drawing code. Add a comment here that says which code this has to be in sync with, and also add a comment at the other code that it has to be in sync with this function.
Author
Owner

The code is currently scattered about, noted to check functions that use UI_MARKER_MARGIN_Y, but I think this is a candidate for a refactor that adds functions to return the rcti for the margin/main regions.

Notes in comment.

The code is currently scattered about, noted to check functions that use `UI_MARKER_MARGIN_Y`, but I think this is a candidate for a refactor that adds functions to return the `rcti` for the margin/main regions. Notes in comment.
ideasman42 marked this conversation as resolved
@ -35,3 +35,3 @@
};
using EventHandlerPoll = bool (*)(const ARegion *region, const wmEvent *event);
using EventHandlerPoll = bool (*)(const wmWindow *win,

What's the reason this type alias is defined twice, once here and once in source/blender/windowmanager/WM_api.hh? Shouldn't this have a comment that says these should be kept in sync? Or can't they just be in one header without any duplication?

What's the reason this type alias is defined twice, once here and once in `source/blender/windowmanager/WM_api.hh`? Shouldn't this have a comment that says these should be kept in sync? Or can't they just be in one header without any duplication?
Author
Owner

I was surprised to see this too, agree it should be either de-duplicated or noted as a duplicate, in practice getting out of sync will fail to compile.

I was surprised to see this too, agree it should be either de-duplicated or noted as a duplicate, in practice getting out of sync will fail to compile.

Since the duplicate was there already, I don't think it's that important to deduplicate for this PR -- I just wanted to voice my surprise. The 'changes requested' as mostly about the const use + some welcome documentation.

Since the duplicate was there already, I don't think it's that important to deduplicate for this PR -- I just wanted to voice my surprise. The 'changes requested' as mostly about the `const` use + some welcome documentation.
Author
Owner

As it happens this declarations looks to be redundant (this header includes both declarations), but I'll leave cleanups out of this PR.

As it happens this declarations looks to be redundant (this header includes both declarations), but I'll leave cleanups out of this PR.
ideasman42 marked this conversation as resolved
Sybren A. Stüvel added the
Module
User Interface
Interest
Animation & Rigging
labels 2024-11-05 10:45:53 +01:00
Campbell Barton force-pushed pr-timeline-shortcut-fix from 095d10856c to 86c3755437 2024-11-08 01:21:53 +01:00 Compare
Author
Owner

Updated the PR to address comments.

Some other changes:

  • Moved the "Markers" key-map handler into wm_event_system.cc so it can be shared by the function that excludes marker events.
  • Added comments noting that MARKER_OT_select & ACTION_OT_clickselect internals are similar & should be kept in sync.
Updated the PR to address comments. Some other changes: - Moved the `"Markers"` key-map handler into `wm_event_system.cc` so it can be shared by the function that excludes marker events. - Added comments noting that `MARKER_OT_select` & `ACTION_OT_clickselect` internals are similar & should be kept in sync.
Author
Owner

@blender-bot build

@blender-bot build
Campbell Barton added 1 commit 2024-11-08 01:30:56 +01:00
Minor correction to doc-string, include return type in related functions
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
67b01e0fa8
Campbell Barton requested review from Sybren A. Stüvel 2024-11-08 02:26:34 +01:00

@blender-bot build

@blender-bot build
Sybren A. Stüvel merged commit 4306e746a5 into main 2024-11-12 10:38:16 +01:00
Sybren A. Stüvel deleted branch pr-timeline-shortcut-fix 2024-11-12 10:38:20 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#129841
No description provided.