Animation: blend to infinity slider #106517

Closed
AresDeveaux wants to merge 15 commits from AresDeveaux/blender:blend_to_infinity_slider into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 1 additions and 2 deletions
Showing only changes of commit a0e005c3f6 - Show all commits

View File

@ -1076,8 +1076,7 @@ static void blend_to_infinity_graph_keys(bAnimContext *ac, const float factor)
LISTBASE_FOREACH (FCurveSegment *, segment, &segments) {
if (segment->start_index + segment->length >= fcu->totvert - 1 ||
segment->start_index <= 1) {
WM_report(RPT_WARNING,
"This operator needs at least 2 keys to either side of the selection!");
WM_report(RPT_WARNING, "You need at least 2 keys to eider side of the selection.");

the conditions can also be simplified like above
you can also continue after the warning because the code cannot run anyway

the conditions can also be simplified like above you can also `continue` after the warning because the code cannot run anyway

your suggestion of adding continue to the condition for the warning works, but made me realize 2 things:

1.- I need to split the warning into two possibilities. One when we don't have two reference keys on the left, and another if we don't have two reference keys on the right. As it is now it locks the function even if one of the sides has all it needs (I added this)

2.- If we put continue on the condition in graph_slider_ops.c we don't need the same if statements in `keyframes_general.c' since it will never be executed. (I didn't delete them until you take a look at it)

By the way, doesn't it bother you the warning is blinking? I'm thinking it's doing that because of where I put it. I think it is refreshing as the function is called back when the slider is modified, but don't know in what function I should put it to avoid it.

your suggestion of adding continue to the condition for the warning works, but made me realize 2 things: 1.- I need to split the warning into two possibilities. One when we don't have two reference keys on the left, and another if we don't have two reference keys on the right. As it is now it locks the function even if one of the sides has all it needs (I added this) 2.- If we put continue on the condition in graph_slider_ops.c we don't need the same if statements in `keyframes_general.c' since it will never be executed. (I didn't delete them until you take a look at it) By the way, doesn't it bother you the warning is blinking? I'm thinking it's doing that because of where I put it. I think it is refreshing as the function is called back when the slider is modified, but don't know in what function I should put it to avoid it.

Let's have the warning outside of the for-loop so it's only displayed once per modal cycle
so make a bool all_segments_valid = true
and where the warning is now, set it to false

then after the 2 loops do a if(!all_segments_valid)

Let's have the warning outside of the for-loop so it's only displayed once per modal cycle so make a `bool all_segments_valid = true` and where the warning is now, set it to false then after the 2 loops do a `if(!all_segments_valid)`
}
blend_to_infinity_fcurve_segment(fcu, segment, factor);
}