Repository: godotengine/godot
File: editor/audio/editor_audio_buses.cpp (C++)

Code before:
	bus_scroll->add_child(bus_hb);

	save_timer = memnew(Timer);
	save_timer->set_wait_time(0.8);
	save_timer->set_one_shot(true);
	main_vb->add_child(save_timer);
	save_timer->connect("timeout", callable_mp(this, &EditorAudioBuses::_server_save));

	set_v_size_flags(SIZE_EXPAND_FILL);

	file_dialog = memnew(EditorFileDialog);
	List<String> ext;
	ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
	for (const String &E : ext) {
		file_dialog->add_filter("*." + E, TTR("Audio Bus Layout"));
	}
	add_child(file_dialog);
	file_dialog->connect("file_selected", callable_mp(this, &EditorAudioBuses::_file_dialog_callback));

	AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &EditorAudioBuses::_rebuild_buses));

	set_process(true);
}

void EditorAudioBuses::open_layout(const String &p_path) {
	open();

	const String path = ResourceUID::ensure_path(p_path);

	if (!ResourceLoader::exists(path)) {
		EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" doesn't exist.)"), path));
		return;
	}

	Ref<AudioBusLayout> state = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (state.is_null()) {
		EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" is not a valid audio bus layout.)"), path));
		return;
	}

	edited_path = path;
	const String _file_name = edited_path.get_file();
	file->set_text(_file_name);
	file->set_tooltip_text(_file_name);
	_update_file_label_size();

	AudioServer::get_singleton()->set_bus_layout(state);
	_rebuild_buses();
	EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY);
	callable_mp(this, &EditorAudioBuses::_select_layout).call_deferred();
}

Review comment (suggestion):
```suggestion
	make_visible();
```
Should be `make_visible()` to keep the same behavior of actually showing the dock (`open` early returns if the dock is already open), this should preferred for global docks but non-global docks can do `open()`

Code after:
	bus_scroll->add_child(bus_hb);

	save_timer = memnew(Timer);
	save_timer->set_wait_time(0.8);
	save_timer->set_one_shot(true);
	main_vb->add_child(save_timer);
	save_timer->connect("timeout", callable_mp(this, &EditorAudioBuses::_server_save));

	set_v_size_flags(SIZE_EXPAND_FILL);

	file_dialog = memnew(EditorFileDialog);
	List<String> ext;
	ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
	for (const String &E : ext) {
		file_dialog->add_filter("*." + E, TTR("Audio Bus Layout"));
	}
	add_child(file_dialog);
	file_dialog->connect("file_selected", callable_mp(this, &EditorAudioBuses::_file_dialog_callback));

	AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &EditorAudioBuses::_rebuild_buses));

	set_process(true);
}

void EditorAudioBuses::open_layout(const String &p_path) {
	make_visible();

	const String path = ResourceUID::ensure_path(p_path);

	if (!ResourceLoader::exists(path)) {
		EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" doesn't exist.)"), path));
		return;
	}

	Ref<AudioBusLayout> state = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (state.is_null()) {
		EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" is not a valid audio bus layout.)"), path));
		return;
	}

	edited_path = path;
	const String _file_name = edited_path.get_file();
	file->set_text(_file_name);
	file->set_tooltip_text(_file_name);
	_update_file_label_size();

	AudioServer::get_singleton()->set_bus_layout(state);
	_rebuild_buses();
	EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY);
	callable_mp(this, &EditorAudioBuses::_select_layout).call_deferred();
}