[gegl] gegl: serialize opi per op when storing data
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: serialize opi per op when storing data
- Date: Wed, 29 Mar 2017 12:57:46 +0000 (UTC)
commit 91f34a5e1a214b500b4c395315e272f6c9be31f4
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Mar 26 15:38:22 2017 +0200
gegl: serialize opi per op when storing data
bin/gegl.c | 2 +-
bin/ui.c | 2 +-
gegl/gegl-serialize.c | 7 +++++++
gegl/graph/gegl-node.c | 11 +++++++++++
gegl/graph/gegl-node.h | 2 ++
5 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/bin/gegl.c b/bin/gegl.c
index d6cdc40..5553efe 100644
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -221,7 +221,7 @@ main (gint argc,
{
fprintf (stderr, "%s\n", gegl_serialize (iter,
gegl_node_get_producer (proxy, "input", NULL), "/",
- GEGL_SERIALIZE_TRIM_DEFAULTS));
+ GEGL_SERIALIZE_TRIM_DEFAULTS|GEGL_SERIALIZE_VERSION));
}
}
}
diff --git a/bin/ui.c b/bin/ui.c
index f148611..cc082c9 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -1938,7 +1938,7 @@ static void save_cb (MrgEvent *event, void *data1, void *data2)
gegl_node_link_many (load, o->source, NULL);
{
char *containing_path = get_path_parent (o->path);
- serialized = gegl_serialize (NULL, o->sink, containing_path, GEGL_SERIALIZE_TRIM_DEFAULTS);
+ serialized = gegl_serialize (NULL, o->sink, containing_path,
GEGL_SERIALIZE_TRIM_DEFAULTS|GEGL_SERIALIZE_VERSION);
free (containing_path);
}
gegl_node_remove_child (o->gegl, load);
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index a258a91..1c79397 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -160,6 +160,12 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
else
g_warning ("unknown id '%s'", value);
}
+ else if (!strcmp (key, "opi"))
+ {
+ /* should do check, and at least warn if incompatible,
+ for now just ignore */
+ g_print ("ignoring opi='%s'", value);
+ }
else
{
unsigned int n_props = 0;
@@ -558,6 +564,7 @@ static gchar *gegl_serialize2 (GeglNode *start, GeglNode *end, const char *basep
{
GString *s2 = g_string_new ("");
g_string_append_printf (s2, " %s", gegl_node_get_operation (iter));
+ g_string_append_printf (s2, " opi=%s", gegl_node_get_op_version (iter));
{
gint i;
guint n_properties;
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 87d4cc5..ba6fd9a 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -2214,3 +2214,14 @@ void gegl_node_progress (GeglNode *node,
g_idle_add (delayed_emission, closure);
}
}
+
+const char *gegl_node_get_op_version (GeglNode *node)
+{
+ const gchar *ret = NULL;
+ g_return_val_if_fail (GEGL_IS_NODE (node), "error");
+
+ ret = gegl_operation_get_key (gegl_node_get_operation(node), "op-version");
+ if (!ret)
+ ret = "0:0";
+ return ret;
+}
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index 767745e..e93a61d 100644
--- a/gegl/graph/gegl-node.h
+++ b/gegl/graph/gegl-node.h
@@ -694,6 +694,8 @@ void gegl_node_set_passthrough (GeglNode *node,
void gegl_node_progress (GeglNode *node, gdouble progress, gchar *message);
+const char *gegl_node_get_op_version (GeglNode *node);
+
G_END_DECLS
#endif /* __GEGL_NODE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]