Fix T86881: Curve Edit handle offset when snapping

When an aligned (or auto) handle was snapped with only the control
point selected, it would not snap to the correct point, but offset. This
was because the handles were not considered selected. The `TD_SELECTED`
flag was not being set.

The fix makes sure that we include the handles in the selection when
the handle is aligned or auto.

Reviewed By: antoniov

Maniphest Tasks: T86881

Differential Revision: https://developer.blender.org/D11111
This commit is contained in:
Falk David 2021-04-28 16:20:09 +02:00
parent c4bebc03e0
commit e0fa295bc6
Notes: blender-bot 2023-02-14 06:46:23 +01:00
Referenced by issue #86881, Greasepencil curve editing has an issue with snapping (offset)
1 changed files with 4 additions and 6 deletions

View File

@ -78,14 +78,12 @@ static short get_bezt_sel_triple_flag(BezTriple *bezt, const bool handles_visibl
flag = ((bezt->f1 & SELECT) ? SEL_F1 : 0) | ((bezt->f2 & SELECT) ? SEL_F2 : 0) |
((bezt->f3 & SELECT) ? SEL_F3 : 0);
}
else {
if (bezt->f2 & SELECT) {
flag = SEL_ALL;
}
else if (bezt->f2 & SELECT) {
flag = SEL_ALL;
}
/* Special case for auto & aligned handles */
if (flag != SEL_ALL && flag & SEL_F2) {
if ((flag != SEL_ALL) && (flag & SEL_F2)) {
if (ELEM(bezt->h1, HD_AUTO, HD_ALIGN) && ELEM(bezt->h2, HD_AUTO, HD_ALIGN)) {
flag = SEL_ALL;
}
@ -316,7 +314,7 @@ static void createTransGPencil_curves(bContext *C,
}
}
else if (handles_visible) {
if (BEZT_ISSEL_IDX(bezt, j)) {
if (sel) {
td->flag = TD_SELECTED;
}
else {