[Bf-blender-cvs] [ed178f5ff5a] master: Fix: Potential divide by 0 using GRAPH_OT_ease

Christoph Lendenfeld noreply at git.blender.org
Thu Jan 12 12:54:36 CET 2023


Commit: ed178f5ff5a9cb02f25faa35271a4ca6c8f07ec2
Author: Christoph Lendenfeld
Date:   Thu Jan 12 12:46:53 2023 +0100
Branches: master
https://developer.blender.org/rBed178f5ff5a9cb02f25faa35271a4ca6c8f07ec2

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

===================================================================

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/editors/animation/keyframes_general.c
M	source/tools

===================================================================

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 7084c4ecd97..4f6dbb69893 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 7084c4ecd97d93459d9d23fd90f81589b09be5df
+Subproject commit 4f6dbb69893bd6bdf73467effe77ae46c8e4ee37
diff --git a/release/scripts/addons b/release/scripts/addons
index a9d4443c244..bf49eeaa14c 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit a9d4443c244f89399ec4bcc427e05a07950528cc
+Subproject commit bf49eeaa14c445d3c53068203fdf91bff568fe64
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index bdcfdd47ec3..0f72f6c85c3 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit bdcfdd47ec3451822b21d1cff2ea2db751093c9a
+Subproject commit 0f72f6c85c3743a9072273acb6a8a34b1cf1064b
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index f6b09e60e3c..c356f633053 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -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;
diff --git a/source/tools b/source/tools
index e1744b9bd82..3582f5326d0 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit e1744b9bd82527cf7e8af63362b61bd309b5711b
+Subproject commit 3582f5326d08ca05c2a19056597e49ec5511d854



More information about the Bf-blender-cvs mailing list