INX Specification Questions

Post questions on how to use or achieve an effect in Inkscape.
noblestudd
Posts: 4
Joined: Thu Aug 26, 2010 12:53 am

INX Specification Questions

Postby noblestudd » Sat Aug 28, 2010 9:05 am

I'm tinkering of adding an extension to Inkscape and I' curious why most INX file I've seen always starts with this id:
<id>org.ekips.filter.xxxx</id>


There is no info on Inkscape website on what the program do with the id other than a hint such as:
<id>{org.domain.sub-domain.extension-name}</id>


Which on my first impression looks like a URL that led me to visit ekips.org.

Others I've seen used for "output" rather than "filter" have:
<id>org.inkscape.output.xxxx</id>


Are there any repercussion of not conforming with this id?
Like for example:
<id>com.mysite.output.xxxx</id>

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: INX Specification Questions

Postby ~suv » Sat Aug 28, 2010 4:56 pm

noblestudd wrote:There is no info on Inkscape website on what the program do with the id other than a hint such as:

Code: Select all

<id>{org.domain.sub-domain.extension-name}</id>

The ID must be unique for each extension and is used (besides internal handling to load, add to menu and execute the extension) to
  • save settings (parameter values) for the extension in the preferences file
  • assign keyboard shortcuts to extensions
  • allow extensions to be called from the command line with the '--verb' option (use 'inkscape --verb-list' to get a list of all registered verbs, including the loaded extensions by ID)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: INX Specification Questions

Postby ~suv » Sat Aug 28, 2010 5:21 pm

noblestudd wrote:Others I've seen used for "output" rather than "filter" have:

Code: Select all

<id>org.inkscape.output.xxxx</id>


There are different types of extensions, currently supported for script extensions are:
  • Input (added as file format in the 'File > Open' dialog)
  • Output (added as file format in the 'File > Save' dialogs)
  • Effect (added to the 'Extensions' menu)
Adding the extension type to the 'ID' isn't required AFAIK but useful information.

'filter' is used internally for preset filter effects which are loaded in a similar way as external script extensions (for input, output and effect).

Many of the "older" extensions written by Aaron use 'filter' in their 'ID' too - my guess is that this is 'legacy code' - referring to an older naming convention (when extensions where called effects, in 0.46 and prior versions). Unfortunately his website about extending Inkscape seems no longer online (old version in web.archive - note: has out-dated information about extensions).

noblestudd
Posts: 4
Joined: Thu Aug 26, 2010 12:53 am

Re: INX Specification Questions

Postby noblestudd » Sun Aug 29, 2010 9:01 am

Thanks for the info.

When I tried using my site's URI as "id ", Inkscape displayed an error prompt upon second load:
The preferences file C:\Documents and Settings\Administrator\Application Data\inkscape\preferences.xml is not a valid XML document.

Error checking is not done on initial load of Inkscape.Fortunately, I know that it is caused by an invalid id since I'm testing my plugin.
It would be difficult for normal users using third-party plugins (such as mine) what caused such error.

Again, thanks!

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: INX Specification Questions

Postby ~suv » Sun Aug 29, 2010 2:40 pm

noblestudd wrote:When I tried using my site's URI as "id ", Inkscape displayed an error prompt upon second load:
The preferences file C:\Documents and Settings\Administrator\Application Data\inkscape\preferences.xml is not a valid XML document.

Error checking is not done on initial load of Inkscape.Fortunately, I know that it is caused by an invalid id since I'm testing my plugin.
It would be difficult for normal users using third-party plugins (such as mine) what caused such error.

Are you writing a plugin (C++ code) or an extension script? Anyway - I'd be curious to know what an invalid ID looks like (my guess would be it contained a non-unicode character causing incorrect encoding when being used to save the extension parameters into preferences.xml and an error when loading the preferences file again). Can you attach the INX file or paste it as [ code ] into a comment?

On the other hand that error ("... preferences.xml is not a valid XML document ") can have other causes, most often it had been reported with Inkscape 0.47 when tablet configuration failed and corrupted the preferences file.

noblestudd
Posts: 4
Joined: Thu Aug 26, 2010 12:53 am

Re: INX Specification Questions

Postby noblestudd » Sun Aug 29, 2010 7:48 pm

Are you writing a plugin (C++ code) or an extension script?

Err, I mean extension script.

I'd be curious to know what an invalid ID looks

You can just write any id having a slash character. Such as:

Code: Select all

<inkscape-extension>
   <_name>myextension</_name>
   <id>python.mysite.com/svg2css</id>


The id is registered to preferences.xml which will cause the prompt on the next Inkscape start.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: INX Specification Questions

Postby ~suv » Sun Aug 29, 2010 8:15 pm

noblestudd wrote:You can just write any id having a slash character. Such as:

Code: Select all

<inkscape-extension>
   <_name>myextension</_name>
   <id>python.mysite.com/svg2css</id>

The id is registered to preferences.xml which will cause the prompt on the next Inkscape start.

Can you please file a bug report about this? Thx.

noblestudd
Posts: 4
Joined: Thu Aug 26, 2010 12:53 am

Re: INX Specification Questions

Postby noblestudd » Mon Aug 30, 2010 3:50 pm



Return to “Help with using Inkscape”