[Bf-blender-cvs] [ec6175960aa] asset-lite-greasepencil: Add poll messages

Antonio Vazquez noreply at git.blender.org
Fri Jun 24 13:09:12 CEST 2022


Commit: ec6175960aa6b69f9495c9ffad3aeab2d32cf164
Author: Antonio Vazquez
Date:   Thu Jun 23 09:25:48 2022 +0200
Branches: asset-lite-greasepencil
https://developer.blender.org/rBec6175960aa6b69f9495c9ffad3aeab2d32cf164

Add poll messages

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

M	source/blender/editors/gpencil/gpencil_asset.c

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

diff --git a/source/blender/editors/gpencil/gpencil_asset.c b/source/blender/editors/gpencil/gpencil_asset.c
index c2aabb7c9df..5881e698e4d 100644
--- a/source/blender/editors/gpencil/gpencil_asset.c
+++ b/source/blender/editors/gpencil/gpencil_asset.c
@@ -311,13 +311,15 @@ static bool gpencil_asset_edit_poll(bContext *C)
 {
   const enum eContextObjectMode mode = CTX_data_mode_enum(C);
 
-  /* Only allowed in Grease Pencil Edit mode. */
-  if (mode != CTX_MODE_EDIT_GPENCIL) {
+  Object *ob = CTX_data_active_object(C);
+  if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+    CTX_wm_operator_poll_msg_set(C, "Need a Grease Pencil object selected");
     return false;
   }
 
-  Object *ob = CTX_data_active_object(C);
-  if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+  /* Only allowed in Grease Pencil Edit mode. */
+  if (mode != CTX_MODE_EDIT_GPENCIL) {
+    CTX_wm_operator_poll_msg_set(C, "Grease Pencil object must be in Edit mode");
     return false;
   }



More information about the Bf-blender-cvs mailing list