summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorokamstudio <juan@okamstudio.com>2014-02-20 23:40:26 -0200
committerokamstudio <juan@okamstudio.com>2014-02-20 23:40:26 -0200
commitb98da14f0f97a5039c512c5ea0cc7d99325dd74b (patch)
treebe85393e433d0b76ceb13eb3aca4b22b6997ba15
parent70a9647d2dc7b218e3dc4e9607aa5ffc0e6e1aa3 (diff)
parentc78a06536ebc7c2c2718eaf800c8227bdb07a931 (diff)
Merge pull request #116 from olifly/master
Added function "get_tiles_ids" to TreeSet.
-rw-r--r--doc/engine_classes.xml7
-rw-r--r--scene/resources/tile_set.cpp12
-rw-r--r--scene/resources/tile_set.h1
3 files changed, 20 insertions, 0 deletions
diff --git a/doc/engine_classes.xml b/doc/engine_classes.xml
index 8747aea601..fca2be0318 100644
--- a/doc/engine_classes.xml
+++ b/doc/engine_classes.xml
@@ -15046,6 +15046,13 @@
<description>
</description>
</method>
+ <method name="get_tiles_ids" qualifiers="const" >
+ <return type="Array">
+ </return>
+ <description>
+
+ </description>
+ </method>
</methods>
<constants>
</constants>
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index c85b470325..208ba5bb66 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -250,6 +250,17 @@ Array TileSet::_tile_get_shapes(int p_id) const{
return arr;
}
+Array TileSet::_get_tiles_ids() const{
+
+ Array arr;
+
+ for (Map<int, Data>::Element *E = tile_map.front(); E; E = E->next()) {
+ arr.push_back(E->key());
+ }
+
+ return arr;
+}
+
void TileSet::get_tile_list(List<int> *p_tiles) const {
for(Map<int,Data>::Element *E=tile_map.front();E;E=E->next()) {
@@ -322,6 +333,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 0550962362..ddbb1b59a6 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -57,6 +57,7 @@ protected:
void _get_property_list( List<PropertyInfo> *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: