[patch] improved SVG import

Bug #227472 reported by sas
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Rygle

Bug Description

Here's a patch that makes a few improvements to SVG import:

 * 'style' elements at the top level are not lost on import (fixes bug 196898)

 * the contents of top-level 'defs' elements are not lost on import, even if there's more than one such 'defs' element (fixes bug 209296)

 * layers are unlocked when they are converted to ordinary groups (fixes bug 221888)

The existing code has some code duplication, because the case where imported objects need to be put in a new group and the case where a new group isn't needed are handled in separate loops. In order to avoid increasing the amount of code duplication even further (by putting more stuff in the loops), I've refactored this into a single loop that works slightly differently in the two cases.

Tags: importing svg
Revision history for this message
sas (sas-sas) wrote :
Revision history for this message
Rygle (rygle) wrote :

Will check this soon sas.

Changed in inkscape:
assignee: nobody → rygle
importance: Undecided → Medium
milestone: none → 0.47
status: New → In Progress
Revision history for this message
Rygle (rygle) wrote :

This patch seems to apply and build cleanly and import files well on Win32 with latest trunk, but I can't test Linux or Mac, so this is not thoroughly tested.

It seems to fix all the test cases in the bugs mentioned above, all of which are still present in SVN trunk before patching. My only question is whether instead of deleting the layers in an imported file with a locked layer, whether the layers can be imported and added to the layers in the present document. Alternately, a dialogue could pop up indicating that layers are present and asking whether they should be imported or flattened.

Applied to trunk at SVN revision 18579.

Sas - if you haven't already got SVN commit access, you should get on IRC and ask for it - Bryce, Bulia Byak, or Ted can probably help you.

Changed in inkscape:
status: In Progress → Fix Released
Revision history for this message
sas (sas-sas) wrote :

Re layer handling:

Import currently seems to work on the principle that the imported image should be a single object that the user can easily move about, resize, rotate, etc. That makes sense to me, and isn't really compatible with having the imported image spread over several layers. So the current behaviour (layers are converted to ordinary groups on import) seems like the best default behaviour. A "preserve layers" mode might be useful as a preference option, although I'm not sure where the new layers should go (on top of the existing layers? just above the current layer? as sublayers of the current layer?).

I'll look into getting SVG commit access, but I don't really want to install an IRC client just for that.

su_v (suv-lp)
tags: removed: import
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.