From 74b1560672eb490c6d5375606c57350297bdbc95 Mon Sep 17 00:00:00 2001 From: follower Date: Tue, 7 Sep 2021 01:45:22 +1200 Subject: [PATCH 01/29] Fix the "AudioEffectRecord" descriptions. The `AudioEffectRecord` effect has no microphone capture-specific functionality--it can be used with any audio bus. This patch attempts to clarify this fact (so people like me who want to capture audio output know they're in the right place) while still providing a pointer use of the effect with `AudioStreamMicrophone` for microphone capture. (cherry picked from commit 022f49437b5d8ec4aa0b63f1561dd9aa253c895f) --- doc/classes/AudioEffectRecord.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/classes/AudioEffectRecord.xml b/doc/classes/AudioEffectRecord.xml index c1d462e5c37..b460d45d93c 100644 --- a/doc/classes/AudioEffectRecord.xml +++ b/doc/classes/AudioEffectRecord.xml @@ -1,10 +1,12 @@ - Audio effect used for recording sound from a microphone. + Audio effect used for recording the sound from an audio bus. - Allows the user to record sound from a microphone. It sets and gets the format in which the audio file will be recorded (8-bit, 16-bit, or compressed). It checks whether or not the recording is active, and if it is, records the sound. It then returns the recorded sample. + Allows the user to record the sound from an audio bus. This can include all audio output by Godot when used on the "Master" audio bus. + Can be used (with an [AudioStreamMicrophone]) to record from a microphone. + It sets and gets the format in which the audio file will be recorded (8-bit, 16-bit, or compressed). It checks whether or not the recording is active, and if it is, records the sound. It then returns the recorded sample. https://docs.godotengine.org/en/3.4/tutorials/audio/recording_with_microphone.html From 2106c5175ad5bb9884b506c6a558ba34e96ae833 Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Mon, 27 Dec 2021 13:35:50 -0500 Subject: [PATCH 02/29] Expose autotile_coord parameter in TileMap.set_cellv (cherry picked from commit 4106f95f309d33653c385d15ea85b8491fe052b8) --- doc/classes/TileMap.xml | 3 ++- scene/2d/tile_map.cpp | 6 +++--- scene/2d/tile_map.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 758d6349225..9480b19d171 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -154,10 +154,11 @@ + Sets the tile index for the cell given by a Vector2. An index of [code]-1[/code] clears the cell. - Optionally, the tile can also be flipped or transposed. + Optionally, the tile can also be flipped, transposed, or given autotile coordinates. The autotile coordinate refers to the column and row of the subtile. [b]Note:[/b] Data such as navigation polygons and collision shapes are not immediately updated for performance reasons. If you need these to be immediately updated, you can call [method update_dirty_quadrants]. diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 77f626fb641..b937ea7fa77 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -848,8 +848,8 @@ void TileMap::_make_quadrant_dirty(Map::Element *Q, bool updat } } -void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose) { - set_cell(p_pos.x, p_pos.y, p_tile, p_flip_x, p_flip_y, p_transpose); +void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, Vector2 p_autotile_coord) { + set_cell(p_pos.x, p_pos.y, p_tile, p_flip_x, p_flip_y, p_transpose, p_autotile_coord); } void TileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) { @@ -1811,7 +1811,7 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &TileMap::get_occluder_light_mask); ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("_set_celld", "position", "data"), &TileMap::_set_celld); ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell); ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 8edb432774e..f0019e3cb76 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -263,7 +263,7 @@ public: Vector2 get_cell_autotile_coord(int p_x, int p_y) const; void _set_celld(const Vector2 &p_pos, const Dictionary &p_data); - void set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false); + void set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false, Vector2 p_autotile_coord = Vector2()); int get_cellv(const Vector2 &p_pos) const; void make_bitmask_area_dirty(const Vector2 &p_pos); From dd9121040ec0eed81f3990c6987e0f994bc228fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Cambr=C3=A9?= Date: Wed, 29 Dec 2021 18:53:11 +0100 Subject: [PATCH 03/29] Update default port_grab_distance_vertical (cherry picked from commit 38ad72af44173fdc98e61664192b02ad63fe7324) --- doc/classes/GraphEdit.xml | 2 +- scene/resources/default_theme/default_theme.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 4ff01b41272..3035fb4a2ca 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -283,7 +283,7 @@ The horizontal range within which a port can be grabbed (on both sides). - + The vertical range within which a port can be grabbed (on both sides). diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 85474a07357..93e72faca1a 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -903,7 +903,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // Visual Node Ports theme->set_constant("port_grab_distance_horizontal", "GraphEdit", 24 * scale); - theme->set_constant("port_grab_distance_vertical", "GraphEdit", 6 * scale); + theme->set_constant("port_grab_distance_vertical", "GraphEdit", 26 * scale); theme->set_stylebox("bg", "GraphEditMinimap", make_flat_stylebox(Color(0.24, 0.24, 0.24), 0, 0, 0, 0)); Ref style_minimap_camera = make_flat_stylebox(Color(0.65, 0.65, 0.65, 0.2), 0, 0, 0, 0); From efe56e5e889db408c6696171e6c06a93159d086f Mon Sep 17 00:00:00 2001 From: SaracenOne Date: Sun, 2 Jan 2022 07:50:53 +0000 Subject: [PATCH 04/29] Prevent saving branches in foreign scenes (cherry picked from commit 2056e8b0283a05fd83f1f9e6439a8c79ca7ecc45) --- editor/scene_tree_dock.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index da99a1a8d6f..0325f82a0e3 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -948,6 +948,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } + if (tocopy->get_owner() != scene) { + accept->set_text(TTR("Can't save a branch which is a child of an already instantiated scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + + if (scene->get_scene_inherited_state().is_valid() && scene->get_scene_inherited_state()->find_node_by_path(scene->get_path_to(tocopy)) >= 0) { + accept->set_text(TTR("Can't save a branch which is part of an inherited scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); List extensions; From e62363ec89df4a13ceea8ff2f6de3d68d49afa63 Mon Sep 17 00:00:00 2001 From: skyace65 Date: Thu, 6 Jan 2022 22:25:35 -0500 Subject: [PATCH 05/29] Document how to erase project settings with set_setting (cherry picked from commit 290038952f96c6e4d2bad294d601eca07e34fbb7) --- doc/classes/ProjectSettings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index c207979807b..5be5b9b2a94 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -163,6 +163,7 @@ [codeblock] ProjectSettings.set_setting("application/config/name", "Example") [/codeblock] + This can also be used to erase custom project settings. To do this change the setting value to [code]null[/code]. From 4674599dfa01cf0a5d016f5852c7eed6d128a82a Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Fri, 7 Jan 2022 12:14:21 +0100 Subject: [PATCH 06/29] Windows input: fix bracket -> brace for US input (cherry picked from commit 36af1abbe0333888ae9c3931d2271dee2affe2bf) --- platform/windows/key_mapping_windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp index d84e156ab6b..a520cbd8dc1 100644 --- a/platform/windows/key_mapping_windows.cpp +++ b/platform/windows/key_mapping_windows.cpp @@ -217,9 +217,9 @@ static _WinTranslatePair _vk_to_keycode[] = { { KEY_SLASH, VK_OEM_2 }, // (0xBF) //Windows 2000/XP: For the US standard keyboard, the '/?' key { KEY_QUOTELEFT, VK_OEM_3 }, // (0xC0) - { KEY_BRACELEFT, VK_OEM_4 }, // (0xDB) + { KEY_BRACKETLEFT, VK_OEM_4 }, // (0xDB) { KEY_BACKSLASH, VK_OEM_5 }, // (0xDC) - { KEY_BRACERIGHT, VK_OEM_6 }, // (0xDD) + { KEY_BRACKETRIGHT, VK_OEM_6 }, // (0xDD) { KEY_APOSTROPHE, VK_OEM_7 }, // (0xDE) /* {VK_OEM_8 (0xDF) From d445c145959508d3ebf4e44797019053e2131291 Mon Sep 17 00:00:00 2001 From: SaracenOne Date: Fri, 7 Jan 2022 20:08:42 +0000 Subject: [PATCH 07/29] Fix selection of CSG objects (cherry picked from commit b7273b6f7a1cea8322fa17264dd882f2875b8ec7) --- modules/csg/csg_gizmos.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index f70abb2265d..122064ac401 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -377,6 +377,16 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_lines(lines, material); p_gizmo->add_collision_segments(lines); + Array csg_meshes = cs->get_meshes(); + if (csg_meshes.size() != 2) { + return; + } + + Ref csg_mesh = csg_meshes[1]; + if (csg_mesh.is_valid()) { + p_gizmo->add_collision_triangles(csg_mesh->generate_triangle_mesh()); + } + if (p_gizmo->is_selected()) { // Draw a translucent representation of the CSG node Ref mesh = memnew(ArrayMesh); From e0ea177cf960e983085f8fec089c45c2103f078d Mon Sep 17 00:00:00 2001 From: skyace65 Date: Sat, 8 Jan 2022 21:51:30 -0500 Subject: [PATCH 08/29] Add note om when tween methods return false (3.x) (cherry picked from commit 4bd1ce49e65ec4bb8a8df61270174a2b5ee77b89) --- doc/classes/Tween.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index ab5f2127e25..bc901bfbd2f 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -17,6 +17,7 @@ Many methods require a property name, such as [code]"position"[/code] above. You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (e.g. [code]position:x[/code]), where it would only apply to that particular component. Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [url=https://easings.net/]easings.net[/url] for some examples). The second accepts an [enum EaseType] constant, and controls where the [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [constant EASE_IN_OUT], and use the one that looks best. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url] + [b]Note:[/b] Tween methods will return [code]false[/code] if the requested operation cannot be completed. From 68e590e1fbb9a4f15177104a347f053f0a1c1476 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 10 Jan 2022 17:19:47 +0800 Subject: [PATCH 09/29] Fix crash on importing FBX file (cherry picked from commit af67e4c2919cb12ec257ca6bc3bb264933e4e2a4) --- core/set.h | 3 +++ modules/fbx/data/fbx_mesh_data.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/set.h b/core/set.h index eb2014f36d1..d0eeb8a0f90 100644 --- a/core/set.h +++ b/core/set.h @@ -509,6 +509,9 @@ public: } Element *lower_bound(const T &p_value) const { + if (!_data._root) { + return nullptr; + } return _lower_bound(p_value); } diff --git a/modules/fbx/data/fbx_mesh_data.cpp b/modules/fbx/data/fbx_mesh_data.cpp index 75755efeaf7..ac883bafc96 100644 --- a/modules/fbx/data/fbx_mesh_data.cpp +++ b/modules/fbx/data/fbx_mesh_data.cpp @@ -1104,7 +1104,7 @@ HashMap FBXMeshData::extract_per_vertex_data( const int vertex_index = get_vertex_from_polygon_vertex(p_mesh_indices, polygon_vertex_index); ERR_FAIL_COND_V_MSG(vertex_index < 0, (HashMap()), "FBX file corrupted: #ERR05"); ERR_FAIL_COND_V_MSG(vertex_index >= p_vertex_count, (HashMap()), "FBX file corrupted: #ERR06"); - const int index_to_direct = p_mapping_data.index[polygon_vertex_index]; + const int index_to_direct = get_vertex_from_polygon_vertex(p_mapping_data.index, polygon_vertex_index); T value = p_mapping_data.data[index_to_direct]; aggregate_vertex_data[vertex_index].push_back({ polygon_id, value }); } @@ -1309,7 +1309,7 @@ HashMap FBXMeshData::extract_per_polygon( } else { ERR_FAIL_INDEX_V_MSG(polygon_index, (int)p_fbx_data.index.size(), (HashMap()), "FBX file is corrupted: #ERR62"); - const int index_to_direct = p_fbx_data.index[polygon_index]; + const int index_to_direct = get_vertex_from_polygon_vertex(p_fbx_data.index, polygon_index); T value = p_fbx_data.data[index_to_direct]; aggregate_polygon_data[polygon_index].push_back(value); } From 4fd6f6ece752f4b1ee0058e48c1cf1e2f875d089 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Fri, 7 Jan 2022 19:01:09 -0800 Subject: [PATCH 10/29] Skip Draco-compressed glTF 3d format files. (cherry picked from commit b46810484214ff1a5ab109e0131cb2582cb57f83) --- modules/gltf/gltf_document.cpp | 53 +++++++++++++++++++++++----------- modules/gltf/gltf_document.h | 2 ++ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index da8954fff7a..26768979aa2 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6595,103 +6595,110 @@ Error GLTFDocument::parse(Ref state, String p_path, bool p_read_binar state->major_version = version.get_slice(".", 0).to_int(); state->minor_version = version.get_slice(".", 1).to_int(); - /* STEP 0 PARSE SCENE */ + /* PARSE EXTENSIONS */ + + err = _parse_gltf_extensions(state); + if (err != OK) { + return Error::FAILED; + } + + /* PARSE SCENE */ err = _parse_scenes(state); if (err != OK) { return Error::FAILED; } - /* STEP 1 PARSE NODES */ + /* PARSE NODES */ err = _parse_nodes(state); if (err != OK) { return Error::FAILED; } - /* STEP 2 PARSE BUFFERS */ + /* PARSE BUFFERS */ err = _parse_buffers(state, p_path.get_base_dir()); if (err != OK) { return Error::FAILED; } - /* STEP 3 PARSE BUFFER VIEWS */ + /* PARSE BUFFER VIEWS */ err = _parse_buffer_views(state); if (err != OK) { return Error::FAILED; } - /* STEP 4 PARSE ACCESSORS */ + /* PARSE ACCESSORS */ err = _parse_accessors(state); if (err != OK) { return Error::FAILED; } - /* STEP 5 PARSE IMAGES */ + /* PARSE IMAGES */ err = _parse_images(state, p_path.get_base_dir()); if (err != OK) { return Error::FAILED; } - /* STEP 6 PARSE TEXTURES */ + /* PARSE TEXTURES */ err = _parse_textures(state); if (err != OK) { return Error::FAILED; } - /* STEP 7 PARSE TEXTURES */ + /* PARSE TEXTURES */ err = _parse_materials(state); if (err != OK) { return Error::FAILED; } - /* STEP 9 PARSE SKINS */ + /* PARSE SKINS */ err = _parse_skins(state); if (err != OK) { return Error::FAILED; } - /* STEP 10 DETERMINE SKELETONS */ + /* DETERMINE SKELETONS */ err = _determine_skeletons(state); if (err != OK) { return Error::FAILED; } - /* STEP 11 CREATE SKELETONS */ + /* CREATE SKELETONS */ err = _create_skeletons(state); if (err != OK) { return Error::FAILED; } - /* STEP 12 CREATE SKINS */ + /* CREATE SKINS */ err = _create_skins(state); if (err != OK) { return Error::FAILED; } - /* STEP 13 PARSE MESHES (we have enough info now) */ + /* PARSE MESHES (we have enough info now) */ err = _parse_meshes(state); if (err != OK) { return Error::FAILED; } - /* STEP 14 PARSE LIGHTS */ + /* PARSE LIGHTS */ err = _parse_lights(state); if (err != OK) { return Error::FAILED; } - /* STEP 15 PARSE CAMERAS */ + /* PARSE CAMERAS */ err = _parse_cameras(state); if (err != OK) { return Error::FAILED; } - /* STEP 16 PARSE ANIMATIONS */ + /* PARSE ANIMATIONS */ err = _parse_animations(state); if (err != OK) { return Error::FAILED; } - /* STEP 17 ASSIGN SCENE NAMES */ + /* ASSIGN SCENE NAMES */ _assign_scene_names(state); return OK; @@ -6811,3 +6818,15 @@ Error GLTFDocument::_serialize_file(Ref state, const String p_path) { } return err; } + +Error GLTFDocument::_parse_gltf_extensions(Ref state) { + ERR_FAIL_COND_V(!state.is_valid(), ERR_PARSE_ERROR); + if (state->json.has("extensionsRequired") && state->json["extensionsRequired"].get_type() == Variant::ARRAY) { + Array extensions_required = state->json["extensionsRequired"]; + if (extensions_required.find("KHR_draco_mesh_compression") != -1) { + ERR_PRINT("glTF2 extension KHR_draco_mesh_compression is not supported."); + return ERR_UNAVAILABLE; + } + } + return OK; +} diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 28a8a96ac5c..46848f91581 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -369,6 +369,8 @@ public: String _sanitize_scene_name(Ref state, const String &p_name); String _legacy_validate_node_name(const String &p_name); + Error _parse_gltf_extensions(Ref state); + void _process_mesh_instances(Ref state, Node *scene_root); void _generate_scene_node(Ref state, Node *scene_parent, Spatial *scene_root, From b7fbfc27769afa3a2afc0968ddc3e765b59b814d Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 10 Jan 2022 13:43:44 +0200 Subject: [PATCH 11/29] Add joystick button index boundary check. Increase max. button number to 128 (max. buttons supported by DirectInput). (cherry picked from commit 61ea8f83377952a8ca8e1cb5cf8ec1099ca8369f) --- core/os/input_event.h | 2 +- doc/classes/@GlobalScope.xml | 7 +++++-- main/input_default.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/os/input_event.h b/core/os/input_event.h index 6f5f2dc80d9..10a595dd16a 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -85,7 +85,7 @@ enum JoystickList { JOY_BUTTON_20 = 20, JOY_BUTTON_21 = 21, JOY_BUTTON_22 = 22, - JOY_BUTTON_MAX = 23, + JOY_BUTTON_MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons. JOY_L = JOY_BUTTON_4, JOY_R = JOY_BUTTON_5, diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 049663f55a5..74f42081a6e 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1006,8 +1006,11 @@ Gamepad button 22. - - Represents the maximum number of joystick buttons supported. + + The maximum number of game controller buttons supported by the engine. The actual limit may be lower on specific platforms: + - Android: Up to 36 buttons. + - Linux: Up to 80 buttons. + - Windows and macOS: Up to 128 buttons. DualShock circle button. diff --git a/main/input_default.cpp b/main/input_default.cpp index 7ca580f8ede..c2c874076fb 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -775,7 +775,8 @@ InputDefault::InputDefault() { void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) { _THREAD_SAFE_METHOD_; Joypad &joy = joy_names[p_device]; - //printf("got button %i, mapping is %i\n", p_button, joy.mapping); + ERR_FAIL_INDEX(p_button, JOY_BUTTON_MAX); + if (joy.last_buttons[p_button] == p_pressed) { return; } From 596bf6bdaaceb8b495c8d58ca481aae9852dc430 Mon Sep 17 00:00:00 2001 From: Arnav Vijaywargiya Date: Tue, 11 Jan 2022 09:47:42 +0530 Subject: [PATCH 12/29] Fixed incorrect property types (cherry picked from commit 0c46f73b5e5e89ba8fbe1f2294f203b5e9df2d0a) --- doc/classes/RayCast.xml | 2 +- modules/websocket/websocket_server.cpp | 2 +- scene/2d/polygon_2d.cpp | 2 +- scene/3d/ray_cast.cpp | 4 ++-- scene/3d/ray_cast.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml index d45961f2abd..9b5aacfbd2b 100644 --- a/doc/classes/RayCast.xml +++ b/doc/classes/RayCast.xml @@ -123,7 +123,7 @@ The custom color to use to draw the shape in the editor and at run-time if [b]Visible Collision Shapes[/b] is enabled in the [b]Debug[/b] menu. This color will be highlighted at run-time if the [RayCast] is colliding with something. If set to [code]Color(0.0, 0.0, 0.0)[/code] (by default), the color set in [member ProjectSettings.debug/shapes/collision/shape_color] is used. - + If set to [code]1[/code], a line is used as the debug shape. Otherwise, a truncated pyramid is drawn to represent the [RayCast]. Requires [b]Visible Collision Shapes[/b] to be enabled in the [b]Debug[/b] menu for the debug shape to be visible at run-time. diff --git a/modules/websocket/websocket_server.cpp b/modules/websocket/websocket_server.cpp index 69c53db6d84..27e19ac676e 100644 --- a/modules/websocket/websocket_server.cpp +++ b/modules/websocket/websocket_server.cpp @@ -67,7 +67,7 @@ void WebSocketServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_handshake_timeout"), &WebSocketServer::get_handshake_timeout); ClassDB::bind_method(D_METHOD("set_handshake_timeout", "timeout"), &WebSocketServer::set_handshake_timeout); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "handshake_timeout"), "set_handshake_timeout", "get_handshake_timeout"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "handshake_timeout"), "set_handshake_timeout", "get_handshake_timeout"); ADD_SIGNAL(MethodInfo("client_close_request", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::INT, "code"), PropertyInfo(Variant::STRING, "reason"))); ADD_SIGNAL(MethodInfo("client_disconnected", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::BOOL, "was_clean_close"))); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index e86f35ab986..77721a8899b 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -636,7 +636,7 @@ void Polygon2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv"); ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons"), "set_polygons", "get_polygons"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_bones", "_get_bones"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_bones", "_get_bones"); ADD_PROPERTY(PropertyInfo(Variant::INT, "internal_vertex_count", PROPERTY_HINT_RANGE, "0,1000"), "set_internal_vertex_count", "get_internal_vertex_count"); } diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index f6fdc51d264..8db3b94af98 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -332,7 +332,7 @@ void RayCast::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_shape_thickness", PROPERTY_HINT_RANGE, "1,5"), "set_debug_shape_thickness", "get_debug_shape_thickness"); } -float RayCast::get_debug_shape_thickness() const { +int RayCast::get_debug_shape_thickness() const { return debug_shape_thickness; } @@ -361,7 +361,7 @@ void RayCast::_update_debug_shape_vertices() { } } -void RayCast::set_debug_shape_thickness(const float p_debug_shape_thickness) { +void RayCast::set_debug_shape_thickness(const int p_debug_shape_thickness) { debug_shape_thickness = p_debug_shape_thickness; update_gizmo(); diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h index 150595ed4bd..f7639bdce6f 100644 --- a/scene/3d/ray_cast.h +++ b/scene/3d/ray_cast.h @@ -100,8 +100,8 @@ public: Ref get_debug_material(); - float get_debug_shape_thickness() const; - void set_debug_shape_thickness(const float p_debug_thickness); + int get_debug_shape_thickness() const; + void set_debug_shape_thickness(const int p_debug_thickness); void force_raycast_update(); bool is_colliding() const; From e0f95f1f632fd6f23a1e0b5cae7a0f8661c4d5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Fertyk?= Date: Mon, 10 Jan 2022 23:49:51 +0100 Subject: [PATCH 13/29] Issue 56488 fail when image and texture size are different (cherry picked from commit 5e57b850b6664d5c0c7bf057bb8013e23830ae5b) --- scene/resources/texture.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 8788190f282..ac5c1f31be2 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2353,6 +2353,9 @@ void TextureLayered::create(uint32_t p_width, uint32_t p_height, uint32_t p_dept void TextureLayered::set_layer_data(const Ref &p_image, int p_layer) { ERR_FAIL_COND(!texture.is_valid()); ERR_FAIL_COND(!p_image.is_valid()); + ERR_FAIL_COND_MSG( + p_image->get_width() > width || p_image->get_height() > height, + vformat("Image size(%dx%d) is bigger than texture size (%dx%d).", p_image->get_width(), p_image->get_height(), width, height)); VS::get_singleton()->texture_set_data(texture, p_image, p_layer); } From 3839342175aaf0a0fe483c1a0d6ef37077e3d3c7 Mon Sep 17 00:00:00 2001 From: zacryol <60046681+zacryol@users.noreply.github.com> Date: Mon, 10 Jan 2022 21:38:25 -0700 Subject: [PATCH 14/29] Update description of FileDialog `filters` property specify that multiple filetypes/extensions can be included in one filter within the PackedStringArray, and provide an example (cherry picked from commit 123cfb4759076786f783f59becf3eaac26059e45) --- doc/classes/FileDialog.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index e2a674fc75e..e50bc98a2c9 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -65,7 +65,7 @@ - The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. + The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. Multiple file types can also be specified in a single filter. [code]"*.png, *.jpg, *.jpeg ; Supported Images"[/code] will show both PNG and JPEG files when selected. The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants. From 73ca0533d04962a1b4598f7a31968e92c37b0a24 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 27 Oct 2021 13:43:25 +0800 Subject: [PATCH 15/29] Fix RichTextLabel underline appearance when inside fill tag (cherry picked from commit 23c64fc43c19ca9bc17e6cfd98a4045c4b53fa62) --- scene/gui/rich_text_label.cpp | 38 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index cecfdfd78ad..c57a65126b9 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -448,11 +448,18 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & line_descent = MAX(line_descent, descent); fh = line_ascent + line_descent; + float align_spacing = 0.0f; + bool is_at_line_wrap = false; if (end && c[end - 1] == ' ') { if (align == ALIGN_FILL && p_mode != PROCESS_CACHE) { int ln = MIN(l.offset_caches.size() - 1, line); if (l.space_caches[ln]) { - align_ofs = spaces * l.offset_caches[ln] / l.space_caches[ln]; + align_spacing = l.offset_caches[ln] / l.space_caches[ln]; + align_ofs = spaces * align_spacing; + + if (l.space_caches[ln] == spaces) { + is_at_line_wrap = true; + } } } spaces++; @@ -613,24 +620,25 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & } } - if (underline) { + if (underline || strikethrough) { Color uc = color; uc.a *= 0.5; - int uy = y + lh - line_descent + 2; - float underline_width = 1.0; + + int line_y = y + lh; + if (underline) { + line_y -= line_descent - 2; + } else { + line_y -= (line_ascent + line_descent) / 2; + } + const Point2 from = p_ofs + Point2(align_ofs + wofs, line_y); + const Point2 to = from + Point2(w + (is_at_line_wrap ? 0 : align_spacing), 0); + + float line_width = 1.0f; #ifdef TOOLS_ENABLED - underline_width *= EDSCALE; + line_width *= EDSCALE; #endif - VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, underline_width); - } else if (strikethrough) { - Color uc = color; - uc.a *= 0.5; - int uy = y + lh - (line_ascent + line_descent) / 2; - float strikethrough_width = 1.0; -#ifdef TOOLS_ENABLED - strikethrough_width *= EDSCALE; -#endif - VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, strikethrough_width); + + VS::get_singleton()->canvas_item_add_line(ci, from, to, uc, line_width); } } From 575999a9329e7ba5017b8354a4cbe66ae32830ab Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 11 Jan 2022 12:53:51 +0800 Subject: [PATCH 16/29] Fix BBCode underline prevents strikethrough from rendering (cherry picked from commit 09397f10c59689b3a6a3648439d287d2ac14b6fa) --- scene/gui/rich_text_label.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c57a65126b9..2cc2483d63f 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -374,7 +374,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & font_color_shadow = _find_color(text, p_font_color_shadow); if (_find_underline(text) || (_find_meta(text, &meta) && underline_meta)) { underline = true; - } else if (_find_strikethrough(text)) { + } + if (_find_strikethrough(text)) { strikethrough = true; } @@ -620,24 +621,27 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & } } - if (underline || strikethrough) { +#ifdef TOOLS_ENABLED + const float line_width = EDSCALE; +#else + const float line_width = 1.0f; +#endif + if (underline) { Color uc = color; uc.a *= 0.5; - int line_y = y + lh; - if (underline) { - line_y -= line_descent - 2; - } else { - line_y -= (line_ascent + line_descent) / 2; - } + const int line_y = y + lh - (line_descent - 2); const Point2 from = p_ofs + Point2(align_ofs + wofs, line_y); const Point2 to = from + Point2(w + (is_at_line_wrap ? 0 : align_spacing), 0); + VS::get_singleton()->canvas_item_add_line(ci, from, to, uc, line_width); + } + if (strikethrough) { + Color uc = color; + uc.a *= 0.5; - float line_width = 1.0f; -#ifdef TOOLS_ENABLED - line_width *= EDSCALE; -#endif - + const int line_y = y + lh - (line_ascent + line_descent) / 2; + const Point2 from = p_ofs + Point2(align_ofs + wofs, line_y); + const Point2 to = from + Point2(w + (is_at_line_wrap ? 0 : align_spacing), 0); VS::get_singleton()->canvas_item_add_line(ci, from, to, uc, line_width); } } From ad00d99b492ad3124d416aa0ba132d5a9765fa96 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 23 Dec 2021 17:58:02 +0000 Subject: [PATCH 17/29] Fixed typos in MeshDataTool documentation - Fixed missing "be" typo in MeshDataTool's get_face_edge function - Corrected documentation to say negative values aren't valid (cherry picked from commit bc9df365b045419e26763859019cd1111103ac4e) --- doc/classes/MeshDataTool.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml index 45ac61191fe..4c358141e37 100644 --- a/doc/classes/MeshDataTool.xml +++ b/doc/classes/MeshDataTool.xml @@ -93,7 +93,7 @@ Returns specified edge associated with given face. - Edge argument must 2 or less because a face only has three edges. + Edge argument must be either 0, 1, or 2 because a face only has three edges. @@ -116,7 +116,7 @@ Returns the specified vertex of the given face. - Vertex argument must be 2 or less because faces contain three vertices. + Vertex argument must be either 0, 1, or 2 because faces contain three vertices. From 454fe105e6637424dbc69bc4911843bb86ee315e Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 11 Jan 2022 20:43:29 +0200 Subject: [PATCH 18/29] [macOS] Improve window activation hack. (cherry picked from commit 927105692fe42fb0192a190f20e662c94060194c) --- platform/osx/os_osx.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 1adbbe8c356..e19e141f56e 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -170,9 +170,9 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { @implementation GodotApplicationDelegate - (void)forceUnbundledWindowActivationHackStep1 { - // Step1: Switch focus to macOS Dock. + // Step 1: Switch focus to macOS SystemUIServer process. // Required to perform step 2, TransformProcessType will fail if app is already the in focus. - for (NSRunningApplication *app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) { + for (NSRunningApplication *app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.systemuiserver"]) { [app activateWithOptions:NSApplicationActivateIgnoringOtherApps]; break; } @@ -194,8 +194,8 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { - (void)applicationDidFinishLaunching:(NSNotification *)notice { NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; - if (nsappname == nil) { - // If executable is not a bundled, macOS WindowServer won't register and activate app window correctly (menu and title bar are grayed out and input ignored). + if (nsappname == nil || isatty(STDOUT_FILENO) || isatty(STDIN_FILENO) || isatty(STDERR_FILENO)) { + // If the executable is started from terminal or is not bundled, macOS WindowServer won't register and activate app window correctly (menu and title bar are grayed out and input ignored). [self performSelector:@selector(forceUnbundledWindowActivationHackStep1) withObject:nil afterDelay:0.02]; } } From f999fe471d2f4ea30979a465d5a2470879b9c98a Mon Sep 17 00:00:00 2001 From: zacryol <60046681+zacryol@users.noreply.github.com> Date: Tue, 11 Jan 2022 19:55:45 -0700 Subject: [PATCH 19/29] List AnimatedSprite3D in SpriteFrames description Both AnimatedSprite2D and AnimatedSprite3D use a SpriteFrames resource, but the SpriteFrames class description currently only lists being used with the 2D variant. (cherry picked from commit 4391f6a5b57c2c502a87e27af9d0d4258a579e30) --- doc/classes/SpriteFrames.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml index d2881476392..1991920482d 100644 --- a/doc/classes/SpriteFrames.xml +++ b/doc/classes/SpriteFrames.xml @@ -1,10 +1,10 @@ - Sprite frame library for AnimatedSprite. + Sprite frame library for AnimatedSprite and AnimatedSprite3D. - Sprite frame library for [AnimatedSprite]. Contains frames and animation data for playback. + Sprite frame library for an [AnimatedSprite] or [AnimatedSprite3D] node. Contains frames and animation data for playback. [b]Note:[/b] You can associate a set of normal maps by creating additional [SpriteFrames] resources with a [code]_normal[/code] suffix. For example, having 2 [SpriteFrames] resources [code]run[/code] and [code]run_normal[/code] will make it so the [code]run[/code] animation uses the normal map. From 02c596a82cb3109f7cb5efffd08b9c1b16f8bbe4 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 12 Jan 2022 00:20:47 -0800 Subject: [PATCH 20/29] Fix wrong RGBA channel mapping when saving OpenEXR. (cherry picked from commit 08b89a95d2dce9ed663e443c33080f685c37f273) --- modules/tinyexr/image_saver_tinyexr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tinyexr/image_saver_tinyexr.cpp b/modules/tinyexr/image_saver_tinyexr.cpp index 40dbb660085..c98be744ae5 100644 --- a/modules/tinyexr/image_saver_tinyexr.cpp +++ b/modules/tinyexr/image_saver_tinyexr.cpp @@ -171,7 +171,7 @@ Error save_exr(const String &p_path, const Ref &p_img, bool p_grayscale) { 0 }, // R { 1, 0 }, // GR { 2, 1, 0 }, // BGR - { 2, 1, 0, 3 } // BGRA + { 3, 2, 1, 0 } // ABGR }; int channel_count = get_channel_count(format); From b83ae018ff850b8c9c22d394d2721386a88152fc Mon Sep 17 00:00:00 2001 From: Jason Knight Date: Mon, 10 Jan 2022 14:34:00 -0600 Subject: [PATCH 21/29] Android export plugin passes absolute file paths to gradle for keystores. (cherry picked from commit 39070291ef8154eb90ccbdf56fa68fe47516d7dd) --- platform/android/export/export_plugin.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index d91977957be..acd6b27daf5 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -2991,6 +2991,13 @@ Error EditorExportPlatformAndroid::export_project_helper(const Refget("export/android/debug_keystore_pass"); debug_user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user"); } + if (debug_keystore.is_rel_path()) { + debug_keystore = OS::get_singleton()->get_resource_dir().plus_file(debug_keystore).simplify_path(); + } + if (!FileAccess::exists(debug_keystore)) { + EditorNode::add_io_error(TTR("Could not find keystore, unable to export.")); + return ERR_FILE_CANT_OPEN; + } cmdline.push_back("-Pdebug_keystore_file=" + debug_keystore); // argument to specify the debug keystore file. cmdline.push_back("-Pdebug_keystore_alias=" + debug_user); // argument to specify the debug keystore alias. @@ -3000,6 +3007,9 @@ Error EditorExportPlatformAndroid::export_project_helper(const Refget("keystore/release"); String release_username = p_preset->get("keystore/release_user"); String release_password = p_preset->get("keystore/release_password"); + if (release_keystore.is_rel_path()) { + release_keystore = OS::get_singleton()->get_resource_dir().plus_file(release_keystore).simplify_path(); + } if (!FileAccess::exists(release_keystore)) { EditorNode::add_io_error(TTR("Could not find keystore, unable to export.")); return ERR_FILE_CANT_OPEN; From 33e5093e02a52d56148e435160816157c0b3ed88 Mon Sep 17 00:00:00 2001 From: jmb462 Date: Mon, 3 Jan 2022 22:15:59 +0100 Subject: [PATCH 22/29] Fix PopupMenu bad item offset with custom vseparation (cherry picked from commit 4de860c6d5eabc0cc2d3a8b390b56403576cbf16) --- scene/gui/popup_menu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 5b5a8a48935..05d48dfa6e6 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -78,9 +78,7 @@ Size2 PopupMenu::get_minimum_size() const { String text = items[i].xl_text; size.width += font->get_string_size(text).width; - if (i > 0) { - size.height += vseparation; - } + size.height += vseparation; if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) { int accel_w = hseparation * 2; @@ -522,7 +520,9 @@ void PopupMenu::_notification(int p_what) { } for (int i = 0; i < items.size(); i++) { - if (i > 0) { + if (i == 0) { + ofs.y += vseparation / 2; + } else { ofs.y += vseparation; } Point2 item_ofs = ofs; From cf04c46a5ee86d239f820004b721e2f2729d0abe Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 28 Dec 2021 15:29:21 +0800 Subject: [PATCH 23/29] Clear pending function states when reloading GDScript (cherry picked from commit 53af7ee48296d7e39547169574b8ec6f24ba38eb) --- modules/gdscript/gdscript.cpp | 21 +++++++++++++-------- modules/gdscript/gdscript.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 3a7e668dfdd..4ef8d178915 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -77,6 +77,17 @@ Object *GDScriptNativeClass::instance() { return ClassDB::instance(name); } +void GDScript::_clear_pending_func_states() { + GDScriptLanguage::get_singleton()->lock.lock(); + while (SelfList *E = pending_func_states.first()) { + // Order matters since clearing the stack may already cause + // the GDSCriptFunctionState to be destroyed and thus removed from the list. + pending_func_states.remove(E); + E->self()->_clear_stack(); + } + GDScriptLanguage::get_singleton()->lock.unlock(); +} + GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { /* STEP 1, CREATE */ @@ -597,6 +608,7 @@ Error GDScript::reload(bool p_keep_state) { for (Map>::Element *E = subclasses.front(); E; E = E->next()) { _set_subclass_path(E->get(), path); } + _clear_pending_func_states(); return OK; } @@ -923,14 +935,7 @@ void GDScript::_save_orphaned_subclasses() { } GDScript::~GDScript() { - GDScriptLanguage::get_singleton()->lock.lock(); - while (SelfList *E = pending_func_states.first()) { - // Order matters since clearing the stack may already cause - // the GDSCriptFunctionState to be destroyed and thus removed from the list. - pending_func_states.remove(E); - E->self()->_clear_stack(); - } - GDScriptLanguage::get_singleton()->lock.unlock(); + _clear_pending_func_states(); for (Map::Element *E = member_functions.front(); E; E = E->next()) { memdelete(E->get()); diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 026e0c3455e..476d8abd579 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -112,6 +112,7 @@ class GDScript : public Script { SelfList script_list; SelfList::List pending_func_states; + void _clear_pending_func_states(); GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); From 9a26e95d5cd300ced8c302b11962f155d1ac3c2f Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 23 Nov 2021 18:13:00 +0100 Subject: [PATCH 24/29] Warn when using GPU-based particles on macOS due to low performance On macOS, Particles rendering is much slower than CPUParticles due to transform feedback being implemented on the CPU instead of the GPU. (cherry picked from commit 299d277c9c3ac278508b85be8a75780541f4361a) --- doc/classes/Particles.xml | 1 + doc/classes/Particles2D.xml | 1 + scene/2d/particles_2d.cpp | 11 ++++++++++- scene/3d/particles.cpp | 16 ++++++++++++++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml index 1640b490fd3..1b2880ab378 100644 --- a/doc/classes/Particles.xml +++ b/doc/classes/Particles.xml @@ -7,6 +7,7 @@ 3D particle node used to create a variety of particle systems and effects. [Particles] features an emitter that generates some number of particles at a given rate. Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. [b]Note:[/b] [Particles] only work when using the GLES3 renderer. If using the GLES2 renderer, use [CPUParticles] instead. You can convert [Particles] to [CPUParticles] by selecting the node, clicking the [b]Particles[/b] menu at the top of the 3D editor viewport then choosing [b]Convert to CPUParticles[/b]. + [b]Note:[/b] On macOS, [Particles] rendering is much slower than [CPUParticles] due to transform feedback being implemented on the CPU instead of the GPU. Consider using [CPUParticles] instead when targeting macOS. [b]Note:[/b] After working on a Particles node, remember to update its [member visibility_aabb] by selecting it, clicking the [b]Particles[/b] menu at the top of the 3D editor viewport then choose [b]Generate Visibility AABB[/b]. Otherwise, particles may suddenly disappear depending on the camera position and angle. diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml index b0cb062cb94..8cbc0396c89 100644 --- a/doc/classes/Particles2D.xml +++ b/doc/classes/Particles2D.xml @@ -7,6 +7,7 @@ 2D particle node used to create a variety of particle systems and effects. [Particles2D] features an emitter that generates some number of particles at a given rate. Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. [b]Note:[/b] [Particles2D] only work when using the GLES3 renderer. If using the GLES2 renderer, use [CPUParticles2D] instead. You can convert [Particles2D] to [CPUParticles2D] by selecting the node, clicking the [b]Particles[/b] menu at the top of the 2D editor viewport then choosing [b]Convert to CPUParticles2D[/b]. + [b]Note:[/b] On macOS, [Particles2D] rendering is much slower than [CPUParticles2D] due to transform feedback being implemented on the CPU instead of the GPU. Consider using [CPUParticles2D] instead when targeting macOS. [b]Note:[/b] After working on a Particles node, remember to update its [member visibility_rect] by selecting it, clicking the [b]Particles[/b] menu at the top of the 2D editor viewport then choose [b]Generate Visibility Rect[/b]. Otherwise, particles may suddenly disappear depending on the camera position and angle. [b]Note:[/b] Unlike [CPUParticles2D], [Particles2D] currently ignore the texture region defined in [AtlasTexture]s. diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index a0241a2bf09..5b7e216bcb2 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -205,14 +205,23 @@ bool Particles2D::get_fractional_delta() const { String Particles2D::get_configuration_warning() const { String warning = Node2D::get_configuration_warning(); + if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) { if (warning != String()) { warning += "\n\n"; } - warning += TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); + warning += "- " + TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" toolbar option for this purpose."); return warning; } +#ifdef OSX_ENABLED + if (warning != String()) { + warning += "\n\n"; + } + + warning += "- " + TTR("On macOS, Particles2D rendering is much slower than CPUParticles2D due to transform feedback being implemented on the CPU instead of the GPU.\nConsider using CPUParticles2D instead when targeting macOS.\nYou can use the \"Convert to CPUParticles2D\" toolbar option for this purpose."); +#endif + if (process_material.is_null()) { if (warning != String()) { warning += "\n\n"; diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 50663a3a950..2550fb4135a 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -212,11 +212,23 @@ bool Particles::get_fractional_delta() const { } String Particles::get_configuration_warning() const { + String warnings = GeometryInstance::get_configuration_warning(); + if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) { - return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); + if (warnings != String()) { + warnings += "\n\n"; + } + warnings += "- " + TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" toolbar option for this purpose."); + return warnings; } - String warnings = GeometryInstance::get_configuration_warning(); +#ifdef OSX_ENABLED + if (warnings != String()) { + warnings += "\n\n"; + } + + warnings += "- " + TTR("On macOS, Particles rendering is much slower than CPUParticles due to transform feedback being implemented on the CPU instead of the GPU.\nConsider using CPUParticles instead when targeting macOS.\nYou can use the \"Convert to CPUParticles\" toolbar option for this purpose."); +#endif bool meshes_found = false; bool anim_material_found = false; From 8012a48585bdc30d731de9ac734aca3a0c53c22c Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 12 Jan 2022 01:23:04 +0100 Subject: [PATCH 25/29] Improve description of mouse_exited signal (cherry picked from commit 4eec0032ea30dc3b61b9d0b623aa89bcdc40df21) --- doc/classes/Control.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 017c4a5235e..34b93bb3357 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -846,6 +846,12 @@ Emitted when the mouse leaves the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it. [b]Note:[/b] [signal mouse_exited] will be emitted if the mouse enters a child [Control] node, even if the mouse cursor is still inside the parent's [code]Rect[/code] area. + If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this: + [codeblock] + func _on_mouse_exited(): + if not Rect2(Vector2(), rect_size).has_point(get_local_mouse_position()): + # Not hovering over area. + [/codeblock] From 92ce352cc2ce3ba2bf322338eab129f1cdf780de Mon Sep 17 00:00:00 2001 From: LeaoLuciano Date: Thu, 28 Oct 2021 07:51:48 -0300 Subject: [PATCH 26/29] Fix memory leak in RichTextLabel.remove_line (cherry picked from commit f21b5e4d2fb53e692988e01bf4f5b4957dd9422c) --- scene/gui/rich_text_label.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 2cc2483d63f..099d1404847 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1667,6 +1667,7 @@ void RichTextLabel::_remove_item(Item *p_item, const int p_line, const int p_sub _remove_item(p_item->subitems.front()->get(), p_line, p_subitem_line); } } + memdelete(p_item); } void RichTextLabel::add_image(const Ref &p_image, const int p_width, const int p_height) { From 90525d57815025245ada73686c169c2611a1145a Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 8 Jan 2022 16:27:15 +0100 Subject: [PATCH 27/29] Improve FileDialog filters (cherry picked from commit b403954e41f2e47d77a8ee67798cefaeeb6f6588) --- doc/classes/FileDialog.xml | 4 +++- scene/gui/file_dialog.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index e50bc98a2c9..0f25f02676e 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -13,7 +13,9 @@ - Adds [code]filter[/code] as a custom filter; [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code]. For example, [code]"*.png ; PNG Images"[/code]. + Adds [code]filter[/code] to the list of filters, which restricts what files can be picked. + A [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed. + Example filters: [code]"*.png ; PNG Images"[/code], [code]"project.godot ; Godot Project"[/code]. diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 31b7a0a5667..99bd403f652 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -567,6 +567,7 @@ void FileDialog::clear_filters() { invalidate(); } void FileDialog::add_filter(const String &p_filter) { + ERR_FAIL_COND_MSG(p_filter.begins_with("."), "Filter must be \"filename.extension\", can't start with dot."); filters.push_back(p_filter); update_filters(); invalidate(); From 3f7cb6231dc10cb8eabddb124f7fa126ccc510ab Mon Sep 17 00:00:00 2001 From: skyace65 Date: Sun, 9 Jan 2022 15:03:33 -0500 Subject: [PATCH 28/29] Fix normal map description (cherry picked from commit d8560744883584f220a20d66879162c902726a27) --- doc/classes/MeshInstance2D.xml | 2 +- doc/classes/MultiMeshInstance2D.xml | 2 +- doc/classes/SpatialMaterial.xml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/classes/MeshInstance2D.xml b/doc/classes/MeshInstance2D.xml index 876daee1608..7f4f82d85fa 100644 --- a/doc/classes/MeshInstance2D.xml +++ b/doc/classes/MeshInstance2D.xml @@ -17,7 +17,7 @@ The normal map that will be used if using the default [CanvasItemMaterial]. - [b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. + [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. The [Texture] that will be used if using the default [CanvasItemMaterial]. Can be accessed as [code]TEXTURE[/code] in CanvasItem shader. diff --git a/doc/classes/MultiMeshInstance2D.xml b/doc/classes/MultiMeshInstance2D.xml index 0e0e703d220..222b8e04bd2 100644 --- a/doc/classes/MultiMeshInstance2D.xml +++ b/doc/classes/MultiMeshInstance2D.xml @@ -17,7 +17,7 @@ The normal map that will be used if using the default [CanvasItemMaterial]. - [b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. + [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. The [Texture] that will be used if using the default [CanvasItemMaterial]. Can be accessed as [code]TEXTURE[/code] in CanvasItem shader. diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml index 6e60b324f5a..e0e95c7e76b 100644 --- a/doc/classes/SpatialMaterial.xml +++ b/doc/classes/SpatialMaterial.xml @@ -142,7 +142,7 @@ Texture that specifies the per-pixel normal of the detail overlay. - [b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. + [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. Specifies whether to use [code]UV[/code] or [code]UV2[/code] for the detail layer. See [enum DetailUV] for options. @@ -235,7 +235,7 @@ Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh]. [b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively. - [b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. + [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. Threshold at which the alpha scissor will discard values. From 63799b2a8e97b66eb00bb4cb8c5b4f6a769acd0e Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 9 Jan 2022 01:45:07 +0100 Subject: [PATCH 29/29] Set max value of inactive TextEdit scrolls to 0 (cherry picked from commit 892d93759c5dddc9af4e57deec2e3613909d8cc8) --- scene/gui/text_edit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 86d73c61ad4..f6c8b1242b9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -382,6 +382,7 @@ void TextEdit::_update_scrollbars() { cursor.line_ofs = 0; cursor.wrap_ofs = 0; v_scroll->set_value(0); + v_scroll->set_max(0); v_scroll->hide(); } @@ -399,6 +400,7 @@ void TextEdit::_update_scrollbars() { } else { cursor.x_ofs = 0; h_scroll->set_value(0); + h_scroll->set_max(0); h_scroll->hide(); }