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

Feature request: Find object/layer #2162

Closed
JoeCreates opened this issue Jul 16, 2019 · 6 comments
Closed

Feature request: Find object/layer #2162

JoeCreates opened this issue Jul 16, 2019 · 6 comments

Comments

@JoeCreates
Copy link

It would be very useful to be able to do a search for an object or layer by name or ID.

@bjorn
Copy link
Member

bjorn commented Jul 17, 2019

This request duplicates #1467 and is implemented by #1566, but that PR is stuck on a bug that I still meant to look into. I'll have another look at that PR.

@bjorn bjorn closed this as completed Jul 17, 2019
@bjorn
Copy link
Member

bjorn commented Jul 17, 2019

@JoeCreates Object search by name or ID was implemented now, to be released in the next development snapshot (probably sometime next week).

The same is not possible for layers, but it wouldn't be hard to add a filter to the layers view as well. But do you really have that many layers that you need a search filter? (Well, I guess some people do...)

@JoeCreates
Copy link
Author

I'm presently using tile layers to define game objects also. Basically I have objects in my world which are constructed out of tiles. I also use image layers to define reusable submaps (by exporting a map as an image then adding that to another map).

Crucially, I refer to the IDs of these sometimes in scripts. I might see a script trying to do something with the "tiled thing" with id x, and I don't know if it's an image layer, tile layer or object, because I'm treating them all as if they are objects. I'll see the id and I want to find that object quickly.

When we eventually get object reference fields I would similarly want to be able to assign tile layers, image layers, or groups (basically anything with a tiled id).

@bjorn
Copy link
Member

bjorn commented Jul 23, 2019

Crucially, I refer to the IDs of these sometimes in scripts. I might see a script trying to do something with the "tiled thing" with id x, and I don't know if it's an image layer, tile layer or object, because I'm treating them all as if they are objects. I'll see the id and I want to find that object quickly.

Hmm, but the IDs are only unique for each type of data. If you have three layers and three objects, they will both have IDs 1, 2 and 3. Does that not pose a problem?

When we eventually get object reference fields I would similarly want to be able to assign tile layers, image layers, or groups (basically anything with a tiled id).

But when I implement object references, then it will probably only be able to refer to objects due to the above issue. If you want to refer to a layer, it would be a layer reference. Of course, it may make sense to unify all these types first, and I'm not entirely opposed to that, but I think this would be a huge change and likely not going to be backwards compatible.

@JoeCreates
Copy link
Author

Are you sure they're not unique? I seem to have been incredibly lucky so far with not having any collisions if so. My layer IDs are huge even though I've not had many layers in the map and I have a couple of large maps and cross reference stuff all the time with no issue so far.

If true then it throws a bit of a spanner in the works for my current system. I could always add a prefix to the ids like t109, o345. A tiled reference field could maybe account for collisions by having an attribute or prefix to indicate the domain like this.

@bjorn
Copy link
Member

bjorn commented Jul 24, 2019

Are you sure they're not unique? I seem to have been incredibly lucky so far with not having any collisions if so. My layer IDs are huge even though I've not had many layers in the map and I have a couple of large maps and cross reference stuff all the time with no issue so far.

I'm sure about it. In the TMX format, we have separate attributes for nextobjectid and nextlayerid, which simply count upwards.

I think your layer IDs likely got huge due to issue #2160.

I could always add a prefix to the ids like t109, o345. A tiled reference field could maybe account for collisions by having an attribute or prefix to indicate the domain like this.

Doesn't sound like a bad idea! I'd probably go for a syntax like object#20 and layer#1. Something to consider when implementing #707.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants