[gimp] Adds a layer-group aware layers property to Layer objects



commit 2525e30429fd8634126ea9e0dd553fc0e1b4a0ed
Author: João S. O. Bueno <gwidion mpc com br>
Date:   Fri Apr 23 00:55:36 2010 -0300

    Adds a layer-group aware layers property to Layer objects

 plug-ins/pygimp/pygimp-drawable.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c
index 1a04470..fa6c68f 100644
--- a/plug-ins/pygimp/pygimp-drawable.c
+++ b/plug-ins/pygimp/pygimp-drawable.c
@@ -1704,6 +1704,25 @@ lay_set_preserve_trans(PyGimpLayer *self, PyObject *value, void *closure)
     return lay_set_lock_alpha(self, value, closure);
 }
 
+static PyObject *
+lay_get_layers(PyGimpLayer *self, void *closure)
+{
+    gint32 *layers;
+    gint n_layers, i;
+    PyObject *ret;
+
+    layers = gimp_layer_group_get_layers(self->ID, &n_layers);
+
+    ret = PyList_New(n_layers);
+
+    for (i = 0; i < n_layers; i++)
+        PyList_SetItem(ret, i, pygimp_layer_new(layers[i]));
+
+    g_free(layers);
+
+    return ret;
+}
+
 static PyGetSetDef lay_getsets[] = {
     { "is_floating_sel", (getter)lay_get_is_floating_sel, (setter)0 },
     { "mask", (getter)lay_get_mask, (setter)0 },
@@ -1715,6 +1734,7 @@ static PyGetSetDef lay_getsets[] = {
     { "show_mask", (getter)lay_get_show_mask, (setter)lay_set_show_mask },
     { "preserve_trans", (getter)lay_get_preserve_trans,
       (setter)lay_set_preserve_trans },
+    { "layers", (getter)lay_get_layers, (setter)0 },
     { NULL, (getter)0, (setter)0 }
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]