diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-25 20:01:12 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-25 20:01:12 +0300 |
commit | 0f652a1ec072955de32868051e532fe0b5fb64a5 (patch) | |
tree | 1657877d5eeb02f948ed1cd4167c0c1b9ccd4721 /source/blender/editors/gpencil/gpencil_data.c | |
parent | fd1870b995fa4540c342526ca6525641bba5aab5 (diff) |
GP: New deselect by material option
Now the operator to select by color can unselect too.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_data.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 439053957c5..828eff7f630 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -2581,12 +2581,13 @@ void GPENCIL_OT_color_unlock_all(wmOperatorType *ot) /* ***************** Select all strokes using color ************************ */ -static int gpencil_color_select_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_color_select_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, ob->actcol); - bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); + const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); + const bool deselected = RNA_boolean_get(op->ptr, "deselect"); /* sanity checks */ if (ELEM(NULL, gpd, gp_style)) @@ -2616,9 +2617,19 @@ static int gpencil_color_select_exec(bContext *C, wmOperator *UNUSED(op)) bGPDspoint *pt; int i; - gps->flag |= GP_STROKE_SELECT; + if (!deselected) { + gps->flag |= GP_STROKE_SELECT; + } + else { + gps->flag &= ~GP_STROKE_SELECT; + } for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { - pt->flag |= GP_SPOINT_SELECT; + if (!deselected) { + pt->flag |= GP_SPOINT_SELECT; + } + else { + pt->flag &= ~GP_SPOINT_SELECT; + } } } } @@ -2654,4 +2665,8 @@ void GPENCIL_OT_color_select(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + ot->prop = RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Unselect strokes"); + RNA_def_property_flag(ot->prop, PROP_HIDDEN | PROP_SKIP_SAVE); } |