VSE: improved handle tweaking #109522
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
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 project
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#109522
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "iss/blender:tweak-experiment"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This commit changes how users can interact with handles:
Unselected handles are not drawn anymore by default. Handles are bit
thinner. If handle can't be selected, because strip is too small,
it is not drawn.
When hovering over strip handle a cursor is changed to represent a
handle shape. It is possible to select 2 handles at once if strips are
adjoined.
When tweak event happens on unselected handle, handle selection is lost
ater tweaking.
This behavior can be disabled in preferences:
Editing > Video Sequencer > Tweak Handles.
Moving strips with G key works same way as before.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
Tried this build. As mentioned in Harley's patch, indicating with the mouse cursor what will happen is a great way to inform users what will happen when they click at that spot.
As this patch currently is, can't the selected handle to the left be seen at all:
![image](/blender/blender/attachments/b80eb3f9-6054-4c1c-b60f-96af62c0e353)
Since a 3D object, do not have both an outline on the object and a selected vertex in the 3D View(it is either or), consider removing the strip outline, when the handle of a strip is selected. That'll make it much easier to see what is selected.
Now you're using a bracket shape mouse cursor, have I previously made a patch which adds bracket shaped handles: https://archive.blender.org/developer/differential/0010/0010297/index.html
![image](/blender/blender/attachments/5dfee019-8579-4125-823f-37087ae1652f)
The trouble with the handles is that the handle will cover the waveform, so it becomes difficult to make an exact edit based on the waveform: https://archive.blender.org/developer/maniphest/0090/0090824/index.html
When Billray was working for BF, we talked about rounded strips, so it would become more clear where the in and out points are - and having thin rounded handles following the outline.
Another design could be to have handles which are not in the full height of the strip and have rounded corners inwards(indicating direction).
Consider a hot zone in the center of a strip and a new mouse cursor in order to execute the Slip operator.
Consider making an e/w icon variation of then e/w/n/s icon for when handles are transformed, since they can't be moved up or down.
@blender-bot package
Package build started. Download here when ready.
Thanks for the update on this. A couple of suggestions:
handles_only
prop to select OP, makeanim.change_frame
passthrough when clicking on handles 6da0c573e2@fsiddi Chat is down so will respond here - will kick the bot, just wanted to do some fixes. There is still minor discrepancy on how transform works when you use right and left mouse button. LMB in RCS works as expected, all other modes won't deselect neighboring handle when moving only one of them. Will fix that.
With modified keymap, this feature can be optional as we wanted, but there will be some weird items that are basically blocked by select and frame change operator. It is bit more readable now, but still worth documenting
@blender-bot package
Package build started. Download here when ready.
As noted above, when selecting/transforming two adjoined handles, the selected handle on one of the sides is not visible(looks like the outline).
https://projects.blender.org/blender/blender/attachments/b80eb3f9-6054-4c1c-b60f-96af62c0e353 Both selected handles should be visible.
As the mouse cursor should illustrate what happens when the user is clicking, when two adjoined handles are selected, the mouse cursor should not be changed to single side transform, since this in not what will happen:
![trim_cursor_adjoined.gif](/blender/blender/attachments/3b573775-a6d3-433a-8b7c-af2d953bfb21)
During a transform operation, the mouse cursor is changed from the handle cursor to n/s/e/w cursor. Imo, it should stay as handle cursor.
The little arrow on the single sided handle cursor seems redundant, and even misleading, as if you only can move the handle one direction?
There could also be a hot zone in the middle of a strip for the Slip operation and the mouse cursor could look like this: [ ]
WIP: VSE handle drawing/tweaking experimentto VSE handle drawing/tweaking experimentSeems, that handle size is sometimes drawn as 5px, sometimes as 4px. Will rebase this patch and check how this can be resolved. In meanwhile, will just increase handle width so I don't mix fixes in this patch.
@blender-bot package
Package build started. Download here when ready.
The multiple challenges of thin handles were already addressed here:
https://archive.blender.org/developer/differential/0010/0010297/index.html
This imprecise drawing of the line width, make thin handles disappear and blend in with the outline. A solution to this in the above link was to either select outlines or handles, and never both. When you think about it, there is no reason for having both selected. And not having the outline selected when a handle is selected makes the handle stand out.
Another problem is the two adjoined handles may look like one, to solve this problem, a separating line was introduced, and with bracket shapes added, made it very clear in what direction the handle went (and what strip the handle belonged to).
In addition to these challenges, when zoomed out in the timeline, the handles become very small and potentially invisible(especially when they're thin to begin with) - has this been dealt with in this patch?
Since there are no replies to any of my comments above, I wonder if the addressed problems are not considered problems, or what is going on here?
Makes sense, will try that.
I think, that having black outline visible when handle is selected may be necessary, since both strips share that pixel as start/end.
Don't think, that this is an issue really. Currently it is not possible to select handles when they are too small and I did not change it here.
This started with simple goal - to draw cursor when hovering over handle + to make them slimmer. More changes I would rather separate unless they are necessary for functionality.
When releasing (only after dragging), deselect the handle and leave the strip selected. This allows us to still select individual and multiple handles, but allows us to quickly transform a whole strip once is has been resized.
I can do that, but with current setup, handles would be deselected even if you press G key, which I don't think is desirable. The only way transform operator can discriminate between 2 behaviors is whether this tweaking method is enabled in preferences.
Maybe I can hack in some form of signalling in
SpaceSeq::runtime
, but that would be based on mouse cursor position and unreliable.Though looking at
TransInfo
, there isis_launch_event_drag
field, so will check that out. Would definitely simplify things...@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
The mouse cursor, when moving the cursor over a narrow strip, it feels like the click point in the cursor is jumping back/forth(left/right) because the click point is actually changing position, and this feels wrong. The click point in left/center/right handle cursor should be in the same place. So, I would say in the left/right mouse cursor, the vertical bar and the click point should be in the center and the tiny arrow should be removed. This way will the horizontal line in the left/right handle cursor change side and the vertical line will stay in the same place.
Also, it feels like the hot zones are too big in a strip with a considerable size you will not get the grab strip(not handle option):
![mouse_cursor.gif](/blender/blender/attachments/dfd98e08-1d11-46ac-bdba-a4dff471c2cf)
In the center area, the n/s/e/w cursor could be used? (Also then pressing "S" for slide)?
When handles are selected and pressing "G" only e/w cursor should be used, bc they can't be moved up/down.
When transforming adjoined handles, they look asymmetrical(outline when drag is imprecise?):
![image](/blender/blender/attachments/2d82ceaa-3358-479f-bd18-93a3771b126f)
Have you tried removing outlines when handles are selected? As suggested above?
IMO, there is no need to both have an outline and a handle selected.
In the 3D View, you do not have both have a vertex and the object selected.
Previously you could not transform effect strips with fixed length like cross, you can do that now. I guess that til is a bug?
![cross_transform.gif](/blender/blender/attachments/7c5d303a-bbe7-4dd3-abd5-52f181bc7fd3)
Was there a limit before so you could not drag like this, but only to the allowed point? Looks wonky.
![limit_transform.gif](/blender/blender/attachments/17bd0e8a-489d-4cfb-9013-d3a0b5bb33d3)
I don't know. Personally I feel lost when using cursors without arrows. I would like to gather more feedback on this point, but I wouldn't mind either variant.
That seems to be correct, will fix
I mean it could be used, but it is for different purpose. The handle cursor only indicates what you are clicking on, NSEW cursor indicates what you can do or what will happen after clicking. This patch is pretty much pre-selection indicator, but with cursor instead element highlighting.
I have played with this briefly, but wasn't able to fix it. Maybe this is some pixel alignment issue with view coords, not sure.
Yep, tat's a bug
Nope, there wasn't such limit. Not impossible to implement, there already is limit for strip length.
If you want to keep the arrows, then maybe try to keep the selection point the same place in the mouse cursor icon. In other words, keep the point the arrows are pointing at the very same place in all VSE selection/trimming icons.
IMO, have the elements highlighting still a place, especially if the unselected handle indicators are removed(they should be visible, when hover). On the nsew, another wording would be, that it is simply wrong to use it after a handle has been selected, because in that case is it impossible to move ns. And the EW icon will be an indication of what will happen if you click and drag at that point.
In my attempt, mentioned above, I kept a black line between the strips in all states, so the strips will not be "fighting" over the center pixel, and make things asymmetrical.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
Good progress. A couple of notes:
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@fsiddi Updated the patch with suggestions. Not sure if you want handles as standalone overlay, or whether this should be updated when you enable/disable Tweak Handles option. Right now it is standalone overlay option.
It's better, but there is still an issue, when strips get narrow:
![mouse_c.gif](/blender/blender/attachments/29f0cb34-5200-492d-8da5-c2e55c8fed5f)
It doesn't feel very clear and solid what will happen if you click at a specific point this way. Imo, some hover highlighting of the handle area is needed to make it more predictable and easy to read what is being clicked. The click area of the handles could light up like these buttons(I mean, it is not a new concept in Blender that things you can click lights up when hovering over them):
@tintwotin Thanks for noticing that, will fix. I think the idea behind cursor is to emulate gizmo. Some gizmos use highlighting as well so this could be done with handles.
@blender-bot package
Package build started. Download here when ready.
Looks good to me. Get some code review and merge!
I would recommend doing a test-build and get community feedback on it, since this is a major change in how it feels to work in the VSE. As mentioned, without handle hover highlighting, it feels very random in what area you need to click to select a handle, especially when the strips are narrow. Did Hjalti test it?
Should definitely make a test build and make a feedback thread on devtalk. The hover effect is something done in properties editor, but not in other parts of Blender, I rather stay aligned with that for the time being. Hjalti is not a fan of this feature, so I don't think he will use it. As a matter of fact, it's possible to configure Blender to its original behavior and completely ignore this.
Will have to go over this patch again myself, as the code is not great. Will make feedback thread.
I had to edit some footage today, so I used this patch.
Some workflows are worse off:
Some better
Also noticed, that handles are drawn on too small strips, will have to fix that too, since now it is guesswork to know at which zoom level the handle can be selected.
I rarely use adjoined selection (in this edit 0 times eh :), so I would say it's downside for me, since it interferes with handle selection when strips are next to each other, but can imagine some users loving it.
Overall I would like to have option to just disable adjoined selection behavior and perhaps make the cursor somehow slimmer.
08b3db9e95
to3ffc3e7f2f
const
s a9b956afaaVSE handle drawing/tweaking experimentto VSE: improved handle tweaking@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
Had some issues applying the patch, so was testing builds from https://builder.blender.org/download/patch/PR109522/
There is something very wrong with the keymap and overall behavior:
Will update the patch. Not sure if I tested this on Mac last time I updated patch, but there isn't anything too OS specific, maybe DPI scale...
I can reproduce issue with RMB scrubbing, it works here for about 50% of time, will fix this.
Other issues I was not able to reproduce. Will also doublecheck on Mac.
Thanks for the update, it seems to have helped with some of the points from my previous comment, but not all of them.
For example, frame scrubbing is still not possible outside of the timecode header with RMB selection.
Also, the hot-zones feels smaller to what they are for area edge sliding, or node edge resizing.
Indeed, checking now on mac, and this still needs some work.
@Sergey The issues you have mentioned should be fixed.
@blender-bot package
Package build started. Download here when ready.
@ -946,2 +946,4 @@
}
if (!USER_VERSION_ATLEAST(402, 19)) {
userdef->sequencer_editor_flag |= USER_SEQ_ED_SIMPLE_TWEAKING;
userdef_default.cc
needs to have thesequencer_editor_flag
flag set as well. Otherwiseblender --factory-startup
does not have the new intended behavior.@ -230,6 +246,9 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
if (CTX_wm_space_seq(C) != nullptr && region->regiontype == RGN_TYPE_PREVIEW) {
return OPERATOR_CANCELLED;
}
if (sequencer_skip_for_handle_tweak(C, event)) {
Generic animation system operator should not worry about sequencer.
The way such dependencies were commonly used is via order of operators in the keymap. If sequencer tweaking needs to take priority, it should be in the list first, and the rest of operators should not be adjusting to the behavior of other operators.
The issue here is, that we want left click to tweak and also scrub. Only other way to achieve this would be to passthrough from sequencer select operator. But to achieve that, it would need to check if it was invoked by left or right click. I guess I could add hidden operator property which would distinguish how it was invoked. Either way it is hacky.
Why can't the handle tweak event always return
PASS_THROUGH
when it is invoked outside of any handle's hot area?Because it is select operator and if I am not mistaken in RCS it is not modal. At least it isn't when invoked with left click.
@ -46,3 +49,3 @@
void ED_sequencer_special_preview_set(bContext *C, const int mval[2]);
void ED_sequencer_special_preview_clear();
bool sequencer_retiming_mode_is_active(const bContext *C);
bool sequencer_retiming_mode_is_active(const Scene *scene);
Why is the
sequencer_retiming_mode_is_active
changing with this PR?I would guess that at some point I tried to use it from place with no access to
bContext
, but then changed this again.Will revert this change.
Some feedback to finalize this patch from the UX standpoint:
@fsiddi
Tweak handles is enabled by default. It could be, that you have your own startup file, AFAIK these are not changed by versioning. Eeh not sure, perhaps adding this to
userdef_default.c
would solve the issue for you.In RCS, when dragging with left click, only 1 element moves, when dragging with right click, whole selection moves. I have a feeling, that we have discussed this, but could be mistaken. Will change this to work same way with both buttons.
shift click drag is not a thing? What is that supposed to do?
@blender-bot package
Package build started. Download here when ready.
Yes, please.
Nothing, you are right. Was expecting precision tweak, but that happens only after you click.
@fsiddi Right so I did that. You can test the new build.
Ok I did that, so you can test the new build.
Some final visual adjustments to the cursor. Notice the updated position. This might still not be perfect as I could not test the changes directly in the code.
Also, a suggestion on the design itself.
I assume this means, that you want cursor to be centered? I had build like that for feedback, but was likely broken when I checked devtalk thread now... Anyway, it's simple change so will do that, even though I don't like it that way - The triangle is supposed to be mini cursor, which is aligned with mouse position. Perhaps it could be removed, or those triangles could be drawn on both sides.
Currently only 16x16 pure black/white/transparent are supported by these cursor definitions. I could look at other type of cursors that are used for transformation, those seem to support at least grayscale, but not sure if these can be used in this case.
@blender-bot package
Package build started. Download here when ready.
@iss Could this be updated to the latest
main
please? It'd make it easier to review as I'm having issues which I'm not sure are part of this PR or already fixed in main.(for example, I can't select time-locked strips)
@pablovazquez Updated PR. Can reproduce no selection with locked strips. Will fix.
7322bbf4b2
to88dccb8a19
It would help to move all the non-functional changes refactors to main, to help understanding what's going on here, and whether the added complexity is really inevitable.
For example, changes like
Sequence *SEQ_select_active_get(Scene *scene);
->Sequence *SEQ_select_active_get(const Scene *scene);
,selected_strips_from_context
->ED_sequencer_selected_strips_from_context
,bool retiming_keys_are_visible(const bContext *C)
->bool retiming_keys_are_visible(const SpaceSeq *sseq)
.I can do that, the commit would make little sense out of context of this PR. So I will reference this PR in commit message.
@iss Sounds good!
Also, if there are some other non-functional-changes/cleanup possible to extract from this PR which wasn't so obvious on an initial read, feel free to to the same :)
Just compiled it and it works great! Thanks for fixing the selection of time locked strips.
(Can remember that at some point, testing a build of this patch, it wasn't possible to drag the play head, and as I do not have a built environment anymore, could it be checked if this is working again, before committing?)
@blender-bot package
Package build started. Download here when ready.
487a4cbfaf
to9517179fb2
@Sergey Most of refactoring was pushed to main now.
Thanks for the cleanup. Now it is easier to see what exactly is going on.
There are few inlined comments. On top of that i am not sure why do we need the complexity around the keymap changes. Unless it is absolutely needed by this change, it is better to avoid such changes. And from my quick test wed don't need to make those changes as part of this PR. I've attached a take on simplifying this patch even further. From quick tests it seems to behave exactly as this PR does.
Generally, do not make change more deep/complex/involved than it needs to be. And if it is inevitable, make it clear from the description why is it so.
@ -1 +1 @@
Subproject commit 0b910c0a718a1d54d07ecf95c63617576ee9a847
Subproject commit 7181d6dccb9fe4184340f9f5b1c381f8089fe4ec
Seems like an unintended change?
@ -51,0 +54,4 @@
*
* r_seq1 first strip to be selected. Never nullptr if function returns true
* r_seq2 second strip to be selected.
* r_side which handle is selected. This further clarifies result if seq2 is nullptr.
What is the possible values for the
r_side
? From being an integer it is not clear at all.This is anonymous enum defined in
SEQ_sequencer.hh
It is not great, since it is used for splitting and handle selection. Probably would be best to "duplicate" this enum and give it purposeful name...@ -51,0 +56,4 @@
* r_seq2 second strip to be selected.
* r_side which handle is selected. This further clarifies result if seq2 is nullptr.
*/
bool ED_sequencer_handle_selection_refine(const struct Scene *scene,
This is quite confusing name.
handle
is ambiguous since it is not clear if it is a verb or a noun. Andrefine
is also not used properly here, as it is not semantically a refinement of input parameters.Perhaps
ED_sequencer_pick_strip_and_side
?The return value is also never checked, so it will be better to wrap
r_seq{1,2}
andr_side
into a struct and return it. Will avoid need to initialize individual fields. Similarly toPointTrackPick
.@ -894,0 +982,4 @@
return false;
});
/* It may be better to sort strips, as there can be very small strip in set, that may not be
What is the problem with a small strip? Why is the sorting only done for the first 2 elements? And what is the issue with using
std::sort
?This should have been marked as TODO, will need to solve this.
The problem with small strips is, that Francesco requested to be able to select handle from outside of the strip. This means, that strip with < ~2px screenspace size could be between 2 larger strips. And this is not filtered out. But seems, that this would be easy to solve by actually checking its size.
@ -894,0 +1026,4 @@
return SEQ_SIDE_NONE;
}
static bool both_handles_are_selected(const Scene *scene,
What exactly this function does?
It checks if 2 handles next to each other are selected at conce.
@ -645,6 +647,93 @@ static void sequencer_main_region_message_subscribe(const wmRegionMessageSubscri
}
}
static bool mouseover_retiming_key(const Scene *scene,
is_mouse_over_retiming_key
?@ -648,0 +701,4 @@
int side;
Sequence *seq1, *seq2;
ED_sequencer_handle_selection_refine(scene, ®ion->v2d, mouse_co_view, &seq1, &seq2, &side);
The way how currently this function works, it will create a temporary array of all visible strips (which could be 100s) on every mouse move. It is not something we should be accepting easily.
There are easy ways of solving this, having minimal code duplication:
Can even optimize it further by pre-calcualting channel from the mouse, doing an early output for strips outside of that channel.
@ -383,6 +446,11 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
t->flag |= T_MODAL_CURSOR_SET;
WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL);
}
/* On ly use special cursor, when tweaking strips with mouse. */
On ly
->Only
Don't use hardcoded values for the even types.
The change around
SEQ_SIDE_LEFT
->SEQ_HANDLE_RIGHT
needs to be moved to a separate PR. Having a stringer type enum for such things sounds good, but:Also, maybe I am missing something, but there is an outstanding question about why it is required to split keymap on timeline and preview. It might be good for some other reasons, but it does not seem essential for getting functionality of this PR to work, unless there is something non-obvious going on (which then should be clearly and explicitly described).
@ -17,0 +19,4 @@
enum eSeqHandle {
SEQ_HANDLE_NONE = 0,
SEQ_HANDLE_LEFT = SEQ_LEFTSEL,
You should not be mixing semantic of some of elements of enum. Doing so might seem that it saves some code, but in practice it leads to confusions situations when some flag might be directly used for something completely unrelated, but not the other flags (potentially even causing actual bugs later on, after some of the area got expanded).
@ -17,0 +24,4 @@
SEQ_HANDLE_BOTH,
};
struct StripSelection {
Since this is C++, you can benefit from the implicit default constructor:
This will allow making some code more reslitient and clear towards possible refactors in the future.
@ -101,3 +101,3 @@
#define RETIME_KEY_MOUSEOVER_THRESHOLD (16.0f * UI_SCALE_FAC)
static rctf retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
rctf retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
Public functions should either be in the corresponding namespace. such as
blender::ed::seq
(which is more preferred way nowadays), or have an old-style prefix in the name. such asED_seq_retiming_keys_box_get
orsequencer_retiming_keys_box_get
.Even though the function is "intern" to the
space_sequencer
, it is public from the linkage perspective.I guess I could use
seq_
prefix I use in core intern functions. Will have to look up more details on namespaces. I have used them, but not sure how to declare these such that they won't end up creating mess.To me it seems, that it would be better to add these functions to namespace all at once if this is preferred, so better to do that in separate patch.
@ -897,0 +992,4 @@
if (seq->machine != int(mouse_co[1])) {
continue;
}
if (min_ii(SEQ_time_left_handle_frame_get(scene, seq), SEQ_time_start_frame_get(seq)) >
Do we need to worry about the
SEQ_time_start_frame_get(seq)
/SEQ_time_content_end_frame_get(scene, seq)
or can we limit this to justSEQ_time_left_handle_frame_get(scene, seq)
/SEQ_time_right_handle_frame_get(scene, seq)
?Right, I copy-pasted this from timeline drawing. Strip start is used there for offset drawing... Don't need to do that here.
@ -897,0 +1018,4 @@
if (strips.size() == 2 && strip_to_frame_distance(scene, v2d, strips[0], mouse_co[0]) <
strip_to_frame_distance(scene, v2d, strips[1], mouse_co[0]))
{
SWAP(Sequence *, strips[0], strips[1]);
std::swap
.@ -897,0 +1034,4 @@
return s1_right == s2_left || s1_left == s2_right;
}
static eSeqHandle handle_selection_refine(const Scene *scene,
get_strip_handle_under_cursor()
?@ -897,0 +1051,4 @@
return SEQ_HANDLE_NONE;
}
static bool both_handles_are_selected(const Scene *scene,
is_mouse_over_both_handles_of_adjacent_strips
. While it might seen lengthy, it actually shows clear intent of what is going on: makes it unambiguous what are the handles which are checked, and also clarifies that check is based on coordinates, and not on selection flags.@ -897,0 +1054,4 @@
static bool both_handles_are_selected(const Scene *scene,
const Sequence *seq1,
const Sequence *seq2,
eSeqHandle seq1_side,
seq1_handle
. But is also wierd to require passing one of the handles. Might as well just re-compute it here and simplify the function signature without introducing much penalty to hot code paths?@ -897,0 +1058,4 @@
const View2D *v2d,
float mouse_co[2])
{
if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) {
This seems to be quite low-level function to perform such a check. Such branching in behavior should be done on a higher level.
You can easily see it from trying to summarize what function does: check whether adjacent handles are selected, but only if the user preference is not the simple tweaking.
This would mean, that flags could never be used as preconditions, which can result in unreadable code. As example you can look at
draw_seq_strip()
before and after in4d668e6825
Originally this function was meant to return whether both handles should be selected, so to me it did make sense to make the check here.
I am not sure what you mean by preconditions. Having check deep inside a code path is exactly opposite of precondition.
It is also quite confusing when all inlined comments are immediately marked as resolved, without stating a resolution in them. From the comment it is unclear whether something got changed in the code inspired by the comment, or is it still open discussion.
Perhaps early return would be better term here, but I have moved the check where it is necessary to be.
What do you suggest? To me marking inline as resolved means agreement with proposed solution. If no solution is proposed I would probably mention what I have done.
When I do review, I do go over resolved inlines, and look at the code anyway. I must say, that this was much easier with phabricator, where you could jump between multiple "revisions".
If you simply address feedback without providing further information it is fine to mark conversation as resolved.
If you write new information in the comment, leave the conversation open, so it is easier to go over all open conversations.
@ -897,0 +1067,4 @@
if (!strips_are_adjacent(scene, seq1, seq2)) {
return false;
}
const int seq2_side = handle_selection_refine(scene, seq2, v2d, mouse_co);
eSeqHandle seq2_handle
.@ -940,2 +1148,3 @@
StripSelection selection;
if (region->regiontype == RGN_TYPE_PREVIEW) {
seq = seq_select_seq_from_preview(C, mval, toggle, extend, center);
selection.seq1 = seq_select_seq_from_preview(C, mval, toggle, extend, center);
With the current code you're leaving
seq2
andhandle
uninitialized. The proposal aroundStripSelection
solves this.Ok, will do changes like these separately. This one makes sense to do in its own.
The reason was, that I found the keymap to be unreadable and impossible to modify. It's probably better to do such change separately as well.
The point of separate PR and review got ignored, and the point of unclarity of difference between HANDLE and SIDE was not addressed.
I do not really understand the point about impossibility to modify the keymap for the goal of this PR. See some of my earlier comments, where there is a PoC with avoids extra keymap, and does not seem to have any behavior difference from this PR.
Each PR should be the smallest incremental step towards the goal. While it is is possible that it is beneficial to do the keymap split, it should have its own PR, with motivational part, properly set expectations, and separate commit as well for the purpose of bisecting and presentation (as such changes to keymap will break local custom keymaps).
In short, PR should be "this is the feature this PR implements", and not "this is the feature this PR implements, but also changes FOO, BAR, and BAZ. And possible foobar as well.".
Sorry, I thought you meant that this should be applied to main as with previous refactor.
Not sure what do you mean by "unclarity of difference between HANDLE and SIDE".
I did not finish updating this PR yesterday - I intended to remove keymap splitting from here. I have missed the POC patch. I usually read the comments in email, so I did not go back to it here. Will have a look at it.
I understand this, but this feature was developed over long time. Each time I got feedback something had to be changed. So this went from ~100 line PR to what it is now. If I have done refactors in main to suit bigger PR's there could be seemingly nonsensical changes back and forth based on what feedback I get and what direction this feature goes.
I guess I could have split this after functionality on user level is considered done, but then the code may still change during review.
I have looked at the patch for simpler keymap modification and it breaks move tool somehow.
when I made diff in reference to main it looked like this:
It removed
_template_sequencer_preview_select
from the keymap, which does not sound correct. Also it introduced items only intended for timeline region. Even if they did nothing, because in the C code it did early return, why have them there? It's just noise.So IMO it is clearly more readable when these are split.
The patch was explicitly marked as PoC. It might have some remaining issues because I do not have much time to polish changes related on removing parts of PR which should not have been in there to begin with.
The current state of main already has keymap items which are intentionally there and are relying on the
poll()
functions. While it might not be something ideal, trying to change it as part of an unrelated feature, that is the real noise. Please adopt the idea of making it minimal possible steps from a working state to a better working state.We can put this PR on hold, until the #109522 is reviewed and landed, and then come back to this one.
Richard Antalik referenced this pull request2024-05-19 15:14:22 +02:00
@fsiddi What is the expected behavior in the following scenario:
Currently once you've stopped dragging the handle it gets deselected which, intuitively, I don't think it should. But maybe that was an explicit design decision?
@ -834,3 +834,3 @@
}
static bool element_already_selected(const Sequence *seq, const eSeqHandle handle_clicked)
static bool element_already_selected(StripSelection selection)
const StripSelection& selection
@ -902,0 +944,4 @@
{
seq_rectf(scene, seq, r_body);
memcpy(r_left_handle, r_body, sizeof(*r_left_handle));
memcpy(r_right_handle, r_body, sizeof(*r_right_handle));
@ -1101,2 +1309,4 @@
"Select all strips on same side of the current frame as the mouse cursor");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
/* Used for handle tweaking. */
Comments and descriptions needs to be explaining what code or options do. What they are used by might change over time, and there might be other uses outside of the original intent.
It also feels the operator should actually be split, as its behavior is so different depending on this property, and also because it is quite strange to have
handles_only=True
, andside_of_frame
orlinked_handle
set to something other than their default value.It is much more clear to have
select_handle
operator.I agree, that this should have been separate operator, so will create new operator.
I did not do this, because there are many existing properties, that change behavior completely and it felt weird to make new operator, that is used only with RCS keymap.
@ -54,6 +54,19 @@
/** \name Selection Utilities
* \{ */
class MouseCoords {
For now it is probably fine to have such utility, but in a longer term I don't think we should have something like this. Instead, it should become
That would be better, I agree. Will use this utility for this patch.
@ -56,1 +56,4 @@
class MouseCoords {
public:
int region[2];
new code should really be using vectorized types like
int2
andfloat2
.@ -939,3 +1141,1 @@
int mval[2];
mval[0] = RNA_int_get(op->ptr, "mouse_x");
mval[1] = RNA_int_get(op->ptr, "mouse_y");
MouseCoords mouse_co = MouseCoords(
Use constructor directly:
Should also use
const
to make things even better.@ -1107,0 +1334,4 @@
return OPERATOR_CANCELLED;
}
MouseCoords mouse_co = MouseCoords(
Same as above.
@ -1107,0 +1349,4 @@
return OPERATOR_CANCELLED;
}
bool changed = false;
The variable is not used (it is only assigned to, never read back).
@blender-bot package
Package build started. Download here when ready.
Why does the
SEQUENCER_OT_select_handle
need to be modal operator?The way it does the check about
element_already_selected(selection)
and returningOPERATOR_RUNNING_MODAL
is rather confusion: it informs the window manager that it runs modally, but does not add any modal handler. This seems to be against the intended design of working with the modal operators.In practice it makes it impossible to use handle tweaking when the handle is already selected.
I've also talked to Francesco and the conclusion is that the tweak operation should not change initial selection. It means that if the handle is selected, tweaking it should leave it selected when the tweak is finished.
It was mistake - I though, that this would allow for translation when mouse moves, but in RCS that is explicit, so it should not have been modal.
I am ok with either behavior. Deselection after translation was originally requested, but not sure if there was any purpose for this.
@blender-bot package
Package build started. Download here when ready.
The state of handle selection should not change after the tweak:
Currently in both cases handle stays selected after the tweaking.
Ah I misunderstood this. Question is, how to pass previous state to transform operator. I could add a flag to
SpaceSeq
, adding RNA property to transform operator would be bit odd. Both solutions are not great though.@blender-bot package
Package build started. Download here when ready.
Now there is an issue with using G-key transform of handles, which leads to handle being unselected:
--factory-startup
Video Editing
templateColor
stripI think what happens is when you click the
select_handle
operator is run, and it leaves theSPACE_SEQ_DESELECT_STRIP_HANDLE
, which is then later taken into account by the G-transform operator, outside of the tweak tool.I guess there is no way around adding some parameter to the
seq_slide
so that it "knows" it was called as part of the "tweak" tool.Hmm this can be fixed in logic where cursor for transform operator is selected - it checks if the operator is invoked by mouse.
Other method could be to modify keymap on the fly by select operator, but this is much more error prone and complicated.
Following codde would work, it changes state of
SpaceSeq
, which already happens intransform_convert_sequencer.cc
. This could be implemented as separate flag in transform code, that could be better perhaps, but may be unnecessary.@blender-bot package
Package build started. Download here when ready.
Hi, I tested with RCS and LCS, selection and transform of handles works as expected now.
What works:
What doesn't:
Tweak Handles
disables mouse cursor changes, but does not seem to disable the tweaking behaviorNon-intuitive/non-documented/debatable aspects:
The C/C++ code should be making as few assumptions about the keymap as possible. Surely, it does happen in some places in Blender, but they are more of legacy, and they do have issues which users are running into and which we want to be solved. In this specific case, if someone re-binds mouse clicks to something like a keyboard or a pedal it will not be possible to have the same tweak behavior as with the real mouse events. I am not sure if it was attempted to avoid such coupling of code with the default keymap and whether it had some intrinsic issues. If so, it needs to be mentioned as a known limitation, so people are aware.
I've talked to Francesco ab out it. Is not something we consider important to be resolved. So don't focus on this part for the initial feature merge.
Disabling
Tweak Handles
should keep previous behavior. Currently this does not happen with RCS and LMB action - will fix that , but just wanted to state this explicitly here.This could be facilitated by operator property instead of relying on checking how the operator was invoked, so will do that.
@Sergey I have implemented the functionality as operator property. There are 2 caveats:
initSeqSlide()
setsWM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
as custom data. From looking at other areas, only place I saw it being used is intransform_mode_shrink_fatten.cc
event handling. Therefore I have removed this from seq_slide mode and I have used custom data to store state of this property.Finally, with current keymap, translation is not explicitly defined for LCS tweak tool or any other tools, so I have to enabled option to deselect handles for
seq_slide
operator mapped to mouse. Then in the code, this is still controlled by "Tweak Handles" property in preferences. Still better than hardcoding this functionality to mouse buttons I guess.@blender-bot package
Package build started. Download here when ready.
@iss Thanks for the updates! I am a nit distracted today, so can't give full confidence in testing. The only thing i've noticed is the Tweak Handle option in Editor -> VSE is not enabled by default. It might be due to my settings are saved with a newer subversion than what this build has.
If we can merge the latest main, then we can make the final build, and make Francesco double-check the behavior.
Hopefully it will be all fine, and we'll be able to finally land this feature.
@Sergey So if I get OK from francesco I can merge?
@iss I wouldn't mind double-checking the build after update to the latest main, to verify the theory that the new behavior is not enabled by default because of that. But other than that I don't think i have any outstanding comments on the code or behavior, and everything else seems to be addressed.
Right, we have bit more time till bcon3, so I will merge main to this PR, test the checkbox and run it by Francesco anyway. I can wait with merging. Next week though I will be probably just waking up by this time, so monday sounds like good deadline to have this finished up and merged.
@blender-bot package
Package build started. Download here when ready.
Aras Pranckevicius referenced this pull request2024-06-02 20:49:54 +02:00
I think all major points from the review are addressed now.
@iss Maybe you can do one last merge, to see the full green CI/CD pass?
@fsiddi Can test the latest build and stress-test it to see we did not miss anything?
@blender-bot package
Package build started. Download here when ready.
Hi, I tested transform, cancel transform and snap under the following conditions, in various permutations
All seems to work reasonably well. I suggest to merge this and get more real world usage.
Suggestion for after the merge: when a channel is locked, do not display the tweak widget.