SVG plugin additions - Printable Version +- Wings 3D Development Forum (https://www.wings3d.com/forum) +-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1) +--- Forum: Design & Development (https://www.wings3d.com/forum/forumdisplay.php?fid=6) +--- Thread: SVG plugin additions (/showthread.php?tid=3083) |
SVG plugin additions - edb - 11-30-2022 I'm going over the code and doing some additions to the SVG plugin (wpc_svg). So far I've added support for the H, V, S, Q, and T path commands, as well as the relative version of those commands, as sometimes those commands can be used by a drawing program when it saves to SVG. Here's an example file: Code: <?xml version="1.0" encoding="UTF-8"?> Things are still a WIP at the moment. RE: SVG plugin additions [WIP] - edb - 12-01-2022 I've made a repository for it: https://codeberg.org/elblake/wings-svg-plugin RE: SVG plugin additions [WIP] - micheus - 12-01-2022 Hi edb This importer is already available in Wings3D - wpc_svg_path.erl Which different feature are you including on this one? If it's something missing, maybe it would be interesting you make a PR including these features in the current one. RE: SVG plugin additions [WIP] - edb - 12-02-2022 The modifications so far are XML parsing is done with xmerl, a new command tokenizer that can tokenize "shrunk" SVG path strings where spaces that are usually expected are missing (Inkscape optimized SVG), added new path commands (H V Q S T). and possibly a few more things which are WIP atm. My modifications aren't complete but I will make a PR for wpc_svg_path.erl when it is ready. RE: SVG plugin additions [WIP] - micheus - 12-02-2022 Quote:My modifications aren't complete but I will make a PR for wpc_svg_path.erl when it is ready.Nice. Just have in mind that this stuff can be a nightmare. It's hard to cover all options that came with different software exporting this format. Please have this in mind otherwise we have problems keeping the compatibility of kind of plugin. These issues were related to a change made to Inkscape that may need to be checked: - Inkscape .svg path import internal error - SVG import more broken than before? and just to illustrate and show you that it's hard to make it work with all exporters take a look at this thread in which the user tkbd helped with the PS/EPS exporter to minimize the issues when getting it from Illustrator, Inkscape and LibreOffice: When Import any ps/eps file,Output error log So, please try to test your changes to other apps than Inkscape. RE: SVG plugin additions [WIP] - edb - 12-02-2022 Thank you for the forum threads, I will have in mind the previous issues. I will be using tkbd's svg import test files as part of my testing and I'll be testing with libreoffice as well. RE: SVG plugin additions [WIP] - edb - 12-06-2022 I've managed to implement one more command: arcto, so now A commands can now be present in the SVG command list. Code: <?xml version="1.0" encoding="UTF-8"?> I've started testing with libreoffice draw as well and the shapes do get imported. though it adds a bounding box with an invisible rect so I'll have to remove those. I'll be trying with GIMP and scribus eventually. I'll post beam builds to this thread soon before I get around to a PR, so SVG files made in other other software can be tested in advance if there are any issues too. RE: SVG plugin additions [WIP] - edb - 02-27-2023 I'm still making changes for this plugin. The importer now calculates the scale for the shapes from the SVG document width and height and viewbox. Some software export SVGs with document width and height at "100%" so I still have to come up with a reasonable scale for the shapes for that. Here are SVG files from different software I've tried compared to EPS 100pt square. I'll post a branch for wings with this SVG importer soon. RE: SVG plugin additions [WIP] - micheus - 02-28-2023 I'm not sure about this way you are handling the elements' size when importing, but try to not make it to much different the way it hands that currently. The import dialog just provides a Scale factor to help with that. The users are already used to it. RE: SVG plugin additions [WIP] - edb - 02-28-2023 Hi micheus, Thanks for the feedback, I will add an option for the user to use viewbox coordinate system only which will do the scaling the same way as before, giving users a choice. The updated importer will also have checkbox options for the very few changes of behavior so it can be switched to behave the same way as the importer had done previously in case the user needs it. |