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

get_tiles_count on Scene Collection returns wrong number #73645

Closed
Jeb187 opened this issue Feb 20, 2023 · 3 comments · Fixed by #94329
Closed

get_tiles_count on Scene Collection returns wrong number #73645

Jeb187 opened this issue Feb 20, 2023 · 3 comments · Fixed by #94329

Comments

@Jeb187
Copy link

Jeb187 commented Feb 20, 2023

Godot version

4.0 RC2

System information

Kubuntu 22.10

Issue description

The method get_tiles_count() does not return the right amount (always 1) of included scenes, when called on a Scene Collection Source.

It works alright when called on an Atlas Source, though.

Steps to reproduce

  1. Create TileMap Node
  2. Create TileSet
  3. Add Scene Collection to tileset
  4. Add Scenes to Scene Collection
  5. call get_tiles_count() on tileset
  6. it always returns 1, no matter how many scenes were actually added to the Scene Collection

Minimal reproduction project

get_tiles_count.zip

@KoBeWi
Copy link
Member

KoBeWi commented Feb 20, 2023

Seems unimplemented:

int TileSetScenesCollectionSource::get_tiles_count() const {
return 1;
}

I wonder if there is a reason.

@YuriSizov YuriSizov added this to the 4.1 milestone Feb 20, 2023
@Jeb187
Copy link
Author

Jeb187 commented Feb 21, 2023

As a workaround I use get_next_scene_tile_id() and subtract 1 from the returned value.

But I'd prefere to use the proper method.

@groud
Copy link
Member

groud commented Mar 17, 2023

This is the expected behavior. Those function are meant to be used to be able to iterate over all sources tiles and their alternatives. Since tiles scenes are indexed using the alternative ID, then the get_tile_count function should always return 1, and similarly, TileSetScenesCollectionSource::get_tile_id does always return Vector2i(0,0)

Here, it is get_alternative_tiles_count that should return the result you expect.

Edit: as a side note, it would be possible to index scene tiles using the tile ID, but since it is a Vector2i, and scene tiles are not laid out in a grid, I think this would be even more confusing.

I guess that needs a better documentation then though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
5 participants