[Bf-blender-cvs] [cc53900baff] master: GPencil: Add option to keep selected in Select Vertex Color
Antonio Vazquez
noreply at git.blender.org
Sat Mar 14 11:07:44 CET 2020
Commit: cc53900bafff2f353cea3f74759312105a5ff31f
Author: Antonio Vazquez
Date: Sat Mar 14 11:07:35 2020 +0100
Branches: master
https://developer.blender.org/rBcc53900bafff2f353cea3f74759312105a5ff31f
GPencil: Add option to keep selected in Select Vertex Color
===================================================================
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 12d4c7c4329..43e13e88b9c 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1681,6 +1681,7 @@ static bool gpencil_select_vertex_color_poll(bContext *C)
static int gpencil_select_vertex_color_exec(bContext *C, wmOperator *op)
{
const float threshold = RNA_float_get(op->ptr, "threshold");
+ const bool keep = RNA_boolean_get(op->ptr, "keep");
ToolSettings *ts = CTX_data_tool_settings(C);
Object *ob = CTX_data_active_object(C);
@@ -1702,8 +1703,18 @@ static int gpencil_select_vertex_color_exec(bContext *C, wmOperator *op)
bGPDspoint *pt;
int i;
bool gps_selected = false;
+ /* If clear unselect stroke. */
+ if (!keep) {
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+
/* Check all stroke points. */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ /* Clear any previous point selected. */
+ if (!keep) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
+
if (pt->vert_color[3] < 0.03f) {
continue;
}
@@ -1757,6 +1768,10 @@ void GPENCIL_OT_select_vertex_color(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "threshold", 0.01f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
/* avoid re-using last var */
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_boolean(
+ ot->srna, "keep", true, "Keep Previous Selection", "Keep any previous selection");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/** \} */
More information about the Bf-blender-cvs
mailing list