[gimp] plug-ins: in file-psd, fix active layer selection during loading



commit 3cfa35ec073231d51f32051dab2edb17ee69de45
Author: Ell <ell_se yahoo com>
Date:   Mon Sep 4 13:51:26 2017 -0400

    plug-ins: in file-psd, fix active layer selection during loading

 plug-ins/file-psd/psd-load.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 3080d71..c2a189b 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1473,6 +1473,12 @@ add_layers (gint32     image_id,
                   gimp_image_insert_layer (image_id, layer_id, parent_group_id, 0);
                 }
 
+              /* Set the active layer */
+              if (lidx == img_a->layer_state)
+                {
+                  gimp_image_set_active_layer (image_id, layer_id);
+                }
+
               /* Set the layer data */
               if (lyr_a[lidx]->group_type == 0)
                 {
@@ -1661,12 +1667,9 @@ add_merged_image (gint32     image_id,
   gint32                layer_size;
   gint32                layer_id = -1;
   gint32                channel_id = -1;
-  gint32                active_layer;
   gint16                alpha_opacity;
-  gint                 *lyr_lst;
   gint                  cidx;                  /* Channel index */
   gint                  rowi;                  /* Row index */
-  gint                  lyr_count;
   gint                  offset;
   gint                  i;
   gboolean              alpha_visible;
@@ -1926,15 +1929,6 @@ add_merged_image (gint32     image_id,
         }
     }
 
-  /* Set active layer */
-  lyr_lst = gimp_image_get_layers (image_id, &lyr_count);
-  if (img_a->layer_state + 1 > lyr_count ||
-      img_a->layer_state + 1 < 0)
-    img_a->layer_state = 0;
-  active_layer = lyr_lst[lyr_count - img_a->layer_state - 1];
-  gimp_image_set_active_layer (image_id, active_layer);
-  g_free (lyr_lst);
-
   /* FIXME gimp image tattoo state */
 
   return 0;


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