diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-03 10:25:19 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-03 10:25:28 +0300 |
commit | c09c3246eb3b23d032807bc3210b8dbb79aab229 (patch) | |
tree | fa15cc90bdc1bc3b3256eca5b22d3b7c5ac8a852 /source | |
parent | 3d96fd6fd65c196c45750d17c81f6ebfce7d2a62 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/anim_path.c | 20 |
1 files changed, 12 insertions, 8 deletions
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]; |