Tiled: Select/draw/del/C&P in multiple layers

Created on 20 Sep 2012  ·  36Comments  ·  Source: mapeditor/tiled

Hi, a little request:
It'll be awesome if you could select multiple layers and work with all at the same. For example:

You select 3 layers, then make a tile selection, copy and paste. Each tile could be drawed on the same layer name, or maybe on the current selected layers, respecting the same order (or something like that).

I usually have zones drawed in 3/4 layers that I want to repeat in the map, and I have to C/P each layer.

Thank you very much, and sorry for my english :)
(I don't know if this is the right place for doing requests, if not, delete it ;)

feature

Most helpful comment

I've posted a demonstration based on the above commit on YouTube:

https://www.youtube.com/watch?v=pu-yShBRCqM

Unfortunately I have committed to a few other improvements as well, but I aim to get back to working on this in the next weeks.

All 36 comments

I fully agree Tiled needs this feature, but I'm unsure how to best implement it. Problem areas:

  • If we match by layer index, the target map might not have these indexes or it might have different kinds of layers at these indexes.
  • If we match by layer name, the target map might not have layers with the same name, it might have multiple layers with those names and it might have layers with the same name but that are of a different kind.
  • If we require the user to select the target layers, I reckon the whole process will feel quite clumsy. And, what if the user pastes before doing this selection, or what if his selection does not match with the copied layer count, or selected layers are of different kinds?
  • Currently pasting puts the copied part in the stamp brush, so you can then place it where you want. In order to do multi-layer paste, we either need to change this approach or make the stamp brush deal with a multi-layer stamp somehow.
  • How to deal with copy & paste when it involves different kinds of selected layers? (also regarding the use of the stamp brush in case of tile selection)

Also, once #149 is implemented, tile layer selection can't even be reliably applied to all tile layers anymore. Not sure how to solve that yet either.

(I've read your last comment while writing, I comment it at the end)

I have been thinking about the best solution, and I have this possibility:

  • Layer match by layer order.

    • Independently of the layer index / name. If you copy from layers 1, 3 and 5. Then select layers 3, 6 and 9 and paste, layer 1 selection will be pasted on layer 3, 3 on 6 and 5 on 9.

    • That's not a big problem, commonly you will copy and paste from and to the same layers (e.g to move or to clone a building). And if not, you have to select the new layers (normal), and the tiles will be pasted respecting the same order (so the result will be the same, but on other layers).

    • origin_layers < destination_layers = paste in order and ignore last destination_layers, the tiles will be pasted only on the first X layers.

    • origin_layers > destination_layers = ignore last origin_layers. If you've copied 4 layers, you select only 2 and paste, only the first 2 layers will be pasted. If you make a mistake, you will see easily that the result is not "complete" and you need to select more layers.

  • Layer type, ignore non tile layers when pasting.
  • Updating the stamp brush would be incredible. However, if it is complicated, when copying more than 1 layer, the stamp brush wont show the "result". You will see the effect when pasting. If you are not happy, ctrl Z and repeat :)
  • Regarding your last comment about issue #149 :

    • I really don't know if you are working on that, but it is a very good feature.

    • The easiest solution is not to permit selection when the layers have <> types/tile_size. A good way for selecting layers could be pressing ctrl + clicking on the layers. Once you have selected the first layer, if you move the cursor to a layer with <> type, a little "x" or a message could appear beside the cursor while pressing ctrl. You can't select this layer. When pasting, the process will be the same as above. Respecting the order, and ignoring <> layers (type, size, etc.)

I'm not a good coder, so it's nearly impossible for me to implement it. My only help could be to test, to help with design and donate some $

Its my personal experience that donating some $ gives bjorn great motivation to work on requests (so please donate if you can, this is a great program for the game development community). However, this is quite a big request and might take a while to complete. This would be a great addition to the program, and as a fellow tiled user, I thank you for your suggestions :)

Could you have a mode where you highlight a section and you can then drag it to a new place in the map, and have it affect _all_ layers within the highlight region? You could also rotate the selection. This alone would make working on maps a lot easier and save a lot of time.

I really would like this feature. I have fairly complex trees in my scene, which end up being 4 or 5 layers deep. The only way to copy and paste trees around the map is to do it 5 times for every single tree. It's just not feasible. In my use case, most of the issues mentioned are not issues, as I am never copying from one map to another - only copying tiles I've drawn within a single map; and I never care about copying tiles and objects at the same time. The stamp brush is the only complex piece in that case.

No offense intended (thanks for the years of effort!), but it is sometimes sad to see features put on the back burner because doing them perfectly is difficult; when doing the most basic or imperfect version of the feature is actually 80% of what people want.

is this possible to make copy/paste of all layers within one document? in this case should not be any problem. if user removed or add new layer, just show notification that selection in buffer would lost.

@nicloay While this would avoid some of the issues, it does not make this an easy task since the stamp brush still needs to be adapted to handle multiple layers. It would also introduce a parallel copy/paste system which I'm not too fond of.

In general this is an issue I'd like to address, but I have to choose my priorities somehow. Due to the limited time I've had for Tiled development over the past two years, my priorities have been driven mainly by pull requests and sponsored features. And this feature is something nobody set out to address nor did anybody offer to pay for it. I hope that based on support via Patreon, I will soon be able to spend one full day per week on Tiled which would make time available for working on issues like these.

Just wanted to echo the sentiments of others here. Being able to select multiple layers, dragging out a box and then being able to either move or copy the selection would be so helpful.

This would be extremely helpful when creating automapping rules.

Pretty much the biggest thing that could be done to improve workflow/quality of maps.

I also think it would be the greatest improvement to the usability of tiled currently.
Regarding the best way to do it, why not have a button to select from all layers?
Then the copy/paste would not have to be any different (at least from the user point of view).
Then for pasting, there could be 2 ways to handle it:
a) The tiles could be copied with their index and offset to the current layer, and pasting them would paste to the layer given by currentlayer+offset.

b) The tiles would be copied with their index and the layer name, and when pasting each selected tile would be pasted into the layer of the same name at the current location.
If it does not exist (because it is another map), then a layer of the same name is created.

a) is more consistent with the current system
b) is more useful
I think any of the two can work.

Bjorn, how is this coming along? Do we need a bounty to move up the priority (if so, how much is needed given scope of work?). If more than I can pony up, I'll try to organize a pool.

@Bobjt Even with spending two full days on Tiled, I'm totally swamped by all kinds of things. I think currently this is mostly because of the Google Summer of Code mentoring, and of course there's the time spent on documentation recently (moving to a more powerful format and to enable translations). Other problems are that major patrons have asked me to spend time on things like loading resources from URLs and soon showing adjacent maps in the same view.

So, of course it's an option to collect up to $200/month, at which point I will promise to commit at least a full day/month to the issue until it is resolved. When things calm down I will eventually get around to it, but I can't promise a timeline.

Scope-wise, I think this feature opens op a big can of worms, so a rough estimate would be 2-4 days of work.

Thanks for the follow up and I've adjusted contribution. Though not sure how long I can maintain gold level, I rely on Tiled heavily and so there are few hesitations with chipping in commensurate to my investment in my own title. Now worries if it takes a while. I might drop down and come back later to try again depending on finances availability. Either way, I'll be around cheering from the sideline.👍 Keep up the good work.

@Bobjt A major thanks for increasing your support so dramatically! Unfortunately for this month I don't have a day available anymore, but that means I'll be looking for 2 days in August to focus on this issue. I've mentioned this issue in the latest development update. Thanks for the encouragement as well!

Started work on this today, but made slow progress so far. There is a new branch wip/multi-layer, where I've enabled multi-selection in the Layers view (5b3b1991b44ddab483cfd67aa50747886fb14713). In coming days I will see how this will affect various actions, especially painting and selection, but also grouping or moving up/down multiple layers for example.

So excited, Bjørn. While milling away in Tiled as many hours of the day as possible, I've been watching the lists for status. Really looking forward to this one. Cheers!

@Bobjt I'm quite excited about improving this area of Tiled myself as well. Thanks again for your support and sorry for the delay in getting to this!

I've posted a demonstration based on the above commit on YouTube:

https://www.youtube.com/watch?v=pu-yShBRCqM

Unfortunately I have committed to a few other improvements as well, but I aim to get back to working on this in the next weeks.

It's looking perfect! The application Stamps is natural as well, assuming it's opening the ability for multi-level stamps too (?). I look forward to checking it out!

It's looking perfect! The application Stamps is natural as well, assuming it's opening the ability for multi-level stamps too (?). I look forward to checking it out!

Yes, in the video I tried to demonstrate that multi-layer stamps can also be saved and restored in the Stamps view. For now you can check it out only by compiling yourself from the wip/multi-layer branch, but I expect to merge this in the development snapshots sometime next week.

Fantastic! Related to this but probably a separate feature, will we have the ability to copy/paste between two different map files as well? (I suppose in its rudimentary form, assuming both maps share the same layer names/structure?) These features couldn't be coming at a better time since I've redone my map format once again and will be rebuilding the final maps from scratch very soon.

Oh my god. Not to take away from it, but... finally! I'm so excited. Thanks guys!

Fantastic! Related to this but probably a separate feature, will we have the ability to copy/paste between two different map files as well? (I suppose in its rudimentary form, assuming both maps share the same layer names/structure?)

I still have to adjust the copy/paste code, but I don't consider that a separate feature. The way it would currently work, is if you paste multiple layers, they would change the active stamp as usual, and then when you try to paint it will automatically create any layers that it can't find. Layers are matched by name, so it depends on those being unique. I hope this will be fine, but feel free to suggest alternative behaviors / options.

Oh my god. Not to take away from it, but... finally! I'm so excited. Thanks guys!

I definitely share your sentiment!

Layers are matched by name, so it depends on those being unique.

No problem. That's one caveat that is easy to work around.

After spending another two days on this (mostly adjusting cut, copy, paste and delete), today I've merged the wip/multi-layer branch to master and released a new development snapshot! Let me know if you find any issues or things not working as expected!

Known incomplete stuff:

  • Most actions in the Layers view still only work on one layer.
  • The Bucket Fill and Shape Fill tools are not adjusted yet.

Tried this tonight (macOS snapshot) and it's absolutely perfect! I haven't worked with it yet, but sure passes fundamental tests. I can move around in chunks and, from map to map. It's all very intuitive as well. I'm jumping for joy at this lovely work! Thank you, Bjorn!!! 🙌🍾⭐️🎊

Bjorn, the one issue I found in the 14-2-18 build regards rotation of multiple layers ('y' and 'z' shortcuts). Not all layers in the current stamp appear to get rotated.

@Bobjt Man, that was a tough one that took me a few hours to fix! First I made it easy and fast to iterate the tile layers of a map, which I then used while making sure all layers got flipped (while staying in the right composition). In the meantime I also made some small TileLayer optimizations and fixes and realized I had broken display of tile selection earlier. Let's hope no new issues were introduced!

I think now it's time to start looking at the other things I had already mentioned. If you notice anything else, please let me know!

Jesus, @bjorn you're a regular wizard. BUT, that's why I chose you as my map tools engineer because I already knew that 👹 Hee hee hee. I was relieved to hear that some more patrons chipped in to help cover costs. Of the hold outs I think 1/3 can't afford (shucks), another third are stingy (blast!), and there's this third kind that simply aren't thinking. Anyway, this fix is epic. Rotating layered sections is going to vary map look so rapidly that it's simply monumental. Keep up the good work!

@Bobjt Well, I'm not sure if a wizard would make so many mistakes to the same small class, but today I did get multi-layer stamps to play nicely with the fill tools, while reducing code size. ^^

Ah, the long tail of adding certain features to an existing project! All above changes are included in today's new development snapshot.

Still areas that could use improvement:

  • Make "Merge Layer Down" work with multiple selected layers. Should not be that hard, just need to make sure to process selected layers in the right order.

  • Make the "Offset Layer" tool apply the offset to all selected layers. Here we mostly need to avoid moving a layer along with any of its parent layers, since that would apply the offset twice.

Holy, wow, that's a lot of change propagation. But believe me, I'm the first guy to understand... No one should ever see the map editor I created, now retired. It's got more bugs than Pfizer has pills, and I'm flat-out ashamed of the UI - it's a disgrace...I look up to you massively my friend!

Alright, now the "Merge Layer Down" action and "Offset Layer" tool also work on all selected layers. In addition, the Properties view now behaves more like you would expect when having multiple layers selected, applying changes to layer attributes and custom properties to all of them.

At the moment I'm not aware of more areas that need adjustment to multi-selection for layers, so I'm closing this issue!

One small step for Tiled, one giant leap for indie development. ✨🚀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leonidax picture leonidax  ·  47Comments

konsumer picture konsumer  ·  16Comments

Bobjt picture Bobjt  ·  16Comments

bjorn picture bjorn  ·  16Comments

bjorn picture bjorn  ·  14Comments