Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-05-03 10:25:19 +0300
committerHans Goudey <h.goudey@me.com>2022-05-03 10:47:40 +0300
commitaf2740abc0b003fd9d307933480ace3a99803669 (patch)
treed816962106f2483d079a51bde4051d663d84ace4 /source/blender/blenkernel/intern/anim_path.c
parent00fb44797a97b0202f36f2d517570e4df4c06bfc (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/blender/blenkernel/intern/anim_path.c')
-rw-r--r--source/blender/blenkernel/intern/anim_path.c20
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];