On Sun, 2007-05-06 at 08:44 +0000, Gerrit . wrote:
Hello, I would like to use Inkscape to draw animation frames. I have set up every frame as a separate layer. Now I'd like to be able to "flip" between layers for quickly checking the animation.
Interesting.
This means that there would be an "up" key which makes the next layer active and visible and all others invisible, and a "down" key which makes the previous layer active and visible and all others invisible.
This might be possible from the technical perspective, but I don't think that "up" and "down" are good keys for it.
My best bet was that I could change the active layer and visibility in a Python script with the attributes inkscape:current-layer="layerX" and style="display:none". Would that work? How could I trigger a script with a single keystroke?
All Effects can be set to keystrokes, the same as any other key mapping as all effects have Verb IDs. So, when you define a script as an effect you can add it to your keymap directly.
And would it be an efficient way of implementing this? On Aaron Spike's site it said that the entire SVG is written to a file when it's passed to Python. However, I'd need to flip frames back and forth every second if I want to check the animation. Also, does Inkscape parse and reconstruct the entire document when Python has changed something, or is something like a diff applied?
Unfortunately it is pretty much a full replacement today. Plus with serializing everything into files, it really isn't high performance. I'm not saying it's impossible with enough hardware, but I don't think using a script will work for you today.
Are there other easy ways of implementing this flipping in the C++ code?
Any inputs on this will be appreciated
Yes, there are a class of effects called "internal" effects. Basically they are effects that are compiled in, but use the effects interfaces. You just need to subclass the Inkscape::Extension::Implementation::Implementation object and implement the functions you're interested in (probably effect). You should look at blur and grid for examples.
I'd be happy to help with more questions as you get to them.
--Ted