Edited wiki page SVGImport through web user interface.
authorkyberneticist@gmail.com
Thu, 23 Jan 2014 16:57:28 +0000
changeset 385 6f4ad8faeaff
parent 384 08ce9e2c5618
child 386 ee032706a62c
Edited wiki page SVGImport through web user interface.
SVGImport.wiki
--- a/SVGImport.wiki	Wed Jan 22 01:29:43 2014 +0000
+++ b/SVGImport.wiki	Thu Jan 23 16:57:28 2014 +0000
@@ -18,20 +18,16 @@
 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 but keeping the paths inside the groups in the SVG in a text editor might be faster than cleaning up 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
-
-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.
+2) 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.
 
-4) Save and Quit
+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.  Generally resize it and reposition it using the document white area as a guide to how it will look on the in-game drawing area, then save and quit.
 
-5) Open in an editor and verify there is one path. Change sodipodi:namedview's ID attribute to id="base" - this is to work around a bug in the current stable Inkscape (0.48.3.1) extensions tool which was crashing it.  This is probably fixed in 0.48.4. Note that I haven't tested this workaround. su_v says this is the correct way to do it because apparently id="base" is a reserved name for namedview in sodipodi - which seems like a rather common and collision-likely name.  I had misread him and changed the path's id to base, and that seemed to work fine.  If changing namedview doesn't work, try renaming the path instead.
+4) Open in a text editor and verify there is one path. Change sodipodi:namedview's ID attribute to id="base" - this is to work around a bug in the current stable Inkscape (0.48.3.1) extensions tool which was crashing it.  This is probably fixed in 0.48.4. Note that I haven't tested this workaround. su_v says this is the correct way to do it because apparently id="base" is a reserved name for namedview in sodipodi - which seems like a rather common and collision-likely name.  I had misread him and changed the path's id to base, and that seemed to work fine.  If changing namedview doesn't work, try renaming the path instead.
 Make sure all those groups are removed.
 
-6) 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 most of the time, but for small curved objects you might want something like 5.  Keep in mind, the more the approximation, the more points that Hedgewars has to draw, which can be rough on the engine and network communication.
+5) 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 most of the time, but for small curved objects you might want something like 5.  Keep in mind, the more the approximation, the more points that Hedgewars has to draw, which can be rough on the engine and network communication, then save and quit.
 
-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.
+6) 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 for use by the crude script in (10) unless you plan to handle that yourself in some way.  Here is a vim one-liner to do it.
@@ -42,7 +38,7 @@
 {{{rm dupes.txt;PREVXY=(99999 99999);sed 's/\([LM]\)/\n\1/g' inputfile | while read f;do read -a XY <<< "${f:1}";if [ "${f:0:1}" != "M" ];then if((${XY[0]}-${PREVXY[0]}<3&&${XY[0]}-${PREVXY[0]}>-3&&${XY[1]}-${PREVXY[1]}<3&&${XY[1]}-${PREVXY[1]}>-3));then echo "$f" >> dupes.txt;else echo $f;fi;else echo $f;fi;PREVXY[0]=${XY[0]};PREVXY[1]=${XY[1]};done | xargs > inputfile.dedupe}}}
 If dupes.txt has anything in it, you probably should run it again.  Anyway, running these reduced a complex test trace from ~8800 points down to ~6500.
 
-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).
+7) 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 0x00 and 0x3F.  That's 6-636.  See the [DrawnMapFormat] wiki page.
 {{{
 #!/usr/bin/perl
@@ -65,7 +61,7 @@
 }}}
 {{{script pointdata > hwpointdata}}}
 
-10) qCompress the data.
+8) qCompress the data.
 {{{g++ -I /usr/include/qt4 -I /usr/include/qt4/QtCore qcompress.cpp -lQtCore}}}
 {{{
 #include <QFile>
@@ -83,7 +79,7 @@
 }}}
 {{{./a.out hwpointdata hwpointdata.Z}}}
 
-11) Convert to base64 and you're done! (whew)
+9) Convert to base64 and you're done! (whew)
 
 {{{base64 -w0 hwpointdata.Z > mynewhedgewars.hwmap}}}