Fix T97718: Crash using "Text on Curve"

8e4c3c6a24 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.
This commit is contained in:
Hans Goudey 2022-05-03 09:25:19 +02:00
parent 00fb44797a
commit af2740abc0
Notes: blender-bot 2023-02-14 00:20:15 +01:00
Referenced by issue #97718, Regression: Crash Using Text on Curve
1 changed files with 12 additions and 8 deletions

View File

@ -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];