[Bf-blender-cvs] [c09c3246eb3] blender-v3.2-release: Fix T97718: Crash using "Text on Curve"

Hans Goudey noreply at git.blender.org
Tue May 3 09:25:29 CEST 2022


Commit: c09c3246eb3b23d032807bc3210b8dbb79aab229
Author: Hans Goudey
Date:   Tue May 3 09:25:19 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBc09c3246eb3b23d032807bc3210b8dbb79aab229

Fix T97718: Crash using "Text on Curve"

8e4c3c6a2414 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.

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

M	source/blender/blenkernel/intern/anim_path.c

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

diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c
index a8c25069c19..dc12519a843 100644
--- a/source/blender/blenkernel/intern/anim_path.c
+++ b/source/blender/blenkernel/intern/anim_path.c
@@ -320,18 +320,22 @@ bool BKE_where_on_path(const Object *ob,
     key_curve_position_weights(frac, w, KEY_BSPLINE);
   }
 
-  r_vec[0] = /* X */
-      w[0] * p0->vec[0] + w[1] * p1->vec[0] + w[2] * p2->vec[0] + w[3] * p3->vec[0];
-  r_vec[1] = /* Y */
-      w[0] * p0->vec[1] + w[1] * p1->vec[1] + w[2] * p2->vec[1] + w[3] * p3->vec[1];
-  r_vec[2] = /* Z */
-      w[0] * p0->vec[2] + w[1] * p1->vec[2] + w[2] * p2->vec[2] + w[3] * p3->vec[2];
+  if (r_vec) {
+    r_vec[0] = /* X */
+        w[0] * p0->vec[0] + w[1] * p1->vec[0] + w[2] * p2->vec[0] + w[3] * p3->vec[0];
+    r_vec[1] = /* Y */
+        w[0] * p0->vec[1] + w[1] * p1->vec[1] + w[2] * p2->vec[1] + w[3] * p3->vec[1];
+    r_vec[2] = /* Z */
+        w[0] * p0->vec[2] + w[1] * p1->vec[2] + w[2] * p2->vec[2] + w[3] * p3->vec[2];
+  }
 
   /* Clamp weights to 0-1 as we don't want to extrapolate other values than position. */
   clamp_v4(w, 0.0f, 1.0f);
 
-  /* Tilt, should not be needed since we have quat still used. */
-  r_vec[3] = w[0] * p0->tilt + w[1] * p1->tilt + w[2] * p2->tilt + w[3] * p3->tilt;
+  if (r_vec) {
+    /* Tilt, should not be needed since we have quat still used. */
+    r_vec[3] = w[0] * p0->tilt + w[1] * p1->tilt + w[2] * p2->tilt + w[3] * p3->tilt;
+  }
 
   if (r_quat) {
     float totfac, q1[4], q2[4];



More information about the Bf-blender-cvs mailing list