Fix: GPv3: Interpolation not working with no selection

The interpolation tool in edit mode would create an empty keyframe if nothing in the
`from_drawing` and `to_drawing` was selected. This is not how the tool behaved in GPv2
so this is unexpected.

The fix  checks that if `only_selected` is used, there also is a selection in both of the
drawings in the pair, and otherwise fallback to interpolating all the strokes.
This is consistent with how the tool worked in 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/129206
This commit is contained in:
Falk David
2024-10-18 11:38:46 +02:00
committed by Falk David
parent d5d81c5078
commit 078f16a8d5

View File

@@ -260,7 +260,9 @@ static void find_curve_mapping_from_index(const GreasePencil &grease_pencil,
IndexMaskMemory memory;
IndexMask from_selection, to_selection;
if (only_selected) {
if (only_selected && ed::curves::has_anything_selected(from_drawing.strokes()) &&
ed::curves::has_anything_selected(to_drawing.strokes()))
{
from_selection = ed::curves::retrieve_selected_curves(from_drawing.strokes(), memory);
to_selection = ed::curves::retrieve_selected_curves(to_drawing.strokes(), memory);
}