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

Select/draw/del/C&P in multiple layers #282

Closed
olmototis opened this issue Sep 20, 2012 · 36 comments
Closed

Select/draw/del/C&P in multiple layers #282

olmototis opened this issue Sep 20, 2012 · 36 comments
Assignees
Labels
feature It's a feature, not a bug. priority request Has been requested by a major supporter.
Milestone

Comments

@olmototis
Copy link

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 ;)

@bjorn
Copy link
Member

bjorn commented Mar 2, 2013

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)

@bjorn
Copy link
Member

bjorn commented Mar 3, 2013

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.

@olmototis
Copy link
Author

(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 Tile Size per layer not per Map #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 $

@gamedevsam
Copy link

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 :)

@GeorgeBroussard
Copy link

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.

@saluk
Copy link

saluk commented Mar 24, 2015

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.

@nicloay
Copy link

nicloay commented Apr 10, 2015

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.

@bjorn
Copy link
Member

bjorn commented Apr 10, 2015

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

@ArmagonNo1
Copy link

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.

@hamburml
Copy link

This would be extremely helpful when creating automapping rules.

@highruned
Copy link

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

@axboureau
Copy link

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.

@Bobjt
Copy link

Bobjt commented Jul 24, 2017

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.

@bjorn
Copy link
Member

bjorn commented Jul 25, 2017

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

@Bobjt
Copy link

Bobjt commented Jul 25, 2017

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.

@bjorn
Copy link
Member

bjorn commented Jul 31, 2017

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

@bjorn bjorn self-assigned this Dec 17, 2017
@bjorn
Copy link
Member

bjorn commented Dec 17, 2017

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 (5b3b199). 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.

@Bobjt
Copy link

Bobjt commented Dec 17, 2017

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!

@bjorn
Copy link
Member

bjorn commented Dec 17, 2017

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

bjorn added a commit that referenced this issue Dec 19, 2017
* The Stamp Brush now captures from all selected layers on right-click
  drag, creating a multi-layer stamp.
* In case of a multi-layer stamp, a multi-layer preview brush is built.
* The brush preview can now visualize multiple tile layers.
* The paint operation can now handle multiple layers, including to merge
  the undo commands.
* When painting multiple layers, the target layers are matched by name.
  New layers are created when no layers with the given name exist yet.

While this is good progress, it's still only the start since many other
tools as well as many actions should still be adapted to handle
multiple selected layers.

Issue #282
@bjorn
Copy link
Member

bjorn commented Dec 21, 2017

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.

@Bobjt
Copy link

Bobjt commented Dec 21, 2017

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!

@bjorn
Copy link
Member

bjorn commented Dec 27, 2017

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.

@Bobjt
Copy link

Bobjt commented Jan 1, 2018

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.

@highruned
Copy link

highruned commented Jan 1, 2018

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

@Bobjt
Copy link

Bobjt commented Jan 2, 2018

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

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

bjorn added a commit that referenced this issue Feb 14, 2018
* The Stamp Brush now captures from all selected layers on right-click
  drag, creating a multi-layer stamp.
* In case of a multi-layer stamp, a multi-layer preview brush is built.
* The brush preview can now visualize multiple tile layers.
* The paint operation can now handle multiple layers, including to merge
  the undo commands.
* When painting multiple layers, the target layers are matched by name.
  New layers are created when no layers with the given name exist yet.

While this is good progress, it's still only the start since many other
tools as well as many actions should still be adapted to handle
multiple selected layers.

Issue #282
@bjorn
Copy link
Member

bjorn commented Feb 14, 2018

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.

@Bobjt
Copy link

Bobjt commented Feb 17, 2018

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 bjorn added this to the Tiled 1.2 milestone Mar 1, 2018
@Bobjt
Copy link

Bobjt commented Mar 28, 2018

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.

bjorn added a commit that referenced this issue May 31, 2018
Also made some other things, like random mode and synchronization of
selected tiles in the tileset view, take into account multi-layer tile
stamps.

Issue #282
@bjorn
Copy link
Member

bjorn commented May 31, 2018

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

@Bobjt
Copy link

Bobjt commented May 31, 2018

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!

bjorn added a commit that referenced this issue Jun 6, 2018
This applies to both the Bucket Fill Tool as well as the Shape Fill
Tool.

Also applied similar logic regarding working on hidden layers as done in
change c87f8c4 for the Stamp Brush.

Issue #282
@bjorn
Copy link
Member

bjorn commented Jun 6, 2018

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

bjorn added a commit that referenced this issue Jul 30, 2018
bjorn added a commit that referenced this issue Jul 31, 2018
bjorn added a commit that referenced this issue Jul 31, 2018
bjorn added a commit that referenced this issue Aug 2, 2018
* Fixed a potential crash after deleting a group layer. This happened due
  to the QGraphicsRectItem staying parented to its last LayerItem when
  hidden, and then getting deleted along with that layer item when the
  layer was removed.

* Made sure the new current layer is selected after removing the
  selected layers.

* Made sure layers are selected by row.

Part of issue #282
bjorn added a commit that referenced this issue Aug 2, 2018
bjorn added a commit that referenced this issue Aug 2, 2018
bjorn added a commit that referenced this issue Aug 5, 2018
These actions now show/hide or lock/unlock all layers not included in
the current selection, instead of only taking into account the current
layer.

Part of issue #282
@bjorn
Copy link
Member

bjorn commented Aug 7, 2018

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.

@Bobjt
Copy link

Bobjt commented Aug 7, 2018

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!

bjorn added a commit that referenced this issue Sep 5, 2018
When having multiple layers selected, changing properties like the
visibility or locked status now apply to all selected layers instead of
just the last selected one.

The same goes for custom properties, which are also aggregated based on
all selected layers, as was already implemented for objects.

Part of issue #282
bjorn added a commit that referenced this issue Sep 5, 2018
Skipping those that can't be merged down.

Part of issue #282
bjorn added a commit that referenced this issue Sep 5, 2018
The tool makes sure that when a parent layer is moved, its children are
not moved as well, to avoid applying the offset twice.

Also made some other improvements, to reduce the chance of accidental
use:

* Only drag on left mouse button, not on right mouse button.
* Show a "SizeAll" / hand cursor when pressing the mouse button.
* While dragging, allow right mouse button or Escape to abort the drag.

Also fixed a problem with updating a layer's opacity when "Highlight
current layer" is active and multiple layers are selected.

Part of issue #282
@bjorn
Copy link
Member

bjorn commented Sep 5, 2018

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!

@bjorn bjorn closed this as completed Sep 5, 2018
@Bobjt
Copy link

Bobjt commented Sep 5, 2018

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

@bjorn bjorn added the priority request Has been requested by a major supporter. label Feb 1, 2022
@bjorn bjorn added this to Roadmap Feb 3, 2023
@bjorn bjorn moved this to Completed in Roadmap Feb 3, 2023
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. priority request Has been requested by a major supporter.
Projects
Archived in project
Development

No branches or pull requests