From ec448845e295c4b8e897793b0971ebd9912e3101 Mon Sep 17 00:00:00 2001 From: Olafur Haukur Flygenring Date: Tue, 18 Feb 2014 09:49:34 +0000 Subject: [PATCH] Added function "get_tiles_ids" to TreeSet. --- doc/engine_classes.xml | 7 +++++++ scene/resources/tile_set.cpp | 12 ++++++++++++ scene/resources/tile_set.h | 1 + 3 files changed, 20 insertions(+) diff --git a/doc/engine_classes.xml b/doc/engine_classes.xml index 8747aea6013..fca2be0318c 100644 --- a/doc/engine_classes.xml +++ b/doc/engine_classes.xml @@ -15046,6 +15046,13 @@ + + + + + + + diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index e3c27b0c0c0..95714ab501d 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -231,6 +231,17 @@ Array TileSet::_tile_get_shapes(int p_id) const{ return arr; } +Array TileSet::_get_tiles_ids() const{ + + Array arr; + + for (Map::Element *E = tile_map.front(); E; E = E->next()) { + arr.push_back(E->key()); + } + + return arr; +} + void TileSet::get_tile_list(List *p_tiles) const { for(Map::Element *E=tile_map.front();E;E=E->next()) { @@ -301,6 +312,7 @@ void TileSet::_bind_methods() { ObjectTypeDB::bind_method(_MD("clear"),&TileSet::clear); ObjectTypeDB::bind_method(_MD("get_last_unused_tile_id"),&TileSet::get_last_unused_tile_id); ObjectTypeDB::bind_method(_MD("find_tile_by_name","name"),&TileSet::find_tile_by_name); + ObjectTypeDB::bind_method(_MD("get_tiles_ids", "name"), &TileSet::_get_tiles_ids); } diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index e6743165198..5773c56ed2d 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -56,6 +56,7 @@ protected: void _get_property_list( List *p_list) const; void _tile_set_shapes(int p_id,const Array& p_shapes); Array _tile_get_shapes(int p_id) const; + Array _get_tiles_ids() const; static void _bind_methods(); public: