tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Add Move Selection feature.

Open bryanedds opened this issue 12 years ago • 16 comments

This is really fundamental to building stages in side-scrolling games. In that context, you often need to move slices of the stages back and forth. The current tools are insufficient to do this smoothly.

Simple usage of Move Selection feature would be -

  • Select desired tiles with existing Selection tool.
  • Drag selection with right-click.

Usage in a side-scrolling level editing scenario would be -

  • Select tiles you wish to relocate with existing Selection tool.
  • Cut.
  • Select tiles you need to scoot out of the way.
  • Drag selection with right-click.
  • Paste, then place relocated tiles appropriately.

Additional polish feature would be -

  • Press escape to go from Stamp / Paste Mode back to previous mode (here would be Select Mode).

Implementation of main feature and polish should be straight-forward enough.

bryanedds avatar Apr 26 '14 02:04 bryanedds

This is key and it's hard to believe some form of moving a selection isn't in here, as it's a core thing. It's about the first feature I ran into when making something. There is no easy way to move sections around. You have to painfully copy/paste each layer of the section you want to move. This kills iteration time.

GeorgeBroussard avatar Aug 12 '14 03:08 GeorgeBroussard

@GeorgeBroussard Multi-layer editing operations are indeed missing and I understand this can be rather painful. That issue is covered by #282.

bjorn avatar Aug 12 '14 22:08 bjorn

+1 this would be really useful.

lazd avatar Sep 13 '14 01:09 lazd

I need this

joshmmo avatar Feb 01 '15 04:02 joshmmo

Another +1 from @eevee in his forum post. About time to raise the priority.

bjorn avatar Mar 07 '17 12:03 bjorn

Ok I'm on it :)

sanchaez avatar Apr 02 '17 10:04 sanchaez

My crap-a-rific map editor implemented multi-layer movement with a global check box titled "current layer only" - if that was off, every operation applied to every layer. I had a proper move tool (and of course, selection), and so could move portions of my multi layered map around, Yayyyyy. Or just the current selected layer. Rudimentary, but it worked like a charm. I like Tiled so much, can't do both make a map editor AND game (i'll die before then), but man, what a big wall this is not having a move tool... holding out for this one, Thorbjørn, my maps are gonna suffer until then. Might even be willing to up my patronage for this one. If I do though, I'm gonna pm you directly and let you know what it's for with wide eyes and a ridiculously huge wink ;-)

Bobjt avatar May 12 '17 04:05 Bobjt

@Bobjt I've been working on this, but it's current state is not really good and I don't have much free time :( I will push the changes to my fork today.

sanchaez avatar May 12 '17 12:05 sanchaez

Should this be specific to a particular tile layer, because the right now, the selection tool selects only from the currently active layer?

Another doubt: Should this be a new tool? Or should be added to the current selection tool itself (will work only when a particular key/mouse button is pressed)?

ketanhwr avatar Jun 07 '17 06:06 ketanhwr

@ketanhwr Multi-layer move would be awesome, but I suggest you implement single-layer move first, which would already be a nice addition.

Whether it should be a new tool, I'm not entirely sure. In GIMP, moving of selection is handled by a special layer mode which is called "Floated Layer". There can be only one floating layer and when there is one, it is always the currently selected layer. The floated layer can be dragged around by grabbing it, and it can be "anchored" (applied to the layer below it) by clicking outside of it. GIMP goes another step further, and allows selecting a region while having a floating layer, in which case anchoring the floated layer will only apply in the selected region.

So, implementing a move tool like that would be one option. However, it could also be simply a separate tool that cuts the selection when you drag it away and applies it at a new location when you click outside of it (or switch tools, I presume). I would probably go that way for now, since the floating layer approach will be quite involved even though the functionality is otherwise very similar.

Regarding the preview rendering, you can use the BrushItem for the draggable preview, and you could probably just cut out the part when the user starts to drag.

bjorn avatar Jun 07 '17 21:06 bjorn

@sanchaez Btw, if you think your changes could help @ketanhwr with his project, please do still push them to your fork. Thanks!

bjorn avatar Jun 07 '17 21:06 bjorn

Alright, thanks @bjorn! :smile:

ketanhwr avatar Jun 08 '17 05:06 ketanhwr

I would like to get more information about this new feature, which seems to be urgent for quite some time.

How about adding some kind of option for the Rectangular selection tool (disabled by default, I don't know yet where we could toggle it but maybe pressing a key combination may be good like Ctrl+M when selecting the Rectangular selection tool) that would move the selection of tiles instead of remaking a new selection, only if the mouse is hovering over a tile in this selection?

The moved tiles' former position would contain empty tiles (tile value 0) after the action, and each tile under that new moved selection would be erased and replaced by the new moved tiles.

What do you think about that idea?

RhenaudTheLukark avatar Mar 15 '18 10:03 RhenaudTheLukark

Now that #282 is implemented I think this issue is less urgent, since it is no longer than hard to copy or move multiple layers at a time using cut/copy/paste actions.

The issue stays open, because it would still be nice to allow more convenient select-and-move functionality in the future.

bjorn avatar Sep 05 '18 15:09 bjorn

In addition to moving tiles, it would be useful to be able to select tiles and objects to be moved at the same time. Very often you might want to move a section of map somewhere which includes everything on the map in that area including the objects.

At the moment doing this is a bit fiddly. You have to move the tiles with the cut and paste method, then move the objects, which, to do safely with correct snapping might require the creation of a temporary reference to use for snapping them at the exact relative location to the tiles.

JoeCreates avatar Jul 23 '19 07:07 JoeCreates

Agreeing that while multi-layer cut/paste is a huge improvement, it doesn't work as well for frequent minor surgery to a map. Copying and pasting moves the selection an arbitrary distance to the mouse cursor, and then I have to align it with where it was originally before I can think about moving it — which may be difficult if it wasn't attached to any existing geometry. Then I have to select the correct objects — without a clear reference for where the tiles used to be — and move them the same distance, which I don't even know concretely, while hoping that nothing gets snapped without my noticing.

It's okay to do once or twice to, say, cut a map in half and add space in the middle, but frequently moving chunks around by one or two tiles at a time feels almost like a gamble.

I think this can even be done without too much effort, since tile and object selections both continue to exist when switching to another layer. Just add a new Move tool that works on any layer type (like the Offset Layers tool does) and moves whatever's in the current selection on all selected layers. Then moving a chunk of a level would take a couple steps, but otherwise be straightforward:

  1. Make a tile selection
  2. Switch to the object layer(s) and select the objects in the same area, which is easy with the tile selection visible; objects on the border can be selected or not using the normal object selection tool
  3. Select all (relevant) layers
  4. Pick the Move tool and drag around

If you don't have objects, you don't even need half these steps; you can keep your tile layers selected and quickly move multiple chunks around by switching between the two tools. It'd be even quicker than cutting and pasting.

Offhand thoughts:

  • Tiles can only be moved discretely, by the size of a tile... but I'm pretty sure the tile size is per-map and can't be changed per-layer? So it might be enough to say that if any tile layer is selected, the Move tool will only move things by tile increments (even if there's no tile selection?).

  • If there's no selection, then Move could act like an interactive Offset Map, moving the contents of entire layers but keeping the layers themselves in the same place. Maybe with a modifier key to wrap (or maybe wrapping by default, since it's less destructive?).

  • A Move tool should probably treat image layers the same way that Offset Layers does.

  • I think the Move tool should get the icon currently used for Offset Layers, since it's the classic "move" symbol, and Offset Layers should get a new icon. (I tripped over it a few times when I was first using Tiled; offsets for anything but image layers seem like a specialized feature, and I didn't expect them to exist at all.)

eevee avatar Sep 16 '21 01:09 eevee