[Bf-blender-cvs] [6bb2912704b] master: GPencil: Fix unreported unable to deselect when masking is OFF

Antonio Vazquez noreply at git.blender.org
Sat Aug 24 18:00:00 CEST 2019


Commit: 6bb2912704ba23f13879affa075ea9d18211ba81
Author: Antonio Vazquez
Date:   Sat Aug 24 17:58:14 2019 +0200
Branches: master
https://developer.blender.org/rB6bb2912704ba23f13879affa075ea9d18211ba81

GPencil: Fix unreported unable to deselect when masking is OFF

When the mask is disabled, all select operators must be disabled, but the deselect all operator must work or it's impossible to deselect.

===================================================================

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 7225bf43fbd..f4484624d5a 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -111,6 +111,19 @@ static bool gpencil_select_poll(bContext *C)
 /* -------------------------------------------------------------------- */
 /** \name Select All Operator
  * \{ */
+static bool gpencil_select_all_poll(bContext *C)
+{
+  bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+  /* we just need some visible strokes, and to be in editmode or other modes only to catch event */
+  if (GPENCIL_ANY_MODE(gpd)) {
+    if (gpd->layers.first) {
+      return true;
+    }
+  }
+
+  return false;
+}
 
 static int gpencil_select_all_exec(bContext *C, wmOperator *op)
 {
@@ -127,6 +140,14 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
+  /* For sculpt mode, if mask is disable, only allows deselect */
+  if (GPENCIL_SCULPT_MODE(gpd)) {
+    ToolSettings *ts = CTX_data_tool_settings(C);
+    if ((!(GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt))) && (action != SEL_DESELECT)) {
+      return OPERATOR_CANCELLED;
+    }
+  }
+
   ED_gpencil_select_toggle_all(C, action);
 
   /* updates */
@@ -149,7 +170,7 @@ void GPENCIL_OT_select_all(wmOperatorType *ot)
 
   /* callbacks */
   ot->exec = gpencil_select_all_exec;
-  ot->poll = gpencil_select_poll;
+  ot->poll = gpencil_select_all_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;



More information about the Bf-blender-cvs mailing list