Animation: time offset slider #106520

Closed
AresDeveaux wants to merge 7 commits from AresDeveaux/blender:time_offset_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 1 deletions
Showing only changes of commit 264301a1b2 - Show all commits

View File

@ -504,7 +504,7 @@ void time_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float
float delta_y;
/* If we operate directly on the fcurve there will be a feedback loop

you don't need this line

you don't need this line
* so we need to capture the "y" values on an array to then apply them on a second loop*/
* so we need to capture the "y" values on an array to then apply them on a second loop. */

forgot the . at the end of the comment

forgot the . at the end of the comment
float y_values[segment->length];

this doesn't compile for me. C doesn't allow variable length arrays.

you'd need to do MEM_callocN(sizeof(float) * segment->length, "Time Offset Samples");
and at the end of the function MEM_freeN(y_values); so to not have a memory leak

this doesn't compile for me. C doesn't allow variable length arrays. you'd need to do `MEM_callocN(sizeof(float) * segment->length, "Time Offset Samples");` and at the end of the function `MEM_freeN(y_values);` so to not have a memory leak

Why can I compile it? do I need to set something I haven't for make?

When you say C doesn't allow variable length array, I'm not sure I follow. I thought by declaring an array with a fixed value, C could handle it. Isn't segment->length an unchanged value for that segment?

Also the slider currently allows an overshoot in the positive axis, but doesn't allow to go below 0.
When overshooting on positive x it doesn't loop infinitely as you'd expect

Didn't know we could overshoot. Where is that set in the code, and how can I test it on the UI?

In regard to the memory leak, should I be adding those types of lines to the other sliders too?

Why can I compile it? do I need to set something I haven't for `make`? When you say C doesn't allow variable length array, I'm not sure I follow. I thought by declaring an array with a fixed value, C could handle it. Isn't `segment->length` an unchanged value for that segment? ``` Also the slider currently allows an overshoot in the positive axis, but doesn't allow to go below 0. When overshooting on positive x it doesn't loop infinitely as you'd expect ``` Didn't know we could overshoot. Where is that set in the code, and how can I test it on the UI? In regard to the memory leak, should I be adding those types of lines to the other sliders too?

variable length arrays are a C99 feature, but I think Blender runs on a different standard. But honestly I can't find in the wiki where that is.

A lot of the slider features are controller by the slider itself. You can see the shortcuts in the Status Bar
ED_slider_allow_overshoot_set allows you to change the behaviour

variable length arrays are a C99 feature, but I think Blender runs on a different standard. But honestly I can't find in the wiki where that is. A lot of the slider features are controller by the slider itself. You can see the shortcuts in the Status Bar `ED_slider_allow_overshoot_set` allows you to change the behaviour

Interesting! I didn't see those before.

I tried overshoot in time offset slider and as you say, to the right it works as expected, but to the left stops at 0. I then tried the ease slider, the neighbor slider and the default slider, and all of them stop at 0. I could try to find the problem, but it seems the issue is not in my function but in the slider itself and that might be beyond my understanding at this point.

Interesting! I didn't see those before. I tried overshoot in `time offset slider` and as you say, to the right it works as expected, but to the left stops at 0. I then tried the `ease slider`, the `neighbor slider` and the `default slider`, and all of them stop at 0. I could try to find the problem, but it seems the issue is not in my function but in the slider itself and that might be beyond my understanding at this point.
for (int i = segment->start_index; i < segment->start_index + segment->length; i++) {