--- a/SVGImport.wiki Mon Jun 25 16:34:40 2012 +0000
+++ b/SVGImport.wiki Mon Jun 25 16:41:05 2012 +0000
@@ -15,7 +15,7 @@
Open an SVG. Ideally one of simple line art, without too much use of fill or filters.
1) Select all in the image and choose ungroup, then combine all paths in the drawing (select them, then choose Path->Combine).
-Note. I had some difficulty doing that with some images even after repeated use of ungroup. I ended up just going into the SVG file and deleting all the groups. This usually happens if there are filters in place. Removing all the <g> tags in the SVG is faster than cleaning up the filters in inkscape.
+Note. I had some difficulty doing that with some images even after repeated use of ungroup. I ended up just going into the SVG file and deleting all the groups. This usually happens if there are filters in place. Removing all the <g> tags in the SVG is faster than cleaning up the filters in Inkscape.
Also, some paths might be worth eliminating altogether. In order to get a better idea of what it'll look like, try: View->Display Mode->Outline. To simulate occluding, you can try combining individual paths first, and using union to combine into larger groups. This takes a bit more work. If it still doesn't look right, you're going to have to go in and delete nodes, and generally rework the shape to simulate occlusion.
2) Click on the path, and choose dimensions for W and H that would look good in the game (no more than 4096 for W and 2048 for H). The Lock button may be helpful here
@@ -31,9 +31,12 @@
7) Save and Quit again
-8) Edit the file, and delete everything but the path data. You should have a one-line file starting with something like M1234.3 456.78L3298.3 9023.34 and so on. The coordinates should now be rounded unless you plan to handle that yourself in some way. Here is a vim one-liner to do it.
+8) Edit the file, and delete everything but the path data. You should have a one-line file starting with something like M1234.3 456.78L3298.3 9023.34 and so on.
+If instead you have a format like M 1234.678,9875.323 2345.0,123.45 - you'll want to convert if you want to try the crude script in (10) - otherwise a smarter script would be needed. Here's some Vim commands for that syntax {{{s/\(\d\) \(\d\)/\1 L\2/g}}} and {{{s/,/ /g}}} and {{{s/\([LM]\s*\)/\1/g}}}
+
+The coordinates should now be rounded unless you plan to handle that yourself in some way. Here is a vim one-liner to do it.
{{{:s/[0-9][0-9.]*/\=float2nr(floor(submatch(0)*1))/g}}}
-If instead you have a format like M 1234.678,9875.323 2345.0,123.45 - you'll want to convert if you want to try the crude script in (10) - otherwise a smarter script would be needed. Here's some Vim commands for that syntax {{{s/\(\d\) \(\d\)/\1 L\2/g}}} and {{{s/,/ /g}}} and {{{s/\([LM]\s*\)/\1/g}}}
+
9) Convert the path data. Here is a crude script to do that. Note this one uses a line size of 1 (that's the 0x01 business).
If you want larger lines you can pick anything between 0x01 and 0x3F. That's 16-636. See the map format wiki page.