Dmitriy - the "perspective" extension shows how you can save out a selected element and call inkscape on it to do work (in this case find bounds) and get values back - all without restarting inkscape. Hope it helps you.
On 4/27/2016 5:45 AM, Dmitry Zhulanov wrote:
Martin, thank you for you reply,
Im going to write the extension, and I wish to know which extension is best for the begin with?
Using extensions I want write yaml config input extension, wich will reads list of .svg filenames, then looking svg documents for nodes with attributes "onclick" and "sprite" and save all of them to separated svg files.
Here is the task wich I'd like to solve:
I have about 20 layouts .svg files for processing. Also I have 3 animations. Every animation have atlas .svg file with sprite elements. Usaly I doing handling of game data this way:
I run in batch mode, without any user interaction this small generated script for every button state for every button in every layout, and for every element of every atlas file:
#!/bin/bash copy layout.svg button.svg inkscape --select="button" --verb=EditInvert --verb=EditDelete \ --verb=FitCanvasToDrawing --verb=FileSave --verb=FileQuit button.svg
Before the processing I have buttons placed on layouts .svg and animation elements placed on altases .svg. After processing, I have all buttons and elements in a separated files with canvases fited to its sizes.
Current process takes about 3 or 5 minutes, because it must start new copy of inkscape for every element. My game is growing so full processing taking more and more time. Processing must be done without user interation, its ok to show gui while processing, but its important for batch mode to finish inkscape app when proccess finished.
Best regards, Dmitry Zhulanov
26.04.2016 4:02, Martin Owens пишет:
Hi Dmitry,
This looks really interesting (and there's quite a few files there too). For this kind of output where it's not an svg file, we've typically recommended writing python extensions as they're easier to include in builds, release new versions out side of the inkscape release and support.
Given that you've already got this solution working for your own needs. I on't suppose you'd be interested in translating it to python? There's already a yaml library available and inky.py extension module provides access to all the svg element tree.
But I understand this is asking a lot considering all the work you've put in to the C version in your branch.
Best Regards, Martin Owens
On Tue, 2016-04-26 at 01:32 +0600, Dmitry Zhulanov wrote:
Hi, all!
Im a game developer and using the inkscape for layouting my game screens. Loading_screen_layout.svg one of them. It have g with id pause_button and rect with id sandclock_bound which I use for animation placement.
The verbs feature which inkscape already have is have some limitations. The MAX_PATH for example. Also some verbs required user interactions, so I need some eXtended verbs here.
Using python script I have load layout as xml and collecting element-id's of interactive elements with "onclick" attribute, for example. Using this element-id list I generate .yaml, which is some sort of batch file. Here is the .yaml file which is used with Inkscape to clean up layout and put button image in separated file with pause_button.svg filename. Also I count undoable actions to restore state generating verb EditUndo.
command: inkscape -B loading_screen_layout.yaml
----------- loading_screen_layout.yaml --------- run: - xverb-id: XFileOpen, loading_screen_layout.svg - xverb-id: XUndoLabel, fresh_document - xverb-id: XSelectElement, pause_button - verb-id: EditInvert - verb-id: EditDelete - verb-id: FitCanvasToDrawing - xverb-id: XFileSaveAs, pause_button.svg # save with stupid name - xverb-id: UndoToLabel, fresh_document
- xverb-id: XSelectElement, pause_button - verb-id: EditDelete - xverb-id: XUndoLabel, fresh_document - xverb-id: XSelectElement, sandclock_bounds - verb-id: EditDelete - xverb-id: XUndoLabel, fresh_document - xverb-id: XFileSaveAs, loading_screen_layout_release.svg # save
with stupid name - verb-id: FileQuit ------------------ CUT HERE --------------------
I guess you can get readonly access on my launchpad page. https://code.launchpad.net/~dmitry-zhulanov/+junk/inkscape-xverbs
Code is tested with mingw+windows7+VS2010 sdk.
If you would like to merge the feature, I will clean up code to conforming code style, remove printf's & so on
Any help or advice are appreciated! P.S. sorry for my bad english :)
Best Regards, Dmitry Zhulanov
Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
No virus found in this message. Checked by AVG - www.avg.com Version: 2016.0.7596 / Virus Database: 4563/12108 - Release Date: 04/26/16