[gegl/meta-json: 8/18] meta-json: Can connect nodes of subgraph



commit 7da609c76ae62ec4306c9884dbb83b6124425e67
Author: Jon Nordby <jononor gmail com>
Date:   Sun Dec 28 19:40:21 2014 +0100

    meta-json: Can connect nodes of subgraph

 operations/core/json.c           |   10 +++++++---
 operations/json/dropshadow2.fbp  |    2 +-
 operations/json/dropshadow2.json |    3 +++
 3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/operations/core/json.c b/operations/core/json.c
index c8246b0..1dc0ca2 100644
--- a/operations/core/json.c
+++ b/operations/core/json.c
@@ -189,7 +189,6 @@ attach (GeglOperation *operation)
   }
   g_list_free(process_names);
 
-/*
   // Connections
   JsonArray *connections = json_object_get_array_member(root, "connections");
   g_assert(connections);
@@ -198,6 +197,8 @@ attach (GeglOperation *operation)
       JsonObject *tgt = json_object_get_object_member(conn, "tgt");
       const gchar *tgt_proc = json_object_get_string_member(tgt, "process");
       const gchar *tgt_port = json_object_get_string_member(tgt, "port");
+      GeglNode *tgt_node = g_hash_table_lookup(self->nodes, tgt_proc);
+      g_assert(tgt_node);
 
       JsonNode *srcnode = json_object_get_member(conn, "src");
       if (srcnode) {
@@ -205,8 +206,12 @@ attach (GeglOperation *operation)
           JsonObject *src = json_object_get_object_member(conn, "src");
           const gchar *src_proc = json_object_get_string_member(src, "process");
           const gchar *src_port = json_object_get_string_member(src, "port");
+          GeglNode *src_node = g_hash_table_lookup(self->nodes, src_proc);
+
+          g_print("connecting %s,%s to %s,%s\n", src_proc, src_port, tgt_port, tgt_proc);
+          g_assert(src_node);
 
-          gegl_node_connect_from (over, "aux", input, "output");
+          gegl_node_connect_to (src_node, src_port, tgt_node, tgt_port);
       } else {
           // IIP
           JsonNode *datanode = json_object_get_member(conn, "data");
@@ -217,7 +222,6 @@ attach (GeglOperation *operation)
           g_value_unset(&value);
       }
   }
-*/
 
   // TODO: go over the exported ports and redirect them
   // gegl_operation_meta_redirect (operation, "radius", blur, "std-dev-x");
diff --git a/operations/json/dropshadow2.fbp b/operations/json/dropshadow2.fbp
index 6005dca..0d8fb9e 100644
--- a/operations/json/dropshadow2.fbp
+++ b/operations/json/dropshadow2.fbp
@@ -13,7 +13,7 @@ OUTPORT=over.OUTPUT:OUTPUT
 
 input(gegl/nop) OUTPUT -> INPUT darken(gegl/src_in) OUTPUT -> INPUT blur(gegl/gaussian_blur) OUTPUT -> INPUT 
opacity(gegl/opacity) OUTPUT -> INPUT translate(gegl/translate) OUTPUT -> INPUT over(gegl/over)
 input OUTPUT -> AUX over
-color OUTPUT -> AUX darken
+color(gegl/color) OUTPUT -> AUX darken
 
 'rgba(0.0, 0.0, 0.0, 0.0)' -> VALUE color
 '0.5' -> VALUE opacity
diff --git a/operations/json/dropshadow2.json b/operations/json/dropshadow2.json
index 6bf2aec..9f4846a 100644
--- a/operations/json/dropshadow2.json
+++ b/operations/json/dropshadow2.json
@@ -18,6 +18,9 @@
     "opacity": {
       "component": "gegl/opacity"
     },
+    "color": {
+      "component": "gegl/color"
+    },
     "translate": {
       "component": "gegl/translate"
     },


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