Fix: VSE: assert when strips are too short
When handle tweaking is enabled and strips are short, hovering over them would trigger assert in `mouseover_strips_sorted_get()`, because more than 2 strips would be picked. Sorting was done just by swapping strips if order was incorrect Use `std::sort()` instead. Pull Request: https://projects.blender.org/blender/blender/pulls/131594
This commit is contained in:
committed by
Richard Antalik
parent
f6a6334164
commit
eea1a65821
@@ -1058,14 +1058,10 @@ static blender::Vector<Sequence *> mouseover_strips_sorted_get(const Scene *scen
|
||||
strips.append(seq);
|
||||
}
|
||||
|
||||
BLI_assert(strips.size() <= 2);
|
||||
|
||||
/* Ensure that `strips[0]` is the strip closest to the mouse cursor. */
|
||||
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]))
|
||||
{
|
||||
std::swap(strips[0], strips[1]);
|
||||
}
|
||||
std::sort(strips.begin(), strips.end(), [&](const Sequence *seq1, const Sequence *seq2) {
|
||||
return strip_to_frame_distance(scene, v2d, seq1, mouse_co[0]) <
|
||||
strip_to_frame_distance(scene, v2d, seq2, mouse_co[0]);
|
||||
});
|
||||
|
||||
return strips;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user