Tiled: Layer groups / hierarchy

Created on 21 Jul 2015  路  15Comments  路  Source: mapeditor/tiled

I would like to propose that Tiled add support for layer groups, similar to Photoshop.
Layers in the same layer group are merged together first (e.g: rendered to a LayerItem) and then the aggregate image is drawn in its order within the layer stack (per usual).
Nested group layers would also be nice but could be implemented in a later phase.
This is probably more useful for tile layers than object layers.
This includes the ability to turn on/off visibility for individual layers within the layer group or the entire group itself by manipulating the parent node.

This would change the layer dock to be a tree view, and would have to enable drag-and-drop
to add/remove layers to/from the group.

This makes it possible to have an arbitrary number of tiles occupying the same cell (from a visual perspective) while allowing you to organize them onto as many layers as you desire.

Could this be implemented in the current TMX file format and maintain backwards compatibility?

feature

Most helpful comment

For those interested, Tiled2Unity version 1.0.10.1 was just uploaded and it supports Group Layers.

All 15 comments

Right, this is something I'd like to support so thanks for opening an issue about it.

But, I do not understand your suggestion with the merging together or the thing about an arbitrary number of tiles occupying the same cell. Personally I would say the rendering behavior can stay largely the same. How do you think it would be different from the way you can currently have an arbitrary number of tiles occupying the same cell?

As for compatibility, it would be possible to support this in a backwards-compatible way, for example by doing the grouping with a separation character in the layer name (like writing name="Over/Clouds" for a layer called "Clouds" nested in a layer group called "Over"). But I'm not sure if I want to do this. We'll have to consider how this works together with the rest of the format.

On my donation page I had written some plans for the future, which included the following for Tiled 2:

Make the map format more flexible by changing it to an object hierarchy. This would allow using tile layers as objects or to group things like buildings together.

Of course that goes a little bit further than just layer grouping, but I'd like to keep that goal in mind when adding this feature.

Wouldn't layer grouping merely be a small ui feature? Isn't it just "folders" for layers? If you hide the folder all layers of the folder will be hidden and vice versa.

As this is an purely logical implementation it could be added to the tmx/json files at the end (for backwards-compatibility) stating that folder0 contains layer0 and folder1. And folder1 conaints layer1.

@tpetry Well, as I noted at the end of my previous comment, I'd really like to have this kind of grouping supported throughout the format, not just for layers. So adding some tags just to do layer grouping is not really an approach I want to take.

+1 I think a grouping option would be very useful.

I came here to open a issue for "Nested Layers", which sounds like what this issue is requesting. Right now I have Background, Background_Transparent, Background_Objects, etc, which I often have to enable or disable together, so it would be great to have them grouped together under "Background".

+1 to the separation character in the name idea, that would work perfectly for my needs. (Even better if @Seanba could work work that into the prefab hierarchy in Tiled2Unity, but that's a separate issue!)

Btw, thank you for Tiled @bjorn it's an awesome tool. I've been using it for a while now and just decided to back you on Patreon.

(Even better if @Seanba could work work that into the prefab hierarchy in Tiled2Unity, but that's a separate issue!)

I'll keep an eye on progress and make sure to follow Bjorn's lead on this for Tiled2Unity. In the meantime, if the grouping is important to you I suggest you put that into a Custom Importer.

Btw, thank you for Tiled @bjorn it's an awesome tool. I've been using it for a while now and just decided to back you on Patreon.

Hey @adsilcott, thanks a lot for supporting me!

Right now I'm focusing on getting Tiled 0.17 out with the many improvements already made since 0.16 on the master branch, as well as solving issues related to working with external tilesets. I'll try to get to this afterwards. I've added it to the Roadmap for Tiled 1.1, along with layer locking.

Thanks @bjorn ! I'm looking forward to .17!

And thanks for the reply @Seanba ! I've been using Tiled2Unity's Custom Importer extensively in my project, and I wrote one to do just that!

Short update: I'm currently working on this feature and my plan is to make it a simple layer grouping feature, similar to how it works in Photoshop, like originally requested. Making bigger changes to the map format will have to wait.

The feature gained priority mostly because a major patron is asking for it to be implemented.

This work is done on the wip/group-layer branch.

I have merged the wip/group-layer branch into master and updated the snapshot branch, so you can soon try out this feature. The issue remains open for now because I still need to look into supporting drag-n-drop of layers into and out of groups.

At 2,774 additions and 1,014 deletions affecting 86 files, this was one huge change.

Bjorn, are there still daily builds of Tiled available somewhere? I might want to take a peek at what you're doing here, especially to see how this grouping is expressed in the TMX format.

@Seanba Yes, the daily builds are still available (and linked from the itch.io downloads page). You can find them at https://update.mapeditor.org/ in the snapshots-win and snapshots-osx folders.

In the TMX format, you can now find group layers as follows:

<layer ...></layer>
<objectgroup ...></objectgroup>
<group ...>
    <layer ...></layer>
    <objectgroup ...></objectgroup>
</group>

While I think this'll do fine, feedback is welcome.

Bjorn, I grabbed version 0.18.1545 and for the life of me I can't find the Collision Editor. I'm guessing it has been moved?

@Seanba I moved it to the Tileset menu, which is only visible if you're editing a tileset. You're not the first one being confused...

For those interested, Tiled2Unity version 1.0.10.1 was just uploaded and it supports Group Layers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Archeia picture Archeia  路  13Comments

niedzielski picture niedzielski  路  16Comments

bjorn picture bjorn  路  14Comments

bgulanowski picture bgulanowski  路  22Comments

alaa-eddine picture alaa-eddine  路  20Comments