[Bf-blender-cvs] [fbd0c6f5f8c] temp-lanpr-cleanup: ImBuf: add planes, channels attributes

Campbell Barton noreply at git.blender.org
Wed Sep 25 03:50:37 CEST 2019


Commit: fbd0c6f5f8ce48e7f959a40dec3d3e2107f1e8c8
Author: Campbell Barton
Date:   Mon Sep 23 09:36:20 2019 +1000
Branches: temp-lanpr-cleanup
https://developer.blender.org/rBfbd0c6f5f8ce48e7f959a40dec3d3e2107f1e8c8

ImBuf: add planes, channels attributes

D5857 by @cmbasnett

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

M	source/blender/python/generic/imbuf_py_api.c

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

diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c
index 0b595987d73..593145476ad 100644
--- a/source/blender/python/generic/imbuf_py_api.c
+++ b/source/blender/python/generic/imbuf_py_api.c
@@ -256,6 +256,22 @@ static int py_imbuf_filepath_set(Py_ImBuf *self, PyObject *value, void *UNUSED(c
   return 0;
 }
 
+PyDoc_STRVAR(py_imbuf_planes_doc, "Number of bits associated with this image.\n\n:type: int");
+static PyObject *py_imbuf_planes_get(Py_ImBuf *self, void *UNUSED(closure))
+{
+  PY_IMBUF_CHECK_OBJ(self);
+  ImBuf *imbuf = self->ibuf;
+  return PyLong_FromLong(imbuf->planes);
+}
+
+PyDoc_STRVAR(py_imbuf_channels_doc, "Number of bit-planes.\n\n:type: int");
+static PyObject *py_imbuf_channels_get(Py_ImBuf *self, void *UNUSED(closure))
+{
+  PY_IMBUF_CHECK_OBJ(self);
+  ImBuf *imbuf = self->ibuf;
+  return PyLong_FromLong(imbuf->channels);
+}
+
 static PyGetSetDef Py_ImBuf_getseters[] = {
     {(char *)"size", (getter)py_imbuf_size_get, (setter)NULL, (char *)py_imbuf_size_doc, NULL},
     {(char *)"ppm",
@@ -268,6 +284,8 @@ static PyGetSetDef Py_ImBuf_getseters[] = {
      (setter)py_imbuf_filepath_set,
      (char *)py_imbuf_filepath_doc,
      NULL},
+    {(char *)"planes", (getter)py_imbuf_planes_get, NULL, (char *)py_imbuf_planes_doc, NULL},
+    {(char *)"channels", (getter)py_imbuf_channels_get, NULL, (char *)py_imbuf_channels_doc, NULL},
     {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
 };



More information about the Bf-blender-cvs mailing list