Fix T90736: Problem applying scale to curves

Curve Points of handle of type `Auto` on curves not uniformly scaled
cause the shape of the curve to be modified after applying the scale.

So change these handles to `Aligned` in these cases.

Reviewed By: campbellbarton

Maniphest Tasks: T90736

Differential Revision: https://developer.blender.org/D12281
This commit is contained in:
Germano Cavalcante 2021-09-13 12:41:33 -03:00 committed by Germano Cavalcante
parent a78410386b
commit 4f73d43adc
Notes: blender-bot 2023-02-14 05:25:44 +01:00
Referenced by issue #90736, Curve: Apply Scale Problems with Dimensions & Shape
1 changed files with 7 additions and 0 deletions

View File

@ -5269,6 +5269,8 @@ void BKE_curve_transform_ex(Curve *cu,
BezTriple *bezt;
int i;
const bool is_uniform_scaled = is_uniform_scaled_m4(mat);
LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
if (nu->type == CU_BEZIER) {
i = nu->pntsu;
@ -5279,6 +5281,11 @@ void BKE_curve_transform_ex(Curve *cu,
if (do_props) {
bezt->radius *= unit_scale;
}
if (!is_uniform_scaled) {
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
bezt->h1 = bezt->h2 = HD_ALIGN;
}
}
}
BKE_nurb_handles_calc(nu);
}