GNOME Bugzilla – Bug 760784
gegl-xml: Support serializing a segment of a graph
Last modified: 2016-01-20 12:15:19 UTC
Serializing a node with gegl_node_to_xml will serialize all the nodes contributing data to it all the way down to the initial source nodes. An application might want to serialize only a segment of the graph, instead of going all the way down to the sources, because it is only interested in the nodes that are part of the non-destructive editing pipeline. Moreover, if the source of a graph is a gegl:buffer-source, gegl_node_to_xml will simply fail because it is unable to create a textual representation of the GeglBuffer instance. It is quite possible that the "main" graph in a non-destructive editor originates from a gegl:buffer-source because it can use a separate throwaway graph (gegl:load -> gegl:buffer-sink) in a thread to do the actual I/O asynchronously, and then use the buffer to perform the edits in the main thread. This is what gnome-photos and, to some extent, mrg-ui does. Therefore, I think it would be convenient to have an API that can serialize only a segment of a graph. One workaround for the gegl:buffer-source problem (used by both mrg-ui and gnome-photos) is to disconnect the source so that the serialization doesn't fail. However that changes the connectivity of the graph and needlessly invalidates caches, which I want to avoid.
Created attachment 319271 [details] [review] gegl-xml: Add a comment for clarification
Created attachment 319272 [details] [review] gegl-xml: Support serializing a segment of a graph
Created attachment 319273 [details] [review] tests: Test serialization of a graph segment
Pushed to master after some discussion on #gegl on GIMPNet: 17:58 <rishi> pippin: mitch: Any opinion on https://bugzilla.gnome.org/show_bug.cgi?id=760784 ? 17:59 <mitch> rishi: i think you mistake me for somebody who has a clue about gegl internals :) 17:59 <rishi> mitch: No, the use case. 17:59 <mitch> i'm so busy on gimp i hardly get to check how that beast (particularly graph eval) works internally 18:00 <mitch> oh the use case 18:00 <mitch> sure, looking 18:00 <mitch> rishi: i absolutely agree, gimp uses a very dynamic graph that is rearranged all the time, if we used gegl-xml we would certainly want that 18:01 <mitch> in fact, i think every half-complex app would need it ... 07:54 <rishi> pippin: So, what is your opinion on the gegl-xml patch? Code freeze is approaching so time is running out for me. 10:14 <pippin> rishi: I am furnishing a new apartment these days/weeks, so very limited time 10:15 <pippin> rishi: I suggest pushing to master, and then I can check if the gegl ui (mrg-ui) likes the change or not ... 12:07 <rishi> pippin: Ok. Pushed. 12:07 <rishi> Re: mrg-ui ... 12:08 <rishi> Currently it disconnects the gegl:buffer-source, adds a gegl:load, serializes, then removes the load and restores the buffer-source. 12:08 <rishi> I think you can do the trick by always having the gegl:load after the buffer-source, but marking it as a passthrough node. 12:09 <rishi> And then only serialize the segment till the load. 12:09 <rishi> That should do the trick, I think.
commit 1e5e68ca635915495d1aa99757f4b664f5cb44c9 Author: Debarshi Ray <debarshir@gnome.org> Date: Mon Jan 18 14:59:26 2016 +0100 tests: Test serialization of a graph segment https://bugzilla.gnome.org/show_bug.cgi?id=760784 commit 8f128878bb733c06fb865f200c43713386edeed7 Author: Debarshi Ray <debarshir@gnome.org> Date: Mon Jan 18 14:58:19 2016 +0100 gegl-xml: Support serializing a segment of a graph https://bugzilla.gnome.org/show_bug.cgi?id=760784 commit 30de126519139bd93d5edd4bd03423434ee49b3c Author: Debarshi Ray <debarshir@gnome.org> Date: Mon Jan 18 14:17:53 2016 +0100 gegl-xml: Add a comment for clarification https://bugzilla.gnome.org/show_bug.cgi?id=760784