It looks my English is very bad :)
I want to use inkscape "verbs" from command line without any user interation at all. Every GUI menu item of inkscape have "verb" They listed in verbs.cpp:2420 Verb *Verb::_base_verbs[]. For example: Inkscape --verb FileSaveAs file.svg # opens file.svg then opens "File->Save As.." dialog
count of verbs limited only command line MAX_PATH lenght. verbs inserting into actions list, then running serial.
So I wrote the patch wich extends this behaviour. If inkscpape found batch option "-B filename" it loads list of verbs from file. And most imortant for my project, I add xverbs(extended), they can have arguments. verbs does not have arguments they opens gtk dialogs.
For example, this script open file and save it with another names : ------------------ script.yaml run: - xverb-id: XFileOpen, clone.svg - xverb-id: XFileSaveAs, foo.svg - xverb-id: XFileSaveAs, bar.svg ----------------- inkscape -B script.yaml # easy
verb FileOpen opens dialog to ask user for filename and XFileOpen gets filename from its argument
So from command line I can open .svg files then use any count of of 300+ verbs and then save the result to .svg with any filename. And only one instance of Inksape will be used. Thats what I need :)
Best regards, Dmitry Zhulanov
27.04.2016 11:46, Mark Schafer пишет:
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
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