VSE: Implement Snapping to Markers #120450

Merged
Richard Antalik merged 5 commits from linen/blender:vse-markers-snap into main 2024-04-23 01:54:25 +02:00
Contributor

This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here SEQ_SNAP_TO_MARKERS) and adding the marker
frame numbers to snap_data->target_snap_points within
seq_snap_target_points_build().

To enable seq_get_snap_target_points_count() to have access to marker
information, the current Scene object is now passed to the function.
This may be implemented another way if desired.

This patch adds the ability to snap strips to markers. Previously, there only existed options to snap to hold offsets and the current frame. This snap type works identically to other snapping options by checking for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker frame numbers to `snap_data->target_snap_points` within `seq_snap_target_points_build()`. To enable `seq_get_snap_target_points_count()` to have access to marker information, the current Scene object is now passed to the function. This may be implemented another way if desired.
John Swenson added 1 commit 2024-04-10 03:41:10 +02:00
234386a975 VSE: Implement Snapping to Markers
This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker
frame numbers to `snap_data->target_snap_points` within
`seq_snap_target_points_build()`.

To enable `seq_get_snap_target_points_count()` to have access to marker
information, the current Scene object is now passed to the function.
This may be implemented another way if desired.
John Swenson requested review from Richard Antalik 2024-04-10 03:41:30 +02:00
John Swenson requested review from Aras Pranckevicius 2024-04-10 03:41:31 +02:00
Iliya Katushenock added this to the Video Sequencer project 2024-04-10 14:51:52 +02:00
Aras Pranckevicius reviewed 2024-04-11 05:55:47 +02:00
@ -153,3 +153,3 @@
}
static int seq_get_snap_target_points_count(short snap_mode,
static int seq_get_snap_target_points_count(Scene *scene,

Minor: could this be const Scene *?

Minor: could this be `const Scene *`?
Author
Contributor

I'm in agreement with this suggestion. I modeled the function parameters off of seq_snap_target_points_build() and the Scene * there is not const even though it probably could be as well. Let's wait and see what @iss has to say on the matter.

I'm in agreement with this suggestion. I modeled the function parameters off of `seq_snap_target_points_build()` and the `Scene *` there is not `const` even though it probably could be as well. Let's wait and see what @iss has to say on the matter.

The policy is: If it can be const, it should be. It is older code, so at the time it either wasn't policy, or I didn't notice...

The policy is: If it can be `const`, it should be. It is older code, so at the time it either wasn't policy, or I didn't notice...
Author
Contributor

Sounds good! I have made it const.

Sounds good! I have made it `const`.
linen marked this conversation as resolved
Aras Pranckevicius approved these changes 2024-04-11 05:56:22 +02:00
Aras Pranckevicius left a comment
Member

Looks good to me (but, I know nothing about VSE editing code, so not sure if my opinion is valid :))

Looks good to me (but, I know nothing about VSE editing code, so not sure if my opinion is valid :))
Richard Antalik requested changes 2024-04-16 01:11:41 +02:00
Dismissed
Richard Antalik left a comment
Member

Thanks for patch! Code seems mostly fine, I was thinking whether it would not be better to draw thick dashed line in this case. Not sure if that would be obvious, or even necessary to be able to distinguish these snap targets. Would leave that up to you.

Thanks for patch! Code seems mostly fine, I was thinking whether it would not be better to draw thick dashed line in this case. Not sure if that would be obvious, or even necessary to be able to distinguish these snap targets. Would leave that up to you.
@ -2586,3 +2586,3 @@
SequencerToolSettings *sequencer_tool_settings = SEQ_tool_settings_ensure(scene);
sequencer_tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_CURRENT_FRAME |
SEQ_SNAP_TO_STRIP_HOLD;
SEQ_SNAP_TO_STRIP_HOLD | SEQ_SNAP_TO_MARKERS;

Adding this bit here will only affect files saved with blender version before 3.0.0 (subversion 7).

You should add new if (!MAIN_VERSION_FILE_ATLEAST condition to versioning_400.cc file and bump subversion in BKE_blender_version.h file. Then modify sequencer_tool_settings->snap_mode in new condition.

Adding this bit here will only affect files saved with blender version before 3.0.0 (subversion 7). You should add new ` if (!MAIN_VERSION_FILE_ATLEAST` condition to `versioning_400.cc` file and bump subversion in `BKE_blender_version.h` file. Then modify `sequencer_tool_settings->snap_mode` in new condition.
linen marked this conversation as resolved
John Swenson added 1 commit 2024-04-19 03:01:55 +02:00
John Swenson added 1 commit 2024-04-19 03:13:21 +02:00
b8e3084b86 Address code review for VSE marker snapping
Adds proper versioning code in `versioning_400.cc` instead of
`versioning_300.cc` for SEQ_SNAP_TO_MARKERS flag as well as `const`
modifier.
John Swenson requested review from Richard Antalik 2024-04-19 03:44:24 +02:00
John Swenson added 1 commit 2024-04-19 03:59:40 +02:00
Author
Contributor

Thanks for patch! Code seems mostly fine, I was thinking whether it would not be better to draw thick dashed line in this case. Not sure if that would be obvious, or even necessary to be able to distinguish these snap targets. Would leave that up to you.

It seems fine as it is, I'm generally able to distinguish between snapping to a given marker and, say, a nearby strip without any issues. But if you strongly think otherwise when you test it later on, do let me know.

> Thanks for patch! Code seems mostly fine, I was thinking whether it would not be better to draw thick dashed line in this case. Not sure if that would be obvious, or even necessary to be able to distinguish these snap targets. Would leave that up to you. It seems fine as it is, I'm generally able to distinguish between snapping to a given marker and, say, a nearby strip without any issues. But if you strongly think otherwise when you test it later on, do let me know.
John Swenson added 1 commit 2024-04-19 20:11:35 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
e433ffbfe5
Merge remote-tracking branch 'origin/main' into vse-markers-snap

@blender-bot build

@blender-bot build
Richard Antalik approved these changes 2024-04-23 01:51:07 +02:00
Richard Antalik merged commit cff532e134 into main 2024-04-23 01:54:25 +02:00
John Swenson deleted branch vse-markers-snap 2024-05-04 05:14:00 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
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, Assets & 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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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 Assignees
3 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#120450
No description provided.