diff options
Diffstat (limited to 'editor/editor_audio_buses.cpp')
-rw-r--r-- | editor/editor_audio_buses.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 993429a5a4..b3eb3e23a9 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -128,7 +128,7 @@ void EditorAudioBus::update_send() { send->clear(); if (get_index() == 0) { send->set_disabled(true); - send->set_text("Speakers"); + send->set_text(TTR("Speakers")); } else { send->set_disabled(false); StringName current_send = AudioServer::get_singleton()->get_bus_send(get_index()); @@ -183,7 +183,7 @@ void EditorAudioBus::update_bus() { add->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM); add->set_editable(0, true); add->set_selectable(0, false); - add->set_text(0, "Add Effect"); + add->set_text(0, TTR("Add Effect")); update_send(); @@ -221,7 +221,7 @@ void EditorAudioBus::_name_changed(const String &p_new_name) { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); StringName current = AudioServer::get_singleton()->get_bus_name(get_index()); - ur->create_action("Rename Audio Bus"); + ur->create_action(TTR("Rename Audio Bus")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", get_index(), attempt); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_name", get_index(), current); @@ -264,7 +264,7 @@ void EditorAudioBus::_solo_toggled() { updating_bus = true; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Toggle Audio Bus Solo"); + ur->create_action(TTR("Toggle Audio Bus Solo")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), solo->is_pressed()); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), AudioServer::get_singleton()->is_bus_solo(get_index())); ur->add_do_method(buses, "_update_bus", get_index()); @@ -278,7 +278,7 @@ void EditorAudioBus::_mute_toggled() { updating_bus = true; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Toggle Audio Bus Mute"); + ur->create_action(TTR("Toggle Audio Bus Mute")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), mute->is_pressed()); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), AudioServer::get_singleton()->is_bus_mute(get_index())); ur->add_do_method(buses, "_update_bus", get_index()); @@ -292,7 +292,7 @@ void EditorAudioBus::_bypass_toggled() { updating_bus = true; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Toggle Audio Bus Bypass Effects"); + ur->create_action(TTR("Toggle Audio Bus Bypass Effects")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), bypass->is_pressed()); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), AudioServer::get_singleton()->is_bus_bypassing_effects(get_index())); ur->add_do_method(buses, "_update_bus", get_index()); @@ -356,7 +356,7 @@ void EditorAudioBus::_effect_edited() { updating_bus = true; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Select Audio Bus Send"); + ur->create_action(TTR("Select Audio Bus Send")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, effect->is_checked(0)); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index)); ur->add_do_method(buses, "_update_bus", get_index()); @@ -376,14 +376,14 @@ void EditorAudioBus::_effect_add(int p_which) { Object *fx = ClassDB::instance(name); ERR_FAIL_COND(!fx); - AudioEffect *afx = fx->cast_to<AudioEffect>(); + AudioEffect *afx = Object::cast_to<AudioEffect>(fx); ERR_FAIL_COND(!afx); Ref<AudioEffect> afxr = Ref<AudioEffect>(afx); afxr->set_name(effect_options->get_item_text(p_which)); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Add Audio Bus Effect"); + ur->create_action(TTR("Add Audio Bus Effect")); ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), afxr, -1); ur->add_undo_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect_count(get_index())); ur->add_do_method(buses, "_update_bus", get_index()); @@ -403,12 +403,13 @@ void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) { if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) { Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); - delete_popup->set_position(get_global_position() + pos); - delete_popup->popup(); + bus_popup->set_position(get_global_position() + pos); + bus_popup->set_item_disabled(1, get_index() == 0); + bus_popup->popup(); } } -void EditorAudioBus::_delete_pressed(int p_option) { +void EditorAudioBus::_bus_popup_pressed(int p_option) { if (p_option == 1) { emit_signal("delete_request"); @@ -526,7 +527,7 @@ void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data, bool enabled = AudioServer::get_singleton()->is_bus_effect_enabled(bus, effect); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Move Bus Effect"); + ur->create_action(TTR("Move Bus Effect")); ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", bus, effect); ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(bus, effect), paste_at); @@ -567,7 +568,7 @@ void EditorAudioBus::_delete_effect_pressed(int p_option) { int index = item->get_metadata(0); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Delete Bus Effect"); + ur->create_action(TTR("Delete Bus Effect")); ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), index); ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(get_index(), index), index); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index)); @@ -604,7 +605,7 @@ void EditorAudioBus::_bind_methods() { ClassDB::bind_method("_effect_selected", &EditorAudioBus::_effect_selected); ClassDB::bind_method("_effect_add", &EditorAudioBus::_effect_add); ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input); - ClassDB::bind_method("_delete_pressed", &EditorAudioBus::_delete_pressed); + ClassDB::bind_method("_bus_popup_pressed", &EditorAudioBus::_bus_popup_pressed); ClassDB::bind_method("get_drag_data_fw", &EditorAudioBus::get_drag_data_fw); ClassDB::bind_method("can_drop_data_fw", &EditorAudioBus::can_drop_data_fw); ClassDB::bind_method("drop_data_fw", &EditorAudioBus::drop_data_fw); @@ -705,8 +706,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { effects->set_drag_forwarding(this); effects->connect("item_rmb_selected", this, "_effect_rmb"); effects->set_allow_rmb_select(true); - effects->set_single_select_cell_editing_only_when_already_selected(true); effects->set_focus_mode(FOCUS_CLICK); + effects->set_allow_reselect(true); send = memnew(OptionButton); send->set_clip_text(true); @@ -735,14 +736,13 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { effect_options->set_item_icon(effect_options->get_item_count() - 1, icon); } - delete_popup = bus_options->get_popup(); - delete_popup->add_item("Duplicate"); - delete_popup->add_item("Delete"); - add_child(delete_popup); - delete_popup->connect("index_pressed", this, "_delete_pressed"); + bus_popup = bus_options->get_popup(); + bus_popup->add_item(TTR("Duplicate")); + bus_popup->add_item(TTR("Delete")); + bus_popup->connect("index_pressed", this, "_bus_popup_pressed"); delete_effect_popup = memnew(PopupMenu); - delete_effect_popup->add_item("Delete Effect"); + delete_effect_popup->add_item(TTR("Delete Effect")); add_child(delete_effect_popup); delete_effect_popup->connect("index_pressed", this, "_delete_effect_pressed"); } @@ -840,7 +840,7 @@ void EditorAudioBuses::_add_bus() { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); //need to simulate new name, so we can undi :( - ur->create_action("Add Audio Bus"); + ur->create_action(TTR("Add Audio Bus")); ur->add_do_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count() + 1); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count()); ur->add_do_method(this, "_update_buses"); @@ -865,16 +865,16 @@ void EditorAudioBuses::_update_sends() { void EditorAudioBuses::_delete_bus(Object *p_which) { - EditorAudioBus *bus = p_which->cast_to<EditorAudioBus>(); + EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which); int index = bus->get_index(); if (index == 0) { - EditorNode::get_singleton()->show_warning("Master bus can't be deleted!"); + EditorNode::get_singleton()->show_warning(TTR("Master bus can't be deleted!")); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Delete Audio Bus"); + ur->create_action(TTR("Delete Audio Bus")); ur->add_do_method(AudioServer::get_singleton(), "remove_bus", index); ur->add_undo_method(AudioServer::get_singleton(), "add_bus", index); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_name", index, AudioServer::get_singleton()->get_bus_name(index)); @@ -897,7 +897,7 @@ void EditorAudioBuses::_duplicate_bus(int p_which) { int add_at_pos = p_which + 1; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Duplicate Audio Bus"); + ur->create_action(TTR("Duplicate Audio Bus")); ur->add_do_method(AudioServer::get_singleton(), "add_bus", add_at_pos); ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", add_at_pos, AudioServer::get_singleton()->get_bus_name(p_which) + " Copy"); ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", add_at_pos, AudioServer::get_singleton()->get_bus_volume_db(p_which)); @@ -922,7 +922,7 @@ void EditorAudioBuses::_request_drop_end() { drop_end = memnew(EditorAudioBusDrop); bus_hb->add_child(drop_end); - drop_end->set_custom_minimum_size(bus_hb->get_child(0)->cast_to<Control>()->get_size()); + 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); } } @@ -932,7 +932,7 @@ void EditorAudioBuses::_drop_at_index(int p_bus, int p_index) { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); //need to simulate new name, so we can undi :( - ur->create_action("Move Audio Bus"); + ur->create_action(TTR("Move Audio Bus")); ur->add_do_method(AudioServer::get_singleton(), "move_bus", p_bus, p_index); int final_pos; if (p_index == p_bus) { @@ -993,7 +993,7 @@ void EditorAudioBuses::_load_default_layout() { Ref<AudioBusLayout> state = ResourceLoader::load("res://default_bus_layout.tres"); if (state.is_null()) { - EditorNode::get_singleton()->show_warning("There is no 'res://default_bus_layout.tres' file."); + EditorNode::get_singleton()->show_warning(TTR("There is no 'res://default_bus_layout.tres' file.")); return; } @@ -1010,7 +1010,7 @@ 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); if (state.is_null()) { - EditorNode::get_singleton()->show_warning("Invalid file, not an audio bus layout."); + EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout.")); return; } @@ -1144,7 +1144,7 @@ void EditorAudioBuses::open_layout(const String &p_path) { Ref<AudioBusLayout> state = ResourceLoader::load(p_path); if (state.is_null()) { - EditorNode::get_singleton()->show_warning("Invalid file, not an audio bus layout."); + EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout.")); return; } @@ -1158,9 +1158,9 @@ void EditorAudioBuses::open_layout(const String &p_path) { void AudioBusesEditorPlugin::edit(Object *p_node) { - if (p_node->cast_to<AudioBusLayout>()) { + if (Object::cast_to<AudioBusLayout>(p_node)) { - String path = p_node->cast_to<AudioBusLayout>()->get_path(); + String path = Object::cast_to<AudioBusLayout>(p_node)->get_path(); if (path.is_resource_file()) { audio_bus_editor->open_layout(path); } @@ -1169,7 +1169,7 @@ void AudioBusesEditorPlugin::edit(Object *p_node) { bool AudioBusesEditorPlugin::handles(Object *p_node) const { - return (p_node->cast_to<AudioBusLayout>() != NULL); + return (Object::cast_to<AudioBusLayout>(p_node) != NULL); } void AudioBusesEditorPlugin::make_visible(bool p_visible) { |