diff options
Diffstat (limited to 'editor/editor_audio_buses.cpp')
-rw-r--r-- | editor/editor_audio_buses.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index d77216697e..7e499facd5 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -30,8 +30,8 @@ #include "editor_audio_buses.h" +#include "core/input/input_filter.h" #include "core/io/resource_saver.h" -#include "core/os/input.h" #include "core/os/keyboard.h" #include "editor_node.h" #include "editor_scale.h" @@ -69,27 +69,27 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_READY: { for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); - channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); + channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); + channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); channel[i].prev_active = true; } - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons"); Color solo_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.0, 0.92, 0.44); Color mute_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(1.0, 0.44, 0.44); Color bypass_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0); - solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); - solo->add_color_override("icon_color_pressed", solo_color); - mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); - mute->add_color_override("icon_color_pressed", mute_color); - bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); - bypass->add_color_override("icon_color_pressed", bypass_color); + solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons")); + solo->add_theme_color_override("icon_color_pressed", solo_color); + mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons")); + mute->add_theme_color_override("icon_color_pressed", mute_color); + bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); + bypass->add_theme_color_override("icon_color_pressed", bypass_color); - bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); update_bus(); set_process(true); @@ -97,15 +97,15 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_DRAW: { if (is_master) { - draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); } else if (has_focus()) { - draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); } else { - draw_style_box(get_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size())); } if (get_index() != 0 && hovering_drop) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } @@ -168,20 +168,20 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); - channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); + channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); + channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); channel[i].prev_active = true; } - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons"); - solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); - mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); - bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons")); + mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons")); + bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); - bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); } break; case NOTIFICATION_MOUSE_EXIT: case NOTIFICATION_DRAG_END: { @@ -325,7 +325,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) { const float p_db = this->_normalized_volume_to_scaled_db(p_normalized); - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL)) { // Snap the value when holding Ctrl for easier editing. // To do so, it needs to be converted back to normalized volume (as the slider uses that unit). slider->set_value(_scaled_db_to_normalized_volume(Math::round(p_db))); @@ -386,7 +386,7 @@ float EditorAudioBus::_scaled_db_to_normalized_volume(float db) { void EditorAudioBus::_show_value(float slider_value) { float db; - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL)) { // Display the correct (snapped) value when holding Ctrl db = Math::round(_normalized_volume_to_scaled_db(slider_value)); } else { @@ -586,7 +586,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { Panel *p = memnew(Panel); c->add_child(p); p->set_modulate(Color(1, 1, 1, 0.7)); - p->add_style_override("panel", get_stylebox("focus", "Button")); + p->add_theme_style_override("panel", get_theme_stylebox("focus", "Button")); p->set_size(get_size()); p->set_position(-p_point); set_drag_preview(c); @@ -819,10 +819,10 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { Ref<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty); for (int i = 0; i < hbc->get_child_count(); i++) { Control *child = Object::cast_to<Control>(hbc->get_child(i)); - child->add_style_override("normal", sbempty); - child->add_style_override("hover", sbempty); - child->add_style_override("focus", sbempty); - child->add_style_override("pressed", sbempty); + child->add_theme_style_override("normal", sbempty); + child->add_theme_style_override("hover", sbempty); + child->add_theme_style_override("focus", sbempty); + child->add_theme_style_override("pressed", sbempty); } HSeparator *separator = memnew(HSeparator); @@ -854,7 +854,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { audio_value_preview_box->set_as_toplevel(true); Ref<StyleBoxFlat> panel_style = memnew(StyleBoxFlat); panel_style->set_bg_color(Color(0.0f, 0.0f, 0.0f, 0.8f)); - audio_value_preview_box->add_style_override("panel", panel_style); + audio_value_preview_box->add_theme_style_override("panel", panel_style); audio_value_preview_box->set_mouse_filter(MOUSE_FILTER_PASS); audio_value_preview_box->hide(); @@ -953,10 +953,10 @@ void EditorAudioBusDrop::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: { - draw_style_box(get_stylebox("normal", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("normal", "Button"), Rect2(Vector2(), get_size())); if (hovering_drop) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } @@ -1007,7 +1007,7 @@ void EditorAudioBuses::_update_buses() { memdelete(bus_hb->get_child(0)); } - drop_end = NULL; + drop_end = nullptr; for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { @@ -1035,7 +1035,7 @@ void EditorAudioBuses::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - bus_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + bus_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } break; case NOTIFICATION_READY: { @@ -1045,7 +1045,7 @@ void EditorAudioBuses::_notification(int p_what) { if (drop_end) { drop_end->queue_delete(); - drop_end = NULL; + drop_end = nullptr; } } break; case NOTIFICATION_PROCESS: { @@ -1204,7 +1204,7 @@ void EditorAudioBuses::_select_layout() { void EditorAudioBuses::_save_as_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Save Audio Bus Layout As...")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1213,7 +1213,7 @@ void EditorAudioBuses::_save_as_layout() { void EditorAudioBuses::_new_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Location for New Layout...")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1222,7 +1222,7 @@ void EditorAudioBuses::_new_layout() { void EditorAudioBuses::_load_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_dialog->set_title(TTR("Open Audio Bus Layout")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1249,7 +1249,7 @@ void EditorAudioBuses::_load_default_layout() { void EditorAudioBuses::_file_dialog_callback(const String &p_string) { - if (file_dialog->get_mode() == EditorFileDialog::MODE_OPEN_FILE) { + if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_OPEN_FILE) { 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.")); @@ -1263,7 +1263,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { EditorNode::get_singleton()->get_undo_redo()->clear_history(); call_deferred("_select_layout"); - } else if (file_dialog->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { + } else if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { if (new_layout) { Ref<AudioBusLayout> empty_state; @@ -1296,7 +1296,7 @@ void EditorAudioBuses::_bind_methods() { EditorAudioBuses::EditorAudioBuses() { - drop_end = NULL; + drop_end = nullptr; top_hb = memnew(HBoxContainer); add_child(top_hb); @@ -1402,7 +1402,7 @@ void AudioBusesEditorPlugin::edit(Object *p_node) { bool AudioBusesEditorPlugin::handles(Object *p_node) const { - return (Object::cast_to<AudioBusLayout>(p_node) != NULL); + return (Object::cast_to<AudioBusLayout>(p_node) != nullptr); } void AudioBusesEditorPlugin::make_visible(bool p_visible) { @@ -1423,7 +1423,7 @@ void EditorAudioMeterNotches::add_notch(float p_normalized_offset, float p_db_va Size2 EditorAudioMeterNotches::get_minimum_size() const { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); float font_height = font->get_height(); float width = 0; @@ -1460,7 +1460,7 @@ void EditorAudioMeterNotches::_notification(int p_what) { void EditorAudioMeterNotches::_draw_audio_notches() { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); float font_height = font->get_height(); for (int i = 0; i < notches.size(); i++) { |