[gimp] Fix PF_LAYER always being passed as a Layer, even if object is a LayerGroup



commit 59417ca4b67e56ce33258cb0034b8405138fe243
Author: Joao S. O. Bueno <gwidion gmail com>
Date:   Tue Feb 10 11:55:30 2015 -0200

    Fix PF_LAYER always being passed as a Layer, even if object is a LayerGroup

 plug-ins/pygimp/pygimp-drawable.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c
index ba11327..a0efdbb 100644
--- a/plug-ins/pygimp/pygimp-drawable.c
+++ b/plug-ins/pygimp/pygimp-drawable.c
@@ -1904,14 +1904,20 @@ pygimp_layer_new(gint32 ID)
     PyGimpLayer *self;
 
     if (!gimp_item_is_valid(ID) || !gimp_item_is_layer(ID)) {
-       Py_INCREF(Py_None);
-       return Py_None;
+        Py_INCREF(Py_None);
+        return Py_None;
     }
 
-    self = PyObject_NEW(PyGimpLayer, &PyGimpLayer_Type);
+
+    if (gimp_item_is_group(ID)) {
+        self = PyObject_NEW(PyGimpGroupLayer, &PyGimpGroupLayer_Type);
+    }
+    else {
+        self = PyObject_NEW(PyGimpLayer, &PyGimpLayer_Type);
+    }
 
     if (self == NULL)
-       return NULL;
+        return NULL;
 
     self->ID = ID;
     self->drawable = NULL;


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