@@ -944,12 +944,22 @@ void TerrainChunk::scene_set_node(const int index, const Node *p_node) {
944
944
int TerrainChunk::scene_get_count () const {
945
945
return _scenes.size ();
946
946
}
947
- void TerrainChunk::scene_remove (const int index) {
947
+ void TerrainChunk::scene_remove (const int index, const bool p_queue_free ) {
948
948
ERR_FAIL_INDEX (index, _scenes.size ());
949
949
950
+ if (p_queue_free) {
951
+ scene_queue_free (index);
952
+ }
953
+
950
954
_scenes.remove (index);
951
955
}
952
- void TerrainChunk::scenes_clear () {
956
+ void TerrainChunk::scenes_clear (const bool p_queue_free) {
957
+ if (p_queue_free) {
958
+ for (int i = 0 ; i < _scenes.size (); ++i) {
959
+ scene_queue_free (i);
960
+ }
961
+ }
962
+
953
963
_scenes.clear ();
954
964
}
955
965
@@ -2077,8 +2087,8 @@ void TerrainChunk::_bind_methods() {
2077
2087
ClassDB::bind_method (D_METHOD (" scene_set_node" , " index" , " node" ), &TerrainChunk::scene_set_node);
2078
2088
2079
2089
ClassDB::bind_method (D_METHOD (" scene_get_count" ), &TerrainChunk::scene_get_count);
2080
- ClassDB::bind_method (D_METHOD (" scene_remove" , " index" ), &TerrainChunk::scene_remove);
2081
- ClassDB::bind_method (D_METHOD (" scenes_clear" ), &TerrainChunk::scenes_clear);
2090
+ ClassDB::bind_method (D_METHOD (" scene_remove" , " index" , " queue_free " ), &TerrainChunk::scene_remove, DEFVAL ( true ) );
2091
+ ClassDB::bind_method (D_METHOD (" scenes_clear" , " queue_free " ), &TerrainChunk::scenes_clear, DEFVAL ( true ) );
2082
2092
2083
2093
ClassDB::bind_method (D_METHOD (" scene_instance" , " index" ), &TerrainChunk::scene_instance);
2084
2094
ClassDB::bind_method (D_METHOD (" scene_queue_free" , " index" ), &TerrainChunk::scene_queue_free);
0 commit comments