[Bf-blender-cvs] [78b7a1c3a8b] master: PyAPI: disable IMB color management methods for stand-alone mathutils

Campbell Barton noreply at git.blender.org
Wed Sep 21 15:54:58 CEST 2022


Commit: 78b7a1c3a8b982d0081c9071e5b1d90444f902b8
Author: Campbell Barton
Date:   Wed Sep 21 23:52:10 2022 +1000
Branches: master
https://developer.blender.org/rB78b7a1c3a8b982d0081c9071e5b1d90444f902b8

PyAPI: disable IMB color management methods for stand-alone mathutils

Allow building a standalone mathutils without including imbuf.

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

M	source/blender/python/mathutils/mathutils_Color.c

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

diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 955fa4b6f92..a66178baefc 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -14,7 +14,9 @@
 #include "../generic/py_capi_utils.h"
 #include "../generic/python_utildefines.h"
 
-#include "IMB_colormanagement.h"
+#ifndef MATH_STANDALONE
+#  include "IMB_colormanagement.h"
+#endif
 
 #ifndef MATH_STANDALONE
 #  include "BLI_dynstr.h"
@@ -92,6 +94,8 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 /** \name Color Methods: Color Space Conversion
  * \{ */
 
+#ifndef MATH_STANDALONE
+
 PyDoc_STRVAR(Color_from_scene_linear_to_srgb_doc,
              ".. function:: from_scene_linear_to_srgb()\n"
              "\n"
@@ -204,6 +208,8 @@ static PyObject *Color_from_rec709_linear_to_scene_linear(ColorObject *self)
   return Color_CreatePyObject(col, Py_TYPE(self));
 }
 
+#endif /* MATH_STANDALONE */
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
@@ -1050,7 +1056,8 @@ static struct PyMethodDef Color_methods[] = {
     /* base-math methods */
     {"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},
 
-    /* Color-space methods. */
+/* Color-space methods. */
+#ifndef MATH_STANDALONE
     {"from_scene_linear_to_srgb",
      (PyCFunction)Color_from_scene_linear_to_srgb,
      METH_NOARGS,
@@ -1083,6 +1090,8 @@ static struct PyMethodDef Color_methods[] = {
      (PyCFunction)Color_from_rec709_linear_to_scene_linear,
      METH_NOARGS,
      Color_from_rec709_linear_to_scene_linear_doc},
+#endif /* MATH_STANDALONE */
+
     {NULL, NULL, 0, NULL},
 };



More information about the Bf-blender-cvs mailing list