Weasy666 / bevy_svg

A simple and incomplete SVG drawer for the Bevy engine.
Apache License 2.0
103 stars 25 forks source link

group isolate not implemented #42

Open TeamDman opened 4 weeks ago

TeamDman commented 4 weeks ago

I am trying to use this SVG

https://github.com/maskati/azure-icons/blob/a7933b00474aa25ab45bc096ef1bb5366de7bde3/svg/Microsoft_Azure_Billing/Subscription.svg

image

which is hitting

panicked at .cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_svg-0.14.0\src\svg.rs:146:25:
not yet implemented: group isolate not implemented

https://github.com/Weasy666/bevy_svg/blob/7d908ef3cbfe03329684f948632e23b1adc0dfc8/src/svg.rs#L135-L148

Looking inside the SVG there are two path elements, the second one responsible for creating multiple isolated visual elements of the image

image

By commenting out the second path element, I can get the SVG to partially work in bevy

image

There's a few css rules being skipped, but at least the outline of the shape works which is better than nothing lol

 WARN simplecss: The @-moz-document rule is not supported. Skipped.
 WARN simplecss: The @keyframes rule is not supported. Skipped.
 WARN simplecss::selector: ':nth-child' is not supported. Selector skipped.
Weasy666 commented 3 weeks ago

Hey there! Thanks for using this plugin and opening an issue! Yeah, processing isolated groups is currently, sadly, not implemented.

I've tested your SVG with the newest viewsvg, from https://github.com/RazrFalcon/resvg/releases, which does work and does not generate those simplecss warnings. I am not exactly sure why we get them and viewsvg doesn't. They don't seem to do anything special in regard to CSS rules. As far as i can see, they simply create a usvg::Tree from the provided file, same as we do...