"active" scripting support -- separation of presentation & data
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
New
|
Wishlist
|
Unassigned |
Bug Description
Hello,
I would like to make Inkscape the editor for the game I'm making. At the moment, however, it's not very easy to do without a "template" or some sort of variable scripting.
I found out about the SVG "use" tag yesterday, but I need something more powerful. Here's my current setup:
[code]
<defs id="templates">
<g id="template_
<path id="template_
d="m -7.5,0 15,0 -7.5,0 0,-7.5 0,15 0,-7.5"
style=
<circle id="template_
style=
<rect id="template_
style=
</g>
</defs>
[/code]
And the use command:
[code]
<use id="city_
x="1145.5" y="1399" height="1" width="1" />
[/code]
---------------
This is the hypothetical ideal:
[code]
<defs id="templates">
<g id="template_
switch ($subtype) {
case "empire capital": ("template_
case "capital": ("template_
case "city": ("template_
case "fort": ("template_
}
<path id="template_
d="m -7.5,0 15,0 -7.5,0 0,-7.5 0,15 0,-7.5"
style=
<circle id="template_
style=
<rect id="template_
style=
</g>
</defs>
[/code]
[code]
<use id="city_
x="1145.5"
y="1399"
size = "7.5"
subtype = "capital"
portx = "5"
porty = "10"
/>
[/code]
I'd also like to be able to move the rectangle (id="template_
======
I had some possible code written for this on those "unofficial" Inkscape forums but it's not approved yet and I didn't save a copy.. when it's approved I'll add a comment to this report.
======
It would be so much easier to do what I've wanted to do with this sort of way to separate content and data ... it would make much easier the parsing of my map data SVG, allow me to add more data to it, and make the eventual users of my game use Inkscape as a viable and powerful game level editor! ...
tags: | added: extensions-plugins |
Changed in inkscape: | |
importance: | Undecided → Wishlist |
OK: An example to how you'd go from inkscape GUI movement to changing the data:
[code] regular_ action( ); instance.size = new_size; regular_ action( ); subtype = "empire capital"; regular_ action( ); subtype = "capital"; regular_ action( ); subtype = "city"; regular_ action( ); subtype = "purple"; regular_ action( ); point_port" ); point_port" );
switch (event) {
case "stretched_evenly": cancel_
case "color_changed":
switch toInt(color):
case "red": cancel_
case "blue": cancel_
case "green": cancel_
case "fort": cancel_
}
case "childrenMoved":
cancel_
portx = dx("template_
portx = dy("template_
[/code]
}