1
1

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
This commit is contained in:
Shen Ciao
2021-12-30 11:26:59 +01:00
committed by Antonio Vazquez
parent 49a18cc91e
commit 52da1afbf6

View File

@@ -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);
}
}
}
}
}
}