[Bf-blender-cvs] [23aae7822b5] greasepencil-object: GP: If no collision restore selection of points
Antonioya
noreply at git.blender.org
Tue Jan 8 11:26:33 CET 2019
Commit: 23aae7822b5bfc7615c3e3e8d94b046fa9ecd0d8
Author: Antonioya
Date: Tue Jan 8 11:26:22 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB23aae7822b5bfc7615c3e3e8d94b046fa9ecd0d8
GP: If no collision restore selection of points
If no collision, the selection only selected the vertex as vertex mode and don't extend selection.
===================================================================
M source/blender/editors/gpencil/gpencil_utils.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 36bb9dbe9de..e6626f5051d 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2176,6 +2176,9 @@ int ED_gpencil_select_stroke_segment(
int memsize = BLI_listbase_count(&gpf->strokes);
bGPDstroke **gps_array = MEM_callocN(sizeof(bGPDstroke *) * memsize, __func__);
+ /* save points */
+ bGPDspoint *oldpoints = MEM_dupallocN(gps->points);
+
/* Save list of strokes to check */
int totstrokes = 0;
for (bGPDstroke *gps_iter = gpf->strokes.first; gps_iter; gps_iter = gps_iter->next) {
@@ -2317,8 +2320,18 @@ int ED_gpencil_select_stroke_segment(
BLI_ghash_free(all_2d, NULL, NULL);
}
+ /* if no hit, reset selection flag */
+ if ((!hit_a) && (!hit_b)) {
+ for (int i = 0; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ pta2 = &oldpoints[i];
+ pta1->flag = pta2->flag;
+ }
+ }
+
MEM_SAFE_FREE(points2d);
MEM_SAFE_FREE(gps_array);
+ MEM_SAFE_FREE(oldpoints);
/* return type of hit */
if ((hit_a) && (hit_b)) {
More information about the Bf-blender-cvs
mailing list