Hi everyone,
I'd like to enhance the SVG produced by Inkscape with custom object properties. There are many examples of such use on the net. For instance a saw multiple uses of Inkscape for game level/board/map editors. So this is a very common need. However in every instance the recommended way of editing those properties is by using the built-in XML editor. Such an approach is error prone and it would be much better to have a nice GUI.
So I wanted to explore the possibility of writing an extension that provides a GUI for custom properties. As far as I saw writing an extension is easy enough and the GUI can be simply generated using <param> tags in the inx file. However I could not find a way to prefill those parameters with existing values from the SVG.
So is there a way to prefill extension parameters? If not then what other options do I have?
Thanks,
Peter
Extension for editing custom object properties
Re: Extension for editing custom object properties
Welcome to InkscapeForum!
Besides saying welcome, I just wanted to make sure you already know about Object menu > Object properties. Since I'm not familiar with game-making I don't know what object properties you might be needing. But just in case you had overlooked it
Also, I'll move your topic to our new Development forum (which is for help writing extensions).
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Extension for editing custom object properties
I know about default object properties. The idea is to attach custom properties (metadata) to objects that are application specific. In games those might be properties like speed, density or friction. The idea is for application to parse the SVG and interpret custom properties in application-specific way. This works very well. The only issue is how those properties are edited. Right now this can only be done using the XML editor. I am looking into the possibility of having a true GUI.
Re: Extension for editing custom object properties
Not possible with the internal options dialog for extensions (based on the current implementation of the extension system).peterink wrote:However I could not find a way to prefill those parameters with existing values from the SVG.
So is there a way to prefill extension parameters?
AFAIU related solutions (or workarounds): extensions like 'TeX Text' or 'Sozi' use an external dialog (built with PyGTK) to manage/edit custom properties/attributes.peterink wrote: If not then what other options do I have?
Re: Extension for editing custom object properties
I've been thinking about this same problem, and have one more suggestion to add to the more tried and tested methods that ~suv pointed out above. I've seen a few people use inkscape to build graphics for gui widgets... So a third option would be to have your gui widget graphics embeded within your svg: maybe grouped with your objects as hidden elements or overlapping them in a hidden layer (which is technically also a group I guess). Then your extension could simply hide and unhide gui elements and there would be no problem with parameter persistence. I think I'll actually play around with this over the next week as I'm also attempting to use Inkscape as a game level editor.