diff options
author | Shen Ciao <ShenCiao> | 2021-12-30 13:26:59 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-12-30 13:29:09 +0300 |
commit | 52da1afbf67c3be7e4e561ed232632a628c6912b (patch) | |
tree | 2c509f65149b8b800ca55df5693f838adead9b95 /source/blender/editors | |
parent | 49a18cc91e55c92d5e0261d70b56eb3e2a10b0fa (diff) |
Fix T93134: Set origin broken for curve edit mode
Bug: Set Origin causes unexpected offset on Grease Pencil strokes when Curve Editing is enabled.
Fix: Add transformation of editcurve points in `object_origin_set_exec`.
Reviewed By: #grease_pencil, antoniov
Maniphest Tasks: T93134
Differential Revision: https://developer.blender.org/D13273
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_transform.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 4c4727f51ee..c320313643d 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1408,6 +1408,19 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) sub_v3_v3(mpt, offset_local); mul_v3_m4v3(&pt->x, diff_mat, mpt); } + + /* Apply transform to editcurve*/ + if (gps->editcurve != NULL) { + for (i = 0; i < gps->editcurve->tot_curve_points; i++) { + BezTriple *bezt = &gps->editcurve->curve_points[i].bezt; + for (int j = 0; j < 3; j++) { + float mpt[3]; + mul_v3_m4v3(mpt, inverse_diff_mat, bezt->vec[j]); + sub_v3_v3(mpt, offset_local); + mul_v3_m4v3(bezt->vec[j], diff_mat, mpt); + } + } + } } } } |