GP: New deselect by material option
Now the operator to select by color can unselect too.
This commit is contained in:
parent
fd1870b995
commit
0f652a1ec0
Notes:
blender-bot
2023-02-14 05:16:27 +01:00
Referenced by issue #56920, Crash: Renaming bone through outliner in object mode crashes Blender
|
@ -147,7 +147,8 @@ class MATERIAL_PT_gpencil_slots(Panel):
|
|||
if gpd.use_stroke_edit_mode:
|
||||
row = layout.row(align=True)
|
||||
row.operator("gpencil.stroke_change_color", text="Assign")
|
||||
row.operator("gpencil.color_select", text="Select")
|
||||
row.operator("gpencil.color_select", text="Select").deselect=False
|
||||
row.operator("gpencil.color_select", text="Deselect").deselect=True
|
||||
|
||||
elif mat:
|
||||
row.template_ID(space, "pin_id")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue