Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing SVG with no width, height, or viewport doesn't work #684

Closed
Tracked by #709
Qainguin opened this issue Apr 26, 2024 · 15 comments · Fixed by #760
Closed
Tracked by #709

Importing SVG with no width, height, or viewport doesn't work #684

Qainguin opened this issue Apr 26, 2024 · 15 comments · Fixed by #760
Labels

Comments

@Qainguin
Copy link
Contributor

If you import an SVG that is too big for GodSVG to handle, it will save that file path and try to load it. This makes the program forever unusable on the computer.

@Qainguin Qainguin added the bug label Apr 26, 2024
@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

Is this referring to big SVGs, or some non-svg file with an erroneous SVG extension? Also, is there a crash, eternal freeze, or will it load if you wait long enough?

If there's a crash, we can use the CRASH notification - if there's a crash before READY is finished, then add a "program_crashed_last_time" sort of thing to the save data. On next launch, show a dialog asking if you want to try to load the SVG text and its path again, or start completely fresh.

But if there's no actual crash, just an eternal freeze, the above is useless, so we're just back to optimizing.

@Qainguin
Copy link
Contributor Author

I would suggest just adding a timeout for loading an SVG for now so that people can still use the software. This can be removed once optimization is good enough.

@Qainguin
Copy link
Contributor Author

Qainguin commented Apr 26, 2024

Is this referring to big SVGs, or some non-svg file with an erroneous SVG extension? Also, is there a crash, eternal freeze, or will it load if you wait long enough?

If there's a crash, we can use the CRASH notification - if there's a crash before READY is finished, then add a "program_crashed_last_time" sort of thing to the save data. On next launch, show a dialog asking if you want to try to load the SVG text and its path again, or start completely fresh.

But if there's no actual crash, just an eternal freeze, the above is useless, so we're just back to optimizing.

Also, it is from Kenney assets, it is a regular SVG file with a .svg extension, and it will not load if I wait long enough.

I do like your idea of showing a dialog when it's launched. I do kind of need to short-term fix it so is there a way to do it through files?

@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

Could you post the SVG text here by the way? I'd like to inspect if there are any outstanding issues in our processing of this particular graphic.

@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

I do like your idea of showing a dialog when it's launched. I do kind of need to short-term fix it so is there a way to do it through files?

Depends on your OS, but you can find GodSVG's user data and go to save.tres, simply clear the svg_text field. For example on Linux, that's in Home/.local/share/GodSVG. For other operating systems, I don't know.

@Qainguin
Copy link
Contributor Author

Qainguin commented Apr 26, 2024

It is the "vector_objects.svg" file from Kenney's Racing Pack. (https://kenney.nl/assets/racing-pack)

@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

Figured out a possible culprit. The SVG in question has neither width and height, nor a viewBox. Our editor breaks in multiple ways in this scenario, in fact, I kinda thought SVGs like these were just illegal. But it seems like we should instead implement this as some sort of "infinite canvas mode".

@MewPurPur
Copy link
Owner

I personally got this to open eventually, but like I said, the editor is broken and really slow.

image

@Qainguin Qainguin changed the title Importing too big of a file in GodSVG crashes the program forever Importing SVG with no width, height, or viewport doesn't work Apr 26, 2024
@Qainguin
Copy link
Contributor Author

I changed the title to better reflect the issue.

@MewPurPur
Copy link
Owner

The occasional crash probably still had to do with the weight of our UI or other things, but yeah there is definitely a problem here too.

@MewPurPur
Copy link
Owner

MewPurPur commented May 1, 2024

PSA - if the graphic froze GodSVG because of how much memory it required, the situation should be a little better now, mainly thanks to: #694

This doesn't resolve any underlying issues, it just addresses something that commonly made UIs intensive.

@MewPurPur MewPurPur mentioned this issue May 4, 2024
7 tasks
@Qainguin
Copy link
Contributor Author

Another note with the vector_objects.svg file, now after a couple commits, it doesn't crash the editor and doesn't save it to the file path but it does do this.

Screenshot 2024-05-19 at 2 17 55 PM

@MewPurPur
Copy link
Owner

MewPurPur commented May 20, 2024

That's interesting. The logic around zero-size files needs to be refined, this is actually a necessary fix before alpha 4.

I think it no longer crashes because of some commits that improved GodSVG's memory usage by reducing the number of nodes.

@Qainguin
Copy link
Contributor Author

Yeah, but how does it show no editor?

@MewPurPur
Copy link
Owner

Ow, I didn't understand the screenshot. I have no idea, but I'll for sure take on this bug this week. It's the 2nd highest priority right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants