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



commit 4165ba2a0397cf0ba73c0462d3a3d961c2403c2e
Author: Ell <ell_se yahoo com>
Date:   Sun Oct 22 12:24:52 2017 -0400

    plug-ins: in file-psd, fix active layer selection upon loading
    
    When loading a PSD, set the active layer after adding all the
    layers to the image, instead of at the time of its creation, since
    the active layer may change when adding subsequent layers.

 plug-ins/file-psd/psd-load.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 198a9e8..eace8be 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1129,6 +1129,7 @@ add_layers (gint32     image_id,
   gint32                layer_size;
   gint32                layer_id = -1;
   gint32                mask_id = -1;
+  gint32                active_layer_id = -1;
   gint                  lidx;                  /* Layer index */
   gint                  cidx;                  /* Channel index */
   gint                  rowi;                  /* Row index */
@@ -1479,10 +1480,10 @@ add_layers (gint32     image_id,
                   gimp_image_insert_layer (image_id, layer_id, parent_group_id, 0);
                 }
 
-              /* Set the active layer */
+              /* Remember the active layer ID */
               if (lidx == img_a->layer_state)
                 {
-                  gimp_image_set_active_layer (image_id, layer_id);
+                  active_layer_id = layer_id;
                 }
 
               /* Set the layer data */
@@ -1639,6 +1640,10 @@ add_layers (gint32     image_id,
   g_free (lyr_a);
   g_array_free (parent_group_stack, FALSE);
 
+  /* Set the active layer */
+  if (active_layer_id >= 0)
+    gimp_image_set_active_layer (image_id, active_layer_id);
+
   return 0;
 }
 


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