From 650f7c6f3518ccad90d9645111c224c223bff23b Mon Sep 17 00:00:00 2001 From: Eoin O'Neill Date: Fri, 18 Sep 2020 19:59:25 -0700 Subject: [PATCH 01/22] StateMachinePlayback: Added missing bindings to `get_current_play_pos` and `get_current_length`. This allows the user to query the AnimationNodeStateMachinePlayback's current play position and total length of current animation state. These methods are currently used in the editor plugin, but can also be useful for querying general playback state information. Added documentation for AnimationNodeStateMachinePlayback's `get_current_play_position` (cherry picked from commit 674fb52f52f6592c71de319fb4e3fa52be6c136c) --- doc/classes/AnimationNodeStateMachinePlayback.xml | 7 +++++++ scene/animation/animation_node_state_machine.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index 6e2685a0c13e..7f5a9f23bbaa 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -29,6 +29,13 @@ Returns the current travel path as computed internally by the A* algorithm. + + + + + Returns the playback position within the current animation state. + + diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 9b039802ed56..1e58dc8f1254 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -506,6 +506,8 @@ void AnimationNodeStateMachinePlayback::_bind_methods() { ClassDB::bind_method(D_METHOD("stop"), &AnimationNodeStateMachinePlayback::stop); ClassDB::bind_method(D_METHOD("is_playing"), &AnimationNodeStateMachinePlayback::is_playing); ClassDB::bind_method(D_METHOD("get_current_node"), &AnimationNodeStateMachinePlayback::get_current_node); + ClassDB::bind_method(D_METHOD("get_current_play_position"), &AnimationNodeStateMachinePlayback::get_current_play_pos); + ClassDB::bind_method(D_METHOD("get_current_length"), &AnimationNodeStateMachinePlayback::get_current_length); ClassDB::bind_method(D_METHOD("get_travel_path"), &AnimationNodeStateMachinePlayback::get_travel_path); } From bd3c2e96c303cb3477c0b5255c3ebf9242188fb1 Mon Sep 17 00:00:00 2001 From: volzhs Date: Wed, 14 Oct 2020 03:28:45 +0900 Subject: [PATCH 02/22] Enhance editor file dialog 1. show valid directory path when opening editor file dialog 2. keep file name when changing path by entering path 3. add first extension in filter automatically if not given 4. remove directory in recent list if it's not valid anymore (cherry picked from commit 1f4b1e1488551ad297ffa10379ebcbff9cdc764b) --- editor/editor_file_dialog.cpp | 35 +++++++++++++++++++++++------------ editor/editor_file_dialog.h | 1 - editor/editor_node.cpp | 10 +++++----- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index f619246fa2bf..5442a27e6e80 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -222,7 +222,6 @@ void EditorFileDialog::update_dir() { void EditorFileDialog::_dir_entered(String p_dir) { dir_access->change_dir(p_dir); - file->set_text(""); invalidate(); update_dir(); _push_history(); @@ -244,6 +243,14 @@ void EditorFileDialog::_save_confirm_pressed() { void EditorFileDialog::_post_popup() { ConfirmationDialog::_post_popup(); + + // Check if the current path doesn't exist and correct it. + String current = dir_access->get_current_dir(); + while (!dir_access->dir_exists(current)) { + current = current.get_base_dir(); + } + set_current_dir(current); + if (invalidated) { update_file_list(); invalidated = false; @@ -279,11 +286,17 @@ void EditorFileDialog::_post_popup() { } else { name = name.get_file() + "/"; } - - recent->add_item(name, folder); - recent->set_item_metadata(recent->get_item_count() - 1, recentd[i]); - recent->set_item_icon_modulate(recent->get_item_count() - 1, folder_color); + bool exists = dir_access->dir_exists(recentd[i]); + if (!exists) { + // Remove invalid directory from the list of Recent directories. + recentd.remove(i--); + } else { + recent->add_item(name, folder); + recent->set_item_metadata(recent->get_item_count() - 1, recentd[i]); + recent->set_item_icon_modulate(recent->get_item_count() - 1, folder_color); + } } + EditorSettings::get_singleton()->set_recent_dirs(recentd); local_history.clear(); local_history_pos = -1; @@ -441,10 +454,12 @@ void EditorFileDialog::_action_pressed() { } } + // Add first extension of filter if no valid extension is found. if (!valid) { - - exterr->popup_centered_minsize(Size2(250, 80) * EDSCALE); - return; + int idx = filter->get_selected(); + String flt = filters[idx].get_slice(";", 0); + String ext = flt.get_slice(",", 0).strip_edges().get_extension(); + f += "." + ext; } if (dir_access->file_exists(f) && !disable_overwrite_warning) { @@ -1735,10 +1750,6 @@ EditorFileDialog::EditorFileDialog() { mkdirerr->set_text(TTR("Could not create folder.")); add_child(mkdirerr); - exterr = memnew(AcceptDialog); - exterr->set_text(TTR("Must use a valid extension.")); - add_child(exterr); - update_filters(); update_dir(); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index e7ee178b375d..185390652622 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -112,7 +112,6 @@ class EditorFileDialog : public ConfirmationDialog { LineEdit *file; OptionButton *filter; AcceptDialog *mkdirerr; - AcceptDialog *exterr; DirAccess *dir_access; ConfirmationDialog *confirm_save; DependencyRemoveDialog *remove_dialog; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2d187bbf716d..0c1dcee9ebeb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2280,8 +2280,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing; Node *scene = editor_data.get_edited_scene_root(scene_idx); - if (scene && scene->get_filename() != "") { - + if (scene && scene->get_filename() != "" && FileAccess::exists(scene->get_filename())) { if (scene_idx != editor_data.get_edited_scene()) _save_scene_with_preview(scene->get_filename(), scene_idx); else @@ -2326,11 +2325,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } if (scene->get_filename() != "") { - file->set_current_path(scene->get_filename()); + String path = scene->get_filename(); + file->set_current_path(path); if (extensions.size()) { - String ext = scene->get_filename().get_extension().to_lower(); + String ext = path.get_extension().to_lower(); if (extensions.find(ext) == NULL) { - file->set_current_path(scene->get_filename().replacen("." + ext, "." + extensions.front()->get())); + file->set_current_path(path.replacen("." + ext, "." + extensions.front()->get())); } } } else { From 58efe5f3130d3d479452f52f842df257226abe56 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 30 Dec 2020 18:33:43 +0100 Subject: [PATCH 03/22] Document the desktop-only file logging setting override This closes https://github.com/godotengine/godot-docs/issues/4505. (cherry picked from commit bd0b7003e0ab9aececa38cbe5d97e2ce2eb3946a) --- doc/classes/ProjectSettings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index c737386616bc..83fd0c41ff5f 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -850,6 +850,7 @@ If [code]true[/code], logs all output to files. + Desktop override for [member logging/file_logging/enable_file_logging], as log files are not readily accessible on mobile/Web platforms. Path to logs within the project. Using an [code]user://[/code] path is recommended. From 927010e90fcd9134a18bd91de9821fd469f82eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 31 Dec 2020 15:47:37 +0100 Subject: [PATCH 04/22] Do not iterate over map when removing its values (cherry picked from commit 29b288238108ca34b25a58a9376f418d61e55420) --- scene/2d/tile_map.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index e3d425406cba..24161f915d7d 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1049,8 +1049,9 @@ void TileMap::update_dirty_bitmask() { void TileMap::fix_invalid_tiles() { ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot fix invalid tiles if Tileset is not open."); - for (Map::Element *E = tile_map.front(); E; E = E->next()) { + Map temp_tile_map = tile_map; + for (Map::Element *E = temp_tile_map.front(); E; E = E->next()) { if (!tile_set->has_tile(get_cell(E->key().x, E->key().y))) { set_cell(E->key().x, E->key().y, INVALID_CELL); } From bc564cd661c242d65bc2323fec8ca992cc5ef352 Mon Sep 17 00:00:00 2001 From: Maganty Rushyendra Date: Thu, 31 Dec 2020 18:33:39 +0800 Subject: [PATCH 05/22] Issue more precise error when disconnecting a nonexistent connection Checks whether the signal exists when issuing an error message when disconnecting a nonexistent connection. Also prints the callable name. (cherry picked from commit 6c026a6814eb15c2832f9cfd30ee8ef8d0a236ab) --- core/object.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/object.cpp b/core/object.cpp index 361e0ae85f43..38c5399be913 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1563,7 +1563,13 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const ERR_FAIL_NULL(p_to_object); Signal *s = signal_map.getptr(p_signal); - ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string())); + if (!s) { + bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal) || + (!script.is_null() && Ref