Fix: Potential divide by 0 using GRAPH_OT_ease
In case there is only 1 key on the FCurve, the operator can run into a situation where it divides by 0. It now skips the curve in that case Reviewed by: Sybren A. Stüvel Differential Revision: https://developer.blender.org/D16982 Ref: D16982
This commit is contained in:
parent
ea1c31a244
commit
ed178f5ff5
|
@ -1 +1 @@
|
|||
Subproject commit 7084c4ecd97d93459d9d23fd90f81589b09be5df
|
||||
Subproject commit 4f6dbb69893bd6bdf73467effe77ae46c8e4ee37
|
|
@ -1 +1 @@
|
|||
Subproject commit a9d4443c244f89399ec4bcc427e05a07950528cc
|
||||
Subproject commit bf49eeaa14c445d3c53068203fdf91bff568fe64
|
|
@ -1 +1 @@
|
|||
Subproject commit bdcfdd47ec3451822b21d1cff2ea2db751093c9a
|
||||
Subproject commit 0f72f6c85c3743a9072273acb6a8a34b1cf1064b
|
|
@ -388,6 +388,12 @@ void ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor
|
|||
const float key_x_range = right_key.vec[1][0] - left_x;
|
||||
const float key_y_range = right_key.vec[1][1] - left_y;
|
||||
|
||||
/* Happens if there is only 1 key on the FCurve. Needs to be skipped because it
|
||||
* would be a divide by 0. */
|
||||
if (IS_EQF(key_x_range, 0.0f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* In order to have a curve that favors the right key, the curve needs to be mirrored in x and y.
|
||||
* Having an exponent that is a fraction of 1 would produce a similar but inferior result. */
|
||||
const bool inverted = factor > 0.5;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e1744b9bd82527cf7e8af63362b61bd309b5711b
|
||||
Subproject commit 3582f5326d08ca05c2a19056597e49ec5511d854
|
Loading…
Reference in New Issue