[gimp/wip/animation: 281/373] plug-ins: handling deleted layers.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/animation: 281/373] plug-ins: handling deleted layers.
- Date: Sat, 7 Oct 2017 02:18:20 +0000 (UTC)
commit b58c607d1237ef726dff7940d573f6cae7ef36ec
Author: Jehan <jehan girinstud io>
Date: Wed Nov 16 04:34:41 2016 +0100
plug-ins: handling deleted layers.
WIP: maybe I should just gray it or something? Allowing to hit "Undo"?
.../animation-play/core/animation-celanimation.c | 9 ++++++++-
plug-ins/animation-play/widgets/animation-xsheet.c | 20 ++++++++++++++++++--
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-celanimation.c
b/plug-ins/animation-play/core/animation-celanimation.c
index ee9156a..7bd4c54 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -1222,7 +1222,14 @@ animation_cel_animation_cache (AnimationCelAnimation *animation,
layer = gimp_image_get_layer_by_tattoo (image_id,
cache->composition[i]);
- source = gimp_drawable_get_buffer (layer);
+ if (layer > 0)
+ source = gimp_drawable_get_buffer (layer);
+ if (layer <= 0 || ! source)
+ {
+ g_warning ("A layer used for frame %d has been removed. Ignoring.",
+ pos);
+ continue;
+ }
gimp_drawable_offsets (layer, &layer_offx, &layer_offy);
intermediate = normal_blend (preview_width, preview_height,
backdrop, 1.0, 0, 0,
diff --git a/plug-ins/animation-play/widgets/animation-xsheet.c
b/plug-ins/animation-play/widgets/animation-xsheet.c
index 0616d50..ad88a42 100755
--- a/plug-ins/animation-play/widgets/animation-xsheet.c
+++ b/plug-ins/animation-play/widgets/animation-xsheet.c
@@ -1528,7 +1528,7 @@ animation_xsheet_rename_cel (AnimationXSheet *xsheet,
else if (layers)
{
const gchar *track_title;
- gchar *layer_title;
+ gchar *layer_title = NULL;
gint32 image_id;
gint32 layer;
@@ -1537,7 +1537,23 @@ animation_xsheet_rename_cel (AnimationXSheet *xsheet,
image_id = animation_get_image_id (ANIMATION (xsheet->priv->animation));
layer = gimp_image_get_layer_by_tattoo (image_id,
GPOINTER_TO_INT (layers->data));
- layer_title = gimp_item_get_name (layer);
+ if (layer <= 0)
+ {
+ g_warning ("Removing invalid layer from cell: level %d, frame %d.",
+ GPOINTER_TO_INT (track_num),
+ GPOINTER_TO_INT (position));
+ /* Update the layer list on this cell. */
+ animation_cel_animation_set_layers (xsheet->priv->animation,
+ GPOINTER_TO_INT (track_num),
+ GPOINTER_TO_INT (position),
+ NULL);
+ animation_xsheet_rename_cel (xsheet, cel, recursively);
+ return;
+ }
+ else
+ {
+ layer_title = gimp_item_get_name (layer);
+ }
if (g_strcmp0 (layer_title, track_title) == 0)
{
/* If the track and the layer have exactly the same name. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]