Accessing Inkscape document data as it is generated
Hello all,
Haven't posted a message here in a long time -- hope things are going well!
I've received a message asking about the best way to access Inkscape's document data as it's changed. His project involves serving document data from Inkscape to locally-running programs, for which he plans to use DBus. The questioner prefers to remain anonymous for now.
My initial response recommended implementing Inkscape::UndoStackObserver, much as Inkboard did, as it's an easy way to obtain a stream of transactions on the document. However, questioner's concern with this approach was that listening for changes on the undo stack wouldn't capture intermediate states of actions, e.g. motion along a path. He brought up another possibility, which was to send changes in batches at short intervals (using, say, Inkscape::XML::NodeObserver).
I'm no longer familiar enough with the Inkscape codebase to give an opinion on how well this would work, nor do I know if there's been any changes in the past few years that would make this sort of thing easier. Can anyone help out?
I can offer clarifications as necessary.
Thanks,
- David
2010/9/16 David Yip <yipdw1@...400...>:
My initial response recommended implementing Inkscape::UndoStackObserver, much as Inkboard did, as it's an easy way to obtain a stream of transactions on the document. However, questioner's concern with this approach was that listening for changes on the undo stack wouldn't capture intermediate states of actions, e.g. motion along a path. He brought up another possibility, which was to send changes in batches at short intervals (using, say, Inkscape::XML::NodeObserver).
You are not supposed to see the intermediate states, because they are not consistent. This is the whole point of the XML transaction stuff.
When the user moves something along a path, the XML is not updated until he finishes the drag. This is done for performance reasons. Right now there is no way to listen to SP layer events.
Regards, Krzysztof
On Thu, 2010-09-16 at 02:12 -0500, David Yip wrote:
Haven't posted a message here in a long time -- hope things are going well!
Nice to hear from you again!
I've received a message asking about the best way to access Inkscape's document data as it's changed. His project involves serving document data from Inkscape to locally-running programs, for which he plans to use DBus. The questioner prefers to remain anonymous for now.
My initial response recommended implementing Inkscape::UndoStackObserver, much as Inkboard did, as it's an easy way to obtain a stream of transactions on the document. However, questioner's concern with this approach was that listening for changes on the undo stack wouldn't capture intermediate states of actions, e.g. motion along a path. He brought up another possibility, which was to send changes in batches at short intervals (using, say, Inkscape::XML::NodeObserver).
While I think Krzysztof's comment makes sense, it does talk about how complex it would be to handle that data. And it won't ever really be in a "stable state" so you'd have to track Inkscape releases and commits very closely.
Also, I'd say that DBus is probably the wrong technology here for that data. DBus messages aren't cheap to build and send, and there'd probably be too many.
--Ted
participants (3)
-
David Yip
-
Krzysztof Kosiński
-
Ted Gould