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.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index acfdea28e2..1a72b6e1ca 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -34,6 +34,7 @@
#include "core/os/input.h"
#include "core/os/keyboard.h"
#include "editor_node.h"
+#include "editor_scale.h"
#include "filesystem_dock.h"
#include "scene/resources/font.h"
#include "servers/audio_server.h"
@@ -143,8 +144,8 @@ void EditorAudioBus::_notification(int p_what) {
if (activity_found != channel[i].prev_active) {
if (activity_found) {
- channel[i].vu_l->set_over_texture(Ref<Texture>());
- channel[i].vu_r->set_over_texture(Ref<Texture>());
+ channel[i].vu_l->set_over_texture(Ref<Texture2D>());
+ channel[i].vu_r->set_over_texture(Ref<Texture2D>());
} else {
channel[i].vu_l->set_over_texture(disabled_vu);
channel[i].vu_r->set_over_texture(disabled_vu);
@@ -798,8 +799,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
set_v_size_flags(SIZE_EXPAND_FILL);
track_name = memnew(LineEdit);
- track_name->connect("text_entered", this, "_name_changed");
- track_name->connect("focus_exited", this, "_name_focus_exit");
+ track_name->connect_compat("text_entered", this, "_name_changed");
+ track_name->connect_compat("focus_exited", this, "_name_focus_exit");
vb->add_child(track_name);
HBoxContainer *hbc = memnew(HBoxContainer);
@@ -808,19 +809,19 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
solo->set_toggle_mode(true);
solo->set_tooltip(TTR("Solo"));
solo->set_focus_mode(FOCUS_NONE);
- solo->connect("pressed", this, "_solo_toggled");
+ solo->connect_compat("pressed", this, "_solo_toggled");
hbc->add_child(solo);
mute = memnew(ToolButton);
mute->set_toggle_mode(true);
mute->set_tooltip(TTR("Mute"));
mute->set_focus_mode(FOCUS_NONE);
- mute->connect("pressed", this, "_mute_toggled");
+ mute->connect_compat("pressed", this, "_mute_toggled");
hbc->add_child(mute);
bypass = memnew(ToolButton);
bypass->set_toggle_mode(true);
bypass->set_tooltip(TTR("Bypass"));
bypass->set_focus_mode(FOCUS_NONE);
- bypass->connect("pressed", this, "_bypass_toggled");
+ bypass->connect_compat("pressed", this, "_bypass_toggled");
hbc->add_child(bypass);
hbc->add_spacer();
@@ -855,7 +856,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
HBoxContainer *audioprev_hbc = memnew(HBoxContainer);
audioprev_hbc->set_v_size_flags(SIZE_EXPAND_FILL);
audioprev_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
- audioprev_hbc->set_mouse_filter(MOUSE_FILTER_PASS);
audio_value_preview_box->add_child(audioprev_hbc);
audio_value_preview_label = memnew(Label);
@@ -878,9 +878,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
preview_timer->set_one_shot(true);
add_child(preview_timer);
- slider->connect("value_changed", this, "_volume_changed");
- slider->connect("value_changed", this, "_show_value");
- preview_timer->connect("timeout", this, "_hide_value_preview");
+ slider->connect_compat("value_changed", this, "_volume_changed");
+ slider->connect_compat("value_changed", this, "_show_value");
+ preview_timer->connect_compat("timeout", this, "_hide_value_preview");
hb->add_child(slider);
cc = 0;
@@ -918,24 +918,24 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
effects->set_hide_folding(true);
effects->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_child(effects);
- effects->connect("item_edited", this, "_effect_edited");
- effects->connect("cell_selected", this, "_effect_selected");
+ effects->connect_compat("item_edited", this, "_effect_edited");
+ effects->connect_compat("cell_selected", this, "_effect_selected");
effects->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
effects->set_drag_forwarding(this);
- effects->connect("item_rmb_selected", this, "_effect_rmb");
+ effects->connect_compat("item_rmb_selected", this, "_effect_rmb");
effects->set_allow_rmb_select(true);
effects->set_focus_mode(FOCUS_CLICK);
effects->set_allow_reselect(true);
send = memnew(OptionButton);
send->set_clip_text(true);
- send->connect("item_selected", this, "_send_selected");
+ send->connect_compat("item_selected", this, "_send_selected");
vb->add_child(send);
set_focus_mode(FOCUS_CLICK);
effect_options = memnew(PopupMenu);
- effect_options->connect("index_pressed", this, "_effect_add");
+ effect_options->connect_compat("index_pressed", this, "_effect_add");
add_child(effect_options);
List<StringName> effects;
ClassDB::get_inheriters_from_class("AudioEffect", &effects);
@@ -944,7 +944,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
if (!ClassDB::can_instance(E->get()))
continue;
- Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(E->get());
+ Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(E->get());
String name = E->get().operator String().replace("AudioEffect", "");
effect_options->add_item(name);
effect_options->set_item_metadata(effect_options->get_item_count() - 1, E->get());
@@ -956,12 +956,12 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
bus_popup->add_item(TTR("Delete"));
bus_popup->set_item_disabled(1, is_master);
bus_popup->add_item(TTR("Reset Volume"));
- bus_popup->connect("index_pressed", this, "_bus_popup_pressed");
+ bus_popup->connect_compat("index_pressed", this, "_bus_popup_pressed");
delete_effect_popup = memnew(PopupMenu);
delete_effect_popup->add_item(TTR("Delete Effect"));
add_child(delete_effect_popup);
- delete_effect_popup->connect("index_pressed", this, "_delete_effect_pressed");
+ delete_effect_popup->connect_compat("index_pressed", this, "_delete_effect_pressed");
}
void EditorAudioBusDrop::_notification(int p_what) {
@@ -1029,11 +1029,11 @@ void EditorAudioBuses::_update_buses() {
bool is_master = (i == 0);
EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master));
bus_hb->add_child(audio_bus);
- audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
- audio_bus->connect("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED);
- audio_bus->connect("vol_reset_request", this, "_reset_bus_volume", varray(audio_bus), CONNECT_DEFERRED);
- audio_bus->connect("drop_end_request", this, "_request_drop_end");
- audio_bus->connect("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED);
+ audio_bus->connect_compat("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
+ audio_bus->connect_compat("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED);
+ audio_bus->connect_compat("vol_reset_request", this, "_reset_bus_volume", varray(audio_bus), CONNECT_DEFERRED);
+ audio_bus->connect_compat("drop_end_request", this, "_request_drop_end");
+ audio_bus->connect_compat("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED);
}
}
@@ -1187,7 +1187,7 @@ void EditorAudioBuses::_request_drop_end() {
bus_hb->add_child(drop_end);
drop_end->set_custom_minimum_size(Object::cast_to<Control>(bus_hb->get_child(0))->get_size());
- drop_end->connect("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED);
+ drop_end->connect_compat("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED);
}
}
@@ -1248,7 +1248,7 @@ void EditorAudioBuses::_load_default_layout() {
String layout_path = ProjectSettings::get_singleton()->get("audio/default_bus_layout");
- Ref<AudioBusLayout> state = ResourceLoader::load(layout_path);
+ Ref<AudioBusLayout> state = ResourceLoader::load(layout_path, "", true);
if (state.is_null()) {
EditorNode::get_singleton()->show_warning(vformat(TTR("There is no '%s' file."), layout_path));
return;
@@ -1265,7 +1265,7 @@ void EditorAudioBuses::_load_default_layout() {
void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
if (file_dialog->get_mode() == EditorFileDialog::MODE_OPEN_FILE) {
- Ref<AudioBusLayout> state = ResourceLoader::load(p_string);
+ Ref<AudioBusLayout> state = ResourceLoader::load(p_string, "", true);
if (state.is_null()) {
EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout."));
return;
@@ -1289,7 +1289,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
Error err = ResourceSaver::save(p_string, AudioServer::get_singleton()->generate_bus_layout());
if (err != OK) {
- EditorNode::get_singleton()->show_warning("Error saving file: " + p_string);
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_string));
return;
}
@@ -1339,7 +1339,7 @@ EditorAudioBuses::EditorAudioBuses() {
top_hb->add_child(add);
add->set_text(TTR("Add Bus"));
add->set_tooltip(TTR("Add a new Audio Bus to this layout."));
- add->connect("pressed", this, "_add_bus");
+ add->connect_compat("pressed", this, "_add_bus");
VSeparator *separator = memnew(VSeparator);
top_hb->add_child(separator);
@@ -1348,25 +1348,25 @@ EditorAudioBuses::EditorAudioBuses() {
load->set_text(TTR("Load"));
load->set_tooltip(TTR("Load an existing Bus Layout."));
top_hb->add_child(load);
- load->connect("pressed", this, "_load_layout");
+ load->connect_compat("pressed", this, "_load_layout");
save_as = memnew(Button);
save_as->set_text(TTR("Save As"));
save_as->set_tooltip(TTR("Save this Bus Layout to a file."));
top_hb->add_child(save_as);
- save_as->connect("pressed", this, "_save_as_layout");
+ save_as->connect_compat("pressed", this, "_save_as_layout");
_default = memnew(Button);
_default->set_text(TTR("Load Default"));
_default->set_tooltip(TTR("Load the default Bus Layout."));
top_hb->add_child(_default);
- _default->connect("pressed", this, "_load_default_layout");
+ _default->connect_compat("pressed", this, "_load_default_layout");
_new = memnew(Button);
_new->set_text(TTR("Create"));
_new->set_tooltip(TTR("Create a new Bus Layout."));
top_hb->add_child(_new);
- _new->connect("pressed", this, "_new_layout");
+ _new->connect_compat("pressed", this, "_new_layout");
bus_scroll = memnew(ScrollContainer);
bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1381,7 +1381,7 @@ EditorAudioBuses::EditorAudioBuses() {
save_timer->set_wait_time(0.8);
save_timer->set_one_shot(true);
add_child(save_timer);
- save_timer->connect("timeout", this, "_server_save");
+ save_timer->connect_compat("timeout", this, "_server_save");
set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1394,7 +1394,7 @@ EditorAudioBuses::EditorAudioBuses() {
file_dialog->add_filter("*." + E->get() + "; Audio Bus Layout");
}
add_child(file_dialog);
- file_dialog->connect("file_selected", this, "_file_dialog_callback");
+ file_dialog->connect_compat("file_selected", this, "_file_dialog_callback");
set_process(true);
}
@@ -1403,7 +1403,7 @@ void EditorAudioBuses::open_layout(const String &p_path) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
- Ref<AudioBusLayout> state = ResourceLoader::load(p_path);
+ Ref<AudioBusLayout> state = ResourceLoader::load(p_path, "", true);
if (state.is_null()) {
EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout."));
return;