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) |
RE: SVG plugin additions [WIP] - edb - 05-07-2023 Hello, I was able to replicate the problem, it is likely caused by there being repeat coordinates being generated for the <circle> tag. Removing the repeat coordinates, at least in a isolated setup for debugging, seems to fix it: However after trying to apply the fix to remove the extra points to the wpc_svg_path plugin and trying the test file again, it then cause a key_exists error and make the shape vanish. So in some conditions there might happen a key_exists error that I am trying to figure out. In some cases I can cause the key_exists error to happen in isolated setup as well in some different scenarios. If I only remove some coordinates and not others, it will cause key_exists, which then works again if I put back in 2 repeating coordinates at the end of the path. RE: SVG plugin additions [WIP] - micheus - 05-07-2023 Where in the code are you getting this key_exists error? RE: SVG plugin additions [WIP] - edb - 05-07-2023 Hello micheus, It happens somewhere when calling into wpc_ai and then into e3d__tri_quad. I've attached a file with tkbd's test file and a .beam/.erl of that reproduces the error, the setting "combine all paths" needs to be checked on: svg_key_exists.zip Code: error: {key_exists,{120,103}} Also if it is useful, this is what i'm using to try to debug between the modules, I run it from erl command line and the vs and fs is drawn to a imagemagick vector file to make a png: setup_fix_wpc_svg.zip RE: SVG plugin additions [WIP] - edb - 05-08-2023 Hello micheus and tkbd, I've found a fix for the <circle> in the svg plugin. There was still a point at the end of the generated path that was similar to the first point before the path closing command. It could be that key_exists might have been caused by that. Here is the test file with the fix: Here is the newest .beam/.erl wpc_svg_path.tar I might try to make a change to the kind of path that is generated for <circle> and another bug I have noticed, before making a pull request. RE: SVG plugin additions [WIP] - micheus - 05-08-2023 Nice. Quote:There was still a point at the end of the generated path that was similar to the first point before the path closing command. It could be that key_exists might have been caused by that.Yeah. Probably it was the cause. I think I already face that before in a similar situation which I was trying to insert a coordinate twice in a gb_trees (I was using coordinate as index). In that case it was easy because the problem was happening in my code (not in Wings3D's module) and I just checked it before to insert. RE: SVG plugin additions [WIP] - tkbd - 05-09-2023 Thank you very much It works fine RE: SVG plugin additions [WIP] - edb - 05-09-2023 Thank you tkbd for confirming the fix works. Latest .beam made for the pull request has some small changes (made <circle> more round, and a path tokenizer fix): wpc_svg_path.tar RE: SVG plugin additions [WIP] - edb - 05-12-2023 A new build with better handling of the transform attribute: wpc_svg_path.tar RE: SVG plugin additions [WIP] - edb - 05-28-2023 I've made a fix for SVG files that use X11 color names such as fill="blue". I thought it worked before but a change might have happened at some point so I fixed it. Newest build: wpc_svg_path.tar RE: SVG plugin additions - edb - 10-19-2023 Just as an update, <style> css support is on my TODO for the SVG importer. |