summaryrefslogtreecommitdiff
path: root/editor/editor_audio_buses.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_audio_buses.cpp')
-rw-r--r--editor/editor_audio_buses.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 9685ff4b70..89dc106717 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -92,6 +92,12 @@ void EditorAudioBus::_notification(int p_what) {
audio_value_preview_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel")));
audio_value_preview_label->add_theme_color_override("font_shadow_color", get_theme_color(SNAME("font_shadow_color"), SNAME("TooltipLabel")));
audio_value_preview_box->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel")));
+
+ for (int i = 0; i < effect_options->get_item_count(); i++) {
+ String class_name = effect_options->get_item_metadata(i);
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(class_name);
+ effect_options->set_item_icon(i, icon);
+ }
} break;
case NOTIFICATION_READY: {
@@ -733,7 +739,11 @@ void EditorAudioBus::_delete_effect_pressed(int p_option) {
ur->commit_action();
}
-void EditorAudioBus::_effect_rmb(const Vector2 &p_pos) {
+void EditorAudioBus::_effect_rmb(const Vector2 &p_pos, MouseButton p_button) {
+ if (p_button != MouseButton::RIGHT) {
+ return;
+ }
+
TreeItem *item = effects->get_selected();
if (!item) {
return;
@@ -765,9 +775,7 @@ void EditorAudioBus::_bind_methods() {
EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
buses = p_buses;
- updating_bus = false;
is_master = p_is_master;
- hovering_drop = false;
set_tooltip(TTR("Drag & drop to rearrange."));
@@ -893,7 +901,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
effects->connect("cell_selected", callable_mp(this, &EditorAudioBus::_effect_selected));
effects->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
effects->set_drag_forwarding(this);
- effects->connect("item_rmb_selected", callable_mp(this, &EditorAudioBus::_effect_rmb));
+ effects->connect("item_mouse_selected", callable_mp(this, &EditorAudioBus::_effect_rmb));
effects->set_allow_rmb_select(true);
effects->set_focus_mode(FOCUS_CLICK);
effects->set_allow_reselect(true);
@@ -913,15 +921,13 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
ClassDB::get_inheriters_from_class("AudioEffect", &effects);
effects.sort_custom<StringName::AlphCompare>();
for (const StringName &E : effects) {
- if (!ClassDB::can_instantiate(E)) {
+ if (!ClassDB::can_instantiate(E) || ClassDB::is_virtual(E)) {
continue;
}
- Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(E);
String name = E.operator String().replace("AudioEffect", "");
effect_options->add_item(name);
- effect_options->set_item_metadata(effect_options->get_item_count() - 1, E);
- effect_options->set_item_icon(effect_options->get_item_count() - 1, icon);
+ effect_options->set_item_metadata(-1, E);
}
bus_options = memnew(MenuButton);
@@ -988,7 +994,6 @@ void EditorAudioBusDrop::_bind_methods() {
}
EditorAudioBusDrop::EditorAudioBusDrop() {
- hovering_drop = false;
}
void EditorAudioBuses::_update_buses() {
@@ -1210,7 +1215,7 @@ void EditorAudioBuses::_load_default_layout() {
}
edited_path = layout_path;
- file->set_text(String(TTR("Layout")) + ": " + layout_path.get_file());
+ file->set_text(String(TTR("Layout:")) + " " + layout_path.get_file());
AudioServer::get_singleton()->set_bus_layout(state);
_update_buses();
EditorNode::get_singleton()->get_undo_redo()->clear_history();
@@ -1226,7 +1231,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
}
edited_path = p_string;
- file->set_text(String(TTR("Layout")) + ": " + p_string.get_file());
+ file->set_text(String(TTR("Layout:")) + " " + p_string.get_file());
AudioServer::get_singleton()->set_bus_layout(state);
_update_buses();
EditorNode::get_singleton()->get_undo_redo()->clear_history();
@@ -1247,7 +1252,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
}
edited_path = p_string;
- file->set_text(String(TTR("Layout")) + ": " + p_string.get_file());
+ file->set_text(String(TTR("Layout:")) + " " + p_string.get_file());
_update_buses();
EditorNode::get_singleton()->get_undo_redo()->clear_history();
call_deferred(SNAME("_select_layout"));
@@ -1262,13 +1267,12 @@ void EditorAudioBuses::_bind_methods() {
}
EditorAudioBuses::EditorAudioBuses() {
- drop_end = nullptr;
top_hb = memnew(HBoxContainer);
add_child(top_hb);
file = memnew(Label);
String layout_path = ProjectSettings::get_singleton()->get("audio/buses/default_bus_layout");
- file->set_text(String(TTR("Layout")) + ": " + layout_path.get_file());
+ file->set_text(String(TTR("Layout:")) + " " + layout_path.get_file());
file->set_clip_text(true);
file->set_h_size_flags(SIZE_EXPAND_FILL);
top_hb->add_child(file);
@@ -1328,7 +1332,7 @@ EditorAudioBuses::EditorAudioBuses() {
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
for (const String &E : ext) {
- file_dialog->add_filter("*." + E + "; Audio Bus Layout");
+ file_dialog->add_filter(vformat("*.%s; %s", E, TTR("Audio Bus Layout")));
}
add_child(file_dialog);
file_dialog->connect("file_selected", callable_mp(this, &EditorAudioBuses::_file_dialog_callback));