-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
No option to change layer ID #4020
Comments
Why is this necessary, what is your use for sequential IDs? Layer IDs are a Tiled implementation detail and their specific value shouldn't matter as long as they remain unique within a map. If you are relying on layer IDs for something in your game, that is a mistake - use layer names or custom properties instead. That said, I do wish Tiled assigned layer IDs sequentially based on the IDs currently in use, rather than always incrementing. This would avoid the need to store "nextlayerid" in map files, and it would prevent the IDs from getting silly large when layers are created and deleted repeatedly. I have some maps with perhaps a dozen layers with IDs in the hundreds if not thousands, and it just feels silly. It's not a "real" problem since, as I said, the IDs should not be treated as static or "important" (and in fact, could be randomised on each save without making them any less useful), but the IDs getting huge does bother me a bit. Ditto for Objects, which have the same problem. With Objects, the IDs are done the way they are to prevent object references from accidentally referring to the wrong object when the values are changed, but I'd rather see IDs reused and no-longer-valid references cleared. |
Coz is often fake and bad intuition due names in case code need int ID.. |
I think You are wrong.. coz .tmx should be like a data base and template, so if you building logic levels eg. 3 similar, then layers should be this same id for each. And when some mistake or something.. accidentally pushed add layer, etc. changing this data structure with no option to manage. I tried manually in file, but then app have problem with this.. as broken - probably I made this in bad way or it not allowing to some changes maybe. |
When layer IDs were introduced, it was specifically to allow other files to associate data with specific layers, in the knowledge that a layer ID would be both unique and stable. Layer IDs are also used for making the current layer and expanded layers persistent across sessions. So allowing layer IDs to be changed or randomized would mess with the original use-case for layer IDs and could cause issues (although minor) with restoring the session. Internally, they are also used in cases where a direct pointer isn't possible (a kind of weak reference). We can see these IDs as similar to the unique IDs assigned to rows in a database table. These IDs are generally also never changed and not reused after rows have been deleted. I understand that not everybody works the same, but I'd really suggest to use layer names rather than trying to rely on their IDs. Or maybe you can just rely on their order / index if you don't want to look them up by their name, since you can reorder layers as needed. |
Ok.. ID as key. But maybe should be something like |
@ManPython Sorry, I have no idea what you mean. |
I can change position queue in GUI, but can't use queue id in case want use IDqueue not IDkey. |
As bjorn suggested earlier, you can use the layer index (i.e. its position in the list of layers) instead of the layer ID if you want. It would be against the purpose of the layer ID for it to change when layers are reordered. The index isn't displayed in the GUI, but it would be simple to calculate it, or to write a script to calculate it for you. And if you want a fully controllable "ID" that only changes when you want it to, you can use custom properties. |
Describe the bug
No option to change layer ID. This made problem when deleting old to add new due some mistakes, then ID is always incremented.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Manage ID due automation for discover layers, eg. levels as some template (1st main terain, 2nd sprite_1 3th sprite_3)
It's bad case to no option to change or manage when many maps and something was in bad case.
Media
If applicable, add screenshots or videos to help explain your problem.
Specifications:
The text was updated successfully, but these errors were encountered: