[Bf-blender-cvs] [885aff65616] temp-gpencil-io: Change Poll methods

Antonio Vazquez noreply at git.blender.org
Wed Mar 17 16:32:57 CET 2021


Commit: 885aff6561646b474298e82be68b54a43fbfe27f
Author: Antonio Vazquez
Date:   Wed Mar 17 16:30:16 2021 +0100
Branches: temp-gpencil-io
https://developer.blender.org/rB885aff6561646b474298e82be68b54a43fbfe27f

Change Poll methods

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

M	source/blender/editors/io/io_gpencil_export.c

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

diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index e2db5e98a24..e57be3e155c 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -78,7 +78,6 @@ static void ui_gpencil_export_common_settings(uiLayout *layout, PointerRNA *imfp
 #ifdef WITH_PUGIXML
 static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op)
 {
-
   char filepath[FILE_MAX];
   RNA_string_get(op->ptr, "filepath", filepath);
 
@@ -242,18 +241,7 @@ static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op)
 
 static bool wm_gpencil_export_svg_poll(bContext *C)
 {
-  if (CTX_wm_window(C) == NULL) {
-    return false;
-  }
-  Object *ob = CTX_data_active_object(C);
-  if ((ob == NULL) || (ob->type != OB_GPENCIL) || (ob->mode != OB_MODE_OBJECT)) {
-    return false;
-  }
-
-  bGPdata *gpd = (bGPdata *)ob->data;
-  bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
-
-  if (gpl == NULL) {
+  if ((CTX_wm_window(C) == NULL) || (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)) {
     return false;
   }
 
@@ -428,18 +416,7 @@ static void wm_gpencil_export_pdf_draw(bContext *C, wmOperator *op)
 
 static bool wm_gpencil_export_pdf_poll(bContext *C)
 {
-  if (CTX_wm_window(C) == NULL) {
-    return false;
-  }
-  Object *ob = CTX_data_active_object(C);
-  if ((ob == NULL) || (ob->type != OB_GPENCIL) || (ob->mode != OB_MODE_OBJECT)) {
-    return false;
-  }
-
-  bGPdata *gpd = (bGPdata *)ob->data;
-  bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
-
-  if (gpl == NULL) {
+  if ((CTX_wm_window(C) == NULL) || (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)) {
     return false;
   }



More information about the Bf-blender-cvs mailing list