[gegl] gegl-serialize: api hack permitting returning a pointer



commit 523b32c390d1550d7201325994077307ba170234
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Nov 29 03:22:20 2018 +0100

    gegl-serialize: api hack permitting returning a pointer
    
    Allow inserting a return pointer using the error pointer, this to be used as a
    hack for the commandline permitting specifying a sink op as last member of
    chain.

 gegl/gegl-serialize.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index fb1d89dc5..0c6843adc 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -103,6 +103,14 @@ gegl_create_chain_argv (char      **ops,
   GHashTable *ht = NULL;
   GeglPath   *path = NULL;
   GString    *string = NULL;
+  GeglNode **ret_sinkp = NULL;
+
+  if (error && *error)
+  {
+    GeglNode **an = (void*)error;
+    ret_sinkp = *an;
+    *error = NULL;
+  }
 
   remove_in_betweens (start, proxy);
 
@@ -110,6 +118,8 @@ gegl_create_chain_argv (char      **ops,
 
   ht = g_hash_table_new (g_str_hash, g_str_equal);
 
+
+
   while (*arg)
     {
       if (in_keyframes)
@@ -627,10 +637,17 @@ gegl_create_chain_argv (char      **ops,
                                                proxy), "operation",
                                              level_op[level], NULL);
 
-                  if (iter[level] && gegl_node_has_pad (new, "input"))
-                    gegl_node_link_many (iter[level], new, proxy, NULL);
+                  if (gegl_node_has_pad (new, "output"))
+                  {
+                    if (iter[level] && gegl_node_has_pad (new, "input"))
+                      gegl_node_link_many (iter[level], new, proxy, NULL);
+                    else
+                      gegl_node_link_many (new, proxy, NULL);
+                  }
                   else
-                    gegl_node_link_many (new, proxy, NULL);
+                  {
+                    gegl_node_link_many (iter[level], new, NULL);
+                  }
                   iter[level] = new;
                 }
               else if (error)
@@ -695,7 +712,17 @@ gegl_create_chain_argv (char      **ops,
 
   g_free (prop);
   g_hash_table_unref (ht);
-  gegl_node_link_many (iter[level], proxy, NULL);
+
+
+  if (gegl_node_has_pad (iter[level], "output"))
+    gegl_node_link_many (iter[level], proxy, NULL);
+  else
+  {
+    if (ret_sinkp)
+    {
+      *ret_sinkp = iter[level];
+    }
+  }
 }
 
 void


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