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

Layer groups / hierarchy #1038

Closed
nobody-special666 opened this issue Jul 21, 2015 · 15 comments
Closed

Layer groups / hierarchy #1038

nobody-special666 opened this issue Jul 21, 2015 · 15 comments
Assignees
Labels
feature It's a feature, not a bug.
Milestone

Comments

@nobody-special666
Copy link

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?

@nobody-special666 nobody-special666 changed the title Proposal: Layer groups for tiled Proposal: Layer groups for Tiled Jul 21, 2015
@bjorn bjorn added the feature It's a feature, not a bug. label Jul 21, 2015
@bjorn
Copy link
Member

bjorn commented Jul 21, 2015

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.

@bjorn bjorn changed the title Proposal: Layer groups for Tiled Layer groups / hierarchy Jul 21, 2015
@tpetry
Copy link

tpetry commented Aug 5, 2015

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.

@bjorn
Copy link
Member

bjorn commented Aug 6, 2015

@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.

@mscharhag
Copy link

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

@adsilcott
Copy link

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.

@Seanba
Copy link
Contributor

Seanba commented Jul 25, 2016

(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.

@bjorn
Copy link
Member

bjorn commented Jul 25, 2016

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.

@adsilcott
Copy link

adsilcott commented Jul 25, 2016

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!

@bjorn bjorn self-assigned this Jan 10, 2017
@bjorn
Copy link
Member

bjorn commented Jan 15, 2017

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.

@bjorn bjorn added this to the Tiled 1.0 milestone Jan 21, 2017
@bjorn bjorn mentioned this issue Jan 27, 2017
@bjorn
Copy link
Member

bjorn commented Feb 7, 2017

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.

@Seanba
Copy link
Contributor

Seanba commented Feb 12, 2017

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.

@bjorn
Copy link
Member

bjorn commented Feb 13, 2017

@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.

@Seanba
Copy link
Contributor

Seanba commented Feb 19, 2017

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?

@bjorn
Copy link
Member

bjorn commented Feb 19, 2017

@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...

@Seanba
Copy link
Contributor

Seanba commented Mar 9, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

6 participants