feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -274,7 +274,7 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
|||
List<FileInfo> file_list;
|
||||
for (int i = 0; i < p_dir->get_file_count(); i++) {
|
||||
String file_type = p_dir->get_file_type(i);
|
||||
if (file_type != "TextFile" && file_type != "OtherFile" && _is_file_type_disabled_by_feature_profile(file_type)) {
|
||||
if (_is_file_type_disabled_by_feature_profile(file_type)) {
|
||||
// If type is disabled, file won't be displayed.
|
||||
continue;
|
||||
}
|
||||
|
|
@ -321,9 +321,7 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
|||
if (main_scene == file_metadata) {
|
||||
file_item->set_custom_color(0, get_theme_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
}
|
||||
Array udata;
|
||||
udata.push_back(tree_update_id);
|
||||
udata.push_back(file_item);
|
||||
Array udata = { tree_update_id, file_item };
|
||||
EditorResourcePreview::get_singleton()->queue_resource_preview(file_metadata, this, "_tree_thumbnail_done", udata);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -377,7 +375,8 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||
// Handles the favorites.
|
||||
favorites_item = tree->create_item(root);
|
||||
favorites_item->set_icon(0, get_editor_theme_icon(SNAME("Favorites")));
|
||||
favorites_item->set_text(0, TTR("Favorites:"));
|
||||
favorites_item->set_text(0, TTRC("Favorites:"));
|
||||
favorites_item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_ALWAYS);
|
||||
favorites_item->set_metadata(0, "Favorites");
|
||||
favorites_item->set_collapsed(!p_uncollapsed_paths.has("Favorites"));
|
||||
|
||||
|
|
@ -437,9 +436,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||
ti->set_metadata(0, favorite);
|
||||
|
||||
if (!favorite.ends_with("/")) {
|
||||
Array udata;
|
||||
udata.push_back(tree_update_id);
|
||||
udata.push_back(ti);
|
||||
Array udata = { tree_update_id, ti };
|
||||
EditorResourcePreview::get_singleton()->queue_resource_preview(favorite, this, "_tree_thumbnail_done", udata);
|
||||
}
|
||||
}
|
||||
|
|
@ -574,8 +571,6 @@ void FileSystemDock::_notification(int p_what) {
|
|||
case NOTIFICATION_THEME_CHANGED: {
|
||||
_update_display_mode(true);
|
||||
|
||||
button_reload->set_button_icon(get_editor_theme_icon(SNAME("Reload")));
|
||||
|
||||
StringName mode_icon = "Panels1";
|
||||
if (display_mode == DISPLAY_MODE_VSPLIT) {
|
||||
mode_icon = "Panels2";
|
||||
|
|
@ -841,11 +836,11 @@ void FileSystemDock::_set_file_display(bool p_active) {
|
|||
if (p_active) {
|
||||
file_list_display_mode = FILE_LIST_DISPLAY_LIST;
|
||||
button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileThumbnail")));
|
||||
button_file_list_display_mode->set_tooltip_text(TTR("View items as a grid of thumbnails."));
|
||||
button_file_list_display_mode->set_tooltip_text(TTRC("View items as a grid of thumbnails."));
|
||||
} else {
|
||||
file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
|
||||
button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileList")));
|
||||
button_file_list_display_mode->set_tooltip_text(TTR("View items as a list."));
|
||||
button_file_list_display_mode->set_tooltip_text(TTRC("View items as a list."));
|
||||
}
|
||||
|
||||
_update_file_list(true);
|
||||
|
|
@ -853,7 +848,7 @@ void FileSystemDock::_set_file_display(bool p_active) {
|
|||
|
||||
bool FileSystemDock::_is_file_type_disabled_by_feature_profile(const StringName &p_class) {
|
||||
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||
if (profile.is_null()) {
|
||||
if (profile.is_null() || !ClassDB::class_exists(p_class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1226,7 +1221,7 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
|
|||
if (config->has_section_key("remap", "importer")) {
|
||||
String importer = config->get_value("remap", "importer");
|
||||
if (importer == "keep" || importer == "skip") {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Importing has been disabled for this file, so it can't be opened for editing."));
|
||||
EditorNode::get_singleton()->show_warning(TTRC("Importing has been disabled for this file, so it can't be opened for editing."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1234,10 +1229,8 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
|
|||
}
|
||||
|
||||
String resource_type = ResourceLoader::get_resource_type(fpath);
|
||||
|
||||
if (resource_type == "PackedScene" || resource_type == "AnimationLibrary") {
|
||||
bool is_imported = false;
|
||||
|
||||
{
|
||||
List<String> importer_exts;
|
||||
ResourceImporterScene::get_scene_importer_extensions(&importer_exts);
|
||||
|
|
@ -1252,10 +1245,8 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
|
|||
|
||||
if (is_imported) {
|
||||
SceneImportSettingsDialog::get_singleton()->open_settings(p_path, resource_type);
|
||||
} else if (resource_type == "PackedScene") {
|
||||
EditorNode::get_singleton()->open_request(fpath);
|
||||
} else {
|
||||
EditorNode::get_singleton()->load_resource(fpath);
|
||||
EditorNode::get_singleton()->load_scene_or_resource(fpath);
|
||||
}
|
||||
} else if (ResourceLoader::is_imported(fpath)) {
|
||||
// If the importer has advanced settings, show them.
|
||||
|
|
@ -1275,7 +1266,6 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
|
|||
if (!used_advanced_settings) {
|
||||
EditorNode::get_singleton()->load_resource(fpath);
|
||||
}
|
||||
|
||||
} else {
|
||||
EditorNode::get_singleton()->load_resource(fpath);
|
||||
}
|
||||
|
|
@ -1338,6 +1328,10 @@ void FileSystemDock::_fs_changed() {
|
|||
}
|
||||
|
||||
set_process(false);
|
||||
if (had_focus) {
|
||||
had_focus->grab_focus();
|
||||
had_focus = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemDock::_set_scanning_mode() {
|
||||
|
|
@ -1563,7 +1557,7 @@ void FileSystemDock::_update_resource_paths_after_move(const HashMap<String, Str
|
|||
String extra_path;
|
||||
int sep_pos = r->get_path().find("::");
|
||||
if (sep_pos >= 0) {
|
||||
extra_path = base_path.substr(sep_pos, base_path.length());
|
||||
extra_path = base_path.substr(sep_pos);
|
||||
base_path = base_path.substr(0, sep_pos);
|
||||
}
|
||||
|
||||
|
|
@ -1629,7 +1623,7 @@ void FileSystemDock::_update_project_settings_after_move(const HashMap<String, S
|
|||
// If the autoload resource paths has a leading "*", it indicates that it is a Singleton,
|
||||
// so we have to handle both cases when updating.
|
||||
String autoload = GLOBAL_GET(E.name);
|
||||
String autoload_singleton = autoload.substr(1, autoload.length());
|
||||
String autoload_singleton = autoload.substr(1);
|
||||
if (p_renames.has(autoload)) {
|
||||
ProjectSettings::get_singleton()->set_setting(E.name, p_renames[autoload]);
|
||||
} else if (autoload.begins_with("*") && p_renames.has(autoload_singleton)) {
|
||||
|
|
@ -1738,9 +1732,7 @@ void FileSystemDock::_folder_removed(const String &p_folder) {
|
|||
|
||||
// Remove assigned folder color for all subfolders.
|
||||
bool folder_colors_updated = false;
|
||||
List<Variant> paths;
|
||||
assigned_folder_colors.get_key_list(&paths);
|
||||
for (const Variant &E : paths) {
|
||||
for (const Variant &E : assigned_folder_colors.get_key_list()) {
|
||||
const String &path = E;
|
||||
// These folder paths are guaranteed to end with a "/".
|
||||
if (path.begins_with(p_folder)) {
|
||||
|
|
@ -1773,17 +1765,17 @@ void FileSystemDock::_rename_operation_confirm() {
|
|||
|
||||
bool rename_error = false;
|
||||
if (new_name.length() == 0) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("No name provided."));
|
||||
EditorNode::get_singleton()->show_warning(TTRC("No name provided."));
|
||||
rename_error = true;
|
||||
} else if (new_name.contains_char('/') || new_name.contains_char('\\') || new_name.contains_char(':')) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Name contains invalid characters."));
|
||||
EditorNode::get_singleton()->show_warning(TTRC("Name contains invalid characters."));
|
||||
rename_error = true;
|
||||
} else if (new_name[0] == '.') {
|
||||
EditorNode::get_singleton()->show_warning(TTR("This filename begins with a dot rendering the file invisible to the editor.\nIf you want to rename it anyway, use your operating system's file manager."));
|
||||
EditorNode::get_singleton()->show_warning(TTRC("This filename begins with a dot rendering the file invisible to the editor.\nIf you want to rename it anyway, use your operating system's file manager."));
|
||||
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(TTR("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."));
|
||||
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."));
|
||||
rename_error = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1814,7 +1806,7 @@ void FileSystemDock::_rename_operation_confirm() {
|
|||
new_exist = new_exist && (new_path.to_lower() != old_path.to_lower());
|
||||
}
|
||||
if (new_exist) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("A file or folder with this name already exists."));
|
||||
EditorNode::get_singleton()->show_warning(TTRC("A file or folder with this name already exists."));
|
||||
if (ti) {
|
||||
ti->set_text(col_index, old_name);
|
||||
}
|
||||
|
|
@ -1936,8 +1928,8 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_cop
|
|||
TTR("The following files or folders conflict with items in the target location '%s':"), to_move_path));
|
||||
overwrite_dialog_file_list->set_text(String("\n").join(conflicting_items));
|
||||
overwrite_dialog_footer->set_text(
|
||||
p_copy ? TTR("Do you wish to overwrite them or rename the copied files?")
|
||||
: TTR("Do you wish to overwrite them or rename the moved files?"));
|
||||
p_copy ? TTRC("Do you wish to overwrite them or rename the copied files?")
|
||||
: TTRC("Do you wish to overwrite them or rename the moved files?"));
|
||||
overwrite_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
|
@ -2675,6 +2667,12 @@ bool FileSystemDock::_matches_all_search_tokens(const String &p_text) {
|
|||
}
|
||||
|
||||
void FileSystemDock::_rescan() {
|
||||
if (tree->has_focus()) {
|
||||
had_focus = tree;
|
||||
} else if (files->has_focus()) {
|
||||
had_focus = files;
|
||||
}
|
||||
|
||||
_set_scanning_mode();
|
||||
EditorFileSystem::get_singleton()->scan();
|
||||
}
|
||||
|
|
@ -2737,7 +2735,13 @@ void FileSystemDock::focus_on_filter() {
|
|||
}
|
||||
|
||||
void FileSystemDock::create_directory(const String &p_path, const String &p_base_dir) {
|
||||
Error err = EditorFileSystem::get_singleton()->make_dir_recursive(p_path.trim_prefix(p_base_dir), p_base_dir);
|
||||
String trimmed_path = p_path;
|
||||
if (!p_base_dir.is_empty()) {
|
||||
// Trims off the joining '/' if the base didn't end with one. If the base did have it
|
||||
// and there's two slashes, the empty directory is safe to trim off anyways.
|
||||
trimmed_path = trimmed_path.trim_prefix(p_base_dir).trim_prefix("/");
|
||||
}
|
||||
Error err = EditorFileSystem::get_singleton()->make_dir_recursive(trimmed_path, p_base_dir);
|
||||
if (err != OK) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Could not create folder: %s"), error_names[err]));
|
||||
}
|
||||
|
|
@ -2851,12 +2855,12 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
|
||||
// Moving favorite around.
|
||||
TreeItem *ti = tree->get_item_at_position(p_point);
|
||||
TreeItem *ti = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_selected() : tree->get_item_at_position(p_point);
|
||||
if (!ti) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int drop_section = tree->get_drop_section_at_position(p_point);
|
||||
int drop_section = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point);
|
||||
if (ti == favorites_item) {
|
||||
return (drop_section == 1); // The parent, first fav.
|
||||
}
|
||||
|
|
@ -2929,11 +2933,11 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
|
|||
return;
|
||||
}
|
||||
// Moving favorite around.
|
||||
TreeItem *ti = tree->get_item_at_position(p_point);
|
||||
TreeItem *ti = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_selected() : tree->get_item_at_position(p_point);
|
||||
if (!ti) {
|
||||
return;
|
||||
}
|
||||
int drop_section = tree->get_drop_section_at_position(p_point);
|
||||
int drop_section = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point);
|
||||
|
||||
int drop_position;
|
||||
Vector<String> drag_files = drag_data["files"];
|
||||
|
|
@ -3053,7 +3057,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
|
|||
|
||||
// In the file list.
|
||||
if (p_from == files) {
|
||||
int pos = files->get_item_at_position(p_point, true);
|
||||
int pos = (p_point == Vector2(Math::INF, Math::INF)) ? -1 : files->get_item_at_position(p_point, true);
|
||||
if (pos == -1) {
|
||||
target = get_current_directory();
|
||||
return;
|
||||
|
|
@ -3066,8 +3070,8 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
|
|||
|
||||
// In the tree.
|
||||
if (p_from == tree) {
|
||||
TreeItem *ti = tree->get_item_at_position(p_point);
|
||||
int section = tree->get_drop_section_at_position(p_point);
|
||||
TreeItem *ti = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_selected() : tree->get_item_at_position(p_point);
|
||||
int section = (p_point == Vector2(Math::INF, Math::INF)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point);
|
||||
if (ti) {
|
||||
// Check the favorites first.
|
||||
if (ti == tree->get_root()->get_first_child() && section >= 0) {
|
||||
|
|
@ -3195,24 +3199,24 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
if (all_files) {
|
||||
if (all_files_scenes) {
|
||||
if (filenames.size() == 1) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open Scene"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTR("New Inherited Scene"), FILE_INHERIT);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTRC("New Inherited Scene"), FILE_INHERIT);
|
||||
if (GLOBAL_GET("application/run/main_scene") != filenames[0]) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTR("Set as Main Scene"), FILE_MAIN_SCENE);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTRC("Set as Main Scene"), FILE_MAIN_SCENE);
|
||||
}
|
||||
} else {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open Scenes"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scenes"), FILE_OPEN);
|
||||
}
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Instance")), TTR("Instantiate"), FILE_INSTANTIATE);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Instance")), TTRC("Instantiate"), FILE_INSTANTIATE);
|
||||
p_popup->add_separator();
|
||||
} else if (filenames.size() == 1) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open"), FILE_OPEN);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
|
||||
if (filenames.size() == 1) {
|
||||
p_popup->add_item(TTR("Edit Dependencies..."), FILE_DEPENDENCIES);
|
||||
p_popup->add_item(TTR("View Owners..."), FILE_OWNERS);
|
||||
p_popup->add_item(TTRC("Edit Dependencies..."), FILE_DEPENDENCIES);
|
||||
p_popup->add_item(TTRC("View Owners..."), FILE_OWNERS);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
}
|
||||
|
|
@ -3221,14 +3225,14 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
PopupMenu *new_menu = memnew(PopupMenu);
|
||||
new_menu->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_generic_rmb_option_selected));
|
||||
|
||||
p_popup->add_submenu_node_item(TTR("Create New"), new_menu, FILE_NEW);
|
||||
p_popup->add_submenu_node_item(TTRC("Create New"), new_menu, FILE_NEW);
|
||||
p_popup->set_item_icon(p_popup->get_item_index(FILE_NEW), get_editor_theme_icon(SNAME("Add")));
|
||||
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTR("Folder..."), FILE_NEW_FOLDER);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTR("Scene..."), FILE_NEW_SCENE);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTR("Script..."), FILE_NEW_SCRIPT);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTR("Resource..."), FILE_NEW_RESOURCE);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTR("TextFile..."), FILE_NEW_TEXTFILE);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("Folder..."), FILE_NEW_FOLDER);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("Scene..."), FILE_NEW_SCENE);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("Script..."), FILE_NEW_SCRIPT);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("Resource..."), FILE_NEW_RESOURCE);
|
||||
new_menu->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("TextFile..."), FILE_NEW_TEXTFILE);
|
||||
|
||||
EditorContextMenuPluginManager::get_singleton()->add_options_from_plugins(new_menu, EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM_CREATE, p_paths);
|
||||
p_popup->add_separator();
|
||||
|
|
@ -3239,11 +3243,11 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
bool root_path_not_selected = p_paths[0] != "res://" && (p_paths.size() <= 1 || p_paths[1] != "res://");
|
||||
|
||||
if (all_folders && foldernames.size() > 0) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Expand Folder"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Expand Folder"), FILE_OPEN);
|
||||
|
||||
if (foldernames.size() == 1) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), TTR("Expand Hierarchy"), FOLDER_EXPAND_ALL);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), TTR("Collapse Hierarchy"), FOLDER_COLLAPSE_ALL);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), TTRC("Expand Hierarchy"), FOLDER_EXPAND_ALL);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), TTRC("Collapse Hierarchy"), FOLDER_COLLAPSE_ALL);
|
||||
}
|
||||
|
||||
p_popup->add_separator();
|
||||
|
|
@ -3253,10 +3257,10 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
PopupMenu *folder_colors_menu = memnew(PopupMenu);
|
||||
folder_colors_menu->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_folder_color_index_pressed).bind(folder_colors_menu));
|
||||
|
||||
p_popup->add_submenu_node_item(TTR("Set Folder Color..."), folder_colors_menu);
|
||||
p_popup->add_submenu_node_item(TTRC("Set Folder Color..."), folder_colors_menu);
|
||||
p_popup->set_item_icon(-1, get_editor_theme_icon(SNAME("Paint")));
|
||||
|
||||
folder_colors_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTR("Default (Reset)"));
|
||||
folder_colors_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("Default (Reset)"));
|
||||
folder_colors_menu->set_item_icon_modulate(0, get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog")));
|
||||
folder_colors_menu->add_separator();
|
||||
|
||||
|
|
@ -3284,7 +3288,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
|
||||
// Add the options that are only available when the root path is not selected.
|
||||
if (root_path_not_selected) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("MoveUp")), TTR("Move/Duplicate To..."), FILE_MOVE);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("MoveUp")), TTRC("Move/Duplicate To..."), FILE_MOVE);
|
||||
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Remove")), ED_GET_SHORTCUT("filesystem_dock/delete"), FILE_REMOVE);
|
||||
}
|
||||
|
||||
|
|
@ -3296,10 +3300,10 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
// Add the options that are available when one or more items are selected.
|
||||
if (p_paths.size() >= 1) {
|
||||
if (!all_favorites) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Favorites")), TTR("Add to Favorites"), FILE_ADD_FAVORITE);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Favorites")), TTRC("Add to Favorites"), FILE_ADD_FAVORITE);
|
||||
}
|
||||
if (!all_not_favorites) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("NonFavorite")), TTR("Remove from Favorites"), FILE_REMOVE_FAVORITE);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("NonFavorite")), TTRC("Remove from Favorites"), FILE_REMOVE_FAVORITE);
|
||||
}
|
||||
|
||||
if (root_path_not_selected) {
|
||||
|
|
@ -3319,7 +3323,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
container_menu = memnew(PopupMenu);
|
||||
container_menu->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_generic_rmb_option_selected));
|
||||
|
||||
p_popup->add_submenu_node_item(TTR("Convert to..."), container_menu, FILE_NEW);
|
||||
p_popup->add_submenu_node_item(TTRC("Convert to..."), container_menu, FILE_NEW);
|
||||
conversion_string_template = "%s";
|
||||
}
|
||||
|
||||
|
|
@ -3364,7 +3368,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
}
|
||||
|
||||
if (resource_valid) {
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Reimport"), FILE_REIMPORT);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Reimport"), FILE_REIMPORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3389,7 +3393,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
if (is_item_in_favorites) {
|
||||
p_popup->add_separator();
|
||||
added_separator = true;
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTR("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
|
||||
p_popup->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3403,14 +3407,14 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
const bool is_directory = fpath.ends_with("/");
|
||||
|
||||
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_OPEN_IN_TERMINAL);
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_OPEN_IN_TERMINAL), is_directory ? TTR("Open in Terminal") : TTR("Open Folder in Terminal"));
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_OPEN_IN_TERMINAL), is_directory ? TTRC("Open in Terminal") : TTRC("Open Folder in Terminal"));
|
||||
|
||||
if (!is_directory) {
|
||||
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ExternalLink")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
|
||||
}
|
||||
|
||||
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager"));
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), is_directory ? TTRC("Open in File Manager") : TTRC("Show in File Manager"));
|
||||
#endif
|
||||
|
||||
current_path = fpath;
|
||||
|
|
@ -3447,11 +3451,11 @@ void FileSystemDock::_tree_empty_click(const Vector2 &p_pos, MouseButton p_butto
|
|||
current_path = "res://";
|
||||
tree_popup->clear();
|
||||
tree_popup->reset_size();
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_NEW_FOLDER);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_NEW_SCENE);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_NEW_SCRIPT);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_NEW_RESOURCE);
|
||||
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_NEW_TEXTFILE);
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
// Opening the system file manager is not supported on the Android and web editors.
|
||||
tree_popup->add_separator();
|
||||
|
|
@ -3517,11 +3521,11 @@ void FileSystemDock::_file_list_empty_clicked(const Vector2 &p_pos, MouseButton
|
|||
file_list_popup->clear();
|
||||
file_list_popup->reset_size();
|
||||
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_NEW_FOLDER);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_NEW_SCENE);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_NEW_SCRIPT);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_NEW_RESOURCE);
|
||||
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_NEW_TEXTFILE);
|
||||
file_list_popup->add_separator();
|
||||
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_OPEN_IN_TERMINAL);
|
||||
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
||||
|
|
@ -3695,7 +3699,7 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
|
|||
if (fpath.size() > String("res://").size()) {
|
||||
fpath = fpath.left(fpath.size() - 2); // Remove last '/'.
|
||||
const int slash_idx = fpath.rfind_char('/');
|
||||
fpath = fpath.substr(slash_idx + 1, fpath.size() - slash_idx - 1);
|
||||
fpath = fpath.substr(slash_idx + 1);
|
||||
}
|
||||
|
||||
tree_item = tree->get_item_with_text(fpath);
|
||||
|
|
@ -3834,7 +3838,7 @@ void FileSystemDock::_update_import_dock() {
|
|||
imports.push_back(fpath);
|
||||
}
|
||||
|
||||
if (imports.size() == 0) {
|
||||
if (imports.is_empty()) {
|
||||
ImportDock::get_singleton()->clear();
|
||||
} else if (imports.size() == 1) {
|
||||
ImportDock::get_singleton()->set_edit_path(imports[0]);
|
||||
|
|
@ -3880,16 +3884,17 @@ MenuButton *FileSystemDock::_create_file_menu_button() {
|
|||
MenuButton *button = memnew(MenuButton);
|
||||
button->set_flat(false);
|
||||
button->set_theme_type_variation("FlatMenuButton");
|
||||
button->set_tooltip_text(TTR("Sort Files"));
|
||||
button->set_tooltip_text(TTRC("Sort Files"));
|
||||
button->set_accessibility_name(TTRC("Sort Files"));
|
||||
|
||||
PopupMenu *p = button->get_popup();
|
||||
p->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_file_sort_popup));
|
||||
p->add_radio_check_item(TTR("Sort by Name (Ascending)"), (int)FileSortOption::FILE_SORT_NAME);
|
||||
p->add_radio_check_item(TTR("Sort by Name (Descending)"), (int)FileSortOption::FILE_SORT_NAME_REVERSE);
|
||||
p->add_radio_check_item(TTR("Sort by Type (Ascending)"), (int)FileSortOption::FILE_SORT_TYPE);
|
||||
p->add_radio_check_item(TTR("Sort by Type (Descending)"), (int)FileSortOption::FILE_SORT_TYPE_REVERSE);
|
||||
p->add_radio_check_item(TTR("Sort by Last Modified"), (int)FileSortOption::FILE_SORT_MODIFIED_TIME);
|
||||
p->add_radio_check_item(TTR("Sort by First Modified"), (int)FileSortOption::FILE_SORT_MODIFIED_TIME_REVERSE);
|
||||
p->add_radio_check_item(TTRC("Sort by Name (Ascending)"), (int)FileSortOption::FILE_SORT_NAME);
|
||||
p->add_radio_check_item(TTRC("Sort by Name (Descending)"), (int)FileSortOption::FILE_SORT_NAME_REVERSE);
|
||||
p->add_radio_check_item(TTRC("Sort by Type (Ascending)"), (int)FileSortOption::FILE_SORT_TYPE);
|
||||
p->add_radio_check_item(TTRC("Sort by Type (Descending)"), (int)FileSortOption::FILE_SORT_TYPE_REVERSE);
|
||||
p->add_radio_check_item(TTRC("Sort by Last Modified"), (int)FileSortOption::FILE_SORT_MODIFIED_TIME);
|
||||
p->add_radio_check_item(TTRC("Sort by First Modified"), (int)FileSortOption::FILE_SORT_MODIFIED_TIME_REVERSE);
|
||||
p->set_item_checked((int)file_sort, true);
|
||||
return button;
|
||||
}
|
||||
|
|
@ -4074,38 +4079,36 @@ FileSystemDock::FileSystemDock() {
|
|||
button_hist_prev->set_flat(true);
|
||||
button_hist_prev->set_disabled(true);
|
||||
button_hist_prev->set_focus_mode(FOCUS_NONE);
|
||||
button_hist_prev->set_tooltip_text(TTR("Go to previous selected folder/file."));
|
||||
button_hist_prev->set_tooltip_text(TTRC("Go to previous selected folder/file."));
|
||||
button_hist_prev->set_accessibility_name(TTRC("Previous"));
|
||||
nav_hbc->add_child(button_hist_prev);
|
||||
|
||||
button_hist_next = memnew(Button);
|
||||
button_hist_next->set_flat(true);
|
||||
button_hist_next->set_disabled(true);
|
||||
button_hist_next->set_focus_mode(FOCUS_NONE);
|
||||
button_hist_next->set_tooltip_text(TTR("Go to next selected folder/file."));
|
||||
button_hist_next->set_tooltip_text(TTRC("Go to next selected folder/file."));
|
||||
button_hist_next->set_accessibility_name(TTRC("Next"));
|
||||
nav_hbc->add_child(button_hist_next);
|
||||
|
||||
current_path_line_edit = memnew(LineEdit);
|
||||
current_path_line_edit->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
|
||||
current_path_line_edit->set_accessibility_name(TTRC("Path"));
|
||||
current_path_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_set_current_path_line_edit_text(current_path);
|
||||
toolbar_hbc->add_child(current_path_line_edit);
|
||||
|
||||
button_reload = memnew(Button);
|
||||
button_reload->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_rescan));
|
||||
button_reload->set_focus_mode(FOCUS_NONE);
|
||||
button_reload->set_tooltip_text(TTR("Re-Scan Filesystem"));
|
||||
button_reload->hide();
|
||||
toolbar_hbc->add_child(button_reload);
|
||||
|
||||
button_toggle_display_mode = memnew(Button);
|
||||
button_toggle_display_mode->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_change_split_mode));
|
||||
button_toggle_display_mode->set_focus_mode(FOCUS_NONE);
|
||||
button_toggle_display_mode->set_tooltip_text(TTR("Change Split Mode"));
|
||||
button_toggle_display_mode->set_tooltip_text(TTRC("Change Split Mode"));
|
||||
button_toggle_display_mode->set_accessibility_name(TTRC("Change Split Mode"));
|
||||
button_toggle_display_mode->set_theme_type_variation("FlatMenuButton");
|
||||
toolbar_hbc->add_child(button_toggle_display_mode);
|
||||
|
||||
button_dock_placement = memnew(Button);
|
||||
button_dock_placement->set_theme_type_variation("FlatMenuButton");
|
||||
button_dock_placement->set_accessibility_name(TTRC("Dock Placement"));
|
||||
button_dock_placement->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_change_bottom_dock_placement));
|
||||
button_dock_placement->hide();
|
||||
toolbar_hbc->add_child(button_dock_placement);
|
||||
|
|
@ -4115,7 +4118,8 @@ FileSystemDock::FileSystemDock() {
|
|||
|
||||
tree_search_box = memnew(LineEdit);
|
||||
tree_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
tree_search_box->set_placeholder(TTR("Filter Files"));
|
||||
tree_search_box->set_placeholder(TTRC("Filter Files"));
|
||||
tree_search_box->set_accessibility_name(TTRC("Filter Files"));
|
||||
tree_search_box->set_clear_button_enabled(true);
|
||||
tree_search_box->connect(SceneStringName(text_changed), callable_mp(this, &FileSystemDock::_search_changed).bind(tree_search_box));
|
||||
toolbar2_hbc->add_child(tree_search_box);
|
||||
|
|
@ -4138,6 +4142,7 @@ FileSystemDock::FileSystemDock() {
|
|||
add_child(split_box);
|
||||
|
||||
tree = memnew(FileSystemTree);
|
||||
tree->set_accessibility_name(TTRC("Directories"));
|
||||
tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
|
||||
tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
|
|
@ -4167,7 +4172,8 @@ FileSystemDock::FileSystemDock() {
|
|||
|
||||
file_list_search_box = memnew(LineEdit);
|
||||
file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file_list_search_box->set_placeholder(TTR("Filter Files"));
|
||||
file_list_search_box->set_placeholder(TTRC("Filter Files"));
|
||||
file_list_search_box->set_accessibility_name(TTRC("Filter Files"));
|
||||
file_list_search_box->set_clear_button_enabled(true);
|
||||
file_list_search_box->connect(SceneStringName(text_changed), callable_mp(this, &FileSystemDock::_search_changed).bind(file_list_search_box));
|
||||
path_hb->add_child(file_list_search_box);
|
||||
|
|
@ -4176,11 +4182,13 @@ FileSystemDock::FileSystemDock() {
|
|||
path_hb->add_child(file_list_button_sort);
|
||||
|
||||
button_file_list_display_mode = memnew(Button);
|
||||
button_file_list_display_mode->set_accessibility_name(TTRC("Display Mode"));
|
||||
button_file_list_display_mode->set_theme_type_variation("FlatMenuButton");
|
||||
path_hb->add_child(button_file_list_display_mode);
|
||||
|
||||
files = memnew(FileSystemList);
|
||||
files->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
files->set_accessibility_name(TTRC("Files"));
|
||||
files->set_select_mode(ItemList::SELECT_MULTI);
|
||||
files->set_theme_type_variation("ItemListSecondary");
|
||||
SET_DRAG_FORWARDING_GCD(files, FileSystemDock);
|
||||
|
|
@ -4198,11 +4206,12 @@ FileSystemDock::FileSystemDock() {
|
|||
add_child(scanning_vb);
|
||||
|
||||
Label *slabel = memnew(Label);
|
||||
slabel->set_text(TTR("Scanning Files,\nPlease Wait..."));
|
||||
slabel->set_text(TTRC("Scanning Files,\nPlease Wait..."));
|
||||
slabel->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
scanning_vb->add_child(slabel);
|
||||
|
||||
scanning_progress = memnew(ProgressBar);
|
||||
scanning_progress->set_accessibility_name(TTRC("Filesystem Scan"));
|
||||
scanning_vb->add_child(scanning_progress);
|
||||
|
||||
deps_editor = memnew(DependencyEditor);
|
||||
|
|
@ -4224,8 +4233,8 @@ FileSystemDock::FileSystemDock() {
|
|||
|
||||
overwrite_dialog = memnew(ConfirmationDialog);
|
||||
add_child(overwrite_dialog);
|
||||
overwrite_dialog->set_ok_button_text(TTR("Overwrite"));
|
||||
overwrite_dialog->add_button(TTR("Keep Both"), true)->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_overwrite_dialog_action).bind(false));
|
||||
overwrite_dialog->set_ok_button_text(TTRC("Overwrite"));
|
||||
overwrite_dialog->add_button(TTRC("Keep Both"), true)->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_overwrite_dialog_action).bind(false));
|
||||
overwrite_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_overwrite_dialog_action).bind(true));
|
||||
|
||||
VBoxContainer *overwrite_dialog_vb = memnew(VBoxContainer);
|
||||
|
|
@ -4252,7 +4261,7 @@ FileSystemDock::FileSystemDock() {
|
|||
make_scene_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_make_scene_confirm));
|
||||
|
||||
make_script_dialog = memnew(ScriptCreateDialog);
|
||||
make_script_dialog->set_title(TTR("Create Script"));
|
||||
make_script_dialog->set_title(TTRC("Create Script"));
|
||||
add_child(make_script_dialog);
|
||||
|
||||
make_shader_dialog = memnew(ShaderCreateDialog);
|
||||
|
|
@ -4265,7 +4274,7 @@ FileSystemDock::FileSystemDock() {
|
|||
|
||||
conversion_dialog = memnew(ConfirmationDialog);
|
||||
add_child(conversion_dialog);
|
||||
conversion_dialog->set_ok_button_text(TTR("Convert"));
|
||||
conversion_dialog->set_ok_button_text(TTRC("Convert"));
|
||||
conversion_dialog->connect(SceneStringName(confirmed), callable_mp(this, &FileSystemDock::_convert_dialog_action));
|
||||
|
||||
uncollapsed_paths_before_search = Vector<String>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue