[Bf-blender-cvs] [1914e44b57e] temp-gpencil-io: GPencil: Limit Export/Import to Object mode only

Antonio Vazquez noreply at git.blender.org
Sun Mar 14 17:43:36 CET 2021


Commit: 1914e44b57e3440052b009ac0977d58f23c524df
Author: Antonio Vazquez
Date:   Sun Mar 14 17:43:30 2021 +0100
Branches: temp-gpencil-io
https://developer.blender.org/rB1914e44b57e3440052b009ac0977d58f23c524df

GPencil: Limit Export/Import to Object mode only

Change poll function to check mode.

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

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

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

diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index 28bad597f4e..8176c0dd3b9 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -248,7 +248,7 @@ static bool wm_gpencil_export_svg_poll(bContext *C)
     return false;
   }
   Object *ob = CTX_data_active_object(C);
-  if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+  if ((ob == NULL) || (ob->type != OB_GPENCIL) || (ob->mode != OB_MODE_OBJECT)) {
     return false;
   }
 
@@ -436,7 +436,7 @@ static bool wm_gpencil_export_pdf_poll(bContext *C)
     return false;
   }
   Object *ob = CTX_data_active_object(C);
-  if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+  if ((ob == NULL) || (ob->type != OB_GPENCIL) || (ob->mode != OB_MODE_OBJECT)) {
     return false;
   }
 
diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c
index d8e958b01d7..6a3dca57295 100644
--- a/source/blender/editors/io/io_gpencil_import.c
+++ b/source/blender/editors/io/io_gpencil_import.c
@@ -185,7 +185,7 @@ static void wm_gpencil_import_svg_draw(bContext *UNUSED(C), wmOperator *op)
 
 static bool wm_gpencil_import_svg_poll(bContext *C)
 {
-  if (CTX_wm_window(C) == 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