[gegl] Made gegl_node_get_producer() return the graph node of meta-ops
- From: Øyvind Kolås <ok src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gegl] Made gegl_node_get_producer() return the graph node of meta-ops
- Date: Sun, 22 Nov 2009 21:57:24 +0000 (UTC)
commit 9a33312122c116cc3549f886bec05579dd3d726a
Author: �yvind Kolås <pippin gimp org>
Date: Sun Nov 22 21:22:02 2009 +0000
Made gegl_node_get_producer() return the graph node of meta-ops
It was returning the proxy-nop representing the output pad, this
can seldomly be what is expected.
gegl/graph/gegl-node.c | 50 ++++++++++++++++++++++++++++++++---------------
1 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 1aad0bc..bf8dcf1 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1644,27 +1644,45 @@ gegl_node_get_producer (GeglNode *node,
gchar *pad_name,
gchar **output_pad_name)
{
- GeglPad *pad;
+ GeglNode *ret;
+ gpointer pad;
- g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
- g_return_val_if_fail (pad_name != NULL, NULL);
+ /* XXX: there should be public API to test if a node is
+ * really a graph. So that the user of the API knows
+ * the internals can be reached through the proxy nops
+ */
+ if (node->is_graph)
+ node = gegl_node_get_input_proxy (node, "input");
pad = gegl_node_get_pad (node, pad_name);
- if (pad &&
- gegl_pad_is_input (pad) &&
- gegl_pad_get_num_connections (pad) == 1)
- {
- GeglConnection *connection = g_slist_nth_data (pad->connections, 0);
+ if (!pad)
+ return NULL;
+ pad = gegl_pad_get_connected_to (pad);
+ if (!pad)
+ return NULL;
+ ret = gegl_pad_get_node (pad);
- if (output_pad_name)
- {
- GeglPad *pad = gegl_connection_get_source_pad (connection);
- *output_pad_name = g_strdup (gegl_pad_get_name (pad));
- }
- return gegl_connection_get_source_node (connection);
- }
- return NULL;
+ if(ret)
+ {
+ const gchar *name;
+ name = gegl_node_get_name (ret);
+ if (name && !strcmp (name, "proxynop-output"))
+ {
+ ret = g_object_get_data (G_OBJECT (ret), "graph");
+ /* XXX: needs testing whether this returns the correct value
+ * for non "output" output pads.
+ */
+ if (output_pad_name)
+ *output_pad_name = g_strdup (gegl_pad_get_name (pad));
+ }
+ else
+ {
+ if (output_pad_name)
+ *output_pad_name = g_strdup (gegl_pad_get_name (pad));
+ }
+ }
+ return ret;
}
GeglRectangle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]