Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix ambiguous renaming in FileSystem dock

kobewi7152e4e6169a
diff --git a/editor/docks/filesystem_dock.cpp b/editor/docks/filesystem_dock.cpp
index a43fefccd6a..c34f6f39dd8 100644
--- a/editor/docks/filesystem_dock.cpp
+++ b/editor/docks/filesystem_dock.cpp
@@ -1870,12 +1870,12 @@ void FileSystemDock::_folder_removed(const String &p_folder) {
}
}
-void FileSystemDock::_rename_operation_confirm() {
+void FileSystemDock::_rename_operation_confirm(bool p_from_tree) {
String new_name;
TreeItem *ti = tree->get_edited();
int col_index = tree->get_edited_column();
- if (ti) {
+ if (p_from_tree) {
new_name = ti->get_text(col_index).strip_edges();
} else {
new_name = files->get_edit_text().strip_edges();
@@ -4632,7 +4632,7 @@ FileSystemDock::FileSystemDock() {
tree->connect("nothing_selected", callable_mp(this, &FileSystemDock::_tree_empty_selected));
tree->connect(SceneStringName(gui_input), callable_mp(this, &FileSystemDock::_tree_gui_input));
tree->connect(SceneStringName(mouse_exited), callable_mp(this, &FileSystemDock::_tree_mouse_exited));
- tree->connect("item_edited", callable_mp(this, &FileSystemDock::_rename_operation_confirm));
+ tree->connect("item_edited", callable_mp(this, &FileSystemDock::_rename_operation_confirm).bind(true));
file_list_vb = memnew(VBoxContainer);
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -4695,7 +4695,7 @@ FileSystemDock::FileSystemDock() {
files->connect(SceneStringName(gui_input), callable_mp(this, &FileSystemDock::_file_list_gui_input));
files->connect("multi_selected", callable_mp(this, &FileSystemDock::_file_multi_selected));
files->connect("empty_clicked", callable_mp(this, &FileSystemDock::_file_list_empty_clicked));
- files->connect("item_edited", callable_mp(this, &FileSystemDock::_rename_operation_confirm));
+ files->connect("item_edited", callable_mp(this, &FileSystemDock::_rename_operation_confirm).bind(false));
files->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
files->set_allow_rmb_select(true);
files_mc->add_child(files);
diff --git a/editor/docks/filesystem_dock.h b/editor/docks/filesystem_dock.h
index 55356759367..f071b47db71 100644
--- a/editor/docks/filesystem_dock.h
+++ b/editor/docks/filesystem_dock.h
@@ -329,7 +329,7 @@ private:
void _resource_created();
void _script_or_shader_created(const Ref<Resource> &p_resource);
void _make_scene_confirm();
- void _rename_operation_confirm();
+ void _rename_operation_confirm(bool p_from_tree);
void _duplicate_operation_confirm(const String &p_path);
void _move_confirm();
void _overwrite_dialog_action(bool p_overwrite);