mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 13:43:15 +00:00
Add GridMap::get_used_cells. Fixes #11857.
This commit is contained in:
parent
0c82d113ed
commit
16bf0f08ed
@ -769,6 +769,8 @@ void GridMap::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear"), &GridMap::clear);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_used_cells"), &GridMap::get_used_cells);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_meshes"), &GridMap::get_meshes);
|
||||
|
||||
BIND_CONSTANT(INVALID_CELL_ITEM);
|
||||
@ -807,6 +809,19 @@ float GridMap::get_cell_scale() const {
|
||||
return cell_scale;
|
||||
}
|
||||
|
||||
Array GridMap::get_used_cells() const {
|
||||
|
||||
Array a;
|
||||
a.resize(cell_map.size());
|
||||
int i = 0;
|
||||
for (Map<IndexKey, Cell>::Element *E = cell_map.front(); E; E = E->next()) {
|
||||
Vector3 p(E->key().x, E->key().y, E->key().z);
|
||||
a[i++] = p;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
Array GridMap::get_meshes() {
|
||||
|
||||
if (theme.is_null())
|
||||
|
@ -223,6 +223,8 @@ public:
|
||||
void set_cell_scale(float p_scale);
|
||||
float get_cell_scale() const;
|
||||
|
||||
Array get_used_cells() const;
|
||||
|
||||
Array get_meshes();
|
||||
|
||||
void clear();
|
||||
|
Loading…
Reference in New Issue
Block a user