From 50d69a5a3d1203bfc289553a1522c012cd920a18 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Fri, 25 Oct 2019 14:20:01 +0200 Subject: [PATCH 01/33] Call CRASH_COND_MSG if key not found in HashMap get function. (cherry picked from commit 1b05f449f0584ff29a9f340b1c7c310a52aec7b1) --- core/hash_map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/hash_map.h b/core/hash_map.h index c9d3a690e72..9e51292f47e 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -294,14 +294,14 @@ public: const TData &get(const TKey &p_key) const { const TData *res = getptr(p_key); - ERR_FAIL_COND_V(!res, *res); + CRASH_COND_MSG(!res, "Map key not found."); return *res; } TData &get(const TKey &p_key) { TData *res = getptr(p_key); - ERR_FAIL_COND_V(!res, *res); + CRASH_COND_MSG(!res, "Map key not found."); return *res; } From 38509f1a89f3e10763969a84882991ce9179b0e9 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 13 Dec 2019 13:13:47 +0800 Subject: [PATCH 02/33] Prevent dragging from SceneTree buttons (cherry picked from commit 45d0799b5b4a62f7764c0b9e318a9d1547c7083b) --- editor/scene_tree_editor.cpp | 4 ++++ scene/gui/tree.cpp | 41 ++++++++++++++++++++++++++++++++++++ scene/gui/tree.h | 1 + 3 files changed, 46 insertions(+) diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index c49ea72e99b..49c2f2b8b5e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -928,6 +928,10 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from if (!can_rename) return Variant(); //not editable tree + if (tree->get_button_id_at_position(p_point) != -1) { + return Variant(); //dragging from button + } + Vector selected; Vector > icons; TreeItem *next = tree->get_next_selected(NULL); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 6428da65be1..976dd4aa7e1 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3799,6 +3799,47 @@ TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const { return NULL; } +int Tree::get_button_id_at_position(const Point2 &p_pos) const { + if (root) { + Point2 pos = p_pos; + pos -= cache.bg->get_offset(); + pos.y -= _get_title_button_height(); + if (pos.y < 0) { + return -1; + } + + if (h_scroll->is_visible_in_tree()) { + pos.x += h_scroll->get_value(); + } + if (v_scroll->is_visible_in_tree()) { + pos.y += v_scroll->get_value(); + } + + int col, h, section; + TreeItem *it = _find_item_at_pos(root, pos, col, h, section); + + if (it) { + const TreeItem::Cell &c = it->cells[col]; + int col_width = get_column_width(col); + + for (int i = 0; i < col; i++) { + pos.x -= get_column_width(i); + } + + for (int j = c.buttons.size() - 1; j >= 0; j--) { + Ref b = c.buttons[j].texture; + Size2 size = b->get_size() + cache.button_pressed->get_minimum_size(); + if (pos.x > col_width - size.width) { + return c.buttons[j].id; + } + col_width -= size.width; + } + } + } + + return -1; +} + String Tree::get_tooltip(const Point2 &p_pos) const { if (root) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index f3c88eb5acd..73a8200d164 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -535,6 +535,7 @@ public: TreeItem *get_item_at_position(const Point2 &p_pos) const; int get_column_at_position(const Point2 &p_pos) const; int get_drop_section_at_position(const Point2 &p_pos) const; + int get_button_id_at_position(const Point2 &p_pos) const; void clear(); From 3a08658881f3b11576a6a43b45bb0db005b80ca6 Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Sat, 7 Mar 2020 02:28:17 +0530 Subject: [PATCH 03/33] animation autocomplete bug fixed (cherry picked from commit b07e788ad91dffebd229d1b2b634d313adf73a11) --- scene/animation/animation_player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 727671a6e25..acba1497d2b 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1542,7 +1542,7 @@ void AnimationPlayer::get_argument_options(const StringName &p_function, int p_i #endif String pf = p_function; - if (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") { + if (p_idx == 0 && (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue")) { List al; get_animation_list(&al); for (List::Element *E = al.front(); E; E = E->next()) { From f50c88ba7bf04345f36c931b086ce7bf3384a2d0 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Fri, 1 May 2020 17:51:26 +0300 Subject: [PATCH 04/33] Clarify `Geometry.offset_polygon_2d` regarding vertices translation The method is used to either inflate or deflate a polygon. For translating/transforming a polygon, use `Transform2D.xform`. (cherry picked from commit 19b72da35da1be4574cbac889e5c5263c2824e70) --- doc/classes/Geometry.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml index 48a831e9460..af6fe913b6b 100644 --- a/doc/classes/Geometry.xml +++ b/doc/classes/Geometry.xml @@ -302,6 +302,13 @@ Inflates or deflates [code]polygon[/code] by [code]delta[/code] units (pixels). If [code]delta[/code] is positive, makes the polygon grow outward. If [code]delta[/code] is negative, shrinks the polygon inward. Returns an array of polygons because inflating/deflating may result in multiple discrete polygons. Returns an empty array if [code]delta[/code] is negative and the absolute value of it approximately exceeds the minimum bounding rectangle dimensions of the polygon. Each polygon's vertices will be rounded as determined by [code]join_type[/code], see [enum PolyJoinType]. The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distinguished by calling [method is_polygon_clockwise]. + [b]Note:[/b] To translate the polygon's vertices specifically, use the [method Transform2D.xform] method: + [codeblock] + var polygon = PoolVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)]) + var offset = Vector2(50, 50) + polygon = Transform2D(0, offset).xform(polygon) + print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] + [/codeblock] From 850f07a4d9b110e040aadfaa87cd77639a813b74 Mon Sep 17 00:00:00 2001 From: Paul Herman Date: Thu, 21 May 2020 13:46:44 +0200 Subject: [PATCH 05/33] Expose loading TGA images in Image. (cherry picked from commit 7d4b3e65876af61452a13c23bec1829a0a2de77f) --- core/image.cpp | 8 ++++++++ core/image.h | 2 ++ modules/tga/image_loader_tga.cpp | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/image.cpp b/core/image.cpp index b22d6b8e01a..7bd1ef9c4e4 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -30,6 +30,7 @@ #include "image.h" +#include "core/error_macros.h" #include "core/hash_map.h" #include "core/io/image_loader.h" #include "core/io/resource_loader.h" @@ -2330,6 +2331,7 @@ void Image::fill(const Color &c) { ImageMemLoadFunc Image::_png_mem_loader_func = NULL; ImageMemLoadFunc Image::_jpg_mem_loader_func = NULL; ImageMemLoadFunc Image::_webp_mem_loader_func = NULL; +ImageMemLoadFunc Image::_tga_mem_loader_func = NULL; void (*Image::_image_compress_bc_func)(Image *, float, Image::CompressSource) = NULL; void (*Image::_image_compress_bptc_func)(Image *, float, Image::CompressSource) = NULL; @@ -2778,6 +2780,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("load_png_from_buffer", "buffer"), &Image::load_png_from_buffer); ClassDB::bind_method(D_METHOD("load_jpg_from_buffer", "buffer"), &Image::load_jpg_from_buffer); ClassDB::bind_method(D_METHOD("load_webp_from_buffer", "buffer"), &Image::load_webp_from_buffer); + ClassDB::bind_method(D_METHOD("load_tga_from_buffer", "buffer"), &Image::load_tga_from_buffer); ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "_set_data", "_get_data"); @@ -3093,6 +3096,11 @@ Error Image::load_webp_from_buffer(const PoolVector &p_array) { return _load_from_buffer(p_array, _webp_mem_loader_func); } +Error Image::load_tga_from_buffer(const PoolVector &p_array) { + ERR_FAIL_NULL_V_MSG(_tga_mem_loader_func, ERR_UNAVAILABLE, "TGA module was not installed."); + return _load_from_buffer(p_array, _tga_mem_loader_func); +} + Error Image::_load_from_buffer(const PoolVector &p_array, ImageMemLoadFunc p_loader) { int buffer_size = p_array.size(); diff --git a/core/image.h b/core/image.h index dfb0bce2701..ace8e473066 100644 --- a/core/image.h +++ b/core/image.h @@ -131,6 +131,7 @@ public: static ImageMemLoadFunc _png_mem_loader_func; static ImageMemLoadFunc _jpg_mem_loader_func; static ImageMemLoadFunc _webp_mem_loader_func; + static ImageMemLoadFunc _tga_mem_loader_func; static void (*_image_compress_bc_func)(Image *, float, CompressSource p_source); static void (*_image_compress_bptc_func)(Image *, float p_lossy_quality, CompressSource p_source); @@ -331,6 +332,7 @@ public: Error load_png_from_buffer(const PoolVector &p_array); Error load_jpg_from_buffer(const PoolVector &p_array); Error load_webp_from_buffer(const PoolVector &p_array); + Error load_tga_from_buffer(const PoolVector &p_array); Image(const uint8_t *p_mem_png_jpg, int p_len = -1); Image(const char **p_xpm); diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 480016eb97b..1b383946e97 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -30,6 +30,8 @@ #include "image_loader_tga.h" +#include "core/error_macros.h" +#include "core/io/file_access_memory.h" #include "core/os/os.h" #include "core/print_string.h" @@ -314,5 +316,17 @@ void ImageLoaderTGA::get_recognized_extensions(List *p_extensions) const p_extensions->push_back("tga"); } -ImageLoaderTGA::ImageLoaderTGA() { +static Ref _tga_mem_loader_func(const uint8_t *p_png, int p_size) { + FileAccessMemory memfile; + Error open_memfile_error = memfile.open_custom(p_png, p_size); + ERR_FAIL_COND_V_MSG(open_memfile_error, Ref(), "Could not create memfile for TGA image buffer."); + Ref img; + img.instance(); + Error load_error = ImageLoaderTGA().load_image(img, &memfile, false, 1.0f); + ERR_FAIL_COND_V_MSG(load_error, Ref(), "Failed to load TGA image."); + return img; +} + +ImageLoaderTGA::ImageLoaderTGA() { + Image::_tga_mem_loader_func = _tga_mem_loader_func; } From 46590fa3b03de6e910f3bf3d0e4b77e524202620 Mon Sep 17 00:00:00 2001 From: Mark Kuo Date: Mon, 29 Jun 2020 12:56:10 +1000 Subject: [PATCH 06/33] VideoPlayer: fix possible race condition In set_stream() we write to 'playback' while accessing the same object in _mix_audio() in audio thread. Protect the 'write' part in set_stream() to avoid possible crash in _mix_audio() function. (cherry picked from commit e435d57758017ae7e92b052dcdd64488934998c1) --- scene/gui/video_player.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 0a693d40236..e641675a946 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -212,10 +212,9 @@ bool VideoPlayer::has_expand() const { void VideoPlayer::set_stream(const Ref &p_stream) { stop(); + AudioServer::get_singleton()->lock(); mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size()); - AudioServer::get_singleton()->unlock(); - stream = p_stream; if (stream.is_valid()) { stream->set_audio_track(audio_track); @@ -223,6 +222,7 @@ void VideoPlayer::set_stream(const Ref &p_stream) { } else { playback = Ref(); } + AudioServer::get_singleton()->unlock(); if (!playback.is_null()) { playback->set_loop(loops); From 4c54f39dbe815592ba663d01b234353d6de1c9fa Mon Sep 17 00:00:00 2001 From: Stijn Hinlopen Date: Mon, 29 Jun 2020 17:11:04 +0200 Subject: [PATCH 07/33] Deleting multiple nodes displays correct message. (cherry picked from commit 8b046ed4772bcbc8037398b76ead3f7876a338a4) --- editor/scene_tree_dock.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index e0326c77e48..6880ff59152 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -734,17 +734,28 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { _delete_confirm(); } else { - if (remove_list.size() >= 2) { - delete_dialog->set_text(vformat(TTR("Delete %d nodes?"), remove_list.size())); - } else if (remove_list.size() == 1 && remove_list[0] == editor_data->get_edited_scene_root()) { - delete_dialog->set_text(vformat(TTR("Delete the root node \"%s\"?"), remove_list[0]->get_name())); - } else if (remove_list.size() == 1 && remove_list[0]->get_filename() == "" && remove_list[0]->get_child_count() >= 1) { - // Display this message only for non-instanced scenes - delete_dialog->set_text(vformat(TTR("Delete node \"%s\" and its children?"), remove_list[0]->get_name())); + String msg; + if (remove_list.size() > 1) { + bool any_children = false; + for (int i = 0; !any_children && i < remove_list.size(); i++) { + any_children = remove_list[i]->get_child_count() > 0; + } + + msg = vformat(any_children ? TTR("Delete %d nodes and any children?") : TTR("Delete %d nodes?"), remove_list.size()); } else { - delete_dialog->set_text(vformat(TTR("Delete node \"%s\"?"), remove_list[0]->get_name())); + Node *node = remove_list[0]; + if (node == editor_data->get_edited_scene_root()) { + msg = vformat(TTR("Delete the root node \"%s\"?"), node->get_name()); + } else if (node->get_filename() == "" && node->get_child_count() > 0) { + // Display this message only for non-instanced scenes + msg = vformat(TTR("Delete node \"%s\" and its children?"), node->get_name()); + } else { + msg = vformat(TTR("Delete node \"%s\"?"), node->get_name()); + } } + delete_dialog->set_text(msg); + // Resize the dialog to its minimum size. // This prevents the dialog from being too wide after displaying // a deletion confirmation for a node with a long name. From c68ef4d754126a007176ddce771914eab808739a Mon Sep 17 00:00:00 2001 From: lordkettune Date: Mon, 29 Jun 2020 19:10:18 -0700 Subject: [PATCH 08/33] Fix issues with custom tracks on reimport (cherry picked from commit 4313a7bdc857e7e32a5c71b931e8c02b29416e3c) --- editor/import/resource_importer_scene.cpp | 10 ++++------ scene/resources/animation.cpp | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index d763f367ae2..40e0c357140 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -973,10 +973,9 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String ERR_CONTINUE(anim.is_null()); if (!p_animations.has(anim)) { - - // We are making external files so they are modifiable + // Tracks from source file should be set as imported, anything else is a custom track. for (int i = 0; i < anim->get_track_count(); i++) { - anim->track_set_imported(i, false); + anim->track_set_imported(i, true); } String ext_name; @@ -988,10 +987,9 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String } if (FileAccess::exists(ext_name) && p_keep_animations) { - //try to keep custom animation tracks + // Copy custom animation tracks from previously imported files. Ref old_anim = ResourceLoader::load(ext_name, "Animation", true); if (old_anim.is_valid()) { - //meergeee for (int i = 0; i < old_anim->get_track_count(); i++) { if (!old_anim->track_is_imported(i)) { old_anim->copy_track(i, anim); @@ -1001,7 +999,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String } } - anim->set_path(ext_name, true); //if not set, then its never saved externally + anim->set_path(ext_name, true); // Set path to save externally. ResourceSaver::save(ext_name, anim, ResourceSaver::FLAG_CHANGE_PATH); p_animations[anim] = anim; } diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 91d1e32053c..a3e61081394 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2732,7 +2732,10 @@ void Animation::copy_track(int p_track, Ref p_to_animation) { p_to_animation->track_set_enabled(dst_track, track_is_enabled(p_track)); p_to_animation->track_set_interpolation_type(dst_track, track_get_interpolation_type(p_track)); p_to_animation->track_set_interpolation_loop_wrap(dst_track, track_get_interpolation_loop_wrap(p_track)); - p_to_animation->value_track_set_update_mode(dst_track, value_track_get_update_mode(p_track)); + if (track_get_type(p_track) == TYPE_VALUE) { + p_to_animation->value_track_set_update_mode(dst_track, value_track_get_update_mode(p_track)); + } + for (int i = 0; i < track_get_key_count(p_track); i++) { p_to_animation->track_insert_key(dst_track, track_get_key_time(p_track, i), track_get_key_value(p_track, i), track_get_key_transition(p_track, i)); } From 14b812407438893853b236bfe48246c6e1c5e4ff Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 30 Jun 2020 10:16:02 +0300 Subject: [PATCH 09/33] [macOS export] Set correct external file attributes (Unix mode), and creation time. (cherry picked from commit accae11fe3f28e1da27b67346f3303f68160a375) --- platform/osx/export/export.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index e426f0844c6..fbe5bd771ff 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -749,14 +749,15 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String zipfi.tmz_date.tm_hour = time.hour; zipfi.tmz_date.tm_mday = date.day; zipfi.tmz_date.tm_min = time.min; - zipfi.tmz_date.tm_mon = date.month; + zipfi.tmz_date.tm_mon = date.month - 1; // Note: "tm" month range - 0..11, Godot month range - 1..12, http://www.cplusplus.com/reference/ctime/tm/ zipfi.tmz_date.tm_sec = time.sec; zipfi.tmz_date.tm_year = date.year; zipfi.dosDate = 0; // 0100000: regular file type // 0000755: permissions rwxr-xr-x // 0000644: permissions rw-r--r-- - zipfi.external_fa = (is_executable ? 0100755 : 0100644) << 16L; + uint32_t _mode = (is_executable ? 0100755 : 0100644); + zipfi.external_fa = (_mode << 16L) | !(_mode & 0200); zipfi.internal_fa = 0; zipOpenNewFileInZip4(p_zip, From cdb9b51ed1fd4231937f4a0a039b7312534f6fe2 Mon Sep 17 00:00:00 2001 From: Stijn Hinlopen Date: Mon, 29 Jun 2020 18:23:49 +0200 Subject: [PATCH 10/33] Add Control to preferred types (cherry picked from commit ec86d3268429eebbf512779bd03df9cd754cea99) Fix crash by calculating wrong size of array. (cherry picked from commit 81b6000812983ee6d113921bc62c47ebd8d5611f) --- editor/scene_tree_dock.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6880ff59152..8aba7ac40bb 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -362,17 +362,26 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!profile_allow_editing) { break; } - String preferred = ""; + + // Prefer nodes that inherit from the current scene root. Node *current_edited_scene_root = EditorNode::get_singleton()->get_edited_scene(); - if (current_edited_scene_root) { + String root_class = current_edited_scene_root->get_class_name(); + static Vector preferred_types; + if (preferred_types.empty()) { + preferred_types.push_back("Control"); + preferred_types.push_back("Node2D"); + preferred_types.push_back("Node3D"); + } - if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Node2D")) - preferred = "Node2D"; - else if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Spatial")) - preferred = "Spatial"; + for (int i = 0; i < preferred_types.size(); i++) { + if (ClassDB::is_parent_class(root_class, preferred_types[i])) { + create_dialog->set_preferred_search_result_type(preferred_types[i]); + break; + } + } } - create_dialog->set_preferred_search_result_type(preferred); + create_dialog->popup_create(true); } break; case TOOL_INSTANCE: { From 89421c58cd04357a97bdd67d94f1327c81c98356 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 30 Jun 2020 15:21:35 +0200 Subject: [PATCH 11/33] Write "Aces" tonemapping in uppercase as it's an acronym (cherry picked from commit a31fc59ff3b0b0f081eeaa2507b8a5d3b73aa08d) --- scene/resources/environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 99a0bf98f2e..9c9ab5459c0 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1074,7 +1074,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("get_tonemap_auto_exposure_grey"), &Environment::get_tonemap_auto_exposure_grey); ADD_GROUP("Tonemap", "tonemap_"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "tonemap_mode", PROPERTY_HINT_ENUM, "Linear,Reinhard,Filmic,Aces"), "set_tonemapper", "get_tonemapper"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "tonemap_mode", PROPERTY_HINT_ENUM, "Linear,Reinhard,Filmic,ACES"), "set_tonemapper", "get_tonemapper"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "tonemap_exposure", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_exposure", "get_tonemap_exposure"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "tonemap_white", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_white", "get_tonemap_white"); ADD_GROUP("Auto Exposure", "auto_exposure_"); From 9388237e2dcd5166db0b0384bf667c2bf3e8f7be Mon Sep 17 00:00:00 2001 From: follower Date: Wed, 1 Jul 2020 03:19:24 +1200 Subject: [PATCH 12/33] Revert "Adds fuzzy search for help search dialog" This reverts commit 481dbceed0d0610a6c689e3be448b7953994763e. Current fuzzy search implementation results in too many non-useful results. Could be re-added after result sort/filter/score functionality is added. See #30072 for example existing implementation. Fixes: #39128 Reverts: #32043 Fixed format style conflicts: editor/editor_help_search.cpp (cherry picked from commit 55d706c352fd3cbb25418201053bc0d688ee88d4) --- editor/editor_help_search.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 700d9b692bb..06ae7a19439 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -344,16 +344,12 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { if (search_flags & SEARCH_METHODS) for (int i = 0; i < class_doc.methods.size(); i++) { String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); - String aux_term = (search_flags & SEARCH_CASE_SENSITIVE) ? term : term.to_lower(); - - if (aux_term.begins_with(".")) - aux_term = aux_term.right(1); - - if (aux_term.ends_with("(")) - aux_term = aux_term.left(aux_term.length() - 1).strip_edges(); - - if (aux_term.is_subsequence_of(method_name)) + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { match.methods.push_back(const_cast(&class_doc.methods[i])); + } } if (search_flags & SEARCH_SIGNALS) for (int i = 0; i < class_doc.signals.size(); i++) @@ -440,11 +436,11 @@ bool EditorHelpSearch::Runner::_phase_select_match() { } bool EditorHelpSearch::Runner::_match_string(const String &p_term, const String &p_string) const { - - if (search_flags & SEARCH_CASE_SENSITIVE) - return p_term.is_subsequence_of(p_string); - else - return p_term.is_subsequence_ofi(p_string); + if (search_flags & SEARCH_CASE_SENSITIVE) { + return p_string.find(p_term) > -1; + } else { + return p_string.findn(p_term) > -1; + } } void EditorHelpSearch::Runner::_match_item(TreeItem *p_item, const String &p_text) { From 32c154d297c1bda11a3f7545fe083551fddf78e4 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Tue, 30 Jun 2020 18:22:26 -0300 Subject: [PATCH 13/33] Fix Tree's 'scroll_to_item()' not working correctly on some cases (cherry picked from commit 144a4cc39f037b6deba6095a342ede59d1afa8cb) --- scene/gui/tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 976dd4aa7e1..0aca928625b 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3587,7 +3587,7 @@ void Tree::scroll_to_item(TreeItem *p_item) { const Rect2 r = get_item_rect(p_item); - if (r.position.y < v_scroll->get_value()) { + if (r.position.y <= v_scroll->get_value()) { v_scroll->set_value(r.position.y); } else if (r.position.y + r.size.y + 2 * cache.vseparation > v_scroll->get_value() + get_size().y) { v_scroll->set_value(r.position.y + r.size.y + 2 * cache.vseparation - get_size().y); From 35523a46c0d948ff3c578de6808a08233b0e81c9 Mon Sep 17 00:00:00 2001 From: Daniel Ting Date: Tue, 30 Jun 2020 21:39:12 -0500 Subject: [PATCH 14/33] Make "Close and save changes?" actually save This fixes issue #39844, where the confirmation dialog when a user attempts to close an unsaved script did not actually save it even after clicking "Save." (cherry picked from commit d2a5b92e9be3e244ceb9a86b4ebf904e1db603fc) --- editor/plugins/script_editor_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index a6f9cf0e6d1..53642a30893 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -583,7 +583,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { ScriptEditorBase *current = Object::cast_to(tab_container->get_child(selected)); if (current) { if (p_save) { - apply_scripts(); + _menu_option(FILE_SAVE); } Ref