Mobile app version of vmapp.org
Login or Join
Radia289

: How do I move groups TO the root layer in Inkscape As the title shows, I need to move groups to root layer in Inkscape. This is needed because I'm using a Unity plugin that allows to automatically

@Radia289

Posted in: #Inkscape #Svg

As the title shows, I need to move groups to root layer in Inkscape. This is needed because I'm using a Unity plugin that allows to automatically generate a PNG atlas from a SVG file, but unluckily the only way to detect different objects is having them layed in "groups" at root layer.

A newly created Inkscape file has a default layer wich is not the root layer :/.

When I open certain SVG files I can clearly see "[Root]" layer in inkscape, but I think those files are created with another application (Illustrator) because I'm not able to reproduce the same from withint pure inkscape fresh start

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Radia289

2 Comments

Sorted by latest first Latest Oldest Best

 

@Connie430

The "root" layer in Inkscape is simply any objects that are not in a layer. Layers are not part of the SVG standard; they are a special feature for groups within Inkscape, using the inkscape namespace (example: <svg:g inkscape:groupmode="layer">).

In the current version of Inkscape, there is a default layer when you create a new drawing--older versions of Inkscape didn't do this. Other SVG editing programs may or may not have their own distinct method for creating layers. The is why some SVG files may already have content in the "root" layer while others do not.

Knowing this, to move things from the root layer, you simple need to move them out of any groups that Inkscape treats as layers. You can do this with Inkscape's XML editor.


Select the group you want to move.
Press Ctrl+Shift+X to open the XML editor.
Do one of the following:


Click and drag the group to the root <svg> element. (just after the <svg:metadata> is a good place)
If the group you want to move to the "root" later is a layer in Inkscape, select the inkscape:groupmode attribute for the group, and in the XML Editor's toolbar click the Delete Attribute button.



Example

If my svg file looks like this:

<svg:svg>
<svg:g inkscape:groupmode="layer">
<svg:rect ... />
</svg:g>
</svg>


Then I want to modify it to be like either of the following:

<svg:svg>
<svg:rect ... />
<svg:g inkscape:groupmode="layer">
</svg:g>
</svg>


or

<svg:svg>
<svg:g>
<svg:rect ... />
</svg:g>
</svg>


Both of these will move my drawing to the root layer. The second example will retain the original layer as a group.

10% popularity Vote Up Vote Down


 

@Turnbaugh909

After asking in InkscapeForum

I found I just need to remove all layers, this is not a perfect solution (what If I need some layer existing for some reason?) but at least a feasible and easy solution.

To remove a layer I need to open layer window Layer->layers and hit the minus - button in that window.

I'll accept the answer that allows to moving groups from any layer to the root layer.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme