[gegl] serialize: remove existing in-betweens when creating chain



commit e6611ffe7131143103421939f5396c314d3c8648
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Apr 5 19:29:04 2016 +0200

    serialize: remove existing in-betweens when creating chain

 gegl/gegl-serialize.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index f49a56a..7e1c774 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -23,6 +23,27 @@
 //#define make_rel(strv) (g_strtod (strv, NULL) * gegl_node_get_bounding_box (iter[0]).height)
 #define make_rel(strv) (g_strtod (strv, NULL) * rel_dim)
 
+static void remove_in_betweens (GeglNode *nop_raw,
+                                GeglNode *nop_transformed)
+{
+  GeglNode *iter =  nop_raw;
+  GList *collect = NULL;
+  while (iter && iter != nop_transformed)
+    {
+      GeglNode **nodes = NULL;
+      int count = gegl_node_get_consumers (iter, "output", &nodes, NULL);
+      if (count) iter = nodes[0];
+      g_free (nodes);
+      if (iter && iter != nop_transformed)
+        collect = g_list_append (collect, iter);
+    }
+  while (collect)
+    {
+      g_object_unref (collect->data);
+      collect = g_list_remove (collect, collect->data);
+    }
+}
+
 void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, double time, int rel_dim, GError 
**error)
 {
   GeglNode   *iter[10] = {start, NULL};
@@ -36,6 +57,8 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
   GHashTable *ht = NULL;
   GeglCurve  *curve = NULL;
 
+  remove_in_betweens (start, proxy);
+
   level_op[level] = *arg;
  
   ht = g_hash_table_new (g_str_hash, g_str_equal);
@@ -105,7 +128,7 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
           char *key = g_strdup (*arg);
           char *value = strchr (key, '=') + 1;
           value[-1] = '\0';
-          curve = gegl_curve_new (-1000.0, 1000.0);
+          curve = gegl_curve_new (0.0, 1.0);
           in_keyframes = 1;
           if (prop)
             g_free (prop);


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