diff options
Diffstat (limited to 'editor')
47 files changed, 534 insertions, 184 deletions
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_data.cpp b/editor/editor_data.cpp index f61a831015..38f30df169 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -560,6 +560,7 @@ void EditorData::move_edited_scene_index(int p_idx, int p_to_idx) { ERR_FAIL_INDEX(p_to_idx, edited_scene.size()); SWAP(edited_scene.write[p_idx], edited_scene.write[p_to_idx]); } + void EditorData::remove_scene(int p_idx) { ERR_FAIL_INDEX(p_idx, edited_scene.size()); if (edited_scene[p_idx].root) { 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 43c8ef60aa..79c312b7b1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -523,6 +523,7 @@ void EditorNode::_fs_changed() { void EditorNode::_resources_reimported(const Vector<String> &p_resources) { List<String> scenes; //will load later + int current_tab = scene_tabs->get_current_tab(); for (int i = 0; i < p_resources.size(); i++) { String file_type = ResourceLoader::get_resource_type(p_resources[i]); @@ -545,6 +546,8 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) { for (List<String>::Element *E = scenes.front(); E; E = E->next()) { reload_scene(E->get()); } + + scene_tabs->set_current_tab(current_tab); } void EditorNode::_sources_changed(bool p_exist) { @@ -1214,6 +1217,17 @@ void EditorNode::save_all_scenes() { _save_all_scenes(); } +void EditorNode::save_scene_list(Vector<String> p_scene_filenames) { + + for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { + Node *scene = editor_data.get_edited_scene_root(i); + + if (scene && (p_scene_filenames.find(scene->get_filename()) >= 0)) { + _save_scene(scene->get_filename(), i); + } + } +} + void EditorNode::restart_editor() { exiting = true; @@ -1397,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(); @@ -2859,7 +2873,7 @@ bool EditorNode::is_addon_plugin_enabled(const String &p_addon) const { return plugin_addons.has(p_addon); } -void EditorNode::_remove_edited_scene() { +void EditorNode::_remove_edited_scene(bool p_change_tab) { int new_index = editor_data.get_edited_scene(); int old_index = new_index; @@ -2875,18 +2889,19 @@ void EditorNode::_remove_edited_scene() { if (editor_data.get_scene_path(old_index) != String()) { ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index)); } - _scene_tab_changed(new_index); + + if (p_change_tab) _scene_tab_changed(new_index); editor_data.remove_scene(old_index); editor_data.get_undo_redo().clear_history(false); _update_title(); _update_scene_tabs(); } -void EditorNode::_remove_scene(int index) { +void EditorNode::_remove_scene(int index, bool p_change_tab) { if (editor_data.get_edited_scene() == index) { //Scene to remove is current scene - _remove_edited_scene(); + _remove_edited_scene(p_change_tab); } else { //Scene to remove is not active scene editor_data.remove_scene(index); @@ -4182,6 +4197,14 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { return true; } +int EditorNode::get_current_tab() { + return scene_tabs->get_current_tab(); +} + +void EditorNode::set_current_tab(int p_tab) { + scene_tabs->set_current_tab(p_tab); +} + void EditorNode::_update_layouts_menu() { editor_layouts->clear(); @@ -4809,8 +4832,7 @@ void EditorNode::reload_scene(const String &p_path) { if (scene_idx == -1) { if (get_edited_scene()) { - //scene is not open, so at it might be instanced, just refresh, set tab to itself and it will reload - set_current_scene(current_tab); + //scene is not open, so at it might be instanced. We'll refresh the whole scene later. editor_data.get_undo_redo().clear_history(); } return; @@ -4820,17 +4842,19 @@ void EditorNode::reload_scene(const String &p_path) { editor_data.apply_changes_in_editors(); _set_scene_metadata(p_path); } + //remove scene - _remove_scene(scene_idx); - //reload scene + _remove_scene(scene_idx, false); + //reload scene load_scene(p_path, true, false, true, true); + //adjust index so tab is back a the previous position editor_data.move_edited_scene_to_index(scene_idx); get_undo_redo()->clear_history(); + //recover the tab scene_tabs->set_current_tab(current_tab); - _scene_tab_changed(current_tab); } int EditorNode::plugin_init_callback_count = 0; @@ -5020,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_node.h b/editor/editor_node.h index ea988cb134..f3bc95c409 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -525,8 +525,8 @@ private: static void _editor_file_dialog_unregister(EditorFileDialog *p_dialog); void _cleanup_scene(); - void _remove_edited_scene(); - void _remove_scene(int index); + void _remove_edited_scene(bool p_change_tab = true); + void _remove_scene(int index, bool p_change_tab = true); bool _find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags); bool _find_and_save_edited_subresources(Object *obj, Map<RES, bool> &processed, int32_t flags); void _save_edited_subresources(Node *scene, Map<RES, bool> &processed, int32_t flags); @@ -644,6 +644,12 @@ protected: void _notification(int p_what); static void _bind_methods(); +protected: + friend class FileSystemDock; + + int get_current_tab(); + void set_current_tab(int p_tab); + public: bool call_build(); @@ -815,6 +821,7 @@ public: void remove_tool_menu_item(const String &p_name); void save_all_scenes(); + void save_scene_list(Vector<String> p_scene_filenames); void restart_editor(); void dim_editor(bool p_dimming); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ef8456549a..4050899ccc 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -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 6a4d9fea0c..e57217bb11 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1203,6 +1203,21 @@ void FileSystemDock::_update_favorites_list_after_move(const Map<String, String> EditorSettings::get_singleton()->set_favorites(new_favorites); } +void FileSystemDock::_save_scenes_after_move(const Map<String, String> &p_renames) const { + Vector<String> remaps; + _find_remaps(EditorFileSystem::get_singleton()->get_filesystem(), p_renames, remaps); + Vector<String> new_filenames; + + for (int i = 0; i < remaps.size(); ++i) { + String file = p_renames.has(remaps[i]) ? p_renames[remaps[i]] : remaps[i]; + if (ResourceLoader::get_resource_type(file) == "PackedScene") { + new_filenames.push_back(file); + } + } + + editor->save_scene_list(new_filenames); +} + void FileSystemDock::_make_dir_confirm() { String dir_name = make_dir_dialog_text->get_text().strip_edges(); @@ -1281,14 +1296,21 @@ void FileSystemDock::_rename_operation_confirm() { Map<String, String> file_renames; Map<String, String> folder_renames; _try_move_item(to_rename, new_path, file_renames, folder_renames); + + int current_tab = editor->get_current_tab(); + _update_dependencies_after_move(file_renames); _update_resource_paths_after_move(file_renames); _update_project_settings_after_move(file_renames); _update_favorites_list_after_move(file_renames, folder_renames); - //Rescan everything + editor->set_current_tab(current_tab); + print_verbose("FileSystem: calling rescan."); _rescan(); + + print_verbose("FileSystem: saving moved scenes."); + _save_scenes_after_move(file_renames); } void FileSystemDock::_duplicate_operation_confirm() { @@ -1384,13 +1406,20 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw } if (is_moved) { + int current_tab = editor->get_current_tab(); + _update_dependencies_after_move(file_renames); _update_resource_paths_after_move(file_renames); _update_project_settings_after_move(file_renames); _update_favorites_list_after_move(file_renames, folder_renames); + editor->set_current_tab(current_tab); + print_verbose("FileSystem: calling rescan."); _rescan(); + + print_verbose("FileSystem: saving moved scenes."); + _save_scenes_after_move(file_renames); } } @@ -2040,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/filesystem_dock.h b/editor/filesystem_dock.h index 978235b328..46eaf71a8a 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -202,6 +202,7 @@ private: void _try_duplicate_item(const FileOrFolder &p_item, const String &p_new_path) const; void _update_dependencies_after_move(const Map<String, String> &p_renames) const; void _update_resource_paths_after_move(const Map<String, String> &p_renames) const; + void _save_scenes_after_move(const Map<String, String> &p_renames) const; void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const; void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const; diff --git a/editor/icons/icon_multi_mesh_instance_2d.svg b/editor/icons/icon_multi_mesh_instance_2d.svg new file mode 100644 index 0000000000..07202ac659 --- /dev/null +++ b/editor/icons/icon_multi_mesh_instance_2d.svg @@ -0,0 +1,4 @@ +<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"> +<rect x="-1" y="-1" width="582" height="402" fill="none"/> +<path d="m3 1c-1.1046 0-2 0.89543-2 2 5.6e-4 0.71397 0.38169 1.3735 1 1.7305v6.541c-0.61771 0.35664-0.99874 1.0152-1 1.7285 0 1.1046 0.89543 2 2 2 0.71397-5.6e-4 1.3735-0.38169 1.7305-1h1.2695v-2h-1.2715c-0.17478-0.30301-0.42598-0.55488-0.72852-0.73047v-5.8555l3.5859 3.5859h1.4141v-1.4141l-3.5859-3.5859h5.8574c0.17532 0.30158 0.42647 0.55205 0.72852 0.72656v1.2734h2v-1.2695c0.61831-0.35698 0.99944-1.0165 1-1.7305 0-1.1046-0.89543-2-2-2-0.71397 5.6e-4 -1.3735 0.38169-1.7305 1h-6.541c-0.35664-0.61771-1.0152-0.99874-1.7285-1zm8 7v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2z" fill="#a5b7f3" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/> +</svg> 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..fc5c8dbbb4 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -100,17 +100,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"); @@ -150,7 +152,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { 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 +196,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 +208,6 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const break; } } - //item->call("set_image",p_type,p_index,p_image); } break; } } @@ -554,7 +554,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); @@ -733,6 +733,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt image_data = cached_data; file->close(); + memdelete(file); } } @@ -807,6 +808,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 +818,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 +858,7 @@ void EditorAssetLibrary::_update_image_queue() { if (file) { headers.push_back("If-None-Match: " + file->get_line()); file->close(); + memdelete(file); } } @@ -984,7 +988,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 +1194,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); @@ -1357,7 +1361,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 +1463,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 +1478,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 +1499,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/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..f45e6a2c9a 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) { @@ -2121,6 +2128,8 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (!se->is_unsaved()) continue; 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..1b71f6800a 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(); @@ -867,6 +872,12 @@ 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); 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 4ef2d17128..5e1d818ce9 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -299,9 +299,13 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p Vector2 position; int current = manual_palette->get_current(); if (current != -1) { - position = manual_palette->get_item_metadata(current); + if (tool != TOOL_PASTING) { + position = manual_palette->get_item_metadata(current); + } else { + position = p_autotile_coord; + } } else { - // if there is no manual tile selected, that either means that + // If there is no manual tile selected, that either means that // autotiling is enabled, or the given tile is not autotiling. Either // way, the coordinate of the tile does not matter, so assigning it to // the coordinate of the existing tile works fine. @@ -309,7 +313,7 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p } if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose && prev_position == position) - return; //check that it's actually different + return; // Check that it's actually different. for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) { for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) { @@ -322,21 +326,19 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p node->_set_celld(p_pos, _create_cell_dictionary(p_value, p_flip_h, p_flip_v, p_transpose, p_autotile_coord)); + if (tool == TOOL_PASTING) + return; + if (manual_autotile || (p_value != -1 && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) { if (current != -1) { node->set_cell_autotile_coord(p_pos.x, p_pos.y, position); - - } else if (tool != TOOL_PASTING && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE && priority_atlastile) { - - // BIND_CENTER is used to indicate that bitmask should not update for this tile cell + } else if (node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE && priority_atlastile) { + // BIND_CENTER is used to indicate that bitmask should not update for this tile cell. node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), TileSet::BIND_CENTER); node->update_cell_bitmask(p_pos.x, p_pos.y); } } else { - // manually placing tiles should not update bitmasks - if (tool != TOOL_PASTING) { - node->update_bitmask_area(Point2(p_pos)); - } + node->update_bitmask_area(Point2(p_pos)); } } @@ -396,6 +398,8 @@ void TileMapEditor::_update_palette() { // Update the palette Vector<int> selected = get_selected_tiles(); + int selected_single = palette->get_current(); + int selected_manual = manual_palette->get_current(); palette->clear(); manual_palette->clear(); manual_palette->hide(); @@ -503,7 +507,7 @@ void TileMapEditor::_update_palette() { if (selected.get(0) != TileMap::INVALID_CELL) { set_selected_tiles(selected); sel_tile = selected.get(Math::rand() % selected.size()); - } else { + } else if (palette->get_item_count() > 0) { palette->select(0); } @@ -545,9 +549,10 @@ void TileMapEditor::_update_palette() { if (manual_palette->get_item_count() > 0) { // Only show the manual palette if at least tile exists in it - int selected2 = manual_palette->get_current(); - if (selected2 == -1) selected2 = 0; - manual_palette->set_current(selected2); + if (selected_manual == -1 || selected_single != palette->get_current()) + selected_manual = 0; + if (selected_manual < manual_palette->get_item_count()) + manual_palette->set_current(selected_manual); manual_palette->show(); } @@ -759,15 +764,15 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p Rect2 r = node->get_tileset()->tile_get_region(p_cell); if (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE) { Vector2 offset; - int selected = manual_palette->get_current(); - if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) { - offset = manual_palette->get_item_metadata(selected); - } else { - if (tool != TOOL_PASTING) { - offset = node->get_tileset()->autotile_get_icon_coordinate(p_cell); + if (tool != TOOL_PASTING) { + int selected = manual_palette->get_current(); + if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) { + offset = manual_palette->get_item_metadata(selected); } else { - offset = p_autotile_coord; + offset = node->get_tileset()->autotile_get_icon_coordinate(p_cell); } + } else { + offset = p_autotile_coord; } int spacing = node->get_tileset()->autotile_get_spacing(p_cell); @@ -775,7 +780,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(); @@ -787,10 +793,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) { @@ -810,10 +817,11 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p Color modulate = node->get_tileset()->tile_get_modulate(p_cell); modulate.a = 0.5; - if (r.has_no_area()) + if (r.has_no_area()) { p_viewport->draw_texture_rect(t, rect, false, modulate, p_transpose); - else + } else { p_viewport->draw_texture_rect_region(t, rect, r, modulate, p_transpose); + } } void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i p_autotile_coord, const Transform2D &p_xform) { @@ -848,7 +856,6 @@ void TileMapEditor::_update_copydata() { TileData tcd; tcd.cell = node->get_cell(j, i); - if (tcd.cell != TileMap::INVALID_CELL) { tcd.pos = Point2i(j, i); tcd.flip_h = node->is_cell_x_flipped(j, i); @@ -1980,31 +1987,31 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->connect("id_pressed", this, "_menu_option"); rotate_left_button = memnew(ToolButton); - rotate_left_button->set_tooltip(TTR("Rotate left")); + rotate_left_button->set_tooltip(TTR("Rotate Left")); rotate_left_button->set_focus_mode(FOCUS_NONE); rotate_left_button->connect("pressed", this, "_rotate", varray(-1)); tool_hb->add_child(rotate_left_button); rotate_right_button = memnew(ToolButton); - rotate_right_button->set_tooltip(TTR("Rotate right")); + rotate_right_button->set_tooltip(TTR("Rotate Right")); rotate_right_button->set_focus_mode(FOCUS_NONE); rotate_right_button->connect("pressed", this, "_rotate", varray(1)); tool_hb->add_child(rotate_right_button); flip_horizontal_button = memnew(ToolButton); - flip_horizontal_button->set_tooltip(TTR("Flip horizontally")); + flip_horizontal_button->set_tooltip(TTR("Flip Horizontally")); flip_horizontal_button->set_focus_mode(FOCUS_NONE); flip_horizontal_button->connect("pressed", this, "_flip_horizontal"); tool_hb->add_child(flip_horizontal_button); flip_vertical_button = memnew(ToolButton); - flip_vertical_button->set_tooltip(TTR("Flip vertically")); + flip_vertical_button->set_tooltip(TTR("Flip Vertically")); flip_vertical_button->set_focus_mode(FOCUS_NONE); flip_vertical_button->connect("pressed", this, "_flip_vertical"); tool_hb->add_child(flip_vertical_button); clear_transform_button = memnew(ToolButton); - clear_transform_button->set_tooltip(TTR("Clear transform")); + clear_transform_button->set_tooltip(TTR("Clear Transform")); clear_transform_button->set_focus_mode(FOCUS_NONE); clear_transform_button->connect("pressed", this, "_clear_transform"); tool_hb->add_child(clear_transform_button); 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_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 621ab039f4..c3b62810f1 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1025,7 +1025,9 @@ void ScriptEditorDebugger::_performance_draw() { int pi = which[i]; Color c = get_color("accent_color", "Editor"); float h = (float)which[i] / (float)(perf_items.size()); - c.set_hsv(Math::fmod(h + 0.4, 0.9), c.get_s() * 0.9, c.get_v() * 1.4); + // Use a darker color on light backgrounds for better visibility + float value_multiplier = EditorSettings::get_singleton()->is_dark_theme() ? 1.4 : 0.55; + c.set_hsv(Math::fmod(h + 0.4, 0.9), c.get_s() * 0.9, c.get_v() * value_multiplier); c.a = 0.6; perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x); @@ -1045,9 +1047,8 @@ void ScriptEditorDebugger::_performance_draw() { float h2 = E->get()[pi] / m; h2 = (1.0 - h2) * r.size.y; - c.a = 0.7; if (E != perf_history.front()) - perf_draw->draw_line(r.position + Point2(from, h2), r.position + Point2(from + spacing, prev), c, 2.0); + perf_draw->draw_line(r.position + Point2(from, h2), r.position + Point2(from + spacing, prev), c, Math::round(EDSCALE), true); prev = h2; E = E->next(); from -= spacing; |