For my current project needs, I've created a converter tool that takes Inkscape SVG paths and converts them to orx config BodyPart sections and VertexLists.
This is handy for creating mesh shapes for BodyPart(s).
Amazing work you have done man, it looks like many community made tools are coming, which is great, just cant wait for the next official release of ORX
Thanks Jim. This tool has been so handy even just for me. I use it all the time and it saves so much time and effort rather than plot points by hand to make meshes. Glad you like it.
Nice work, sausage, I'm going to give it a try over the week end.
@jim: About the next release, it's slowly shaping up: I successfully wrote a setup for windows master/slave buildbots.
The master is notified of new commits (it's polling the repo every X mins) and can either build for every commit, nightly or when manually forced.
The slave is able to clone the repo and start commands. Right now I got it to compile the msvs2008 versions.
I now need to write a batch file to create the packages themselves and also add slave supports for other versions/platforms.
I did a similar thing a while back using Python / Pyglet. I wanted to create all my graphics in Inkscape. I'd add non-visible paths to the graphics for physics outlines, and a 'mass' attribute.
There was one problem I ran into that you might not have hit yet. SVG graphics often have transformations (e.g. rotate, scale, etc) in them, and often are nested. As such I needed to use xpath to find my physics paths in the XML tree, then move up the tree to the root node looking for transforms, and apply them so that the final path matched the rendered graphic. The actual rasterization of the graphic was separate.
In any case, I've attached the relevant Python code for reference. Even if you don't know Python, it should be relatively easy to read through.
This only covers physics path extraction. The actual rasterization is rather boring; just uses available libs.
Thanks, epoulsen. You're right, I haven't had to deal with transformations. The converter expects you're just plonking down points rather than any curves or anything else.
In fact, if you do make an accidental curve in Inkscape, the converter will just turn them into points so you have to watch that.
Thank you for submitting your code. I can sift the logic from that if people using the converter require it to handle those things.
Comments
Using the Inkscape to ORX Converter
https://bitbucket.org/orx/inkscapetoorxmesh
@jim: About the next release, it's slowly shaping up: I successfully wrote a setup for windows master/slave buildbots.
The master is notified of new commits (it's polling the repo every X mins) and can either build for every commit, nightly or when manually forced.
The slave is able to clone the repo and start commands. Right now I got it to compile the msvs2008 versions.
I now need to write a batch file to create the packages themselves and also add slave supports for other versions/platforms.
I did a similar thing a while back using Python / Pyglet. I wanted to create all my graphics in Inkscape. I'd add non-visible paths to the graphics for physics outlines, and a 'mass' attribute.
There was one problem I ran into that you might not have hit yet. SVG graphics often have transformations (e.g. rotate, scale, etc) in them, and often are nested. As such I needed to use xpath to find my physics paths in the XML tree, then move up the tree to the root node looking for transforms, and apply them so that the final path matched the rendered graphic. The actual rasterization of the graphic was separate.
In any case, I've attached the relevant Python code for reference. Even if you don't know Python, it should be relatively easy to read through.
This only covers physics path extraction. The actual rasterization is rather boring; just uses available libs.
In fact, if you do make an accidental curve in Inkscape, the converter will just turn them into points so you have to watch that.
Thank you for submitting your code. I can sift the logic from that if people using the converter require it to handle those things.
Here it is:
https://forum.orx-project.org/uploads/legacy/fbfiles/files/InkscapeToOrxMesh-cfb2500cb5a8f34f1cae13a58855f997.zip
Tutorial updated as well.
Download here:
https://forum.orx-project.org/uploads/legacy/fbfiles/files/InkscapeToOrxMesh03.zip
Source repo is here:
https://bitbucket.org/orx/inkscapetoorxmesh