diff options
Diffstat (limited to 'editor')
51 files changed, 811 insertions, 433 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 7dadbf88fb..0385220baa 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1214,7 +1214,7 @@ void AnimationTrackEdit::_notification(int p_what) { Color accent = get_color("accent_color", "Editor"); accent.a *= 0.7; // Offside so the horizontal sides aren't cutoff. - draw_rect(Rect2(Point2(1, 0), get_size() - Size2(1, 0)), accent, false); + draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), accent, false); } Ref<Font> font = get_font("font", "Label"); diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp index 85db8b77f9..b30b94ab26 100644 --- a/editor/audio_stream_preview.cpp +++ b/editor/audio_stream_preview.cpp @@ -129,7 +129,7 @@ void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) { float max = -1000; float min = 1000; int from = uint64_t(i) * to_read / to_write; - int to = uint64_t(i + 1) * to_read / to_write; + int to = (uint64_t(i) + 1) * to_read / to_write; to = MIN(to, to_read); from = MIN(from, to_read - 1); if (to == from) { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 33adb33c8c..01773a0bcd 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -804,6 +804,24 @@ void CodeTextEditor::trim_trailing_whitespace() { } } +void CodeTextEditor::insert_final_newline() { + int final_line = text_editor->get_line_count() - 1; + + String line = text_editor->get_line(final_line); + + //length 0 means it's already an empty line, + //no need to add a newline + if (line.length() > 0 && !line.ends_with("\n")) { + text_editor->begin_complex_operation(); + + line += "\n"; + text_editor->set_line(final_line, line); + + text_editor->end_complex_operation(); + text_editor->update(); + } +} + void CodeTextEditor::convert_indent_to_spaces() { int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); String indent = ""; @@ -912,7 +930,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) { for (int i = begin; i <= end; i++) { int len = text_editor->get_line(i).length(); if (i == end) - len -= len - end_col; + len = end_col; if (i == begin) len -= begin_col; String new_line = text_editor->get_line(i).substr(i == begin ? begin_col : 0, len); diff --git a/editor/code_editor.h b/editor/code_editor.h index 5c6b54ae44..cf97f30b72 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -195,6 +195,7 @@ protected: public: void trim_trailing_whitespace(); + void insert_final_newline(); void convert_indent_to_spaces(); void convert_indent_to_tabs(); diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index e9040b9d3e..a0d319c81b 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -651,7 +651,7 @@ void Collada::_parse_effect_material(XMLParser &parser, Effect &effect, String & effect.emission.texture = uri; } else if (what == "bump") { if (parser.has_attribute("bumptype") && parser.get_attribute_value("bumptype") != "NORMALMAP") { - WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported.") + WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported."); } effect.bump.texture = uri; @@ -707,7 +707,7 @@ void Collada::_parse_effect_material(XMLParser &parser, Effect &effect, String & String uri = effect.params[surface]; if (parser.has_attribute("bumptype") && parser.get_attribute_value("bumptype") != "NORMALMAP") { - WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported.") + WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported."); } effect.bump.texture = uri; diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index a9a96da7b1..82fc8e5cfa 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -307,39 +307,42 @@ void ConnectDialog::init(Connection c, bool bEdit) { bEditMode = bEdit; } -void ConnectDialog::popup_dialog(const String &p_for_signal, bool p_advanced) { +void ConnectDialog::popup_dialog(const String &p_for_signal) { - advanced->set_pressed(p_advanced); from_signal->set_text(p_for_signal); error_label->add_color_override("font_color", get_color("error_color", "Editor")); - vbc_right->set_visible(p_advanced); + if (!advanced->is_pressed()) + error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); - if (p_advanced) { + popup_centered(); +} + +void ConnectDialog::_advanced_pressed() { - popup_centered(Size2(900, 500) * EDSCALE); - connect_to_label->set_text("Connect to Node:"); + if (advanced->is_pressed()) { + set_custom_minimum_size(Size2(900, 500) * EDSCALE); + connect_to_label->set_text(TTR("Connect to Node:")); tree->set_connect_to_script_mode(false); + + vbc_right->show(); error_label->hide(); } else { - popup_centered(Size2(700, 500) * EDSCALE); - connect_to_label->set_text("Connect to Script:"); + set_custom_minimum_size(Size2(600, 500) * EDSCALE); + set_size(Size2()); + connect_to_label->set_text(TTR("Connect to Script:")); tree->set_connect_to_script_mode(true); - if (!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())) { - error_label->show(); - } else { - error_label->hide(); - } + vbc_right->hide(); + error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); } -} -void ConnectDialog::_advanced_pressed() { - - popup_dialog(from_signal->get_text(), advanced->is_pressed()); + set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2); } ConnectDialog::ConnectDialog() { + set_custom_minimum_size(Size2(600, 500) * EDSCALE); + VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -356,6 +359,7 @@ ConnectDialog::ConnectDialog() { vbc_left->add_margin_child(TTR("From Signal:"), from_signal); tree = memnew(SceneTreeEditor(false)); + tree->set_connecting_signal(true); tree->get_scene_tree()->connect("item_activated", this, "_ok"); tree->connect("node_selected", this, "_tree_node_selected"); tree->set_connect_to_script_mode(true); @@ -381,7 +385,7 @@ ConnectDialog::ConnectDialog() { type_list->add_item("bool", Variant::BOOL); type_list->add_item("int", Variant::INT); type_list->add_item("real", Variant::REAL); - type_list->add_item("string", Variant::STRING); + type_list->add_item("String", Variant::STRING); type_list->add_item("Vector2", Variant::VECTOR2); type_list->add_item("Rect2", Variant::RECT2); type_list->add_item("Vector3", Variant::VECTOR3); @@ -416,28 +420,26 @@ ConnectDialog::ConnectDialog() { dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); - advanced = memnew(CheckBox); + advanced = memnew(CheckButton); dstm_hb->add_child(advanced); - advanced->set_text(TTR("Advanced...")); + advanced->set_text(TTR("Advanced")); advanced->connect("pressed", this, "_advanced_pressed"); - /* - dst_method_list = memnew( MenuButton ); - dst_method_list->set_text("List..."); - dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_LEFT, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_TOP, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - dst_method_list->set_begin( Point2( 70,59) ); - dst_method_list->set_end( Point2( 15,39 ) ); - */ + // Add spacing so the tree and inspector are the same size. + Control *spacing = memnew(Control); + spacing->set_custom_minimum_size(Size2(0, 4) * EDSCALE); + vbc_right->add_child(spacing); - deferred = memnew(CheckButton); + deferred = memnew(CheckBox); + deferred->set_h_size_flags(0); deferred->set_text(TTR("Deferred")); + deferred->set_tooltip(TTR("Defers the signal, storing it in a queue and only firing it at idle time.")); vbc_right->add_child(deferred); - oneshot = memnew(CheckButton); + oneshot = memnew(CheckBox); + oneshot->set_h_size_flags(0); oneshot->set_text(TTR("Oneshot")); + oneshot->set_tooltip(TTR("Disconnects the signal after its first emission.")); vbc_right->add_child(oneshot); set_as_toplevel(true); @@ -662,9 +664,7 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &item) { c.signal = StringName(signalname); c.target = dst_node; c.method = dst_method; - - //connect_dialog->set_title(TTR("Connect Signal: ") + signalname); - connect_dialog->popup_dialog(signalname, false); + connect_dialog->popup_dialog(signalname); connect_dialog->init(c); connect_dialog->set_title(TTR("Connect a Signal to a Method")); } diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 9b35d84426..94f1510810 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -67,9 +67,9 @@ class ConnectDialog : public ConfirmationDialog { AcceptDialog *error; EditorInspector *bind_editor; OptionButton *type_list; - CheckButton *deferred; - CheckButton *oneshot; - CheckBox *advanced; + CheckBox *deferred; + CheckBox *oneshot; + CheckButton *advanced; Label *error_label; @@ -99,7 +99,7 @@ public: void init(Connection c, bool bEdit = false); - void popup_dialog(const String &p_for_signal, bool p_advanced); + void popup_dialog(const String &p_for_signal); ConnectDialog(); ~ConnectDialog(); }; diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index bde73e9268..cc9e2c12e8 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -725,7 +725,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa int ds = efsd->get_file_deps(i).size(); ti->set_text(1, itos(ds)); if (ds) { - ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons")); + ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); } ti->set_metadata(0, path); has_children = true; diff --git a/editor/editor_atlas_packer.cpp b/editor/editor_atlas_packer.cpp index 4e1d98399a..96ddc607df 100644 --- a/editor/editor_atlas_packer.cpp +++ b/editor/editor_atlas_packer.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* editor_atlas_packer.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "editor_atlas_packer.h" void EditorAtlasPacker::_plot_triangle(Ref<BitMap> p_bitmap, Vector2i *vertices) { diff --git a/editor/editor_atlas_packer.h b/editor/editor_atlas_packer.h index dd9caa340e..1627f74a28 100644 --- a/editor/editor_atlas_packer.h +++ b/editor/editor_atlas_packer.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* editor_atlas_packer.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef EDITOR_ATLAS_PACKER_H #define EDITOR_ATLAS_PACKER_H diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 9cd7d781a4..57fac241b0 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -63,118 +63,132 @@ void EditorAudioBus::_update_visible_channels() { void EditorAudioBus::_notification(int p_what) { - if (p_what == 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].prev_active = true; - } - - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); - - Color solo_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ffe337" : "#ffeb70"); - Color mute_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ff2929" : "#ff7070"); - Color bypass_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#22ccff" : "#70deff"); - - 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); - - bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); - - update_bus(); - set_process(true); - } + switch (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].prev_active = true; + } - if (p_what == NOTIFICATION_DRAW) { + disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); - if (has_focus()) { - draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); - } else if (is_master) { - draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); - } - } + Color solo_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ffe337" : "#ffeb70"); + Color mute_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ff2929" : "#ff7070"); + Color bypass_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#22ccff" : "#70deff"); - if (p_what == NOTIFICATION_PROCESS) { + 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); - if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) { - cc = AudioServer::get_singleton()->get_bus_channels(get_index()); - _update_visible_channels(); - } + bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); - for (int i = 0; i < cc; i++) { - float real_peak[2] = { -100, -100 }; - bool activity_found = false; + update_bus(); + set_process(true); + } break; + case NOTIFICATION_DRAW: { - if (AudioServer::get_singleton()->is_bus_channel_active(get_index(), i)) { - activity_found = true; - real_peak[0] = MAX(real_peak[0], AudioServer::get_singleton()->get_bus_peak_volume_left_db(get_index(), i)); - real_peak[1] = MAX(real_peak[1], AudioServer::get_singleton()->get_bus_peak_volume_right_db(get_index(), i)); + if (is_master) { + draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); + } else if (has_focus()) { + draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); + } else { + draw_style_box(get_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size())); } - if (real_peak[0] > channel[i].peak_l) { - channel[i].peak_l = real_peak[0]; - } else { - channel[i].peak_l -= get_process_delta_time() * 60.0; + if (get_index() != 0 && hovering_drop) { + Color accent = get_color("accent_color", "Editor"); + accent.a *= 0.7; + draw_rect(Rect2(Point2(), get_size()), accent, false); } + } break; + case NOTIFICATION_PROCESS: { - if (real_peak[1] > channel[i].peak_r) { - channel[i].peak_r = real_peak[1]; - } else { - channel[i].peak_r -= get_process_delta_time() * 60.0; + if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) { + cc = AudioServer::get_singleton()->get_bus_channels(get_index()); + _update_visible_channels(); } - channel[i].vu_l->set_value(channel[i].peak_l); - channel[i].vu_r->set_value(channel[i].peak_r); + for (int i = 0; i < cc; i++) { + float real_peak[2] = { -100, -100 }; + bool activity_found = false; - 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>()); + if (AudioServer::get_singleton()->is_bus_channel_active(get_index(), i)) { + activity_found = true; + real_peak[0] = MAX(real_peak[0], AudioServer::get_singleton()->get_bus_peak_volume_left_db(get_index(), i)); + real_peak[1] = MAX(real_peak[1], AudioServer::get_singleton()->get_bus_peak_volume_right_db(get_index(), i)); + } + + if (real_peak[0] > channel[i].peak_l) { + channel[i].peak_l = real_peak[0]; } else { - channel[i].vu_l->set_over_texture(disabled_vu); - channel[i].vu_r->set_over_texture(disabled_vu); + channel[i].peak_l -= get_process_delta_time() * 60.0; } - channel[i].prev_active = activity_found; - } - } - } + if (real_peak[1] > channel[i].peak_r) { + channel[i].peak_r = real_peak[1]; + } else { + channel[i].peak_r -= get_process_delta_time() * 60.0; + } - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + channel[i].vu_l->set_value(channel[i].peak_l); + channel[i].vu_r->set_value(channel[i].peak_r); - for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].peak_l = -100; - channel[i].peak_r = -100; - channel[i].prev_active = true; - } + 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>()); + } else { + channel[i].vu_l->set_over_texture(disabled_vu); + channel[i].vu_r->set_over_texture(disabled_vu); + } - set_process(is_visible_in_tree()); - } + channel[i].prev_active = activity_found; + } + } + } break; + case NOTIFICATION_VISIBILITY_CHANGED: { - if (p_what == NOTIFICATION_THEME_CHANGED) { + for (int i = 0; i < CHANNELS_MAX; i++) { + channel[i].peak_l = -100; + channel[i].peak_r = -100; + channel[i].prev_active = true; + } - 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].prev_active = true; - } + set_process(is_visible_in_tree()); + } break; + case NOTIFICATION_THEME_CHANGED: { - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + 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].prev_active = true; + } - solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); - mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); - bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); - bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); + solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); + mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); + bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + + bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); + } break; + case NOTIFICATION_MOUSE_EXIT: + case NOTIFICATION_DRAG_END: { + + if (hovering_drop) { + hovering_drop = false; + update(); + } + } break; } } @@ -553,6 +567,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { Control *c = memnew(Control); 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->set_size(get_size()); p->set_position(-p_point); @@ -560,21 +575,29 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { Dictionary d; d["type"] = "move_audio_bus"; d["index"] = get_index(); - emit_signal("drop_end_request"); + + if (get_index() < AudioServer::get_singleton()->get_bus_count() - 1) { + emit_signal("drop_end_request"); + } + return d; } bool EditorAudioBus::can_drop_data(const Point2 &p_point, const Variant &p_data) const { - if (get_index() == 0) + if (get_index() == 0) { return false; + } + Dictionary d = p_data; - if (d.has("type") && String(d["type"]) == "move_audio_bus") { + if (d.has("type") && String(d["type"]) == "move_audio_bus" && (int)d["index"] != get_index()) { + hovering_drop = true; return true; } return false; } + void EditorAudioBus::drop_data(const Point2 &p_point, const Variant &p_data) { Dictionary d = p_data; @@ -589,7 +612,6 @@ Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from) } Variant md = item->get_metadata(0); - if (md.get_type() == Variant::INT) { Dictionary fxd; fxd["type"] = "audio_bus_effect"; @@ -749,6 +771,7 @@ 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("Audio Bus, Drag and Drop to rearrange.")); @@ -756,7 +779,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { add_child(vb); set_v_size_flags(SIZE_EXPAND_FILL); - set_custom_minimum_size(Size2(110, 0) * EDSCALE); track_name = memnew(LineEdit); track_name->connect("text_entered", this, "_name_changed"); @@ -800,7 +822,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { child->add_style_override("pressed", sbempty); } - vb->add_child(memnew(HSeparator)); + HSeparator *separator = memnew(HSeparator); + separator->set_mouse_filter(MOUSE_FILTER_PASS); + vb->add_child(separator); HBoxContainer *hb = memnew(HBoxContainer); vb->add_child(hb); @@ -811,20 +835,19 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { slider->set_clip_contents(false); audio_value_preview_box = memnew(Panel); - { - 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); - audio_value_preview_label->set_v_size_flags(SIZE_EXPAND_FILL); - audio_value_preview_label->set_h_size_flags(SIZE_EXPAND_FILL); - audio_value_preview_label->set_mouse_filter(MOUSE_FILTER_PASS); - - audioprev_hbc->add_child(audio_value_preview_label); - } + 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); + audio_value_preview_label->set_v_size_flags(SIZE_EXPAND_FILL); + audio_value_preview_label->set_h_size_flags(SIZE_EXPAND_FILL); + audio_value_preview_label->set_mouse_filter(MOUSE_FILTER_PASS); + + audioprev_hbc->add_child(audio_value_preview_label); + slider->add_child(audio_value_preview_box); audio_value_preview_box->set_as_toplevel(true); Ref<StyleBoxFlat> panel_style = memnew(StyleBoxFlat); @@ -863,17 +886,18 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { channel[i].peak_r = 0.0f; } - scale = memnew(EditorAudioMeterNotches); + EditorAudioMeterNotches *scale = memnew(EditorAudioMeterNotches); for (float db = 6.0f; db >= -80.0f; db -= 6.0f) { bool renderNotch = (db >= -6.0f || db == -24.0f || db == -72.0f); scale->add_notch(_scaled_db_to_normalized_volume(db), db, renderNotch); } + scale->set_mouse_filter(MOUSE_FILTER_PASS); hb->add_child(scale); effects = memnew(Tree); effects->set_hide_root(true); - effects->set_custom_minimum_size(Size2(0, 100) * EDSCALE); + effects->set_custom_minimum_size(Size2(0, 80) * EDSCALE); effects->set_hide_folding(true); effects->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_child(effects); @@ -923,6 +947,36 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { delete_effect_popup->connect("index_pressed", this, "_delete_effect_pressed"); } +void EditorAudioBusDrop::_notification(int p_what) { + + switch (p_what) { + case NOTIFICATION_DRAW: { + draw_style_box(get_stylebox("normal", "Button"), Rect2(Vector2(), get_size())); + + if (hovering_drop) { + Color accent = get_color("accent_color", "Editor"); + accent.a *= 0.7; + draw_rect(Rect2(Point2(), get_size()), accent, false); + } + } break; + case NOTIFICATION_MOUSE_ENTER: { + + if (!hovering_drop) { + hovering_drop = true; + update(); + } + } break; + case NOTIFICATION_MOUSE_EXIT: + case NOTIFICATION_DRAG_END: { + + if (hovering_drop) { + hovering_drop = false; + update(); + } + } break; + } +} + bool EditorAudioBusDrop::can_drop_data(const Point2 &p_point, const Variant &p_data) const { Dictionary d = p_data; @@ -932,10 +986,11 @@ bool EditorAudioBusDrop::can_drop_data(const Point2 &p_point, const Variant &p_d return false; } + void EditorAudioBusDrop::drop_data(const Point2 &p_point, const Variant &p_data) { Dictionary d = p_data; - emit_signal("dropped", d["index"], -1); + emit_signal("dropped", d["index"], AudioServer::get_singleton()->get_bus_count()); } void EditorAudioBusDrop::_bind_methods() { @@ -944,6 +999,8 @@ void EditorAudioBusDrop::_bind_methods() { } EditorAudioBusDrop::EditorAudioBusDrop() { + + hovering_drop = false; } void EditorAudioBuses::_update_buses() { @@ -976,37 +1033,43 @@ EditorAudioBuses *EditorAudioBuses::register_editor() { void EditorAudioBuses::_notification(int p_what) { - if (p_what == NOTIFICATION_READY) { - _update_buses(); - } + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { - if (p_what == NOTIFICATION_DRAG_END) { - if (drop_end) { - drop_end->queue_delete(); - drop_end = NULL; - } - } + bus_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + } break; + case NOTIFICATION_READY: { - if (p_what == NOTIFICATION_PROCESS) { + _update_buses(); + } break; + case NOTIFICATION_DRAG_END: { - //check if anything was edited - bool edited = AudioServer::get_singleton()->is_edited(); - for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { - for (int j = 0; j < AudioServer::get_singleton()->get_bus_effect_count(i); j++) { - Ref<AudioEffect> effect = AudioServer::get_singleton()->get_bus_effect(i, j); - if (effect->is_edited()) { - edited = true; - effect->set_edited(false); + if (drop_end) { + drop_end->queue_delete(); + drop_end = NULL; + } + } break; + case NOTIFICATION_PROCESS: { + + // Check if anything was edited. + bool edited = AudioServer::get_singleton()->is_edited(); + for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { + for (int j = 0; j < AudioServer::get_singleton()->get_bus_effect_count(i); j++) { + Ref<AudioEffect> effect = AudioServer::get_singleton()->get_bus_effect(i, j); + if (effect->is_edited()) { + edited = true; + effect->set_edited(false); + } } } - } - - AudioServer::get_singleton()->set_edited(false); - if (edited) { + AudioServer::get_singleton()->set_edited(false); - save_timer->start(); - } + if (edited) { + save_timer->start(); + } + } break; } } @@ -1014,7 +1077,6 @@ void EditorAudioBuses::_add_bus() { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - //need to simulate new name, so we can undi :( 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()); @@ -1119,21 +1181,12 @@ void EditorAudioBuses::_request_drop_end() { 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(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) { - final_pos = p_bus; - } else if (p_index == -1) { - final_pos = AudioServer::get_singleton()->get_bus_count() - 1; - } else if (p_index < p_bus) { - final_pos = p_index; - } else { - final_pos = p_index - 1; - } - ur->add_undo_method(AudioServer::get_singleton(), "move_bus", final_pos, p_bus); + int real_bus = p_index > p_bus ? p_bus : p_bus + 1; + int real_index = p_index > p_bus ? p_index - 1 : p_index; + ur->add_undo_method(AudioServer::get_singleton(), "move_bus", real_index, real_bus); ur->add_do_method(this, "_update_buses"); ur->add_undo_method(this, "_update_buses"); @@ -1189,7 +1242,7 @@ void EditorAudioBuses::_load_default_layout() { } edited_path = layout_path; - file->set_text(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(); @@ -1206,7 +1259,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { } edited_path = p_string; - file->set_text(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(); @@ -1228,7 +1281,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { } edited_path = p_string; - file->set_text(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("_select_layout"); @@ -1262,19 +1315,20 @@ EditorAudioBuses::EditorAudioBuses() { top_hb = memnew(HBoxContainer); add_child(top_hb); - file = memnew(ToolButton); - file->set_text("default_bus_layout.tres"); + file = memnew(Label); + file->set_text(String(TTR("Layout")) + ": " + "default_bus_layout.tres"); + file->set_clip_text(true); + file->set_h_size_flags(SIZE_EXPAND_FILL); top_hb->add_child(file); - file->connect("pressed", this, "_select_layout"); add = memnew(Button); 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"); - top_hb->add_spacer(); + VSeparator *separator = memnew(VSeparator); + top_hb->add_child(separator); load = memnew(Button); load->set_text(TTR("Load")); @@ -1301,7 +1355,6 @@ EditorAudioBuses::EditorAudioBuses() { _new->connect("pressed", this, "_new_layout"); bus_scroll = memnew(ScrollContainer); - bus_scroll->add_style_override("panel", memnew(StyleBoxEmpty)); bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL); bus_scroll->set_enable_h_scroll(true); bus_scroll->set_enable_v_scroll(false); @@ -1377,38 +1430,65 @@ AudioBusesEditorPlugin::AudioBusesEditorPlugin(EditorAudioBuses *p_node) { AudioBusesEditorPlugin::~AudioBusesEditorPlugin() { } -void EditorAudioMeterNotches::add_notch(float normalized_offset, float db_value, bool render_value) { - notches.push_back(AudioNotch(normalized_offset, db_value, render_value)); +void EditorAudioMeterNotches::add_notch(float p_normalized_offset, float p_db_value, bool p_render_value) { + + notches.push_back(AudioNotch(p_normalized_offset, p_db_value, p_render_value)); +} + +Size2 EditorAudioMeterNotches::get_minimum_size() const { + + Ref<Font> font = get_font("font", "Label"); + float font_height = font->get_height(); + + float width = 0; + float height = top_padding + btm_padding; + + for (uint8_t i = 0; i < notches.size(); i++) { + if (notches[i].render_db_value) { + width = MAX(width, font->get_string_size(String::num(Math::abs(notches[i].db_value)) + "dB").x); + height += font_height; + } + } + width += line_length + label_space; + + return Size2(width, height); } void EditorAudioMeterNotches::_bind_methods() { + ClassDB::bind_method("add_notch", &EditorAudioMeterNotches::add_notch); ClassDB::bind_method("_draw_audio_notches", &EditorAudioMeterNotches::_draw_audio_notches); } void EditorAudioMeterNotches::_notification(int p_what) { - if (p_what == NOTIFICATION_DRAW) { - notch_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0f, 1.0f, 1.0f, 0.8f) : Color(0.0f, 0.0f, 0.0f, 0.8f); - _draw_audio_notches(); + + switch (p_what) { + case NOTIFICATION_THEME_CHANGED: { + notch_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1, 1, 1) : Color(0, 0, 0); + } break; + case NOTIFICATION_DRAW: { + _draw_audio_notches(); + } break; } } void EditorAudioMeterNotches::_draw_audio_notches() { + Ref<Font> font = get_font("font", "Label"); float font_height = font->get_height(); for (uint8_t i = 0; i < notches.size(); i++) { AudioNotch n = notches[i]; - draw_line(Vector2(0.0f, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), + draw_line(Vector2(0, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), Vector2(line_length, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), notch_color, - 1.0f); + 1); if (n.render_db_value) { draw_string(font, Vector2(line_length + label_space, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + (font_height / 4) + top_padding), - String("{0}dB").format(varray(Math::abs(n.db_value))), + String::num(Math::abs(n.db_value)) + "dB", notch_color); } } @@ -1419,7 +1499,6 @@ EditorAudioMeterNotches::EditorAudioMeterNotches() : label_space(2.0f), btm_padding(9.0f), top_padding(5.0f) { - this->set_v_size_flags(SIZE_EXPAND_FILL); - this->set_h_size_flags(SIZE_EXPAND_FILL); - notch_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0f, 1.0f, 1.0f, 0.8f) : Color(0.0f, 0.0f, 0.0f, 0.8f); + + notch_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1, 1, 1) : Color(0, 0, 0); } diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index 50f2101fd8..20890fd3b5 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -72,7 +72,6 @@ class EditorAudioBus : public PanelContainer { TextureProgress *vu_r; } channel[CHANNELS_MAX]; - class EditorAudioMeterNotches *scale; OptionButton *send; PopupMenu *effect_options; @@ -90,8 +89,8 @@ class EditorAudioBus : public PanelContainer { Tree *effects; bool updating_bus; - bool is_master; + mutable bool hovering_drop; void _gui_input(const Ref<InputEvent> &p_event); void _bus_popup_pressed(int p_option); @@ -137,15 +136,18 @@ public: EditorAudioBus(EditorAudioBuses *p_buses = NULL, bool p_is_master = false); }; -class EditorAudioBusDrop : public Panel { +class EditorAudioBusDrop : public Control { - GDCLASS(EditorAudioBusDrop, Panel); + GDCLASS(EditorAudioBusDrop, Control); virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const; virtual void drop_data(const Point2 &p_point, const Variant &p_data); + mutable bool hovering_drop; + protected: static void _bind_methods(); + void _notification(int p_what); public: EditorAudioBusDrop(); @@ -157,13 +159,14 @@ class EditorAudioBuses : public VBoxContainer { HBoxContainer *top_hb; - Button *add; ScrollContainer *bus_scroll; HBoxContainer *bus_hb; EditorAudioBusDrop *drop_end; - Button *file; + Label *file; + + Button *add; Button *load; Button *save_as; Button *_default; @@ -242,7 +245,8 @@ public: float top_padding; Color notch_color; - void add_notch(float normalized_offset, float db_value, bool render_value = false); + void add_notch(float p_normalized_offset, float p_db_value, bool p_render_value = false); + Size2 get_minimum_size() const; private: static void _bind_methods(); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 37f148bdbb..b5325a07a5 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -907,7 +907,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c String tmppath = EditorSettings::get_singleton()->get_cache_dir().plus_file("packtmp"); FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE); - ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE) + ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE); PackData pd; pd.ep = &ep; @@ -924,7 +924,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c pd.file_ofs.sort(); //do sort, so we can do binary search later FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE); - ERR_FAIL_COND_V(!f, ERR_CANT_CREATE) + ERR_FAIL_COND_V(!f, ERR_CANT_CREATE); f->store_32(0x43504447); //GDPK f->store_32(1); //pack version f->store_32(VERSION_MAJOR); @@ -977,7 +977,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c ftmp = FileAccess::open(tmppath, FileAccess::READ); if (!ftmp) { memdelete(f); - ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE) + ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE); } const int bufsize = 16384; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 714df44e25..56358f059a 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* editor_feature_profile.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "editor_feature_profile.h" #include "core/io/json.h" #include "core/os/dir_access.h" diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h index b7c2ebc1b2..d670719d7d 100644 --- a/editor/editor_feature_profile.h +++ b/editor/editor_feature_profile.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* editor_feature_profile.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef EDITOR_FEATURE_PROFILE_H #define EDITOR_FEATURE_PROFILE_H diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 3d198dec67..1a293adb4b 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1253,6 +1253,12 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) { _update_favorites(); } +void EditorFileDialog::_favorite_pressed() { + + favorite->set_pressed(!favorite->is_pressed()); + _favorite_toggled(favorite->is_pressed()); +} + void EditorFileDialog::_recent_selected(int p_idx) { Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs(); @@ -1376,6 +1382,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_go_up"), &EditorFileDialog::_go_up); ClassDB::bind_method(D_METHOD("_favorite_toggled"), &EditorFileDialog::_favorite_toggled); + ClassDB::bind_method(D_METHOD("_favorite_pressed"), &EditorFileDialog::_favorite_pressed); ClassDB::bind_method(D_METHOD("_favorite_selected"), &EditorFileDialog::_favorite_selected); ClassDB::bind_method(D_METHOD("_favorite_move_up"), &EditorFileDialog::_favorite_move_up); ClassDB::bind_method(D_METHOD("_favorite_move_down"), &EditorFileDialog::_favorite_move_down); @@ -1519,7 +1526,7 @@ EditorFileDialog::EditorFileDialog() { favorite->set_flat(true); favorite->set_toggle_mode(true); favorite->set_tooltip(TTR("(Un)favorite current folder.")); - favorite->connect("toggled", this, "_favorite_toggled"); + favorite->connect("pressed", this, "_favorite_pressed"); pathhb->add_child(favorite); Ref<ButtonGroup> view_mode_group; diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index edaccac51d..529aaa71de 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -151,6 +151,7 @@ private: void _update_favorites(); void _favorite_toggled(bool p_toggle); + void _favorite_pressed(); void _favorite_selected(int p_idx); void _favorite_move_up(); void _favorite_move_down(); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5917869988..df25b08b4c 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -203,8 +203,9 @@ String EditorHelp::_fix_constant(const String &p_constant) const { if (p_constant.strip_edges() == "2147483647") { return "0x7FFFFFFF"; } + if (p_constant.strip_edges() == "1048575") { - return "0xfffff"; + return "0xFFFFF"; } return p_constant; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 616a52e25b..55ab38ba6c 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -250,6 +250,25 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(results_tree, true); } +bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const StringName &p_class) { + + Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); + if (profile.is_null()) { + return false; + } + + StringName class_name = p_class; + while (class_name != StringName()) { + + if (!ClassDB::class_exists(class_name) || profile->is_class_disabled(class_name)) { + return true; + } + class_name = ClassDB::get_parent_class(class_name); + } + + return false; +} + bool EditorHelpSearch::Runner::_slice() { bool phase_done = false; @@ -299,43 +318,45 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { bool EditorHelpSearch::Runner::_phase_match_classes() { DocData::ClassDoc &class_doc = iterator_doc->value(); - - matches[class_doc.name] = ClassMatch(); - ClassMatch &match = matches[class_doc.name]; - - match.doc = &class_doc; - - // Match class name. - if (search_flags & SEARCH_CLASSES) - match.name = term == "" || _match_string(term, class_doc.name); - - // Match members if the term is long enough. - if (term.length() > 1) { - if (search_flags & SEARCH_METHODS) - for (int i = 0; i < class_doc.methods.size(); i++) { - String method_name = search_flags & SEARCH_CASE_SENSITIVE ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); - if (method_name.find(term) > -1 || - (term.begins_with(".") && method_name.begins_with(term.right(1))) || - (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || - (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) - match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); - } - if (search_flags & SEARCH_SIGNALS) - for (int i = 0; i < class_doc.signals.size(); i++) - if (_match_string(term, class_doc.signals[i].name)) - match.signals.push_back(const_cast<DocData::MethodDoc *>(&class_doc.signals[i])); - if (search_flags & SEARCH_CONSTANTS) - for (int i = 0; i < class_doc.constants.size(); i++) - if (_match_string(term, class_doc.constants[i].name)) - match.constants.push_back(const_cast<DocData::ConstantDoc *>(&class_doc.constants[i])); - if (search_flags & SEARCH_PROPERTIES) - for (int i = 0; i < class_doc.properties.size(); i++) - if (_match_string(term, class_doc.properties[i].name)) - match.properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.properties[i])); - if (search_flags & SEARCH_THEME_ITEMS) - for (int i = 0; i < class_doc.theme_properties.size(); i++) - if (_match_string(term, class_doc.theme_properties[i].name)) - match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i])); + if (!_is_class_disabled_by_feature_profile(class_doc.name)) { + + matches[class_doc.name] = ClassMatch(); + ClassMatch &match = matches[class_doc.name]; + + match.doc = &class_doc; + + // Match class name. + if (search_flags & SEARCH_CLASSES) + match.name = term == "" || _match_string(term, class_doc.name); + + // Match members if the term is long enough. + if (term.length() > 1) { + if (search_flags & SEARCH_METHODS) + for (int i = 0; i < class_doc.methods.size(); i++) { + String method_name = search_flags & SEARCH_CASE_SENSITIVE ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) + match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); + } + if (search_flags & SEARCH_SIGNALS) + for (int i = 0; i < class_doc.signals.size(); i++) + if (_match_string(term, class_doc.signals[i].name)) + match.signals.push_back(const_cast<DocData::MethodDoc *>(&class_doc.signals[i])); + if (search_flags & SEARCH_CONSTANTS) + for (int i = 0; i < class_doc.constants.size(); i++) + if (_match_string(term, class_doc.constants[i].name)) + match.constants.push_back(const_cast<DocData::ConstantDoc *>(&class_doc.constants[i])); + if (search_flags & SEARCH_PROPERTIES) + for (int i = 0; i < class_doc.properties.size(); i++) + if (_match_string(term, class_doc.properties[i].name)) + match.properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.properties[i])); + if (search_flags & SEARCH_THEME_ITEMS) + for (int i = 0; i < class_doc.theme_properties.size(); i++) + if (_match_string(term, class_doc.theme_properties[i].name)) + match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i])); + } } iterator_doc = iterator_doc->next(); diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index 93cf66a0dd..12ffd024a7 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -125,6 +125,8 @@ class EditorHelpSearch::Runner : public Reference { Map<String, TreeItem *> class_items; TreeItem *matched_item; + bool _is_class_disabled_by_feature_profile(const StringName &p_class); + bool _slice(); bool _phase_match_classes_init(); bool _phase_match_classes(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index ecb9ea5f35..e4ddf44bc4 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -66,7 +66,7 @@ Size2 EditorProperty::get_minimum_size() const { if (checkable) { Ref<Texture> check = get_icon("checked", "CheckBox"); - ms.width += check->get_width() + get_constant("hseparator", "Tree"); + ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree"); } if (bottom_editor != NULL && bottom_editor->is_visible()) { @@ -228,8 +228,7 @@ void EditorProperty::_notification(int p_what) { } check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height()); draw_texture(checkbox, check_rect.position, color2); - ofs += get_constant("hseparator", "Tree"); - ofs += checkbox->get_width(); + ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox"); text_limit -= ofs; } else { check_rect = Rect2(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 969e1affd7..79c312b7b1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1411,7 +1411,7 @@ void EditorNode::_dialog_action(String p_file) { case RESOURCE_SAVE: case RESOURCE_SAVE_AS: { - ERR_FAIL_COND(saving_resource.is_null()) + ERR_FAIL_COND(saving_resource.is_null()); save_resource_in_path(saving_resource, p_file); saving_resource = Ref<Resource>(); ObjectID current = editor_history.get_current(); @@ -5044,7 +5044,7 @@ void EditorNode::_feature_profile_changed() { main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)); - if (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)) { + if (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)) { _editor_select(EDITOR_2D); } } else { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ef8456549a..c7fac07ba2 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -569,7 +569,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/2d/bone_outline_size", 2); _initial_set("editors/2d/viewport_border_color", Color(0.4, 0.4, 1.0, 0.4)); _initial_set("editors/2d/warped_mouse_panning", true); - _initial_set("editors/2d/simple_spacebar_panning", false); + _initial_set("editors/2d/simple_panning", false); _initial_set("editors/2d/scroll_to_pan", false); _initial_set("editors/2d/pan_speed", 20); @@ -1123,7 +1123,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re Variant _EDITOR_GET(const String &p_setting) { - ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant()) + ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant()); return EditorSettings::get_singleton()->get(p_setting); } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ee88b558c8..e57217bb11 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2069,7 +2069,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) { // Add options for files and folders - ERR_FAIL_COND(p_paths.empty()) + ERR_FAIL_COND(p_paths.empty()); Vector<String> filenames; Vector<String> foldernames; diff --git a/editor/icons/icon_project_icon_loading.svg b/editor/icons/icon_project_icon_loading.svg new file mode 100644 index 0000000000..3802b67654 --- /dev/null +++ b/editor/icons/icon_project_icon_loading.svg @@ -0,0 +1 @@ +<svg height="64" viewBox="0 0 64 64" width="64" xmlns="http://www.w3.org/2000/svg"><path d="m8 0c-4.432 0-8 3.568-8 8v48c0 4.432 3.568 8 8 8h48c4.432 0 8-3.568 8-8v-48c0-4.432-3.568-8-8-8z" fill="#e0e0e0" fill-opacity=".188235"/></svg>
\ No newline at end of file diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 35fdd32e2c..eca4e58abe 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* resource_importer_texture_atlas.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "resource_importer_texture_atlas.h" #include "atlas_import_failed.xpm" diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h index 62be570dc6..042deacfe3 100644 --- a/editor/import/resource_importer_texture_atlas.h +++ b/editor/import/resource_importer_texture_atlas.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* resource_importer_texture_atlas.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef RESOURCE_IMPORTER_TEXTURE_ATLAS_H #define RESOURCE_IMPORTER_TEXTURE_ATLAS_H diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index fdf1103258..e39f2dabaa 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -119,7 +119,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s file->close(); memdelete(file); - ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)") + ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)"); ERR_FAIL_V(ERR_FILE_UNRECOGNIZED); } diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 8a2393ff60..8a0812973f 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -169,7 +169,7 @@ void InspectorDock::_save_resource(bool save_as) const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); @@ -183,7 +183,7 @@ void InspectorDock::_unref_resource() const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); current_res->set_path(""); @@ -194,7 +194,7 @@ void InspectorDock::_copy_resource() const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index bfee76492b..dff6eb5c5e 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -471,7 +471,7 @@ void AnimationNodeBlendTreeEditor::_node_selected(Object *p_node) { void AnimationNodeBlendTreeEditor::_open_in_editor(const String &p_which) { Ref<AnimationNode> an = blend_tree->get_node(p_which); - ERR_FAIL_COND(!an.is_valid()) + ERR_FAIL_COND(!an.is_valid()); AnimationTreeEditor::get_singleton()->enter_editor(p_which); } @@ -798,7 +798,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima String new_name = p_text; - ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1) + ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1); if (new_name == prev_name) { return; //nothing to do diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 7d96f0b87b..5204565c06 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -769,7 +769,7 @@ void AnimationPlayerEditor::_dialog_action(String p_file) { if (current != "") { Ref<Animation> anim = player->get_animation(current); - ERR_FAIL_COND(!Object::cast_to<Resource>(*anim)) + ERR_FAIL_COND(!Object::cast_to<Resource>(*anim)); RES current_res = RES(Object::cast_to<Resource>(*anim)); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index f06b4b2828..e25e7ac7ed 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1096,7 +1096,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { String new_name = p_text; - ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1) + ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1); if (new_name == prev_name) { return; // Nothing to do. diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 0dfb53b34a..1503258ff5 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "editor_node.h" #include "editor_settings.h" -void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost) { +void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost) { title->set_text(p_title); asset_id = p_asset_id; @@ -44,13 +44,6 @@ void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, co author->set_text(p_author); author_id = p_author_id; price->set_text(p_cost); - - for (int i = 0; i < 5; i++) { - if (i < p_rating) - stars[i]->set_texture(get_icon("Favorites", "EditorIcons")); - else - stars[i]->set_texture(get_icon("NonFavorite", "EditorIcons")); - } } void EditorAssetLibraryItem::set_image(int p_type, int p_index, const Ref<Texture> &p_image) { @@ -65,9 +58,10 @@ void EditorAssetLibraryItem::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - icon->set_normal_texture(get_icon("DefaultProjectIcon", "EditorIcons")); + icon->set_normal_texture(get_icon("ProjectIconLoading", "EditorIcons")); category->add_color_override("font_color", Color(0.5, 0.5, 0.5)); author->add_color_override("font_color", Color(0.5, 0.5, 0.5)); + price->add_color_override("font_color", Color(0.5, 0.5, 0.5)); } } @@ -100,17 +94,19 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { Ref<StyleBoxEmpty> border; border.instance(); - border->set_default_margin(MARGIN_LEFT, 5); - border->set_default_margin(MARGIN_RIGHT, 5); - border->set_default_margin(MARGIN_BOTTOM, 5); - border->set_default_margin(MARGIN_TOP, 5); + border->set_default_margin(MARGIN_LEFT, 5 * EDSCALE); + border->set_default_margin(MARGIN_RIGHT, 5 * EDSCALE); + border->set_default_margin(MARGIN_BOTTOM, 5 * EDSCALE); + border->set_default_margin(MARGIN_TOP, 5 * EDSCALE); add_style_override("panel", border); HBoxContainer *hb = memnew(HBoxContainer); + // Add some spacing to visually separate the icon from the asset details + hb->add_constant_override("separation", 15 * EDSCALE); add_child(hb); icon = memnew(TextureButton); - icon->set_custom_minimum_size(Size2(64, 64)); + icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); icon->connect("pressed", this, "_asset_clicked"); @@ -139,18 +135,11 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { author->connect("pressed", this, "_author_clicked"); vb->add_child(author); - HBoxContainer *rating_hb = memnew(HBoxContainer); - vb->add_child(rating_hb); - - for (int i = 0; i < 5; i++) { - stars[i] = memnew(TextureRect); - rating_hb->add_child(stars[i]); - } price = memnew(Label); price->set_text(TTR("Free")); vb->add_child(price); - set_custom_minimum_size(Size2(250, 100)); + set_custom_minimum_size(Size2(250, 100) * EDSCALE); set_h_size_flags(SIZE_EXPAND_FILL); set_mouse_filter(MOUSE_FILTER_PASS); @@ -194,7 +183,6 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const break; } } - //item->call("set_image",p_type,p_index,p_image); } break; case EditorAssetLibrary::IMAGE_QUEUE_SCREENSHOT: { @@ -207,7 +195,6 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const break; } } - //item->call("set_image",p_type,p_index,p_image); } break; } } @@ -248,13 +235,13 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) { } } -void EditorAssetLibraryItemDescription::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash) { +void EditorAssetLibraryItemDescription::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash) { asset_id = p_asset_id; title = p_title; download_url = p_download_url; sha256 = p_sha256_hash; - item->configure(p_title, p_asset_id, p_category, p_category_id, p_author, p_author_id, p_rating, p_cost); + item->configure(p_title, p_asset_id, p_category, p_category_id, p_author, p_author_id, p_cost); description->clear(); description->add_text(TTR("Version:") + " " + p_version_string + "\n"); description->add_text(TTR("Contents:") + " "); @@ -554,7 +541,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { hb2->add_child(retry); hb2->add_child(install); - set_custom_minimum_size(Size2(310, 0)); + set_custom_minimum_size(Size2(310, 0) * EDSCALE); download = memnew(HTTPRequest); add_child(download); @@ -666,7 +653,6 @@ void EditorAssetLibrary::_install_asset() { } const char *EditorAssetLibrary::sort_key[SORT_MAX] = { - "rating", "downloads", "name", "cost", @@ -674,10 +660,9 @@ const char *EditorAssetLibrary::sort_key[SORT_MAX] = { }; const char *EditorAssetLibrary::sort_text[SORT_MAX] = { - "Rating", "Downloads", "Name", - "Cost", + "License", // "cost" stores the SPDX license name in the Godot Asset Library "Updated" }; @@ -733,6 +718,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt image_data = cached_data; file->close(); + memdelete(file); } } @@ -807,6 +793,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons if (file) { file->store_line(new_etag); file->close(); + memdelete(file); } int len = p_data.size(); @@ -816,6 +803,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons file->store_32(len); file->store_buffer(r.ptr(), len); file->close(); + memdelete(file); } break; @@ -855,6 +843,7 @@ void EditorAssetLibrary::_update_image_queue() { if (file) { headers.push_back("If-None-Match: " + file->get_line()); file->close(); + memdelete(file); } } @@ -984,7 +973,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int to = p_page_count; hbc->add_spacer(); - hbc->add_constant_override("separation", 5); + hbc->add_constant_override("separation", 5 * EDSCALE); Button *first = memnew(Button); first->set_text(TTR("First")); @@ -1190,8 +1179,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const asset_items = memnew(GridContainer); asset_items->set_columns(2); - asset_items->add_constant_override("hseparation", 10); - asset_items->add_constant_override("vseparation", 10); + asset_items->add_constant_override("hseparation", 10 * EDSCALE); + asset_items->add_constant_override("vseparation", 10 * EDSCALE); library_vb->add_child(asset_items); @@ -1208,12 +1197,11 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const ERR_CONTINUE(!r.has("author_id")); ERR_CONTINUE(!r.has("category_id")); ERR_FAIL_COND(!category_map.has(r["category_id"])); - ERR_CONTINUE(!r.has("rating")); ERR_CONTINUE(!r.has("cost")); EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem); asset_items->add_child(item); - item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["rating"], r["cost"]); + item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"]); item->connect("asset_selected", this, "_select_asset"); item->connect("author_selected", this, "_select_author"); item->connect("category_selected", this, "_select_category"); @@ -1234,7 +1222,6 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const ERR_FAIL_COND(!r.has("version_string")); ERR_FAIL_COND(!r.has("category_id")); ERR_FAIL_COND(!category_map.has(r["category_id"])); - ERR_FAIL_COND(!r.has("rating")); ERR_FAIL_COND(!r.has("cost")); ERR_FAIL_COND(!r.has("description")); ERR_FAIL_COND(!r.has("download_url")); @@ -1250,7 +1237,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description->popup_centered_minsize(); description->connect("confirmed", this, "_install_asset"); - description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["rating"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); + description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); /*item->connect("asset_selected",this,"_select_asset"); item->connect("author_selected",this,"_select_author"); item->connect("category_selected",this,"_category_selected");*/ @@ -1357,7 +1344,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { HBoxContainer *search_hb = memnew(HBoxContainer); library_main->add_child(search_hb); - library_main->add_constant_override("separation", 10); + library_main->add_constant_override("separation", 10 * EDSCALE); search_hb->add_child(memnew(Label(TTR("Search:") + " "))); filter = memnew(LineEdit); @@ -1459,10 +1446,10 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { Ref<StyleBoxEmpty> border2; border2.instance(); - border2->set_default_margin(MARGIN_LEFT, 15); - border2->set_default_margin(MARGIN_RIGHT, 35); - border2->set_default_margin(MARGIN_BOTTOM, 15); - border2->set_default_margin(MARGIN_TOP, 15); + border2->set_default_margin(MARGIN_LEFT, 15 * EDSCALE); + border2->set_default_margin(MARGIN_RIGHT, 35 * EDSCALE); + border2->set_default_margin(MARGIN_BOTTOM, 15 * EDSCALE); + border2->set_default_margin(MARGIN_TOP, 15 * EDSCALE); PanelContainer *library_vb_border = memnew(PanelContainer); library_scroll->add_child(library_vb_border); @@ -1474,15 +1461,14 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_vb->set_h_size_flags(SIZE_EXPAND_FILL); library_vb_border->add_child(library_vb); - //margin_panel->set_stop_mouse(false); asset_top_page = memnew(HBoxContainer); library_vb->add_child(asset_top_page); asset_items = memnew(GridContainer); asset_items->set_columns(2); - asset_items->add_constant_override("hseparation", 10); - asset_items->add_constant_override("vseparation", 10); + asset_items->add_constant_override("hseparation", 10 * EDSCALE); + asset_items->add_constant_override("vseparation", 10 * EDSCALE); library_vb->add_child(asset_items); @@ -1496,7 +1482,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { last_queue_id = 0; - library_vb->add_constant_override("separation", 20); + library_vb->add_constant_override("separation", 20 * EDSCALE); load_status = memnew(ProgressBar); load_status->set_min(0); diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index dd5f3c2077..81288ae831 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -77,7 +77,7 @@ protected: static void _bind_methods(); public: - void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost); + void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost); EditorAssetLibraryItem(); }; @@ -120,7 +120,7 @@ protected: static void _bind_methods(); public: - void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash); + void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash); void add_preview(int p_id, bool p_video, const String &p_url); String get_title() { return title; } @@ -216,7 +216,6 @@ class EditorAssetLibrary : public PanelContainer { }; enum SortOrder { - SORT_RATING, SORT_DOWNLOADS, SORT_NAME, SORT_COST, diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e8ef689ca3..fbf01a9405 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1081,7 +1081,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) { if (b->is_pressed() && (b->get_button_index() == BUTTON_MIDDLE || (b->get_button_index() == BUTTON_LEFT && tool == TOOL_PAN) || - (b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { + (b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) { // Pan the viewport panning = true; } @@ -1097,7 +1097,9 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; if (k.is_valid()) { - if (k->get_scancode() == KEY_SPACE && (EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") || drag_type != DRAG_NONE)) { + bool is_pan_key = pan_view_shortcut.is_valid() && pan_view_shortcut->is_shortcut(p_event); + + if (is_pan_key && (EditorSettings::get_singleton()->get("editors/2d/simple_panning") || drag_type != DRAG_NONE)) { if (!panning) { if (k->is_pressed() && !k->is_echo()) { //Pan the viewport @@ -1110,6 +1112,9 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) { } } } + + if (is_pan_key) + pan_pressed = k->is_pressed(); } Ref<InputEventMouseMotion> m = p_event; @@ -2214,7 +2219,7 @@ bool CanvasItemEditor::_gui_input_hover(const Ref<InputEvent> &p_event) { void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { bool accepted = false; - if (EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") || !Input::get_singleton()->is_key_pressed(KEY_SPACE)) { + if (EditorSettings::get_singleton()->get("editors/2d/simple_panning") || !pan_pressed) { if ((accepted = _gui_input_rulers_and_guides(p_event))) { //printf("Rulers and guides\n"); } else if ((accepted = editor->get_editor_plugins_over()->forward_gui_input(p_event))) { @@ -4780,6 +4785,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { dragged_guide_pos = Point2(); dragged_guide_index = -1; panning = false; + pan_pressed = false; bone_last_frame = 0; @@ -5129,6 +5135,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY); divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE); + pan_view_shortcut = ED_SHORTCUT("canvas_item_editor/pan_view", TTR("Pan View"), KEY_SPACE); skeleton_menu->get_popup()->set_item_checked(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES), true); singleton = this; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index e098d261c0..ff221eb758 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -265,6 +265,7 @@ private: bool key_rot; bool key_scale; bool panning; + bool pan_pressed; MenuOption last_option; @@ -383,6 +384,7 @@ private: Ref<ShortCut> set_pivot_shortcut; Ref<ShortCut> multiply_grid_step_shortcut; Ref<ShortCut> divide_grid_step_shortcut; + Ref<ShortCut> pan_view_shortcut; bool _is_node_locked(const Node *p_node); bool _is_node_movable(const Node *p_node, bool p_popup_warning = false); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 28e57ac48a..285823d95a 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -643,7 +643,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S float max = -1000; float min = 1000; int from = uint64_t(i) * frame_length / w; - int to = uint64_t(i + 1) * frame_length / w; + int to = (uint64_t(i) + 1) * frame_length / w; to = MIN(to, frame_length); from = MIN(from, frame_length - 1); if (to == from) { diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index fc0a425bfc..cae705a697 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -197,7 +197,7 @@ void MultiMeshEditor::_populate() { float areapos = Math::random(0.0f, area_accum); Map<float, int>::Element *E = triangle_area_map.find_closest(areapos); - ERR_FAIL_COND(!E) + ERR_FAIL_COND(!E); int index = E->get(); ERR_FAIL_INDEX(index, facecount); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 66cecf7068..3f4f66a26d 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -67,7 +67,7 @@ bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vect float areapos = Math::random(0.0f, area_accum); Map<float, int>::Element *E = triangle_area_map.find_closest(areapos); - ERR_FAIL_COND_V(!E, false) + ERR_FAIL_COND_V(!E, false); int index = E->get(); ERR_FAIL_INDEX_V(index, geometry.size(), false); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 641c387c64..6bf916cdfc 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -723,6 +723,8 @@ void ScriptEditor::_resave_scripts(const String &p_str) { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { se->convert_indent_to_spaces(); @@ -1078,6 +1080,8 @@ void ScriptEditor::_menu_option(int p_option) { if (trim_trailing_whitespace_on_save) current->trim_trailing_whitespace(); + current->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { current->convert_indent_to_spaces(); @@ -1097,7 +1101,10 @@ void ScriptEditor::_menu_option(int p_option) { } break; case FILE_SAVE_AS: { - current->trim_trailing_whitespace(); + if (trim_trailing_whitespace_on_save) + current->trim_trailing_whitespace(); + + current->insert_final_newline(); if (convert_indent_on_save) { if (use_space_indentation) { @@ -1969,10 +1976,11 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); List<String> args; + bool has_file_flag = false; + String script_path = ProjectSettings::get_singleton()->globalize_path(p_resource->get_path()); if (flags.size()) { String project_path = ProjectSettings::get_singleton()->get_resource_path(); - String script_path = ProjectSettings::get_singleton()->globalize_path(p_resource->get_path()); flags = flags.replacen("{line}", itos(p_line > 0 ? p_line : 0)); flags = flags.replacen("{col}", itos(p_col)); @@ -1994,6 +2002,9 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra } else if (flags[i] == '\0' || (!inside_quotes && flags[i] == ' ')) { String arg = flags.substr(from, num_chars); + if (arg.find("{file}") != -1) { + has_file_flag = true; + } // do path replacement here, else there will be issues with spaces and quotes arg = arg.replacen("{project}", project_path); @@ -2008,6 +2019,11 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra } } + // Default to passing script path if no {file} flag is specified. + if (!has_file_flag) { + args.push_back(script_path); + } + Error err = OS::get_singleton()->execute(path, args, false); if (err == OK) return false; @@ -2121,6 +2137,8 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (!se->is_unsaved()) continue; @@ -3428,7 +3446,8 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/open_scripts/list_script_names_as", PROPERTY_HINT_ENUM, "Name,Parent Directory And Name,Full Path")); EDITOR_DEF("text_editor/open_scripts/list_script_names_as", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_path", PROPERTY_HINT_GLOBAL_FILE)); - EDITOR_DEF("text_editor/external/exec_flags", ""); + EDITOR_DEF("text_editor/external/exec_flags", "{file}"); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_flags", PROPERTY_HINT_PLACEHOLDER_TEXT, "Call flags with placeholders: {project}, {file}, {col}, {line}.")); ED_SHORTCUT("script_editor/open_recent", TTR("Open Recent"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T); ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Files")); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 683fa881f8..fae98d6ec8 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -99,6 +99,7 @@ public: virtual void set_executing_line(int p_line) = 0; virtual void clear_executing_line() = 0; virtual void trim_trailing_whitespace() = 0; + virtual void insert_final_newline() = 0; virtual void convert_indent_to_spaces() = 0; virtual void convert_indent_to_tabs() = 0; virtual void ensure_focus() = 0; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 1fe4ac1372..cea65bb9b4 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -457,6 +457,11 @@ void ScriptTextEditor::trim_trailing_whitespace() { code_editor->trim_trailing_whitespace(); } +void ScriptTextEditor::insert_final_newline() { + + code_editor->insert_final_newline(); +} + void ScriptTextEditor::convert_indent_to_spaces() { code_editor->convert_indent_to_spaces(); @@ -542,7 +547,6 @@ void ScriptTextEditor::_validate_script() { script->set_source_code(text); script->update_exports(); _update_member_keywords(); - //script->reload(); //will update all the variables in property editors } functions.clear(); @@ -553,30 +557,36 @@ void ScriptTextEditor::_validate_script() { } _update_connected_methods(); - code_editor->set_warning_nb(missing_connections.size() + warnings.size()); + int warning_nb = warnings.size(); warnings_panel->clear(); - // add missing connections - Node *base = get_tree()->get_edited_scene_root(); - if (base && missing_connections.size() > 0) { - warnings_panel->push_table(1); - for (List<Connection>::Element *E = missing_connections.front(); E; E = E->next()) { - Connection connection = E->get(); - - String base_path = base->get_name(); - String source_path = base == connection.source ? base_path : base_path + "/" + String(base->get_path_to(Object::cast_to<Node>(connection.source))); - String target_path = base == connection.target ? base_path : base_path + "/" + String(base->get_path_to(Object::cast_to<Node>(connection.target))); + // Add missing connections. + if (GLOBAL_GET("debug/gdscript/warnings/enable").booleanize()) { + Node *base = get_tree()->get_edited_scene_root(); + if (base && missing_connections.size() > 0) { + warnings_panel->push_table(1); + for (List<Connection>::Element *E = missing_connections.front(); E; E = E->next()) { + Connection connection = E->get(); + + String base_path = base->get_name(); + String source_path = base == connection.source ? base_path : base_path + "/" + String(base->get_path_to(Object::cast_to<Node>(connection.source))); + String target_path = base == connection.target ? base_path : base_path + "/" + String(base->get_path_to(Object::cast_to<Node>(connection.target))); + + warnings_panel->push_cell(); + warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); + warnings_panel->add_text(vformat(TTR("Missing connected method '%s' for signal '%s' from node '%s' to node '%s'."), connection.method, connection.signal, source_path, target_path)); + warnings_panel->pop(); // Color. + warnings_panel->pop(); // Cell. + } + warnings_panel->pop(); // Table. - warnings_panel->push_cell(); - warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); - warnings_panel->add_text(vformat(TTR("Missing connected method '%s' for signal '%s' from node '%s' to node '%s'"), connection.method, connection.signal, source_path, target_path)); - warnings_panel->pop(); // Color - warnings_panel->pop(); // Cell + warning_nb += missing_connections.size(); } - warnings_panel->pop(); // Table } - // add script warnings + code_editor->set_warning_nb(warning_nb); + + // Add script warnings. warnings_panel->push_table(3); for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) { ScriptLanguage::Warning w = E->get(); @@ -586,13 +596,13 @@ void ScriptTextEditor::_validate_script() { warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); warnings_panel->add_text(TTR("Line") + " " + itos(w.line)); warnings_panel->add_text(" (" + w.string_code + "):"); - warnings_panel->pop(); // Color - warnings_panel->pop(); // Meta goto - warnings_panel->pop(); // Cell + warnings_panel->pop(); // Color. + warnings_panel->pop(); // Meta goto. + warnings_panel->pop(); // Cell. warnings_panel->push_cell(); warnings_panel->add_text(w.message); - warnings_panel->pop(); // Cell + warnings_panel->pop(); // Cell. Dictionary ignore_meta; ignore_meta["line"] = w.line; @@ -600,11 +610,10 @@ void ScriptTextEditor::_validate_script() { warnings_panel->push_cell(); warnings_panel->push_meta(ignore_meta); warnings_panel->add_text(TTR("(ignore)")); - warnings_panel->pop(); // Meta ignore - warnings_panel->pop(); // Cell - //warnings_panel->add_newline(); + warnings_panel->pop(); // Meta ignore. + warnings_panel->pop(); // Cell. } - warnings_panel->pop(); // Table + warnings_panel->pop(); // Table. line--; bool highlight_safe = EDITOR_DEF("text_editor/highlighting/highlight_type_safe_lines", true); @@ -867,12 +876,33 @@ void ScriptTextEditor::_update_connected_methods() { continue; } + // As deleted nodes are still accessible via the undo/redo system, check if they're still on the tree. + Node *source = Object::cast_to<Node>(connection.source); + if (source && !source->is_inside_tree()) { + continue; + } + int line = script->get_language()->find_function(connection.method, text_edit->get_text()); if (line < 0) { - missing_connections.push_back(connection); - continue; + // There is a chance that the method is inherited from another script. + bool found_inherited_function = false; + Ref<Script> inherited_script = script->get_base_script(); + while (!inherited_script.is_null()) { + line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code()); + if (line != -1) { + found_inherited_function = true; + break; + } + + inherited_script = inherited_script->get_base_script(); + } + + if (!found_inherited_function) { + missing_connections.push_back(connection); + } + } else { + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); } - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); } } } diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index bdfdf18d45..7f5b6c065d 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -194,6 +194,7 @@ public: virtual void set_edit_state(const Variant &p_state); virtual void ensure_focus(); virtual void trim_trailing_whitespace(); + virtual void insert_final_newline(); virtual void convert_indent_to_spaces(); virtual void convert_indent_to_tabs(); virtual void tag_saved_version(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 60f1248ace..a1c0b732fa 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4211,7 +4211,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) { Array vp = d["viewports"]; uint32_t vp_size = static_cast<uint32_t>(vp.size()); if (vp_size > VIEWPORTS_COUNT) { - WARN_PRINT("Ignoring superfluous viewport settings from spatial editor state.") + WARN_PRINT("Ignoring superfluous viewport settings from spatial editor state."); vp_size = VIEWPORTS_COUNT; } diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index a0f3c253d1..d036d7e965 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -251,6 +251,11 @@ void TextEditor::trim_trailing_whitespace() { code_editor->trim_trailing_whitespace(); } +void TextEditor::insert_final_newline() { + + code_editor->insert_final_newline(); +} + void TextEditor::convert_indent_to_spaces() { code_editor->convert_indent_to_spaces(); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index 2da7474793..e06d816177 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -130,6 +130,7 @@ public: virtual void set_executing_line(int p_line); virtual void clear_executing_line(); virtual void trim_trailing_whitespace(); + virtual void insert_final_newline(); virtual void convert_indent_to_spaces(); virtual void convert_indent_to_tabs(); virtual void ensure_focus(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 3f513de30f..16f93b8fd3 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -572,23 +572,25 @@ void TileMapEditor::_pick_tile(const Point2 &p_pos) { if (id == TileMap::INVALID_CELL) return; - if (search_box->get_text().strip_edges() != "") { - + if (search_box->get_text() != "") { search_box->set_text(""); _update_palette(); } - Vector<int> selected; - - selected.push_back(id); - set_selected_tiles(selected); - flip_h = node->is_cell_x_flipped(p_pos.x, p_pos.y); flip_v = node->is_cell_y_flipped(p_pos.x, p_pos.y); transpose = node->is_cell_transposed(p_pos.x, p_pos.y); autotile_coord = node->get_cell_autotile_coord(p_pos.x, p_pos.y); + Vector<int> selected; + selected.push_back(id); + set_selected_tiles(selected); _update_palette(); + + if ((manual_autotile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::AUTO_TILE) || (!priority_atlastile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::ATLAS_TILE)) { + manual_palette->select(manual_palette->find_metadata((Point2)autotile_coord)); + } + CanvasItemEditor::get_singleton()->update_viewport(); } @@ -780,7 +782,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p r.position += (r.size + Vector2(spacing, spacing)) * offset; } Size2 sc = p_xform.get_scale(); - Size2 cell_size = node->get_cell_size(); + /* For a future CheckBox to Center Texture: + Size2 cell_size = node->get_cell_size(); */ Rect2 rect = Rect2(); rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset(); @@ -792,10 +795,11 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p if (p_transpose) { SWAP(tile_ofs.x, tile_ofs.y); + /* For a future CheckBox to Center Texture: rect.position.x += cell_size.x / 2 - rect.size.y / 2; rect.position.y += cell_size.y / 2 - rect.size.x / 2; } else { - rect.position += cell_size / 2 - rect.size / 2; + rect.position += cell_size / 2 - rect.size / 2; */ } if (p_flip_h) { @@ -980,7 +984,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { return true; } else { - // Mousebutton was released + // Mousebutton was released. if (tool != TOOL_NONE) { if (tool == TOOL_PAINTING) { @@ -1044,7 +1048,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { CanvasItemEditor::get_singleton()->update_viewport(); - return true; // We want to keep the Pasting tool + return true; // We want to keep the Pasting tool. } else if (tool == TOOL_SELECTING) { CanvasItemEditor::get_singleton()->update_viewport(); @@ -1068,7 +1072,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { _finish_undo(); - // We want to keep the bucket-tool active + // So the fill preview is cleared right after the click. + CanvasItemEditor::get_singleton()->update_viewport(); + + // We want to keep the bucket-tool active. return true; } @@ -1195,7 +1202,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (tool == TOOL_PAINTING) { - // Paint using bresenham line to prevent holes in painting if the user moves fast + // Paint using bresenham line to prevent holes in painting if the user moves fast. Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y); Vector<int> ids = get_selected_tiles(); @@ -1216,7 +1223,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (tool == TOOL_ERASING) { - // erase using bresenham line to prevent holes in painting if the user moves fast + // Erase using bresenham line to prevent holes in painting if the user moves fast. Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y); @@ -1341,13 +1348,13 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } if (!mouse_over) { - // Editor shortcuts should not fire if mouse not in viewport + // Editor shortcuts should not fire if mouse not in viewport. return false; } if (ED_IS_SHORTCUT("tile_map_editor/paint_tile", p_event)) { // NOTE: We do not set tool = TOOL_PAINTING as this begins painting - // immediately without pressing the left mouse button first + // immediately without pressing the left mouse button first. tool = TOOL_NONE; CanvasItemEditor::get_singleton()->update_viewport(); @@ -1429,7 +1436,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { CanvasItemEditor::get_singleton()->update_viewport(); return true; } - } else if (k.is_valid()) { // release event + } else if (k.is_valid()) { // Release event. if (tool == TOOL_NONE) { @@ -1445,7 +1452,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { #else if (k->get_scancode() == KEY_CONTROL) { #endif - // go back to that last tool if KEY_CONTROL was released + // Go back to that last tool if KEY_CONTROL was released. tool = last_tool; CanvasItemEditor::get_singleton()->update_viewport(); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 5ca3448693..064bf0077a 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -51,6 +51,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (connect_to_script_mode) { return; //don't do anything in this mode } + TreeItem *item = Object::cast_to<TreeItem>(p_item); ERR_FAIL_COND(!item); @@ -220,23 +221,27 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { } if (marked.has(p_node)) { - item->set_text(0, String(p_node->get_name()) + " " + TTR("(Connecting From)")); - + String node_name = p_node->get_name(); + if (connecting_signal) { + node_name += " " + TTR("(Connecting From)"); + } + item->set_text(0, node_name); item->set_custom_color(0, accent); } } else if (part_of_subscene) { - //item->set_selectable(0,marked_selectable); if (valid_types.size() == 0) { item->set_custom_color(0, get_color("disabled_font_color", "Editor")); } - } else if (marked.has(p_node)) { - if (!connect_to_script_mode) { - item->set_selectable(0, marked_selectable); + String node_name = p_node->get_name(); + if (connecting_signal) { + node_name += " " + TTR("(Connecting From)"); } - item->set_custom_color(0, get_color("error_color", "Editor")); + item->set_text(0, node_name); + item->set_selectable(0, marked_selectable); + item->set_custom_color(0, get_color("accent_color", "Editor")); } else if (!marked_selectable && !marked_children_selectable) { Node *node = p_node; @@ -394,15 +399,17 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { void SceneTreeEditor::_node_visibility_changed(Node *p_node) { - if (p_node != get_scene_node() && !p_node->get_owner()) { + if (!p_node || (p_node != get_scene_node() && !p_node->get_owner())) { return; } - TreeItem *item = p_node ? _find(tree->get_root(), p_node->get_path()) : NULL; - if (!item) { + TreeItem *item = _find(tree->get_root(), p_node->get_path()); + + if (!item) { return; } + int idx = item->get_button_by_id(0, BUTTON_VISIBILITY); ERR_FAIL_COND(idx == -1); @@ -1033,6 +1040,11 @@ void SceneTreeEditor::set_connect_to_script_mode(bool p_enable) { update_tree(); } +void SceneTreeEditor::set_connecting_signal(bool p_enable) { + connecting_signal = p_enable; + update_tree(); +} + void SceneTreeEditor::_bind_methods() { ClassDB::bind_method("_tree_changed", &SceneTreeEditor::_tree_changed); @@ -1077,6 +1089,7 @@ void SceneTreeEditor::_bind_methods() { SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_open_instance) { connect_to_script_mode = false; + connecting_signal = false; undo_redo = NULL; tree_dirty = true; selected = NULL; diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index 1c14da0d3a..68642910e8 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -68,6 +68,7 @@ class SceneTreeEditor : public Control { AcceptDialog *warning; bool connect_to_script_mode; + bool connecting_signal; int blocked; @@ -155,6 +156,7 @@ public: void update_tree() { _update_tree(); } void set_connect_to_script_mode(bool p_enable); + void set_connecting_signal(bool p_enable); Tree *get_scene_tree() { return tree; } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 751ae4fcf7..ffa221edaf 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -100,17 +100,25 @@ void ScriptCreateDialog::set_inheritance_base_type(const String &p_base) { base_type = p_base; } -bool ScriptCreateDialog::_validate(const String &p_string) { +bool ScriptCreateDialog::_validate_parent(const String &p_string) { if (p_string.length() == 0) return false; - if (ScriptServer::get_language(language_menu->get_selected())->can_inherit_from_file() && p_string.is_quoted()) { + if (can_inherit_from_file && p_string.is_quoted()) { String p = p_string.substr(1, p_string.length() - 2); if (_validate_path(p, true) == "") return true; } + return ClassDB::class_exists(p_string) || ScriptServer::is_global_class(p_string); +} + +bool ScriptCreateDialog::_validate_class(const String &p_string) { + + if (p_string.length() == 0) + return false; + for (int i = 0; i < p_string.length(); i++) { if (i == 0) { @@ -118,7 +126,7 @@ bool ScriptCreateDialog::_validate(const String &p_string) { return false; // no start with number plz } - bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_' || p_string[i] == '-'; + bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_'; if (!valid_char) return false; @@ -193,7 +201,7 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must void ScriptCreateDialog::_class_name_changed(const String &p_name) { - if (_validate(class_name->get_text())) { + if (_validate_class(class_name->get_text())) { is_class_name_valid = true; } else { is_class_name_valid = false; @@ -203,7 +211,7 @@ void ScriptCreateDialog::_class_name_changed(const String &p_name) { void ScriptCreateDialog::_parent_name_changed(const String &p_parent) { - if (_validate(parent_name->get_text())) { + if (_validate_parent(parent_name->get_text())) { is_parent_name_valid = true; } else { is_parent_name_valid = false; @@ -298,27 +306,13 @@ void ScriptCreateDialog::_load_exist() { void ScriptCreateDialog::_lang_changed(int l) { - l = language_menu->get_selected(); ScriptLanguage *language = ScriptServer::get_language(l); - if (language->has_named_classes()) { - has_named_classes = true; - } else { - has_named_classes = false; - } - - if (language->supports_builtin_mode()) { - supports_built_in = true; - } else { - supports_built_in = false; + has_named_classes = language->has_named_classes(); + can_inherit_from_file = language->can_inherit_from_file(); + supports_built_in = language->supports_builtin_mode(); + if (!supports_built_in) is_built_in = false; - } - - if (ScriptServer::get_language(l)->can_inherit_from_file()) { - can_inherit_from_file = true; - } else { - can_inherit_from_file = false; - } String selected_ext = "." + language->get_extension(); String path = file_path->get_text(); @@ -430,7 +424,7 @@ void ScriptCreateDialog::_file_selected(const String &p_file) { String p = ProjectSettings::get_singleton()->localize_path(p_file); if (is_browsing_parent) { parent_name->set_text("\"" + p + "\""); - _class_name_changed("\"" + p + "\""); + _parent_name_changed(parent_name->get_text()); } else { file_path->set_text(p); _path_changed(p); @@ -445,7 +439,8 @@ void ScriptCreateDialog::_file_selected(const String &p_file) { void ScriptCreateDialog::_create() { - parent_name->set_text(select_class->get_selected_type()); + parent_name->set_text(select_class->get_selected_type().split(" ")[0]); + _parent_name_changed(parent_name->get_text()); } void ScriptCreateDialog::_browse_class_in_tree() { @@ -542,14 +537,7 @@ void ScriptCreateDialog::_update_dialog() { class_name->set_editable(false); class_name->set_placeholder(TTR("N/A")); class_name->set_placeholder_alpha(1); - } - - /* Can script inherit from a file */ - - if (can_inherit_from_file) { - parent_browse_button->set_disabled(false); - } else { - parent_browse_button->set_disabled(true); + class_name->set_text(""); } /* Is script Built-in */ @@ -572,7 +560,8 @@ void ScriptCreateDialog::_update_dialog() { if (is_built_in) { get_ok()->set_text(TTR("Create")); parent_name->set_editable(true); - parent_browse_button->set_disabled(false); + parent_search_button->set_disabled(false); + parent_browse_button->set_disabled(!can_inherit_from_file); internal->set_visible(_can_be_built_in()); internal_label->set_visible(_can_be_built_in()); _msg_path_valid(true, TTR("Built-in script (into scene file).")); @@ -580,7 +569,8 @@ void ScriptCreateDialog::_update_dialog() { // New Script Created get_ok()->set_text(TTR("Create")); parent_name->set_editable(true); - parent_browse_button->set_disabled(false); + parent_search_button->set_disabled(false); + parent_browse_button->set_disabled(!can_inherit_from_file); internal->set_visible(_can_be_built_in()); internal_label->set_visible(_can_be_built_in()); if (is_path_valid) { @@ -590,6 +580,7 @@ void ScriptCreateDialog::_update_dialog() { // Script Loaded get_ok()->set_text(TTR("Load")); parent_name->set_editable(false); + parent_search_button->set_disabled(true); parent_browse_button->set_disabled(true); internal->set_disabled(!_can_be_built_in()); if (is_path_valid) { @@ -755,7 +746,6 @@ ScriptCreateDialog::ScriptCreateDialog() { internal->set_h_size_flags(0); internal->connect("pressed", this, "_built_in_pressed"); internal_label = memnew(Label(TTR("Built-in Script"))); - internal_label->set_text(TTR("Built-in Script")); internal_label->set_align(Label::ALIGN_RIGHT); gc->add_child(internal_label); gc->add_child(internal); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index c6dba78f56..61f87f5732 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -87,7 +87,8 @@ class ScriptCreateDialog : public ConfirmationDialog { void _path_entered(const String &p_path = String()); void _lang_changed(int l = 0); void _built_in_pressed(); - bool _validate(const String &p_string); + bool _validate_parent(const String &p_string); + bool _validate_class(const String &p_string); String _validate_path(const String &p_path, bool p_file_must_exist); void _class_name_changed(const String &p_name); void _parent_name_changed(const String &p_parent); |