• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Design & Development v
1 2 3 4 5 … 11 Next »
SVG plugin additions

 
  • 0 Vote(s) - 0 Average
SVG plugin additions

Pages (4): « Previous 1 2 3 4 Next »
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#21
05-07-2023, 01:21 PM (This post was last modified: 05-07-2023, 01:22 PM by edb.)
Hello,

I was able to replicate the problem, it is likely caused by there being repeat coordinates being generated for the <circle> tag.
[Image: iQLFfpRS_o.png]

Removing the repeat coordinates, at least in a isolated setup for debugging, seems to fix it:
[Image: QRQU7jtc_o.png]

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.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#22
05-07-2023, 06:48 PM
Where in the code are you getting this key_exists error?
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#23
05-07-2023, 07:50 PM (This post was last modified: 05-09-2023, 04:17 AM by edb.)
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}}
stack trace: [{gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,319}]},
              {gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,281}]},
              {gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,281}]},
              {gb_trees,insert,3,[{file,"gb_trees.erl"},{line,278}]},
              {e3d__tri_quad,tridict1,2,
                             [{file,"e3d__tri_quad.erl"},{line,484}]},
              {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
              {e3d__tri_quad,cdt,3,[{file,"e3d__tri_quad.erl"},{line,432}]},
              {e3d__tri_quad,quadrangulate_face_with_holes,3,
                             [{file,"e3d__tri_quad.erl"},{line,119}]},
              {wpc_ai,pa2object,1,[{file,"wpc_ai.erl"},{line,574}]},
              {lists,map,2,[{file,"lists.erl"},{line,1239}]},
              {wpc_ai,polyareas_to_faces,1,[{file,"wpc_ai.erl"},{line,301}]},
              {wpc_svg_path,'-process_islands/1-fun-0-',2,
                            [{file,"src/wpc_svg_path.erl"},{line,3671}]},
              {lists,foldr,3,[{file,"lists.erl"},{line,1276}]},
              {wpc_svg_path,try_import_svg_1,5,
                            [{file,"src/wpc_svg_path.erl"},{line,427}]},
              {wpc_svg_path,try_import_svg,9,
                            [{file,"src/wpc_svg_path.erl"},{line,386}]},
              {wpc_svg_path,make_svg,2,
                            [{file,"src/wpc_svg_path.erl"},{line,309}]},
              {wpa,do_import,3,[{file,"wpa.erl"},{line,142}]},
              {wpa,'-import/3-fun-0-',3,[{file,"wpa.erl"},{line,131}]},
              {wings_file,'-import_filename_1/2-fun-0-',3,
                          [{file,"wings_file.erl"},{line,67}]},
              {wings_develop,time_command,2,
                             [{file,"wings_develop.erl"},{line,87}]},
              {wings_plugin,command,3,[{file,"wings_plugin.erl"},{line,147}]},
              {wings,raw_command_1,3,[{file,"wings.erl"},{line,644}]},
              {wings,raw_command,4,[{file,"wings.erl"},{line,641}]},
              {wings_wm,handle_event,3,[{file,"wings_wm.erl"},{line,1030}]},
              {wings_wm,send_event,2,[{file,"wings_wm.erl"},{line,996}]}]

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
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#24
05-08-2023, 02:52 PM (This post was last modified: 05-08-2023, 03:19 PM by edb.)
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:
[Image: AAje4MpN_o.png]

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.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#25
05-08-2023, 05:03 PM
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. Smile
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
tkbd
Offline

Senior Member

Posts: 451
Threads: 115
Joined: Nov 2012
#26
05-09-2023, 11:26 AM
Thank you very much
It works fine
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#27
05-09-2023, 03:50 PM
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
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#28
05-12-2023, 05:56 PM
A new build with better handling of the transform attribute:
wpc_svg_path.tar
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#29
05-28-2023, 08:39 PM
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
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#30
10-19-2023, 09:44 PM
Just as an update, <style> css support is on my TODO for the SVG importer.
« Next Oldest | Next Newest »

Users browsing this thread: 2 Guest(s)

Pages (4): « Previous 1 2 3 4 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode