diff options
Diffstat (limited to 'editor')
36 files changed, 379 insertions, 160 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index c835dda1b9..f5b5cfa848 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5273,17 +5273,17 @@ AnimationTrackEditor::AnimationTrackEditor() { VBoxContainer *cleanup_vb = memnew(VBoxContainer); cleanup_dialog->add_child(cleanup_vb); - cleanup_keys = memnew(CheckButton); + cleanup_keys = memnew(CheckBox); cleanup_keys->set_text(TTR("Remove invalid keys")); cleanup_keys->set_pressed(true); cleanup_vb->add_child(cleanup_keys); - cleanup_tracks = memnew(CheckButton); + cleanup_tracks = memnew(CheckBox); cleanup_tracks->set_text(TTR("Remove unresolved and empty tracks")); cleanup_tracks->set_pressed(true); cleanup_vb->add_child(cleanup_tracks); - cleanup_all = memnew(CheckButton); + cleanup_all = memnew(CheckBox); cleanup_all->set_text(TTR("Clean-up all animations")); cleanup_vb->add_child(cleanup_all); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 0d5a621e07..8dc2304a95 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -439,9 +439,9 @@ class AnimationTrackEditor : public VBoxContainer { SpinBox *optimize_max_angle; ConfirmationDialog *cleanup_dialog; - CheckButton *cleanup_keys; - CheckButton *cleanup_tracks; - CheckButton *cleanup_all; + CheckBox *cleanup_keys; + CheckBox *cleanup_tracks; + CheckBox *cleanup_all; ConfirmationDialog *scale_dialog; SpinBox *scale; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index d5aae7b562..2e070d7963 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -161,7 +161,8 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) result_line = line; result_col = col; - set_error(""); + _update_results_count(); + set_error(vformat(TTR("Found %d matches(s)."), results_count)); } else { result_line = -1; result_col = -1; @@ -184,6 +185,8 @@ void FindReplaceBar::_replace() { text_edit->insert_text_at_cursor(get_replace_text()); text_edit->end_complex_operation(); + + results_count = -1; } search_current(); @@ -271,6 +274,7 @@ void FindReplaceBar::_replace_all() { set_error(vformat(TTR("Replaced %d occurrence(s)."), rc)); text_edit->call_deferred("connect", "text_changed", this, "_editor_text_changed"); + results_count = -1; } void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { @@ -297,6 +301,36 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { } } +void FindReplaceBar::_update_results_count() { + if (results_count != -1) + return; + + results_count = 0; + + String searched = get_search_text(); + if (searched.empty()) return; + + String full_text = text_edit->get_text(); + + int from_pos = 0; + + while (true) { + int pos = is_case_sensitive() ? full_text.find(searched, from_pos) : full_text.findn(searched, from_pos); + if (pos == -1) break; + + if (is_whole_words()) { + from_pos++; // Making sure we won't hit the same match next time, if we get out via a continue. + if (pos > 0 && !is_symbol(full_text[pos - 1])) + continue; + if (pos + searched.length() < full_text.length() && !is_symbol(full_text[pos + searched.length()])) + continue; + } + + results_count++; + from_pos = pos + searched.length(); + } +} + bool FindReplaceBar::search_current() { uint32_t flags = 0; @@ -341,7 +375,11 @@ bool FindReplaceBar::search_prev() { bool FindReplaceBar::search_next() { uint32_t flags = 0; - String text = get_search_text(); + String text; + if (replace_all_mode) + text = get_replace_text(); + else + text = get_search_text(); if (is_whole_words()) flags |= TextEdit::SEARCH_WHOLE_WORDS; @@ -416,11 +454,13 @@ void FindReplaceBar::popup_replace() { void FindReplaceBar::_search_options_changed(bool p_pressed) { + results_count = -1; search_current(); } void FindReplaceBar::_editor_text_changed() { + results_count = -1; if (is_visible_in_tree()) { preserve_cursor = true; search_current(); @@ -430,6 +470,7 @@ void FindReplaceBar::_editor_text_changed() { void FindReplaceBar::_search_text_changed(const String &p_text) { + results_count = -1; search_current(); } @@ -482,6 +523,7 @@ void FindReplaceBar::set_error(const String &p_label) { void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) { + results_count = -1; text_edit = p_text_edit; text_edit->connect("text_changed", this, "_editor_text_changed"); } @@ -508,6 +550,7 @@ void FindReplaceBar::_bind_methods() { FindReplaceBar::FindReplaceBar() { + results_count = -1; replace_all_mode = false; preserve_cursor = false; @@ -734,15 +777,54 @@ void CodeTextEditor::_complete_request() { if (entries.size() == 0) return; - Vector<String> options; - options.resize(entries.size()); - size_t i = 0; for (List<ScriptCodeCompletionOption>::Element *E = entries.front(); E; E = E->next()) { - options.write[i] = E->get().insert_text; - i++; + E->get().icon = _get_completion_icon(E->get()); } + text_editor->code_complete(entries, forced); +} - text_editor->code_complete(options, forced); +Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) { + Ref<Texture> tex; + switch (p_option.kind) { + case ScriptCodeCompletionOption::KIND_CLASS: { + if (has_icon(p_option.display, "EditorIcons")) { + tex = get_icon(p_option.display, "EditorIcons"); + } else { + tex = get_icon("Object", "EditorIcons"); + } + } break; + case ScriptCodeCompletionOption::KIND_ENUM: + tex = get_icon("Enum", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_FILE_PATH: + tex = get_icon("File", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_NODE_PATH: + tex = get_icon("NodePath", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_VARIABLE: + tex = get_icon("Variant", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_CONSTANT: + tex = get_icon("MemberConstant", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_MEMBER: + tex = get_icon("MemberProperty", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_SIGNAL: + tex = get_icon("MemberSignal", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_FUNCTION: + tex = get_icon("MemberMethod", "EditorIcons"); + break; + case ScriptCodeCompletionOption::KIND_PLAIN_TEXT: + tex = get_icon("CubeMesh", "EditorIcons"); + break; + default: + tex = get_icon("String", "EditorIcons"); + break; + } + return tex; } void CodeTextEditor::_font_resize_timeout() { diff --git a/editor/code_editor.h b/editor/code_editor.h index 2653a8cecc..700e72627c 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -83,11 +83,13 @@ class FindReplaceBar : public HBoxContainer { int result_line; int result_col; + int results_count; bool replace_all_mode; bool preserve_cursor; void _get_search_from(int &r_line, int &r_col); + void _update_results_count(); void _show_search(); void _hide_bar(); @@ -162,6 +164,7 @@ class CodeTextEditor : public VBoxContainer { void _update_font(); void _complete_request(); + Ref<Texture> _get_completion_icon(const ScriptCodeCompletionOption &p_option); void _font_resize_timeout(); bool _add_font_size(int p_delta); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 547d627925..8a8d52c6f1 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -210,13 +210,13 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p if (is_subsequence_of_type && !is_selected_equal) { if (is_substring_of_type) { - if (!is_substring_of_selected || (is_substring_of_selected && (current_type_prefered && !selected_type_prefered))) { + if (!is_substring_of_selected || (current_type_prefered && !selected_type_prefered)) { *to_select = item; } } else { // substring results weigh more than subsequences, so let's make sure we don't override them if (!is_substring_of_selected) { - if (!is_subsequence_of_selected || (is_subsequence_of_selected && (current_type_prefered && !selected_type_prefered))) { + if (!is_subsequence_of_selected || (current_type_prefered && !selected_type_prefered)) { *to_select = item; } } diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 9a049f3ae3..5f8660e108 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -474,7 +474,7 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector< removed_deps.sort(); if (removed_deps.empty()) { owners->hide(); - text->set_text(TTR("Remove selected files from the project? (no undo)")); + text->set_text(TTR("Remove selected files from the project? (Can't be restored)")); set_size(Size2()); popup_centered(); } else { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index b9fb532c4a..2180742bbb 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -76,9 +76,9 @@ void EditorAudioBus::_notification(int p_what) { 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"); + Color solo_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.0, 0.92, 0.44); + Color mute_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(1.0, 0.44, 0.44); + Color bypass_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0); solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); solo->add_color_override("icon_color_pressed", solo_color); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 9c10c05b59..ed262d9c4f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -899,7 +899,7 @@ Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObj return OK; } -Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files) { +Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) { EditorProgress ep("savepack", TTR("Packing"), 102, true); @@ -921,9 +921,34 @@ 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); - f->store_32(0x43504447); //GDPK + FileAccess *f; + int64_t embed_pos = 0; + if (!p_embed) { + // Regular output to separate PCK file + f = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_V(!f, ERR_CANT_CREATE); + } else { + // Append to executable + f = FileAccess::open(p_path, FileAccess::READ_WRITE); + ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN); + + f->seek_end(); + embed_pos = f->get_position(); + + if (r_embedded_start) { + *r_embedded_start = embed_pos; + } + + // Ensure embedded PCK starts at a 64-bit multiple + int pad = f->get_position() % 8; + for (int i = 0; i < pad; i++) { + f->store_8(0); + } + } + + int64_t pck_start_pos = f->get_position(); + + f->store_32(0x43504447); //GDPC f->store_32(1); //pack version f->store_32(VERSION_MAJOR); f->store_32(VERSION_MINOR); @@ -935,29 +960,29 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c f->store_32(pd.file_ofs.size()); //amount of files - size_t header_size = f->get_position(); + int64_t header_size = f->get_position(); //precalculate header size for (int i = 0; i < pd.file_ofs.size(); i++) { header_size += 4; // size of path string (32 bits is enough) - uint32_t string_len = pd.file_ofs[i].path_utf8.length(); + int string_len = pd.file_ofs[i].path_utf8.length(); header_size += string_len + _get_pad(4, string_len); ///size of path string header_size += 8; // offset to file _with_ header size included header_size += 8; // size of file header_size += 16; // md5 } - size_t header_padding = _get_pad(PCK_PADDING, header_size); + int header_padding = _get_pad(PCK_PADDING, header_size); for (int i = 0; i < pd.file_ofs.size(); i++) { - uint32_t string_len = pd.file_ofs[i].path_utf8.length(); - uint32_t pad = _get_pad(4, string_len); - ; + int string_len = pd.file_ofs[i].path_utf8.length(); + int pad = _get_pad(4, string_len); + f->store_32(string_len + pad); f->store_buffer((const uint8_t *)pd.file_ofs[i].path_utf8.get_data(), string_len); - for (uint32_t j = 0; j < pad; j++) { + for (int j = 0; j < pad; j++) { f->store_8(0); } @@ -966,7 +991,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c f->store_buffer(pd.file_ofs[i].md5.ptr(), 16); //also save md5 for file } - for (uint32_t j = 0; j < header_padding; j++) { + for (int i = 0; i < header_padding; i++) { f->store_8(0); } @@ -992,7 +1017,23 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c memdelete(ftmp); - f->store_32(0x43504447); //GDPK + if (p_embed) { + // Ensure embedded data ends at a 64-bit multiple + int64_t embed_end = f->get_position() - embed_pos + 12; + int pad = embed_end % 8; + for (int i = 0; i < pad; i++) { + f->store_8(0); + } + + int64_t pck_size = f->get_position() - pck_start_pos; + f->store_64(pck_size); + f->store_32(0x43504447); //GDPC + + if (r_embedded_size) { + *r_embedded_size = f->get_position() - embed_pos; + } + } + memdelete(f); return OK; @@ -1399,6 +1440,7 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/no_bptc_fallbacks"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), "")); } @@ -1516,12 +1558,33 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); Error err = da->copy(template_path, p_path, get_chmod_flags()); + memdelete(da); + if (err == OK) { - String pck_path = p_path.get_basename() + ".pck"; + String pck_path; + if (p_preset->get("binary_format/embed_pck")) { + pck_path = p_path; + } else { + pck_path = p_path.get_basename() + ".pck"; + } Vector<SharedObject> so_files; - err = save_pack(p_preset, pck_path, &so_files); + int64_t embedded_pos; + int64_t embedded_size; + err = save_pack(p_preset, pck_path, &so_files, p_preset->get("binary_format/embed_pck"), &embedded_pos, &embedded_size); + if (err == OK && p_preset->get("binary_format/embed_pck")) { + + if (embedded_size >= 0x100000000 && !p_preset->get("binary_format/64_bits")) { + EditorNode::get_singleton()->show_warning(TTR("On 32-bit exports the embedded PCK cannot be bigger than 4 GiB.")); + return ERR_UNAVAILABLE; + } + + FixUpEmbeddedPckFunc fixup_func = get_fixup_embedded_pck_func(); + if (fixup_func) { + err = fixup_func(p_path, embedded_pos, embedded_size); + } + } if (err == OK && !so_files.empty()) { //if shared object files, copy them @@ -1529,10 +1592,10 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr for (int i = 0; i < so_files.size() && err == OK; i++) { err = da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file())); } + memdelete(da); } } - memdelete(da); return err; } @@ -1603,9 +1666,20 @@ void EditorExportPlatformPC::set_chmod_flags(int p_flags) { chmod_flags = p_flags; } +EditorExportPlatformPC::FixUpEmbeddedPckFunc EditorExportPlatformPC::get_fixup_embedded_pck_func() const { + + return fixup_embedded_pck_func; +} + +void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func) { + + fixup_embedded_pck_func = p_fixup_embedded_pck_func; +} + EditorExportPlatformPC::EditorExportPlatformPC() { chmod_flags = -1; + fixup_embedded_pck_func = NULL; } /////////////////////// diff --git a/editor/editor_export.h b/editor/editor_export.h index 7c01abe0e9..3152e249bd 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -240,7 +240,7 @@ public: Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = NULL); - Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL); + Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL, bool p_embed = false, int64_t *r_embedded_start = NULL, int64_t *r_embedded_size = NULL); Error save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path); virtual bool poll_devices() { return false; } @@ -391,6 +391,10 @@ class EditorExportPlatformPC : public EditorExportPlatform { GDCLASS(EditorExportPlatformPC, EditorExportPlatform); +public: + typedef Error (*FixUpEmbeddedPckFunc)(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size); + +private: Ref<ImageTexture> logo; String name; String os_name; @@ -405,6 +409,8 @@ class EditorExportPlatformPC : public EditorExportPlatform { int chmod_flags; + FixUpEmbeddedPckFunc fixup_embedded_pck_func; + public: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features); @@ -436,6 +442,9 @@ public: int get_chmod_flags() const; void set_chmod_flags(int p_flags); + FixUpEmbeddedPckFunc get_fixup_embedded_pck_func() const; + void set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func); + EditorExportPlatformPC(); }; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index d1f765a312..cd5d26e577 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1348,39 +1348,39 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { if (col.begins_with("#")) color = Color::html(col); else if (col == "aqua") - color = Color::html("#00FFFF"); + color = Color(0, 1, 1); else if (col == "black") - color = Color::html("#000000"); + color = Color(0, 0, 0); else if (col == "blue") - color = Color::html("#0000FF"); + color = Color(0, 0, 1); else if (col == "fuchsia") - color = Color::html("#FF00FF"); + color = Color(1, 0, 1); else if (col == "gray" || col == "grey") - color = Color::html("#808080"); + color = Color(0.5, 0.5, 0.5); else if (col == "green") - color = Color::html("#008000"); + color = Color(0, 0.5, 0); else if (col == "lime") - color = Color::html("#00FF00"); + color = Color(0, 1, 0); else if (col == "maroon") - color = Color::html("#800000"); + color = Color(0.5, 0, 0); else if (col == "navy") - color = Color::html("#000080"); + color = Color(0, 0, 0.5); else if (col == "olive") - color = Color::html("#808000"); + color = Color(0.5, 0.5, 0); else if (col == "purple") - color = Color::html("#800080"); + color = Color(0.5, 0, 0.5); else if (col == "red") - color = Color::html("#FF0000"); + color = Color(1, 0, 0); else if (col == "silver") - color = Color::html("#C0C0C0"); + color = Color(0.75, 0.75, 0.75); else if (col == "teal") - color = Color::html("#008008"); + color = Color(0, 0.5, 0.5); else if (col == "white") - color = Color::html("#FFFFFF"); + color = Color(1, 1, 1); else if (col == "yellow") - color = Color::html("#FFFF00"); + color = Color(1, 1, 0); else - color = Color(0, 0, 0, 1); //base_color; + color = Color(0, 0, 0); //base_color; p_rt->push_color(color); pos = brk_end + 1; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 4ec24c76f2..fbfc999dbf 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -337,7 +337,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { 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(); + 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())) || @@ -405,7 +405,7 @@ bool EditorHelpSearch::Runner::_phase_member_items() { ClassMatch &match = iterator_match->value(); - TreeItem *parent = search_flags & SEARCH_SHOW_HIERARCHY ? class_items[match.doc->name] : root_item; + TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item; for (int i = 0; i < match.methods.size(); i++) _create_method_item(parent, match.doc, match.methods[i]); for (int i = 0; i < match.signals.size(); i++) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d9600172d7..1e9cb2f88d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2622,6 +2622,13 @@ void EditorNode::_exit_editor() { exiting = true; resource_preview->stop(); //stop early to avoid crashes _save_docks(); + + // Dim the editor window while it's quitting to make it clearer that it's busy. + // No transition is applied, as the effect needs to be visible immediately + float c = 1.0f - float(EDITOR_GET("interface/editor/dim_amount")); + Color dim_color = Color(c, c, c); + gui_base->set_modulate(dim_color); + get_tree()->quit(); } @@ -4960,18 +4967,18 @@ void EditorNode::dim_editor(bool p_dimming) { static int dim_count = 0; bool dim_ui = EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup"); if (p_dimming) { - if (dim_ui) { - if (dim_count == 0) { - _start_dimming(true); - } - dim_count++; + if (dim_ui && dim_count == 0) { + _start_dimming(true); } + dim_count++; } else { if (dim_count == 1) { _start_dimming(false); - dim_count = 0; - } else if (dim_ui && dim_count > 0) { + } + if (dim_count > 0) { dim_count--; + } else { + ERR_PRINT("Undimmed before dimming!"); } } } @@ -6258,7 +6265,7 @@ EditorNode::EditorNode() { file_export_lib->set_title(TTR("Export Library")); file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE); file_export_lib->connect("file_selected", this, "_dialog_action"); - file_export_lib_merge = memnew(CheckButton); + file_export_lib_merge = memnew(CheckBox); file_export_lib_merge->set_text(TTR("Merge With Existing")); file_export_lib_merge->set_pressed(true); file_export_lib->get_vbox()->add_child(file_export_lib_merge); diff --git a/editor/editor_node.h b/editor/editor_node.h index ca64126c60..733f29c8ff 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -330,7 +330,7 @@ private: EditorFileDialog *file_export; EditorFileDialog *file_export_lib; EditorFileDialog *file_script; - CheckButton *file_export_lib_merge; + CheckBox *file_export_lib_merge; LineEdit *file_export_password; String current_path; MenuButton *update_spinner; diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 90d6c3a983..c2a845653e 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -220,7 +220,7 @@ EditorSelection *EditorInterface::get_selection() { return EditorNode::get_singleton()->get_editor_selection(); } -EditorSettings *EditorInterface::get_editor_settings() { +Ref<EditorSettings> EditorInterface::get_editor_settings() { return EditorSettings::get_singleton(); } diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index ec369bbdbb..75c230adb7 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -87,7 +87,7 @@ public: EditorSelection *get_selection(); //EditorImportExport *get_import_export(); - EditorSettings *get_editor_settings(); + Ref<EditorSettings> get_editor_settings(); EditorResourcePreview *get_resource_previewer(); EditorFileSystem *get_resource_file_system(); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 9cf36f162d..471742948f 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -340,7 +340,7 @@ void EditorProfiler::_update_plot() { } } - wr = PoolVector<uint8_t>::Write(); + wr.release(); Ref<Image> img; img.instance(); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ecc63b1a8d..2c0449398e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -354,9 +354,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT); _initial_set("interface/theme/icon_and_font_color", 0); hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT); - _initial_set("interface/theme/base_color", Color::html("#323b4f")); + _initial_set("interface/theme/base_color", Color(0.2, 0.23, 0.31)); hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT); - _initial_set("interface/theme/accent_color", Color::html("#699ce8")); + _initial_set("interface/theme/accent_color", Color(0.41, 0.61, 0.91)); hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT); _initial_set("interface/theme/contrast", 0.25); hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01"); @@ -505,10 +505,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/grid_map/pick_distance", 5000.0); // 3D - _initial_set("editors/3d/primary_grid_color", Color::html("909090")); + _initial_set("editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56)); hints["editors/3d/primary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/primary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("editors/3d/secondary_grid_color", Color::html("606060")); + _initial_set("editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38)); hints["editors/3d/secondary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/secondary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("editors/3d/grid_size", 50); @@ -648,32 +648,32 @@ void EditorSettings::_load_default_text_editor_theme() { bool dark_theme = is_dark_theme(); - _initial_set("text_editor/highlighting/symbol_color", Color::html("badfff")); - _initial_set("text_editor/highlighting/keyword_color", Color::html("ffffb3")); - _initial_set("text_editor/highlighting/base_type_color", Color::html("a4ffd4")); - _initial_set("text_editor/highlighting/engine_type_color", Color::html("83d3ff")); - _initial_set("text_editor/highlighting/comment_color", Color::html("676767")); - _initial_set("text_editor/highlighting/string_color", Color::html("ef6ebe")); - _initial_set("text_editor/highlighting/background_color", dark_theme ? Color::html("3b000000") : Color::html("#323b4f")); - _initial_set("text_editor/highlighting/completion_background_color", Color::html("2C2A32")); - _initial_set("text_editor/highlighting/completion_selected_color", Color::html("434244")); - _initial_set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); - _initial_set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); - _initial_set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); - _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa")); - _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa")); - _initial_set("text_editor/highlighting/safe_line_number_color", Color::html("99aac8aa")); - _initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa")); - _initial_set("text_editor/highlighting/caret_background_color", Color::html("000000")); - _initial_set("text_editor/highlighting/text_selected_color", Color::html("000000")); - _initial_set("text_editor/highlighting/selection_color", Color::html("5a699ce8")); + _initial_set("text_editor/highlighting/symbol_color", Color(0.73, 0.87, 1.0)); + _initial_set("text_editor/highlighting/keyword_color", Color(1.0, 1.0, 0.7)); + _initial_set("text_editor/highlighting/base_type_color", Color(0.64, 1.0, 0.83)); + _initial_set("text_editor/highlighting/engine_type_color", Color(0.51, 0.83, 1.0)); + _initial_set("text_editor/highlighting/comment_color", Color(0.4, 0.4, 0.4)); + _initial_set("text_editor/highlighting/string_color", Color(0.94, 0.43, 0.75)); + _initial_set("text_editor/highlighting/background_color", dark_theme ? Color(0.0, 0.0, 0.0, 0.23) : Color(0.2, 0.23, 0.31)); + _initial_set("text_editor/highlighting/completion_background_color", Color(0.17, 0.16, 0.2)); + _initial_set("text_editor/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27)); + _initial_set("text_editor/highlighting/completion_existing_color", Color(0.13, 0.87, 0.87, 0.87)); + _initial_set("text_editor/highlighting/completion_scroll_color", Color(1, 1, 1)); + _initial_set("text_editor/highlighting/completion_font_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/highlighting/text_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4)); + _initial_set("text_editor/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6)); + _initial_set("text_editor/highlighting/caret_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/highlighting/caret_background_color", Color(0, 0, 0)); + _initial_set("text_editor/highlighting/text_selected_color", Color(0, 0, 0)); + _initial_set("text_editor/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35)); _initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); _initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); _initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1)); _initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); - _initial_set("text_editor/highlighting/number_color", Color::html("EB9532")); - _initial_set("text_editor/highlighting/function_color", Color::html("66a2ce")); - _initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59")); + _initial_set("text_editor/highlighting/number_color", Color(0.92, 0.58, 0.2)); + _initial_set("text_editor/highlighting/function_color", Color(0.4, 0.64, 0.81)); + _initial_set("text_editor/highlighting/member_variable_color", Color(0.9, 0.31, 0.35)); _initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); _initial_set("text_editor/highlighting/bookmark_color", Color(0.08, 0.49, 0.98)); _initial_set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)); @@ -1579,6 +1579,8 @@ void EditorSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("get_recent_dirs"), &EditorSettings::get_recent_dirs); ADD_SIGNAL(MethodInfo("settings_changed")); + + BIND_CONSTANT(NOTIFICATION_EDITOR_SETTINGS_CHANGED); } EditorSettings::EditorSettings() { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ff38b4b650..4eceb09792 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -257,44 +257,44 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Please, use alphabet order if you've added new theme here(After "Default" and "Custom") if (preset == "Default") { - preset_accent_color = Color::html("#699ce8"); - preset_base_color = Color::html("#323b4f"); + preset_accent_color = Color(0.41, 0.61, 0.91); + preset_base_color = Color(0.2, 0.23, 0.31); preset_contrast = default_contrast; } else if (preset == "Custom") { accent_color = EDITOR_GET("interface/theme/accent_color"); base_color = EDITOR_GET("interface/theme/base_color"); contrast = EDITOR_GET("interface/theme/contrast"); } else if (preset == "Alien") { - preset_accent_color = Color::html("#1bfe99"); - preset_base_color = Color::html("#2f373f"); + preset_accent_color = Color(0.11, 1.0, 0.6); + preset_base_color = Color(0.18, 0.22, 0.25); preset_contrast = 0.25; } else if (preset == "Arc") { - preset_accent_color = Color::html("#5294e2"); - preset_base_color = Color::html("#383c4a"); + preset_accent_color = Color(0.32, 0.58, 0.89); + preset_base_color = Color(0.22, 0.24, 0.29); preset_contrast = 0.25; } else if (preset == "Godot 2") { - preset_accent_color = Color::html("#86ace2"); - preset_base_color = Color::html("#3C3A44"); + preset_accent_color = Color(0.53, 0.67, 0.89); + preset_base_color = Color(0.24, 0.23, 0.27); preset_contrast = 0.25; } else if (preset == "Grey") { - preset_accent_color = Color::html("#b8e4ff"); - preset_base_color = Color::html("#3d3d3d"); + preset_accent_color = Color(0.72, 0.89, 1.0); + preset_base_color = Color(0.24, 0.24, 0.24); preset_contrast = 0.2; } else if (preset == "Light") { - preset_accent_color = Color::html("#2070ff"); - preset_base_color = Color::html("#ffffff"); + preset_accent_color = Color(0.13, 0.44, 1.0); + preset_base_color = Color(1, 1, 1); preset_contrast = 0.08; } else if (preset == "Solarized (Dark)") { - preset_accent_color = Color::html("#268bd2"); - preset_base_color = Color::html("#073642"); + preset_accent_color = Color(0.15, 0.55, 0.82); + preset_base_color = Color(0.03, 0.21, 0.26); preset_contrast = 0.23; } else if (preset == "Solarized (Light)") { - preset_accent_color = Color::html("#268bd2"); - preset_base_color = Color::html("#fdf6e3"); + preset_accent_color = Color(0.15, 0.55, 0.82); + preset_base_color = Color(0.99, 0.96, 0.89); preset_contrast = 0.06; } else { // Default - preset_accent_color = Color::html("#699ce8"); - preset_base_color = Color::html("#323b4f"); + preset_accent_color = Color(0.41, 0.61, 0.91); + preset_base_color = Color(0.2, 0.23, 0.31); preset_contrast = default_contrast; } @@ -1088,14 +1088,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.7); // editor main color - const Color main_color = Color::html(dark_theme ? "#57b3ff" : "#0480ff"); + const Color main_color = dark_theme ? Color(0.34, 0.7, 1.0) : Color(0.02, 0.5, 1.0); - const Color symbol_color = Color::html("#5792ff").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); - const Color keyword_color = Color::html("#ff7185"); - const Color basetype_color = Color::html(dark_theme ? "#42ffc2" : "#00c161"); + const Color symbol_color = Color(0.34, 0.57, 1.0).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); + const Color keyword_color = Color(1.0, 0.44, 0.52); + const Color basetype_color = dark_theme ? Color(0.26, 1.0, 0.76) : Color(0.0, 0.76, 0.38); const Color type_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.7 : 0.5); const Color comment_color = dim_color; - const Color string_color = Color::html(dark_theme ? "#ffd942" : "#ffd118").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); + const Color string_color = (dark_theme ? Color(1.0, 0.85, 0.26) : Color(1.0, 0.82, 0.09)).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); const Color te_background_color = dark_theme ? background_color : base_color; const Color completion_background_color = dark_theme ? base_color : background_color; diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 1787a3b88d..e728dbac31 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -62,6 +62,10 @@ String ResourceImporterWAV::get_resource_type() const { bool ResourceImporterWAV::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { + if (p_option == "force/max_rate_hz" && !bool(p_options["force/max_rate"])) { + return false; + } + return true; } @@ -77,7 +81,7 @@ void ResourceImporterWAV::get_import_options(List<ImportOption> *r_options, int r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/8_bit"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/mono"), false)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/max_rate"), false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/max_rate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "force/max_rate_hz", PROPERTY_HINT_EXP_RANGE, "11025,192000,1"), 44100)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/trim"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/normalize"), true)); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 285823d95a..d260b171a8 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -676,7 +676,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S } } - imgdata = PoolVector<uint8_t>::Write(); + imgdata.release(); //post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index cae705a697..d59efe49e7 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -144,7 +144,7 @@ void MultiMeshEditor::_populate() { } } - w = PoolVector<Face3>::Write(); + w.release(); PoolVector<Face3> faces = geometry; ERR_EXPLAIN(TTR("Parent has no solid faces to populate.")); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index f05e7d65d3..75d31459e8 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -197,7 +197,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { } } - w = PoolVector<Face3>::Write(); + w.release(); emission_dialog->popup_centered(Size2(300, 130)); } diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 04d13f0027..994c542187 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -190,7 +190,7 @@ void ShaderTextEditor::_check_shader_mode() { } } -void ShaderTextEditor::_code_complete_script(const String &p_code, List<String> *r_options) { +void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) { _check_shader_mode(); diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index f01e39189f..8e55a1ad70 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -53,7 +53,7 @@ protected: static void _bind_methods(); virtual void _load_theme_settings(); - virtual void _code_complete_script(const String &p_code, List<String> *r_options); + virtual void _code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options); public: virtual void _validate_script(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 7f7ae8f273..fc72f25b04 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -6048,7 +6048,6 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const void EditorSpatialGizmoPlugin::create_handle_material(const String &p_name, bool p_billboard) { Ref<SpatialMaterial> handle_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - handle_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); handle_material->set_flag(SpatialMaterial::FLAG_USE_POINT_SIZE, true); Ref<Texture> handle_t = SpatialEditor::get_singleton()->get_icon("Editor3DHandle", "EditorIcons"); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 3bddc6d6d4..0404115269 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -119,7 +119,7 @@ public: void set_spatial_node(Spatial *p_node); Spatial *get_spatial_node() const { return spatial_node; } - EditorSpatialGizmoPlugin *get_plugin() const { return gizmo_plugin; } + Ref<EditorSpatialGizmoPlugin> get_plugin() const { return gizmo_plugin; } Vector3 get_handle_pos(int p_idx) const; bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum); bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 35cfdf15be..2b59787f17 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1491,7 +1491,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { w[i] = current_shape[i] - shape_anchor; } - w = PoolVector<Vector2>::Write(); + w.release(); undo_redo->create_action(TTR("Edit Occlusion Polygon")); undo_redo->add_do_method(edited_occlusion_shape.ptr(), "set_polygon", polygon); @@ -1514,7 +1514,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { indices.push_back(i); } - w = PoolVector<Vector2>::Write(); + w.release(); undo_redo->create_action(TTR("Edit Navigation Polygon")); undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon); @@ -2785,7 +2785,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { w[i] = current_shape[i] - shape_anchor; } - w = PoolVector<Vector2>::Write(); + w.release(); shape->set_polygon(polygon); undo_redo->create_action(TTR("Create Occlusion Polygon")); @@ -2813,7 +2813,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { indices.push_back(i); } - w = PoolVector<Vector2>::Write(); + w.release(); shape->set_vertices(polygon); shape->add_polygon(indices); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 7b4ae0f2e9..3ab2ae1643 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -365,10 +365,10 @@ void VisualShaderEditor::_update_graph() { } static const Color type_color[4] = { - Color::html("#61daf4"), // scalar - Color::html("#d67dee"), // vector - Color::html("#8da6f0"), // boolean - Color::html("#f6a86e") // transform + Color(0.38, 0.85, 0.96), // scalar + Color(0.84, 0.49, 0.93), // vector + Color(0.55, 0.65, 0.94), // boolean + Color(0.96, 0.66, 0.43) // transform }; List<VisualShader::Connection> connections; diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 40343cf908..cc9e14975f 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -131,7 +131,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und vbc_substitute->set_name(TTR("Substitute")); tabc_features->add_child(vbc_substitute); - cbut_substitute = memnew(CheckButton); + cbut_substitute = memnew(CheckBox); cbut_substitute->set_text(TTR("Substitute")); vbc_substitute->add_child(cbut_substitute); @@ -246,7 +246,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height)); tabc_features->add_child(vbc_regex); - cbut_regex = memnew(CheckButton); + cbut_regex = memnew(CheckBox); cbut_regex->set_text(TTR("Regular Expressions")); vbc_regex->add_child(cbut_regex); @@ -258,7 +258,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und vbc_process->set_custom_minimum_size(Size2(0, feature_min_height)); tabc_features->add_child(vbc_process); - cbut_process = memnew(CheckButton); + cbut_process = memnew(CheckBox); cbut_process->set_text(TTR("Post-Process")); vbc_process->add_child(cbut_process); diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h index 4e0fab6a9f..9f0fbf66a1 100644 --- a/editor/rename_dialog.h +++ b/editor/rename_dialog.h @@ -32,7 +32,6 @@ #define RENAME_DIALOG_H #include "scene/gui/check_box.h" -#include "scene/gui/check_button.h" #include "scene/gui/dialogs.h" #include "scene/gui/option_button.h" #include "scene/gui/spin_box.h" @@ -75,9 +74,9 @@ class RenameDialog : public ConfirmationDialog { TabContainer *tabc_features; - CheckButton *cbut_substitute; - CheckButton *cbut_regex; - CheckButton *cbut_process; + CheckBox *cbut_substitute; + CheckBox *cbut_regex; + CheckBox *cbut_process; CheckBox *chk_per_level_counter; Button *but_insert_name; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 442de08ffa..935946bf24 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -439,6 +439,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } script_create_dialog->connect("script_created", this, "_script_created"); script_create_dialog->connect("popup_hide", this, "_script_creation_closed"); + script_create_dialog->set_inheritance_base_type("Node"); script_create_dialog->config(inherits, path); script_create_dialog->popup_centered(); @@ -568,10 +569,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *dupsingle = NULL; List<Node *> editable_children; - for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { + selection.sort_custom<Node::Comparator>(); + + for (List<Node *>::Element *E = selection.back(); E; E = E->prev()) { Node *node = E->get(); Node *parent = node->get_parent(); + Node *selection_tail = _get_selection_group_tail(node, selection); List<Node *> owned; node->get_owned_by(node->get_owner(), &owned); @@ -589,7 +593,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { dup->set_name(parent->validate_child_name(dup)); - editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", node, dup); + editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", selection_tail, dup); for (List<Node *>::Element *F = owned.front(); F; F = F->next()) { if (!duplimap.has(F->get())) { @@ -597,7 +601,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { continue; } Node *d = duplimap[F->get()]; - editor_data->get_undo_redo().add_do_method(d, "set_owner", node->get_owner()); + editor_data->get_undo_redo().add_do_method(d, "set_owner", selection_tail->get_owner()); } editor_data->get_undo_redo().add_do_method(editor_selection, "add_node", dup); editor_data->get_undo_redo().add_undo_method(parent, "remove_child", dup); @@ -1884,6 +1888,23 @@ void SceneTreeDock::_selection_changed() { _update_script_button(); } +Node *SceneTreeDock::_get_selection_group_tail(Node *p_node, List<Node *> p_list) { + + Node *tail = p_node; + Node *parent = tail->get_parent(); + + for (int i = p_node->get_position_in_parent(); i < parent->get_child_count(); i++) { + Node *sibling = parent->get_child(i); + + if (p_list.find(sibling)) + tail = sibling; + else + break; + } + + return tail; +} + void SceneTreeDock::_create() { if (current_option == TOOL_NEW) { @@ -2225,23 +2246,20 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) { void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) { - Vector<Node *> nodes; - Node *to_node; - - for (int i = 0; i < p_nodes.size(); i++) { - Node *n = get_node((p_nodes[i])); - if (n) { - nodes.push_back(n); - } - } + List<Node *> selection = editor_selection->get_selected_node_list(); - if (nodes.size() == 0) - return; + if (selection.empty()) + return; //nothing to reparent - to_node = get_node(p_to); + Node *to_node = get_node(p_to); if (!to_node) return; + Vector<Node *> nodes; + for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { + nodes.push_back(E->get()); + } + int to_pos = -1; _normalize_drop(to_node, to_pos, p_type); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 3729e27ce6..8a2b237b8b 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -195,6 +195,7 @@ class SceneTreeDock : public VBoxContainer { bool _validate_no_foreign(); void _selection_changed(); void _update_script_button(); + Node *_get_selection_group_tail(Node *p_node, List<Node *> p_list); void _fill_path_renames(Vector<StringName> base_path, Vector<StringName> new_base_path, Node *p_node, List<Pair<NodePath, NodePath> > *p_renames); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index ff188a00d3..445ca3a792 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -1164,6 +1164,8 @@ void SceneTreeDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", this, "_select"); + filter->set_right_icon(get_icon("Search", "EditorIcons")); + filter->set_clear_button_enabled(true); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", this, "_select"); @@ -1187,20 +1189,37 @@ void SceneTreeDialog::_select() { } } +void SceneTreeDialog::_filter_changed(const String &p_filter) { + + tree->set_filter(p_filter); +} + void SceneTreeDialog::_bind_methods() { ClassDB::bind_method("_select", &SceneTreeDialog::_select); ClassDB::bind_method("_cancel", &SceneTreeDialog::_cancel); + ClassDB::bind_method(D_METHOD("_filter_changed"), &SceneTreeDialog::_filter_changed); + ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::NODE_PATH, "path"))); } SceneTreeDialog::SceneTreeDialog() { set_title(TTR("Select a Node")); + VBoxContainer *vbc = memnew(VBoxContainer); + add_child(vbc); + + filter = memnew(LineEdit); + filter->set_h_size_flags(SIZE_EXPAND_FILL); + filter->set_placeholder(TTR("Filter nodes")); + filter->add_constant_override("minimum_spaces", 0); + filter->connect("text_changed", this, "_filter_changed"); + vbc->add_child(filter); tree = memnew(SceneTreeEditor(false, false, true)); - add_child(tree); + tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->get_scene_tree()->connect("item_activated", this, "_select"); + vbc->add_child(tree); } SceneTreeDialog::~SceneTreeDialog() { diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index 68642910e8..61cb59ce6f 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -171,10 +171,12 @@ class SceneTreeDialog : public ConfirmationDialog { SceneTreeEditor *tree; //Button *select; //Button *cancel; + LineEdit *filter; void update_tree(); void _select(); void _cancel(); + void _filter_changed(const String &p_filter); protected: void _notification(int p_what); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 8916f4d8c4..bebfe6d3a1 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -742,8 +742,8 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Built-in Script */ - internal = memnew(CheckButton); - internal->set_h_size_flags(0); + internal = memnew(CheckBox); + internal->set_text(TTR("On")); internal->connect("pressed", this, "_built_in_pressed"); internal_label = memnew(Label(TTR("Built-in Script"))); internal_label->set_align(Label::ALIGN_RIGHT); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index 61f87f5732..288b8f604b 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -33,7 +33,7 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_settings.h" -#include "scene/gui/check_button.h" +#include "scene/gui/check_box.h" #include "scene/gui/dialogs.h" #include "scene/gui/grid_container.h" #include "scene/gui/line_edit.h" @@ -57,7 +57,7 @@ class ScriptCreateDialog : public ConfirmationDialog { LineEdit *file_path; Button *path_button; EditorFileDialog *file_browse; - CheckButton *internal; + CheckBox *internal; Label *internal_label; VBoxContainer *path_vb; AcceptDialog *alert; |