Fixes favorites not updating and rename favorite_dirs to favorites
This commit is contained in:
@ -1115,7 +1115,7 @@ void EditorFileDialog::_update_drives() {
|
||||
|
||||
void EditorFileDialog::_favorite_selected(int p_idx) {
|
||||
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||
ERR_FAIL_INDEX(p_idx, favorited.size());
|
||||
|
||||
dir_access->change_dir(favorited[p_idx]);
|
||||
@ -1130,7 +1130,7 @@ void EditorFileDialog::_favorite_move_up() {
|
||||
int current = favorites->get_current();
|
||||
|
||||
if (current > 0 && current < favorites->get_item_count()) {
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||
|
||||
int a_idx = favorited.find(String(favorites->get_item_metadata(current - 1)));
|
||||
int b_idx = favorited.find(String(favorites->get_item_metadata(current)));
|
||||
@ -1139,7 +1139,7 @@ void EditorFileDialog::_favorite_move_up() {
|
||||
return;
|
||||
SWAP(favorited.write[a_idx], favorited.write[b_idx]);
|
||||
|
||||
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
|
||||
EditorSettings::get_singleton()->set_favorites(favorited);
|
||||
|
||||
_update_favorites();
|
||||
update_file_list();
|
||||
@ -1150,7 +1150,7 @@ void EditorFileDialog::_favorite_move_down() {
|
||||
int current = favorites->get_current();
|
||||
|
||||
if (current >= 0 && current < favorites->get_item_count() - 1) {
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||
|
||||
int a_idx = favorited.find(String(favorites->get_item_metadata(current + 1)));
|
||||
int b_idx = favorited.find(String(favorites->get_item_metadata(current)));
|
||||
@ -1159,7 +1159,7 @@ void EditorFileDialog::_favorite_move_down() {
|
||||
return;
|
||||
SWAP(favorited.write[a_idx], favorited.write[b_idx]);
|
||||
|
||||
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
|
||||
EditorSettings::get_singleton()->set_favorites(favorited);
|
||||
|
||||
_update_favorites();
|
||||
update_file_list();
|
||||
@ -1176,7 +1176,7 @@ void EditorFileDialog::_update_favorites() {
|
||||
|
||||
favorite->set_pressed(false);
|
||||
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||
for (int i = 0; i < favorited.size(); i++) {
|
||||
bool cres = favorited[i].begins_with("res://");
|
||||
if (cres != res)
|
||||
@ -1206,7 +1206,7 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) {
|
||||
|
||||
String cd = get_current_dir();
|
||||
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
|
||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < favorited.size(); i++) {
|
||||
@ -1228,7 +1228,7 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) {
|
||||
favorite->set_pressed(true);
|
||||
}
|
||||
|
||||
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
|
||||
EditorSettings::get_singleton()->set_favorites(favorited);
|
||||
|
||||
_update_favorites();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user