From fad85d303fbce7c0ee402ffa706cd6d4cdb13409 Mon Sep 17 00:00:00 2001 From: Falk David Date: Tue, 18 Jun 2024 12:29:32 +0200 Subject: [PATCH] Fix #123328: Onion skinning causes change in opacity for current frame Toggling the layer onion skinning toggle would affect the opacity of strokes on the current frame. This was caused by the `get_visible_frames_for_layer` function. It computes a `frame_id` for all the keyframes that are not the currenty visible keyframe. To skip over the currently visible keyframe on the layer, it just compared the start frame of the keyframe with the current scene frame. This only works if the current frame is over the keyframe, but not for any frames after (even if the same keyframe is still visible). The fix computes the start frame of the keyframe under the current frame first, and then uses that to compare to the start frame during the iteration over all keyframes. This makes sure that we skip over the currently visible keyframe in that layer. Pull Request: https://projects.blender.org/blender/blender/pulls/123358 --- .../editors/grease_pencil/intern/grease_pencil_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_utils.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_utils.cc index fbdacdb569d..4ba6628f0d9 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_utils.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_utils.cc @@ -346,9 +346,10 @@ static Array> get_visible_frames_for_layer( const int last_frame = sorted_keys.last(); const int last_frame_index = sorted_keys.index_range().last(); const bool is_before_first = (current_frame < sorted_keys.first()); + const std::optional current_start_frame = layer.start_frame_at(current_frame); for (const int frame_i : sorted_keys.index_range()) { const int frame_number = sorted_keys[frame_i]; - if (frame_number == current_frame) { + if (current_start_frame && *current_start_frame == frame_number) { continue; } const GreasePencilFrame &frame = layer.frames().lookup(frame_number);