Import Inkscape SVG loses layer and sub-layer information

Bug #502075 reported by Jon South
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Wishlist
Unassigned

Bug Description

When importing an SVG created in Inkscape with several layers and sub-layers, some layer information is lost upon ungrouping the import, but no objects are lost.

Usually, any layer without objects in them will simply disappear, though occasionally entire layers will disappear with the objects from those layers being merged into the master import layer (e.g. into the gNNNN layer).

Steps to reproduce:

Notes: Ignore the broken images in the SVG, they are simply there because images existed in my original SVG.

- Use the attached image by opening in Inkscape
- Create a new layer for re-importing, I generally made it above "Reference"
- Import the same test SVG into the image under the new layer
- Note the layers are properly sorted under their parents "Head," "Body," etc...
- Without deselecting, click the "Ungroup selected objects" button twice
- The parent layers ("Head," "Body," etc.) should now be missing

I have been able to reproduce this on win32 - Vista Ultimate 64bit and OSX - 10.5.8 (PPC)

Revision history for this message
Jon South (striker) wrote :
su_v (suv-lp)
tags: added: importing layers svg
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.47 on OS X 10.5.8

workround:
1) after import, un-group only once
2) open XML Editor
3) in the nodes list select the layer that was active when importing the SVG file
4) in the main window un-group the now selected layer

Result: layers of the imported SVG file are now -as expected- on the same top level. In this example (self-import) they duplicate the existing layer structure including all sub-layers.

All (existing and imported) layers are listed and selectable in the 'Layers…' dialog.

Note: the new top-level layers loose the attribute 'inkscape:groupmode="layer"', whereas all of their sub-layers do keep it after importing and un-grouping.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Same thing happens to PDF and AI, so I don't think it needs an extra bug report. But I'm mentioning it here instead :)

Revision history for this message
su_v (suv-lp) wrote :

> Same thing happens to PDF and AI, so I don't think it
> needs an extra bug report.

I don't quite agree ;) Importing SVG IMHO is a special case, because the layer structure in the imported Inkscape SVG file exists and seems obscured by the UI for layers (layers <-> groups).

Missing support of internal layer structure of PDF and AI files (Do PDF files really have a layer structure?) is IMHO a different issue and depends on an import filter capable of interpreting the content of the PDF as Inkscape layers or even reverse-engineering the AI proprietary format.

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Yes, PDF files do have layer structure. There is nothing proprietary in PDF-compatible AI files

Revision history for this message
su_v (suv-lp) wrote :

See also bug #227472 “[patch] improved SVG import” (comment #4):
«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?).»
<https://bugs.launchpad.net/inkscape/+bug/227472>

Revision history for this message
su_v (suv-lp) wrote :

Setting importance to 'Wishlist': implement a "preserve layers" mode as import or preferences option.

Changed in inkscape:
importance: Undecided → Wishlist
status: Confirmed → Triaged
Revision history for this message
Tom McFarlin (geraldmcfarlin4) wrote :

I've found that if the SVG that you are importing has a top layer, the layers are preserved.

Start:
new.svg (importing into this file)
Icon Layer (select this layer before importing)

import.svg
Icon
> Final
> Dimensions

After:
Icon Layer
> Icon
> > Final
> > Dimensions

A bit cumbersome, but preserves layers without needing to do mess with grouping.

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.