diff --git a/CHANGELOG.md b/CHANGELOG.md index a4d95412f7a..41417ffae80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,147 @@ previous feature release. It is equivalent to the listings on our Changelogs for earlier feature releases are available in their respective Git branches, and linked at the [end of this file](#Past-releases). +## 4.2.1 - TBA + +- [Release announcement](https://godotengine.org/article/maintenance-release-godot-4-2-1) +- [Interactive changelog](https://godotengine.github.io/godot-interactive-changelog/#4.2.1) + +#### 2D + +- Fix UV editor not using texture transform ([GH-84076](https://github.com/godotengine/godot/pull/84076)). +- Fix generating terrain icon with certain image formats ([GH-84507](https://github.com/godotengine/godot/pull/84507)). +- Keep scene tiles even if the TileMap is invisible ([GH-85753](https://github.com/godotengine/godot/pull/85753)). +- Fix TileMap occluders ([GH-85893](https://github.com/godotengine/godot/pull/85893)). + +#### 3D + +- Only allow MeshInstance3D-inherited nodes in MultiMesh Populate Surface dialog ([GH-84933](https://github.com/godotengine/godot/pull/84933)). + +#### Animation + +- Fix imported track flag on sliced animations ([GH-85061](https://github.com/godotengine/godot/pull/85061)). +- Prevent a crash when calling `AnimationMixer::restore` with an invalid resource ([GH-85428](https://github.com/godotengine/godot/pull/85428)). +- Fix AnimationPlayer seeking for Discrete keys ([GH-85569](https://github.com/godotengine/godot/pull/85569)). +- Fix Tween loop initial value ([GH-85681](https://github.com/godotengine/godot/pull/85681)). + +#### Audio + +- Fix importing WAV files with odd chunk sizes ([GH-85556](https://github.com/godotengine/godot/pull/85556)). + +#### Buildsystem + +- Use Python venv if detected when building VS project ([GH-84593](https://github.com/godotengine/godot/pull/84593)). +- Fix the Web platform team's codeowners link ([GH-85746](https://github.com/godotengine/godot/pull/85746)). +- Fix invalid Python escape sequences ([GH-85818](https://github.com/godotengine/godot/pull/85818)). + +#### Core + +- Set language encoding flag when using `ZIPPacker` ([GH-78732](https://github.com/godotengine/godot/pull/78732)). +- Fix crash when hashing empty `CharString` ([GH-85389](https://github.com/godotengine/godot/pull/85389)). +- Prevent infinite recursion when printing errors ([GH-85397](https://github.com/godotengine/godot/pull/85397)). +- Fix property groups overriding real properties ([GH-85486](https://github.com/godotengine/godot/pull/85486)). +- Do not reload resources and send notification if locale is not changed ([GH-85787](https://github.com/godotengine/godot/pull/85787)). + +#### Documentation + +- Improve and clarify texture filtering documentation ([GH-83907](https://github.com/godotengine/godot/pull/83907)). +- Fix documentation for `icon_and_font_color` editor setting ([GH-85491](https://github.com/godotengine/godot/pull/85491)). +- Improve documentation for `CameraAttributesPhysical.exposure_shutter_speed` ([GH-85599](https://github.com/godotengine/godot/pull/85599)). +- Fix missing heading in translated online class reference ([GH-85877](https://github.com/godotengine/godot/pull/85877)). + +#### Editor + +- Remove exp hint of a few properties ([GH-80326](https://github.com/godotengine/godot/pull/80326)). +- Fix UV editor not showing polygon correctly ([GH-84116](https://github.com/godotengine/godot/pull/84116)). +- Inspector: Fix clearing array/dictionary element with `` ([GH-84237](https://github.com/godotengine/godot/pull/84237)). +- Allow dragging editable children ([GH-84310](https://github.com/godotengine/godot/pull/84310)). +- Fix errors on file rename or move in the Filesystem Dock ([GH-84520](https://github.com/godotengine/godot/pull/84520)). +- Fix issue with 3D scene drag and drop preview node ([GH-85087](https://github.com/godotengine/godot/pull/85087)). +- Fix SnapGrid is almost invisible in light theme ([GH-85585](https://github.com/godotengine/godot/pull/85585)). +- Fix theme application in various editor dialogs ([GH-85745](https://github.com/godotengine/godot/pull/85745)). + +#### Export + +- Fix order of operations for macOS template check ([GH-84990](https://github.com/godotengine/godot/pull/84990)). +- iOS: Use `mdfind` to check if Xcode is installed in one-click deploy code ([GH-85774](https://github.com/godotengine/godot/pull/85774)). + +#### GDExtension + +- Fix updating cached singletons when reloading GDScripts ([GH-85373](https://github.com/godotengine/godot/pull/85373)). +- Fix crash when using incompatible versions of Godot Jolt ([GH-85779](https://github.com/godotengine/godot/pull/85779)). + +#### GDScript + +- Improve autocompletion with `get_node` ([GH-79386](https://github.com/godotengine/godot/pull/79386)). +- Filter groups and categories from autocompletion ([GH-85196](https://github.com/godotengine/godot/pull/85196)). + +#### GUI + +- Enable scrolling of output with UI scale changes ([GH-82079](https://github.com/godotengine/godot/pull/82079)). +- VideoPlayer: Fix reloading translation remapped stream ([GH-84794](https://github.com/godotengine/godot/pull/84794)). +- Restored Control properties when you undo a parenting of a Control to a Container ([GH-85181](https://github.com/godotengine/godot/pull/85181)). +- Make sure `Window`'s title is respected before we compute the size ([GH-85312](https://github.com/godotengine/godot/pull/85312)). +- RTL: Fix CharFX character offset calculation ([GH-85363](https://github.com/godotengine/godot/pull/85363)). +- Limit window size updates on title change ([GH-85542](https://github.com/godotengine/godot/pull/85542)). +- Fix size and visuals of the `InputEventConfigurationDialog` ([GH-85790](https://github.com/godotengine/godot/pull/85790)). +- Limit window size updates on title translation change ([GH-85828](https://github.com/godotengine/godot/pull/85828)). + +#### Import + +- Fix memory leak on error paths in tinyexr loader ([GH-85002](https://github.com/godotengine/godot/pull/85002)). +- Fix memory corruption and assert failures in convex decomposition ([GH-85631](https://github.com/godotengine/godot/pull/85631)). + +#### Input + +- X11: Send IME update notification deferred ([GH-85306](https://github.com/godotengine/godot/pull/85306)). +- Fix IME key event being erased in macOS ([GH-85458](https://github.com/godotengine/godot/pull/85458)). +- Fix SubViewport physics picking ([GH-85665](https://github.com/godotengine/godot/pull/85665)). + +#### Navigation + +- Fix missing NavigationLink property updates in constructor ([GH-83802](https://github.com/godotengine/godot/pull/83802)). +- Fix missing NavigationRegion property updates in constructor ([GH-83812](https://github.com/godotengine/godot/pull/83812)). +- Fix missing NavigationAgent property updates in constructor ([GH-83814](https://github.com/godotengine/godot/pull/83814)). +- Fix missing NavigationObstacle property updates in constructor ([GH-83816](https://github.com/godotengine/godot/pull/83816)). +- Fix memory leak in 'NavigationServer3D' involving static obstacles ([GH-84816](https://github.com/godotengine/godot/pull/84816)). +- Fix NavigationRegion2D transform update ([GH-85258](https://github.com/godotengine/godot/pull/85258)). + +#### Particles + +- Only allow MeshInstance3D-based nodes in particles emission shape node selector ([GH-84891](https://github.com/godotengine/godot/pull/84891)). + +#### Plugin + +- Correctly check scripts that must inherit `EditorPlugin` ([GH-85271](https://github.com/godotengine/godot/pull/85271)). + +#### Porting + +- Do not consume mouse messages in windows with `no_focus` on Windows OS ([GH-85484](https://github.com/godotengine/godot/pull/85484)). + +#### Rendering + +- Fix buffer updates going to the wrong cmd buffer if barriers were 0 ([GH-83736](https://github.com/godotengine/godot/pull/83736)). +- Fix bad parameter for `rendering_method` crashes Godot ([GH-84241](https://github.com/godotengine/godot/pull/84241)). +- Add `shadows_disabled` macro in Compatibility renderer ([GH-84416](https://github.com/godotengine/godot/pull/84416)). +- Vulkan: Fix incorrect access to the buffers on Android ([GH-84852](https://github.com/godotengine/godot/pull/84852)). +- Use vertex input mask for creating vertex arrays ([GH-85092](https://github.com/godotengine/godot/pull/85092)). +- Fix typo in BaseMaterial3D conversion from 3.x SpatialMaterial ([GH-85269](https://github.com/godotengine/godot/pull/85269)). +- Set ReflectionProbe frame before mapping id in mobile renderer ([GH-85635](https://github.com/godotengine/godot/pull/85635)). +- Add a descriptive error message when creating a mesh surface from the wrong array type ([GH-85646](https://github.com/godotengine/godot/pull/85646)). +- GLES3: Skip batches with zero instance count while rendering canvas ([GH-85778](https://github.com/godotengine/godot/pull/85778)). +- macOS: Switch ANGLE backend to ANGLE over OpenGL, switch default compatibility renderer back to native ([GH-85785](https://github.com/godotengine/godot/pull/85785)). +- Ensure that 2D meshes use a proper input mask ([GH-85972](https://github.com/godotengine/godot/pull/85972)). + +#### Shaders + +- Automatically ensure correct normals in Compatibility renderer ([GH-82804](https://github.com/godotengine/godot/pull/82804)). +- Comment the shader template light function by default ([GH-84594](https://github.com/godotengine/godot/pull/84594)). + +#### XR + +- Remove unused grip touch action from default OpenXR action map ([GH-85048](https://github.com/godotengine/godot/pull/85048)). + + ## 4.2 - 2023-11-30 - [Release announcement](https://godotengine.org/article/godot-4-2-arrives-in-style) @@ -14,38 +155,6 @@ branches, and linked at the [end of this file](#Past-releases). - [Interactive changelog](https://godotengine.github.io/godot-interactive-changelog/#4.2) - [Breaking changes](https://github.com/godotengine/godot/pulls?q=is%3Apr+is%3Amerged+label%3A%22breaks+compat%22+milestone%3A4.2) -Table of contents: - -- [2D](#2D) -- [3D](#3D) -- [Animation](#Animation) -- [Assetlib](#Assetlib) -- [Audio](#Audio) -- [Buildsystem](#Buildsystem) -- [C#](#C) -- [Codestyle](#Codestyle) -- [Core](#Core) -- [Documentation](#Documentation) -- [Editor](#Editor) -- [Export](#Export) -- [GDExtension](#GDExtension) -- [GDScript](#GDScript) -- [GUI](#GUI) -- [Import](#Import) -- [Input](#Input) -- [Multiplayer](#Multiplayer) -- [Navigation](#Navigation) -- [Network](#Network) -- [Particles](#Particles) -- [Physics](#Physics) -- [Plugin](#Plugin) -- [Porting](#Porting) -- [Rendering](#Rendering) -- [Shaders](#Shaders) -- [Tests](#Tests) -- [Thirdparty](#Thirdparty) -- [XR](#XR) - #### 2D - Greatly improve Y-sort performance on TileMaps ([GH-73813](https://github.com/godotengine/godot/pull/73813)). diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 2db17e96f75..85a7da0c270 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -661,6 +661,11 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou state.current_tex = RID(); for (uint32_t i = 0; i <= state.current_batch_index; i++) { + // Skipping when there is no instances. + if (state.canvas_instance_batches[i].instance_count == 0) { + continue; + } + //setup clip if (current_clip != state.canvas_instance_batches[i].clip) { current_clip = state.canvas_instance_batches[i].clip; @@ -1383,7 +1388,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) { GLuint vertex_array_gl = 0; GLuint index_array_gl = 0; - uint64_t input_mask = 0; // 2D meshes always use the same vertex format. + uint64_t input_mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_COLOR | RS::ARRAY_FORMAT_TEX_UV; // 2D meshes always use the same vertex format. if (mesh_instance.is_valid()) { mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(mesh_instance, j, input_mask, vertex_array_gl); } else { diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index a8f7d18503a..04e362c4268 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -447,9 +447,11 @@ void TileMapLayer::_rendering_update() { for (KeyValue &kv : tile_map) { CellData &cell_data = kv.value; for (const RID &occluder : cell_data.occluders) { - Transform2D xform(0, tile_map_node->map_to_local(kv.key)); - rs->canvas_light_occluder_attach_to_canvas(occluder, tile_map_node->get_canvas()); - rs->canvas_light_occluder_set_transform(occluder, tile_map_node->get_global_transform() * xform); + if (occluder.is_valid()) { + Transform2D xform(0, tile_map_node->map_to_local(kv.key)); + rs->canvas_light_occluder_attach_to_canvas(occluder, tile_map_node->get_canvas()); + rs->canvas_light_occluder_set_transform(occluder, tile_map_node->get_global_transform() * xform); + } } } } @@ -565,6 +567,15 @@ void TileMapLayer::_rendering_occluders_update_cell(CellData &r_cell_data) { const Ref &tile_set = tile_map_node->get_tileset(); RenderingServer *rs = RenderingServer::get_singleton(); + // Free unused occluders then resize the occluders array. + for (uint32_t i = tile_set->get_occlusion_layers_count(); i < r_cell_data.occluders.size(); i++) { + RID occluder_id = r_cell_data.occluders[i]; + if (occluder_id.is_valid()) { + rs->free(occluder_id); + } + } + r_cell_data.occluders.resize(tile_set->get_occlusion_layers_count()); + TileSetSource *source; if (tile_set->has_source(r_cell_data.cell.source_id)) { source = *tile_set->get_source(r_cell_data.cell.source_id); @@ -580,18 +591,30 @@ void TileMapLayer::_rendering_occluders_update_cell(CellData &r_cell_data) { tile_data = atlas_source->get_tile_data(r_cell_data.cell.get_atlas_coords(), r_cell_data.cell.alternative_tile); } - // Update/create occluders. - for (int i = 0; i < tile_set->get_occlusion_layers_count(); i++) { - Transform2D xform; - xform.set_origin(tile_map_node->map_to_local(r_cell_data.coords)); - if (tile_data->get_occluder(i).is_valid()) { - RID occluder_id = rs->canvas_light_occluder_create(); - rs->canvas_light_occluder_set_enabled(occluder_id, node_visible); - rs->canvas_light_occluder_set_transform(occluder_id, tile_map_node->get_global_transform() * xform); - rs->canvas_light_occluder_set_polygon(occluder_id, tile_map_node->get_transformed_polygon(Ref(tile_data->get_occluder(i)), r_cell_data.cell.alternative_tile)->get_rid()); - rs->canvas_light_occluder_attach_to_canvas(occluder_id, tile_map_node->get_canvas()); - rs->canvas_light_occluder_set_light_mask(occluder_id, tile_set->get_occlusion_layer_light_mask(i)); - r_cell_data.occluders.push_back(occluder_id); + // Create, update or clear occluders. + for (uint32_t occlusion_layer_index = 0; occlusion_layer_index < r_cell_data.occluders.size(); occlusion_layer_index++) { + Ref occluder_polygon = tile_data->get_occluder(occlusion_layer_index); + + RID &occluder = r_cell_data.occluders[occlusion_layer_index]; + + if (occluder_polygon.is_valid()) { + // Create or update occluder. + Transform2D xform; + xform.set_origin(tile_map_node->map_to_local(r_cell_data.coords)); + if (!occluder.is_valid()) { + occluder = rs->canvas_light_occluder_create(); + } + rs->canvas_light_occluder_set_enabled(occluder, node_visible); + rs->canvas_light_occluder_set_transform(occluder, tile_map_node->get_global_transform() * xform); + rs->canvas_light_occluder_set_polygon(occluder, tile_map_node->get_transformed_polygon(Ref(tile_data->get_occluder(occlusion_layer_index)), r_cell_data.cell.alternative_tile)->get_rid()); + rs->canvas_light_occluder_attach_to_canvas(occluder, tile_map_node->get_canvas()); + rs->canvas_light_occluder_set_light_mask(occluder, tile_set->get_occlusion_layer_light_mask(occlusion_layer_index)); + } else { + // Clear occluder. + if (occluder.is_valid()) { + rs->free(occluder); + occluder = RID(); + } } } @@ -778,7 +801,7 @@ void TileMapLayer::_physics_update_cell(CellData &r_cell_data) { } // Free unused bodies then resize the bodies array. - for (unsigned int i = tile_set->get_physics_layers_count(); i < r_cell_data.bodies.size(); i++) { + for (uint32_t i = tile_set->get_physics_layers_count(); i < r_cell_data.bodies.size(); i++) { RID body = r_cell_data.bodies[i]; if (body.is_valid()) { bodies_coords.erase(body); @@ -787,7 +810,7 @@ void TileMapLayer::_physics_update_cell(CellData &r_cell_data) { } r_cell_data.bodies.resize(tile_set->get_physics_layers_count()); - for (int tile_set_physics_layer = 0; tile_set_physics_layer < tile_set->get_physics_layers_count(); tile_set_physics_layer++) { + for (uint32_t tile_set_physics_layer = 0; tile_set_physics_layer < (uint32_t)tile_set->get_physics_layers_count(); tile_set_physics_layer++) { Ref physics_material = tile_set->get_physics_layer_physics_material(tile_set_physics_layer); uint32_t physics_layer = tile_set->get_physics_layer_collision_layer(tile_set_physics_layer); uint32_t physics_mask = tile_set->get_physics_layer_collision_mask(tile_set_physics_layer); @@ -998,7 +1021,7 @@ void TileMapLayer::_navigation_update() { void TileMapLayer::_navigation_clear_cell(CellData &r_cell_data) { NavigationServer2D *ns = NavigationServer2D::get_singleton(); // Clear navigation shapes. - for (unsigned int i = 0; i < r_cell_data.navigation_regions.size(); i++) { + for (uint32_t i = 0; i < r_cell_data.navigation_regions.size(); i++) { const RID ®ion = r_cell_data.navigation_regions[i]; if (region.is_valid()) { ns->region_set_map(region, RID()); @@ -1031,7 +1054,7 @@ void TileMapLayer::_navigation_update_cell(CellData &r_cell_data) { } // Free unused regions then resize the regions array. - for (unsigned int i = tile_set->get_navigation_layers_count(); i < r_cell_data.navigation_regions.size(); i++) { + for (uint32_t i = tile_set->get_navigation_layers_count(); i < r_cell_data.navigation_regions.size(); i++) { RID ®ion = r_cell_data.navigation_regions[i]; if (region.is_valid()) { ns->region_set_map(region, RID()); @@ -1042,7 +1065,7 @@ void TileMapLayer::_navigation_update_cell(CellData &r_cell_data) { r_cell_data.navigation_regions.resize(tile_set->get_navigation_layers_count()); // Create, update or clear regions. - for (unsigned int navigation_layer_index = 0; navigation_layer_index < r_cell_data.navigation_regions.size(); navigation_layer_index++) { + for (uint32_t navigation_layer_index = 0; navigation_layer_index < r_cell_data.navigation_regions.size(); navigation_layer_index++) { Ref navigation_polygon; navigation_polygon = tile_data->get_navigation_polygon(navigation_layer_index); navigation_polygon = tile_map_node->get_transformed_polygon(Ref(navigation_polygon), c.alternative_tile); @@ -3250,7 +3273,7 @@ void TileMap::add_layer(int p_to_pos) { new_layer.instantiate(); new_layer->set_tile_map(this); layers.insert(p_to_pos, new_layer); - for (unsigned int i = 0; i < layers.size(); i++) { + for (uint32_t i = 0; i < layers.size(); i++) { layers[i]->set_layer_index_in_tile_map_node(i); } queue_internal_update(); @@ -3269,7 +3292,7 @@ void TileMap::move_layer(int p_layer, int p_to_pos) { Ref layer = layers[p_layer]; layers.insert(p_to_pos, layer); layers.remove_at(p_to_pos < p_layer ? p_layer + 1 : p_layer); - for (unsigned int i = 0; i < layers.size(); i++) { + for (uint32_t i = 0; i < layers.size(); i++) { layers[i]->set_layer_index_in_tile_map_node(i); } queue_internal_update(); @@ -3289,7 +3312,7 @@ void TileMap::remove_layer(int p_layer) { // Clear before removing the layer. layers.remove_at(p_layer); - for (unsigned int i = 0; i < layers.size(); i++) { + for (uint32_t i = 0; i < layers.size(); i++) { layers[i]->set_layer_index_in_tile_map_node(i); } queue_internal_update(); @@ -3526,7 +3549,7 @@ Vector2i TileMap::get_coords_for_body_rid(RID p_physics_body) { } int TileMap::get_layer_for_body_rid(RID p_physics_body) { - for (unsigned int i = 0; i < layers.size(); i++) { + for (uint32_t i = 0; i < layers.size(); i++) { if (layers[i]->has_body_rid(p_physics_body)) { return i; } @@ -3576,7 +3599,7 @@ Rect2 TileMap::_edit_get_rect() const { bool changed = false; Rect2 rect = layers[0]->get_rect(changed); any_changed |= changed; - for (unsigned int i = 1; i < layers.size(); i++) { + for (uint32_t i = 1; i < layers.size(); i++) { rect = rect.merge(layers[i]->get_rect(changed)); any_changed |= changed; } @@ -3755,7 +3778,7 @@ void TileMap::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(m_type, property_name, PROPERTY_HINT_NONE, m_hint, (get(property_name) == property_get_revert(property_name)) ? PROPERTY_USAGE_EDITOR : PROPERTY_USAGE_DEFAULT)); \ } - for (unsigned int i = 0; i < layers.size(); i++) { + for (uint32_t i = 0; i < layers.size(); i++) { MAKE_LAYER_PROPERTY(Variant::STRING, "name", ""); MAKE_LAYER_PROPERTY(Variant::BOOL, "enabled", ""); MAKE_LAYER_PROPERTY(Variant::COLOR, "modulate", ""); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 1136e4190d5..9a847a7ebb8 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -104,7 +104,7 @@ struct CellData { // Rendering. Ref rendering_quadrant; SelfList rendering_quadrant_list_element; - List occluders; + LocalVector occluders; // Physics. LocalVector bodies;