Difference between revisions of "Using xverbs"
(initial version) |
m (add info about required library) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Overview == | |||
"xverbs" is an extension that is useful for some batching tasks. It is available [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/main-cmdlinexact.cpp in Inkscape trunk], and will be available in the stable 0.93 release. | |||
libyaml development libraries (e.g. libyaml-dev package on Ubuntu) are required to activate the option when compiling. | |||
Inkscape has a set of action "verbs", which is bounded to the menu system. One of the interesting uses of "verbs" is the --verb command line option. But the length of command line is limited and "verbs" can be applied for only one .svg file or for an empty new document. | |||
"xverbs" aims to overcome the limit of MAX_PATH (with libyaml) and add some useful "xverbs" with arguments. For example "xverb-id: XFileOpen, some.svg" allows you to open an existing document and "xverb-id: XFileSaveAs, other.svg" to save it with specified name. | |||
== Usage == | |||
inkscape --xverbs=xverbs.yaml | inkscape --xverbs=xverbs.yaml | ||
Format of xverbs.yaml | '''Format of xverbs.yaml:''' | ||
<pre> | |||
# only "verbose: yes" enable logging | |||
verbose: yes | |||
run: | run: | ||
# open document to process | # open document to process | ||
- xverb-id: XFileOpen, gfx_sources/loading_screen/sandclock_atlas.svg | - xverb-id: XFileOpen, gfx_sources/loading_screen/sandclock_atlas.svg | ||
# set label for XUndoToLabel xverb works | |||
# NB: if | # set label for XUndoToLabel "xverb" works | ||
- xverb-id: XUndoLabel, fresh_document | # NB: if undo labels do not work, use "verb" EditUndo instead of XUndoLabel and XUndoToLabel | ||
- xverb-id: XUndoLabel, fresh_document | |||
# select element to handle | # select element to handle | ||
- xverb-id: XSelectElement, top_sand | - xverb-id: XSelectElement, top_sand | ||
# verbs | |||
# common "verbs" | |||
- verb-id: EditInvertInAllLayers | - verb-id: EditInvertInAllLayers | ||
- verb-id: EditDelete | - verb-id: EditDelete | ||
- verb-id: FitCanvasToDrawing | - verb-id: FitCanvasToDrawing | ||
# save element to | |||
- xverb-id: XFileSaveAs, output/thegame/linux/data/gfx/loading_screen/top_sand.svg | # save element to separate svg document | ||
- xverb-id: XFileSaveAs, output/thegame/linux/data/gfx/loading_screen/top_sand.svg | |||
# also save png preview | # also save png preview | ||
- xverb-id: XFileExportPNG, output/thegame/linux/data/gfx_preview/loading_screen/top_sand.png | - xverb-id: XFileExportPNG, output/thegame/linux/data/gfx_preview/loading_screen/top_sand.png | ||
# return to the fresh_state of document | # return to the fresh_state of document | ||
- xverb-id: XUndoToLabel, fresh_document | - xverb-id: XUndoToLabel, fresh_document | ||
# do any other handling | # do any other handling | ||
# Inkscape | # Inkscape has a lot of useful "verbs" | ||
- verb-id: FileQuit | - verb-id: FileQuit | ||
</pre> | |||
== List of verbs == | |||
"verbs" are developed for the Inkscape menu system, so "verbs" do not have any arguments. A list of available Inkscape "verbs" can be found in the source code:<br /> | |||
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/verbs.cpp#L2543 | |||
== List of xverbs == | |||
XFileSaveAs - save current document to specified filename<br /> | |||
XFileOpen - open specified .svg filename instead of current document<br /> | |||
XFileExportPNG - export to specified .png filename<br /> | |||
XSelectElement - select svg element by name<br /> | |||
XUndoLabel - set undo label<br /> | |||
XUndoToLabel - undo to specified label<br /> | |||
== Additional info == | |||
Some additional info can be found in this mailing list thread: <br /> | |||
https://sourceforge.net/p/inkscape/mailman/inkscape-devel/thread/33487d06-e3c1-a4e5-1496-7b370d672d2f%40gmail.com/#msg35392523 |
Latest revision as of 14:53, 20 May 2017
Overview
"xverbs" is an extension that is useful for some batching tasks. It is available in Inkscape trunk, and will be available in the stable 0.93 release.
libyaml development libraries (e.g. libyaml-dev package on Ubuntu) are required to activate the option when compiling.
Inkscape has a set of action "verbs", which is bounded to the menu system. One of the interesting uses of "verbs" is the --verb command line option. But the length of command line is limited and "verbs" can be applied for only one .svg file or for an empty new document.
"xverbs" aims to overcome the limit of MAX_PATH (with libyaml) and add some useful "xverbs" with arguments. For example "xverb-id: XFileOpen, some.svg" allows you to open an existing document and "xverb-id: XFileSaveAs, other.svg" to save it with specified name.
Usage
inkscape --xverbs=xverbs.yaml
Format of xverbs.yaml:
# only "verbose: yes" enable logging verbose: yes run: # open document to process - xverb-id: XFileOpen, gfx_sources/loading_screen/sandclock_atlas.svg # set label for XUndoToLabel "xverb" works # NB: if undo labels do not work, use "verb" EditUndo instead of XUndoLabel and XUndoToLabel - xverb-id: XUndoLabel, fresh_document # select element to handle - xverb-id: XSelectElement, top_sand # common "verbs" - verb-id: EditInvertInAllLayers - verb-id: EditDelete - verb-id: FitCanvasToDrawing # save element to separate svg document - xverb-id: XFileSaveAs, output/thegame/linux/data/gfx/loading_screen/top_sand.svg # also save png preview - xverb-id: XFileExportPNG, output/thegame/linux/data/gfx_preview/loading_screen/top_sand.png # return to the fresh_state of document - xverb-id: XUndoToLabel, fresh_document # do any other handling # Inkscape has a lot of useful "verbs" - verb-id: FileQuit
List of verbs
"verbs" are developed for the Inkscape menu system, so "verbs" do not have any arguments. A list of available Inkscape "verbs" can be found in the source code:
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/verbs.cpp#L2543
List of xverbs
XFileSaveAs - save current document to specified filename
XFileOpen - open specified .svg filename instead of current document
XFileExportPNG - export to specified .png filename
XSelectElement - select svg element by name
XUndoLabel - set undo label
XUndoToLabel - undo to specified label
Additional info
Some additional info can be found in this mailing list thread:
https://sourceforge.net/p/inkscape/mailman/inkscape-devel/thread/33487d06-e3c1-a4e5-1496-7b370d672d2f%40gmail.com/#msg35392523