diff options
| author | David Saltares | 2017-09-04 21:52:44 +0100 |
|---|---|---|
| committer | David Saltares | 2017-09-05 22:44:19 +0100 |
| commit | f43a0ef3270737d2b526480ecb0f1337ece9e041 (patch) | |
| tree | 85bb60cbb7ba7c0287796a452a6753052b237dda /modules/gridmap/grid_map.cpp | |
| parent | 29db531fc8360b1e6d5e23008b208517b6d8c627 (diff) | |
| download | godot-f43a0ef3270737d2b526480ecb0f1337ece9e041.tar.gz godot-f43a0ef3270737d2b526480ecb0f1337ece9e041.tar.zst godot-f43a0ef3270737d2b526480ecb0f1337ece9e041.zip | |
Diffstat (limited to 'modules/gridmap/grid_map.cpp')
| -rw-r--r-- | modules/gridmap/grid_map.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 1b932f040..1b7a9e406 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -655,6 +655,24 @@ void GridMap::_notification(int p_what) { //_update_area_instances(); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + _update_visibility(); + } break; + } +} + +void GridMap::_update_visibility() { + if (!is_inside_tree()) + return; + + _change_notify("visible"); + + for (Map<OctantKey, Octant *>::Element *e = octant_map.front(); e; e = e->next()) { + Octant *octant = e->value(); + for (int i = 0; i < octant->multimesh_instances.size(); i++) { + Octant::MultimeshInstance &mi = octant->multimesh_instances[i]; + VS::get_singleton()->instance_set_visible(mi.instance, is_visible()); + } } } @@ -720,6 +738,7 @@ void GridMap::_update_octants_callback() { to_delete.pop_back(); } + _update_visibility(); awaiting_update = false; } |
