[Bf-blender-cvs] [bb42e537a10] greasepencil-object: GPencil: Hide trace image menu option if POTRACE is OFF

Antonio Vazquez noreply at git.blender.org
Thu Sep 17 18:34:09 CEST 2020


Commit: bb42e537a10979f25a8d8c084b1b59fd90b2dcdd
Author: Antonio Vazquez
Date:   Thu Sep 17 18:34:04 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBbb42e537a10979f25a8d8c084b1b59fd90b2dcdd

GPencil: Hide trace image menu option if POTRACE is OFF

This hide the menu if the library is not included as option in Make.

Thanks @LazyDodo for his help.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/python/intern/CMakeLists.txt
M	source/blender/python/intern/bpy_app_build_options.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index a6bf8a5fcc0..6b4674da17a 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2280,9 +2280,10 @@ class VIEW3D_MT_object(Menu):
         else:
             layout.operator_menu_enum("object.convert", "target")
 
-        layout.separator()
-
-        layout.operator("gpencil.trace_image")
+        # Potrace lib dependency
+        if bpy.app.build_options.potrace:
+            layout.separator()
+            layout.operator("gpencil.trace_image")
 
         layout.separator()
 
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index febb0d1cad5..772b31fd9d8 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -341,5 +341,8 @@ if(WITH_XR_OPENXR)
   add_definitions(-DWITH_XR_OPENXR)
 endif()
 
+if(WITH_POTRACE)
+  add_definitions(-DWITH_POTRACE)
+endif()
 
 blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c
index cc97f6dec94..e3bd7d25806 100644
--- a/source/blender/python/intern/bpy_app_build_options.c
+++ b/source/blender/python/intern/bpy_app_build_options.c
@@ -61,6 +61,7 @@ static PyStructSequence_Field app_builtopts_info_fields[] = {
     {"usd", NULL},
     {"fluid", NULL},
     {"xr_openxr", NULL},
+    {"potrace", NULL},
     {NULL},
 };
 
@@ -282,6 +283,12 @@ static PyObject *make_builtopts_info(void)
   SetObjIncref(Py_False);
 #endif
 
+#ifdef WITH_POTRACE
+  SetObjIncref(Py_True);
+#else
+  SetObjIncref(Py_False);
+#endif
+
 #undef SetObjIncref
 
   return builtopts_info;



More information about the Bf-blender-cvs mailing list