diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-23 02:36:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-23 02:56:46 +0300 |
commit | 73a6fcfa80020615f081b75aeb6a6ed90405097a (patch) | |
tree | 9ac5786ba306179849f88e8e1f55e515746cb74a | |
parent | 381a27490925675a00b54814032c0caf22cb4b4e (diff) |
ImBuf: add planes, channels attributes
D5857 by @cmbasnett
-rw-r--r-- | source/blender/python/generic/imbuf_py_api.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 */ }; |