Don't error multiple times when trying to load missing default bus layout

This commit is contained in:
Haoyu Qiu 2024-03-23 21:38:43 +08:00
parent fe01776f05
commit 1ff8e8548b

View file

@ -1226,7 +1226,10 @@ void EditorAudioBuses::_load_layout() {
void EditorAudioBuses::_load_default_layout() {
String layout_path = GLOBAL_GET("audio/buses/default_bus_layout");
Ref<AudioBusLayout> state = ResourceLoader::load(layout_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
Ref<AudioBusLayout> state;
if (ResourceLoader::exists(layout_path)) {
state = ResourceLoader::load(layout_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
}
if (state.is_null()) {
EditorNode::get_singleton()->show_warning(vformat(TTR("There is no '%s' file."), layout_path));
return;