[Bf-blender-cvs] [56e88ada832] soc-2020-greasepencil-curve: GPencil: Fix select fill

Falk David noreply at git.blender.org
Mon Jul 20 21:22:48 CEST 2020


Commit: 56e88ada832432d9490716c28560678b52376b06
Author: Falk David
Date:   Mon Jul 20 15:55:18 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB56e88ada832432d9490716c28560678b52376b06

GPencil: Fix select fill

The function was not working correctly, because it would select
fills where one of the triangles would have a bounding box
large enought that it would intersect the selction.

===================================================================

M	source/blender/editors/gpencil/gpencil_select.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index 11706c7f133..0802cbfde2a 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1565,16 +1565,21 @@ static bool gpencil_stroke_fill_isect_rect(ARegion *region,
       DO_MINMAX2(pt3, tri_min, tri_max);
 
       rcti tri_bb = {tri_min[0], tri_max[0], tri_min[1], tri_max[1]};
-      if (BLI_rcti_inside_rcti(&rect, &tri_bb) || BLI_rcti_inside_rcti(&tri_bb, &rect)) {
+      /* Case 1: triangle is entirely inside box selection */
+      /* (XXX: Can this even happen with no point inside the box?) */
+      if (BLI_rcti_inside_rcti(&tri_bb, &rect)) {
         hit = true;
         break;
       }
 
+      /* Case 2: rectangle intersects sides of triangle */
       if (BLI_rcti_isect_segment(&rect, pt1, pt2) || BLI_rcti_isect_segment(&rect, pt2, pt3) ||
           BLI_rcti_isect_segment(&rect, pt3, pt1)) {
         hit = true;
         break;
       }
+
+      /* TODO: Case 3: rectangle is inside the triangle */
     }
   }



More information about the Bf-blender-cvs mailing list