Fix T85987: Selection when GP is parented

When a GP object was parented to e.g. a bone, box selection as well as
point selection were broken in that the selection from the user would
not correlate with what was actually being selected.

The issue was that box and point selection did not use the active
evaluated stroke data. The fix uses the correct data.

Reviewed By: antoniov

Maniphest Tasks: T85987

Differential Revision: https://developer.blender.org/D10555
This commit is contained in:
Falk David
2021-02-27 09:28:37 +01:00
parent e3c11b36da
commit 4b16cb1e9a

View File

@@ -1847,7 +1847,7 @@ static bool gpencil_generic_stroke_select(bContext *C,
bGPDspoint *pt;
int i;
bool hit = false;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) {
bGPDspoint *pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
/* convert point coords to screenspace */
@@ -2252,12 +2252,12 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
int i;
/* firstly, check for hit-point */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) {
int xy[2];
bGPDspoint pt2;
gpencil_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2);
gpencil_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]);
gpencil_point_to_xy(&gsc, gps_active, &pt2, &xy[0], &xy[1]);
/* do boundbox check first */
if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) {