Add note to extension-change error message about how to make editor recognize an extension
Update editor/docks/filesystem_dock.cpp Update editor/docks/filesystem_dock.cpp Update editor/docks/filesystem_dock.cpp Use pressed signal for button Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
This commit is contained in:
parent
20d58a38c6
commit
e298af3c71
4 changed files with 35 additions and 1 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "editor/docks/editor_dock_manager.h"
|
||||
#include "editor/docks/import_dock.h"
|
||||
#include "editor/docks/scene_tree_dock.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
|
|
@ -58,6 +59,7 @@
|
|||
#include "editor/settings/editor_command_palette.h"
|
||||
#include "editor/settings/editor_feature_profile.h"
|
||||
#include "editor/settings/editor_settings.h"
|
||||
#include "editor/settings/editor_settings_dialog.h"
|
||||
#include "editor/shader/shader_create_dialog.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "editor/themes/editor_theme_manager.h"
|
||||
|
|
@ -1860,7 +1862,7 @@ void FileSystemDock::_rename_operation_confirm() {
|
|||
rename_error = true;
|
||||
} else if (to_rename.is_file && to_rename.path.get_extension() != new_name.get_extension()) {
|
||||
if (!EditorFileSystem::get_singleton()->get_valid_extensions().find(new_name.get_extension())) {
|
||||
EditorNode::get_singleton()->show_warning(TTRC("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore."));
|
||||
unrecognized_ext_dialog->popup_centered_clamped();
|
||||
rename_error = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -4282,6 +4284,17 @@ void FileSystemDock::load_layout_from_config(const Ref<ConfigFile> &p_layout, co
|
|||
}
|
||||
}
|
||||
|
||||
void FileSystemDock::_on_open_editor_settings_file_exts() {
|
||||
unrecognized_ext_dialog->hide();
|
||||
|
||||
// The FileSystem settings are under "advanced settings", so we have to ensure
|
||||
// that setting is enabled before we attempt to open the menu to them.
|
||||
EditorSettingsDialog *ed_settings = EditorNode::get_singleton()->editor_settings_dialog;
|
||||
ed_settings->set_advanced_mode_enabled(true);
|
||||
ed_settings->popup_edit_settings();
|
||||
ed_settings->set_current_section("docks/filesystem");
|
||||
}
|
||||
|
||||
void FileSystemDock::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("navigate_to_path", "path"), &FileSystemDock::navigate_to_path);
|
||||
|
||||
|
|
@ -4572,6 +4585,12 @@ FileSystemDock::FileSystemDock() {
|
|||
add_child(move_confirm_dialog);
|
||||
move_confirm_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_move_confirm));
|
||||
|
||||
unrecognized_ext_dialog = memnew(AcceptDialog);
|
||||
add_child(unrecognized_ext_dialog);
|
||||
unrecognized_ext_dialog->set_text(TTRC("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore.\nTo make the editor recognize this file extension, add it to one of the lists of extensions in Editor Settings > Docks > FileSystem."));
|
||||
Button *settings_button = unrecognized_ext_dialog->add_button(TTRC("Open Editor Settings"), false, "open_editor_settings_docks_filesystem");
|
||||
settings_button->connect("pressed", callable_mp(this, &FileSystemDock::_on_open_editor_settings_file_exts));
|
||||
|
||||
uncollapsed_paths_before_search = Vector<String>();
|
||||
|
||||
tree_update_id = 0;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "scene/gui/split_container.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class AcceptDialog;
|
||||
class CreateDialog;
|
||||
class DependencyEditor;
|
||||
class DependencyEditorOwners;
|
||||
|
|
@ -211,6 +212,8 @@ private:
|
|||
ShaderCreateDialog *make_shader_dialog = nullptr;
|
||||
CreateDialog *new_resource_dialog = nullptr;
|
||||
|
||||
AcceptDialog *unrecognized_ext_dialog = nullptr;
|
||||
|
||||
String confirm_move_to_dir;
|
||||
bool confirm_to_copy = false;
|
||||
|
||||
|
|
@ -380,6 +383,8 @@ private:
|
|||
void _project_settings_changed();
|
||||
static Vector<String> _remove_self_included_paths(Vector<String> selected_strings);
|
||||
|
||||
void _on_open_editor_settings_file_exts();
|
||||
|
||||
private:
|
||||
inline static FileSystemDock *singleton = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -238,6 +238,14 @@ void EditorSettingsDialog::popup_edit_settings() {
|
|||
_focus_current_search_box();
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::set_advanced_mode_enabled(bool p_enabled) {
|
||||
advanced_switch->set_pressed(p_enabled);
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::set_current_section(const String &p_section) {
|
||||
inspector->set_current_section(p_section);
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_undo_redo_callback(void *p_self, const String &p_name) {
|
||||
EditorNode::get_log()->add_message(p_name, EditorLog::MSG_TYPE_EDITOR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ protected:
|
|||
public:
|
||||
void popup_edit_settings();
|
||||
static void update_navigation_preset();
|
||||
void set_current_section(const String &p_section);
|
||||
void set_advanced_mode_enabled(bool p_enabled);
|
||||
|
||||
EditorSettingsDialog();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue