Skip to content

Commit db90dd1

Browse files
committed
Merge pull request #103393 from KoBeWi/independency_editor
Don't hard-code setting list in DependencyEditor
2 parents 56a7109 + 1454f49 commit db90dd1

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

editor/dependency_editor.cpp

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -589,34 +589,19 @@ void DependencyRemoveDialog::ok_pressed() {
589589
}
590590
}
591591

592+
HashMap<String, StringName> setting_path_map;
593+
for (const StringName &setting : path_project_settings) {
594+
const String path = ResourceUID::ensure_path(GLOBAL_GET(setting));
595+
setting_path_map[path] = setting;
596+
}
597+
592598
bool project_settings_modified = false;
593599
for (const String &file : files_to_delete) {
594600
// If the file we are deleting for e.g. the main scene, default environment,
595601
// or audio bus layout, we must clear its definition in Project Settings.
596-
if (file == ResourceUID::ensure_path(GLOBAL_GET("application/config/icon"))) {
597-
ProjectSettings::get_singleton()->set("application/config/icon", "");
598-
project_settings_modified = true;
599-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene"))) {
600-
ProjectSettings::get_singleton()->set("application/run/main_scene", "");
601-
project_settings_modified = true;
602-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("application/boot_splash/image"))) {
603-
ProjectSettings::get_singleton()->set("application/boot_splash/image", "");
604-
project_settings_modified = true;
605-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("rendering/environment/defaults/default_environment"))) {
606-
ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", "");
607-
project_settings_modified = true;
608-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("display/mouse_cursor/custom_image"))) {
609-
ProjectSettings::get_singleton()->set("display/mouse_cursor/custom_image", "");
610-
project_settings_modified = true;
611-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("gui/theme/custom"))) {
612-
ProjectSettings::get_singleton()->set("gui/theme/custom", "");
613-
project_settings_modified = true;
614-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("gui/theme/custom_font"))) {
615-
ProjectSettings::get_singleton()->set("gui/theme/custom_font", "");
616-
project_settings_modified = true;
617-
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("audio/buses/default_bus_layout"))) {
618-
ProjectSettings::get_singleton()->set("audio/buses/default_bus_layout", "");
619-
project_settings_modified = true;
602+
const StringName *setting_name = setting_path_map.getptr(file);
603+
if (setting_name) {
604+
ProjectSettings::get_singleton()->set(*setting_name, "");
620605
}
621606

622607
const String path = OS::get_singleton()->get_resource_dir() + file.replace_first("res://", "/");
@@ -716,6 +701,14 @@ DependencyRemoveDialog::DependencyRemoveDialog() {
716701
owners->set_custom_minimum_size(Size2(0, 94) * EDSCALE);
717702
vb_owners->add_child(owners);
718703
owners->set_v_size_flags(Control::SIZE_EXPAND_FILL);
704+
705+
List<PropertyInfo> property_list;
706+
ProjectSettings::get_singleton()->get_property_list(&property_list);
707+
for (const PropertyInfo &pi : property_list) {
708+
if (pi.type == Variant::STRING && pi.hint == PROPERTY_HINT_FILE) {
709+
path_project_settings.push_back(pi.name);
710+
}
711+
}
719712
}
720713

721714
//////////////

editor/dependency_editor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ class DependencyRemoveDialog : public ConfirmationDialog {
119119
}
120120
};
121121

122+
LocalVector<StringName> path_project_settings;
123+
122124
void _find_files_in_removed_folder(EditorFileSystemDirectory *efsd, const String &p_folder);
123125
void _find_all_removed_dependencies(EditorFileSystemDirectory *efsd, Vector<RemovedDependency> &p_removed);
124126
void _find_localization_remaps_of_removed_files(Vector<RemovedDependency> &p_removed);

0 commit comments

Comments
 (0)