Copy and paste same-named layers is broken

I’m working on automapping, and want to be able to copy and paste layers to reuse templates, or to rearrange the execution of rules. However if I have multiple layers of the same name (e.g. input_ground), then only one of the layers gets copied over.

As a comment it seems like having same-named layers might be a problematic method of overloading a rule, and perhaps a different notation could be employed to resolve this.

Layer names are used to merge pastes, so yes, if all the layers have the same name, pasting is broken. Not a bug, but a feature ):

Other approaches are discussed here: Multi-layer copy/paste not working when two layers have the same name · Issue #3094 · mapeditor/tiled · GitHub

I think we’re more likely to see a change in how pasting works than a change in how automap layer naming works. Until we have a fix to multi-layer copypasting, I use this script, which among other things lets you automatically add (and remove) layer IDs to the name, so temporarily make them all uniquely-named: tiled-scripts/AutomapHelper.js at main · eishiya/tiled-scripts · GitHub
It adds a few menu actions to the Edit and Map menus to aid in Automapping. “Add UIDs to Selected Layers” and “Remove UIDs from Selected Layers” are the ones you’re looking for. You’d Add UIDs after making all your layers and keep them there while editing your AutoMapping rules, and then Remove them when you’re ready to use/test your rules.

2 Likes