Edited wiki page SVGImport through web user interface.
authorkyberneticist@gmail.com
Mon, 25 Jun 2012 13:02:47 +0000
changeset 231 b5780c560285
parent 230 9584a3da2b87
child 232 a0ce457b93f2
Edited wiki page SVGImport through web user interface.
SVGImport.wiki
--- a/SVGImport.wiki	Mon Jun 25 00:13:42 2012 +0000
+++ b/SVGImport.wiki	Mon Jun 25 13:02:47 2012 +0000
@@ -14,20 +14,19 @@
 
 Open an SVG. Ideally one of simple line art, without too much use of fill or filters.
 
-1) 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.
+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.
 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
 
-2) select the combined path, and ungroup.
+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
 
-3) 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.
-
-4) Go to File->Document Properties and choose Resize Page to Drawing or Selection.  You may want to then reposition the art to be more centred vertically or horizontally.
+3) Go to File->Document Properties and specify 4096 for W and 2048 for H.  You may want to then reposition the art to be more centred vertically or horizontally.
 
-5) Save and Quit
+4) Save and Quit
 
-6) Open in an editor and verify there is one path. change the path ID attribute to id="base" - this is to work around a bug in the current stable Inkscape extensions tool which was crashing it.
+6) Open in an editor and verify there is one path. change the path ID attribute to id="base" - this is to work around a bug in the current stable Inkscape extensions tool which was crashing it.  Make sure all those groups are removed.
 
-7) open the file in Inkscape again, Click on the path again, then go to Extensions->Modify Path->Flatten Beziers and flatten out the curves to your taste. Default of 10 seems fine.
+7) open the file in Inkscape again, Click on the path again, then go to Extensions->Modify Path->Flatten Beziers and flatten out the curves to your taste. Default of 10 seems fine. 
 
 8) Save and Quit again
 
@@ -35,7 +34,8 @@
 {{{: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 a Vim one-liner for that syntax {{{s/\(\d\) \(\d\)/\1 L\2/g}}}  and {{{s/,/ /g}}}
 
-10) Convert the path data.  Here is a crude script to do that.
+10) 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.
 {{{
 #!/usr/bin/perl
 # just a one-line list of points. at least, it had better be one-line
@@ -51,7 +51,7 @@
     ($t, $x, $y) = @_;
     $x+=0;
     $y+=0; # just in case
-    printf("%c%c%c%c%c",$x>>8,$x&0xff,$y>>8,$y&0xff,($t=~m/M/)?0x81:0x01);
+    printf("%c%c%c%c%c",$x>>8,$x&0xff,$y>>8,$y&0xff,($t=~m/M/)?(0x80|0x01):0x01);
     return;
 }
 }}}