Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-03-14 13:07:35 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-03-14 13:07:35 +0300
commitcc53900bafff2f353cea3f74759312105a5ff31f (patch)
tree1720e0afb65c24fa59883f61b659dc52c30064af
parent428e65256e77d2939709b0dfe9c8a31c57a93369 (diff)
GPencil: Add option to keep selected in Select Vertex Color
-rw-r--r--source/blender/editors/gpencil/gpencil_select.c15
1 files changed, 15 insertions, 0 deletions
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);
}
/** \} */