diff options
Diffstat (limited to 'editor')
27 files changed, 371 insertions, 177 deletions
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index 9b0aca67d5..0cc153945d 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -35,6 +35,7 @@ #include "scene/gui/tab_container.h" #include "scene/gui/tree.h" +class EditorFileDialog; class EditorFileSystemDirectory; class EditorNode; diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 3a72f8e569..0bb059f425 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -235,7 +235,7 @@ void DocData::generate(bool p_basic_types) { ClassDB::get_property_list(name, &properties, true); for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { - if (E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_CATEGORY) + if (E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_INTERNAL) continue; PropertyDoc prop; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index da41ea87ce..5f026abb6d 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -44,8 +44,8 @@ void EditorAbout::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { Ref<Font> font = EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"); - _tpl_text->add_font_override("font", font); - _license_text->add_font_override("font", font); + _tpl_text->add_font_override("normal_font", font); + _license_text->add_font_override("normal_font", font); } break; } } @@ -53,7 +53,6 @@ void EditorAbout::_notification(int p_what) { void EditorAbout::_license_tree_selected() { TreeItem *selected = _tpl_tree->get_selected(); - _tpl_text->select(0, 0, 0, 0); _tpl_text->set_text(selected->get_metadata(0)); } @@ -165,12 +164,10 @@ EditorAbout::EditorAbout() { // License - _license_text = memnew(TextEdit); + _license_text = memnew(RichTextLabel); _license_text->set_name(TTR("License")); _license_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); _license_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); - _license_text->set_wrap(true); - _license_text->set_readonly(true); _license_text->set_text(String::utf8(about_license)); tc->add_child(_license_text); @@ -239,11 +236,9 @@ EditorAbout::EditorAbout() { tpl_ti_all->set_metadata(0, long_text); tpl_hbc->add_child(_tpl_tree); - _tpl_text = memnew(TextEdit); + _tpl_text = memnew(RichTextLabel); _tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); - _tpl_text->set_wrap(true); - _tpl_text->set_readonly(true); tpl_hbc->add_child(_tpl_text); _tpl_tree->connect("item_selected", this, "_license_tree_selected"); diff --git a/editor/editor_about.h b/editor/editor_about.h index ce29027f05..fe40ce5f14 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -33,11 +33,11 @@ #include "scene/gui/control.h" #include "scene/gui/dialogs.h" #include "scene/gui/item_list.h" +#include "scene/gui/rich_text_label.h" #include "scene/gui/scroll_container.h" #include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" -#include "scene/gui/text_edit.h" #include "scene/gui/texture_rect.h" #include "scene/gui/tree.h" @@ -55,8 +55,8 @@ private: ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[], const int p_flag_single_column = 0); Tree *_tpl_tree; - TextEdit *_license_text; - TextEdit *_tpl_text; + RichTextLabel *_license_text; + RichTextLabel *_tpl_text; TextureRect *_logo; protected: diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index de64c11308..6e507fac9b 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -251,7 +251,7 @@ void EditorAudioBus::_volume_db_changed(float p_db) { updating_bus = true; UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Audio Bus Volume", UndoRedo::MERGE_ENDS); + ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS); ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db); ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index())); ur->add_do_method(buses, "_update_bus", get_index()); @@ -812,7 +812,7 @@ void EditorAudioBuses::_update_buses() { EditorAudioBuses *EditorAudioBuses::register_editor() { EditorAudioBuses *audio_buses = memnew(EditorAudioBuses); - EditorNode::get_singleton()->add_bottom_panel_item("Audio", audio_buses); + EditorNode::get_singleton()->add_bottom_panel_item(TTR("Audio"), audio_buses); return audio_buses; } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 443004f820..49d55e6305 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -690,9 +690,9 @@ Ref<Script> EditorData::get_scene_root_script(int p_idx) const { String EditorData::get_scene_title(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), String()); if (!edited_scene[p_idx].root) - return "[empty]"; + return TTR("[empty]"); if (edited_scene[p_idx].root->get_filename() == "") - return "[unsaved]"; + return TTR("[unsaved]"); bool show_ext = EDITOR_DEF("interface/scene_tabs/show_extension", false); String name = edited_scene[p_idx].root->get_filename().get_file(); if (!show_ext) { diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 8c8d9c4c79..fc73964764 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -743,6 +743,18 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & custom_map["path_remap/remapped_paths"] = path_remaps; } + // Store icon and splash images directly, they need to bypass the import system and be loaded as images + String icon = ProjectSettings::get_singleton()->get("application/config/icon"); + String splash = ProjectSettings::get_singleton()->get("application/boot_splash/image"); + if (icon != String() && FileAccess::exists(icon)) { + Vector<uint8_t> array = FileAccess::get_file_as_array(icon); + p_func(p_udata, icon, array, idx, total); + } + if (splash != String() && FileAccess::exists(splash)) { + Vector<uint8_t> array = FileAccess::get_file_as_array(splash); + p_func(p_udata, splash, array, idx, total); + } + String config_file = "project.binary"; String engine_cfb = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp" + config_file); ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index eb5af2eaeb..eaa57fa46b 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "editor_file_dialog.h" - +#include "dependency_editor.h" #include "editor_resource_preview.h" #include "editor_scale.h" #include "editor_settings.h" #include "os/file_access.h" #include "os/keyboard.h" +#include "os/os.h" #include "print_string.h" #include "scene/gui/center_container.h" #include "scene/gui/label.h" @@ -159,6 +160,10 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { _make_dir(); handled = true; } + if (ED_IS_SHORTCUT("file_dialog/delete", p_event)) { + _delete_items(); + handled = true; + } if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) { dir->grab_focus(); handled = true; @@ -512,6 +517,106 @@ void EditorFileDialog::_item_dc_selected(int p_item) { } } +void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p_pos) { + + // Right click on specific file(s) or folder(s). + item_menu->clear(); + item_menu->set_size(Size2(1, 1)); + + // Allow specific actions only on one item. + bool single_item_selected = item_list->get_selected_items().size() == 1; + + // Disallow deleting the .import folder, Godot kills a cat if you do and it is possibly a senseless novice action. + bool allow_delete = true; + for (int i = 0; i < item_list->get_item_count(); i++) { + if (!item_list->is_selected(i)) { + continue; + } + Dictionary item_meta = item_list->get_item_metadata(i); + if (item_meta["path"] == "res://.import") { + allow_delete = false; + break; + } + } + + if (single_item_selected) { + item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH); + } + if (allow_delete) { + item_menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE); + } + if (single_item_selected) { + item_menu->add_separator(); + item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Show In File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); + } + + if (item_menu->get_item_count() > 0) { + item_menu->set_position(item_list->get_global_position() + p_pos); + item_menu->popup(); + } +} + +void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) { + + // Right click on folder background. Deselect all files so that actions are applied on the current folder. + for (int i = 0; i < item_list->get_item_count(); i++) { + item_list->unselect(i); + } + + item_menu->clear(); + item_menu->set_size(Size2(1, 1)); + + if (can_create_dir) { + item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder.."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N); + } + item_menu->add_icon_item(get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5); + item_menu->add_separator(); + item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Show In File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); + + item_menu->set_position(item_list->get_global_position() + p_pos); + item_menu->popup(); +} + +void EditorFileDialog::_item_menu_id_pressed(int p_option) { + + switch (p_option) { + + case ITEM_MENU_COPY_PATH: { + Dictionary item_meta = item_list->get_item_metadata(item_list->get_current()); + OS::get_singleton()->set_clipboard(item_meta["path"]); + } break; + + case ITEM_MENU_DELETE: { + _delete_items(); + } break; + + case ITEM_MENU_REFRESH: { + invalidate(); + } break; + + case ITEM_MENU_NEW_FOLDER: { + _make_dir(); + } break; + + case ITEM_MENU_SHOW_IN_EXPLORER: { + String path; + int idx = item_list->get_current(); + if (idx == -1 || item_list->get_selected_items().size() == 0) { + // Folder background was clicked. Open this folder. + path = ProjectSettings::get_singleton()->globalize_path(dir_access->get_current_dir()); + } else { + // Specific item was clicked. Open folders directly, or the folder containing a selected file. + Dictionary item_meta = item_list->get_item_metadata(idx); + path = ProjectSettings::get_singleton()->globalize_path(item_meta["path"]); + if (!item_meta["dir"]) { + path = path.get_base_dir(); + } + } + OS::get_singleton()->shell_open(String("file://") + path); + } break; + } +} + bool EditorFileDialog::_is_open_should_be_disabled() { if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE) @@ -617,7 +722,7 @@ void EditorFileDialog::update_file_list() { Dictionary d; d["name"] = dir_name; - d["path"] = String(); + d["path"] = cdir.plus_file(dir_name); d["dir"] = true; item_list->set_item_metadata(item_list->get_item_count() - 1, d); @@ -657,8 +762,6 @@ void EditorFileDialog::update_file_list() { } } - String base_dir = dir_access->get_current_dir(); - while (!files.empty()) { bool match = patterns.empty(); @@ -679,7 +782,7 @@ void EditorFileDialog::update_file_list() { if (get_icon_func) { - Ref<Texture> icon = get_icon_func(base_dir.plus_file(files.front()->get())); + Ref<Texture> icon = get_icon_func(cdir.plus_file(files.front()->get())); //ti->set_icon(0,icon); if (display_mode == DISPLAY_THUMBNAILS) { @@ -698,12 +801,11 @@ void EditorFileDialog::update_file_list() { Dictionary d; d["name"] = files.front()->get(); d["dir"] = false; - String fullpath = base_dir.plus_file(files.front()->get()); - + String fullpath = cdir.plus_file(files.front()->get()); if (display_mode == DISPLAY_THUMBNAILS) { EditorResourcePreview::get_singleton()->queue_resource_preview(fullpath, this, "_thumbnail_result", fullpath); } - d["path"] = base_dir.plus_file(files.front()->get()); + d["path"] = fullpath; //ti->set_metadata(0,d); item_list->set_item_metadata(item_list->get_item_count() - 1, d); @@ -723,7 +825,7 @@ void EditorFileDialog::update_file_list() { fav_down->set_disabled(true); get_ok()->set_disabled(_is_open_should_be_disabled()); for (int i = 0; i < favorites->get_item_count(); i++) { - if (favorites->get_item_metadata(i) == base_dir) { + if (favorites->get_item_metadata(i) == cdir) { favorites->select(i); favorite->set_pressed(true); if (i > 0) { @@ -854,27 +956,27 @@ void EditorFileDialog::set_mode(Mode p_mode) { case MODE_OPEN_FILE: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a File")); - makedir->hide(); + can_create_dir = false; break; case MODE_OPEN_FILES: get_ok()->set_text(TTR("Open")); set_title(TTR("Open File(s)")); - makedir->hide(); + can_create_dir = false; break; case MODE_OPEN_DIR: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a Directory")); - makedir->show(); + can_create_dir = true; break; case MODE_OPEN_ANY: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a File or Directory")); - makedir->show(); + can_create_dir = true; break; case MODE_SAVE_FILE: get_ok()->set_text(TTR("Save")); set_title(TTR("Save a File")); - makedir->show(); + can_create_dir = true; break; } @@ -883,6 +985,12 @@ void EditorFileDialog::set_mode(Mode p_mode) { } else { item_list->set_select_mode(ItemList::SELECT_SINGLE); } + + if (can_create_dir) { + makedir->show(); + } else { + makedir->hide(); + } } EditorFileDialog::Mode EditorFileDialog::get_mode() const { @@ -954,6 +1062,28 @@ void EditorFileDialog::_make_dir() { makedirname->grab_focus(); } +void EditorFileDialog::_delete_items() { + + // Collect the selected folders and files to delete and check them in the deletion dependency dialog. + Vector<String> folders; + Vector<String> files; + for (int i = 0; i < item_list->get_item_count(); i++) { + if (!item_list->is_selected(i)) { + continue; + } + Dictionary item_meta = item_list->get_item_metadata(i); + if (item_meta["dir"]) { + folders.push_back(item_meta["path"]); + } else { + files.push_back(item_meta["path"]); + } + } + if (folders.size() + files.size() > 0) { + remove_dialog->set_size(Size2(1, 1)); + remove_dialog->show(folders, files); + } +} + void EditorFileDialog::_select_drive(int p_idx) { String d = drives->get_item_text(p_idx); @@ -1181,6 +1311,9 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_item_selected"), &EditorFileDialog::_item_selected); ClassDB::bind_method(D_METHOD("_items_clear_selection"), &EditorFileDialog::_items_clear_selection); + ClassDB::bind_method(D_METHOD("_item_list_item_rmb_selected"), &EditorFileDialog::_item_list_item_rmb_selected); + ClassDB::bind_method(D_METHOD("_item_list_rmb_clicked"), &EditorFileDialog::_item_list_rmb_clicked); + ClassDB::bind_method(D_METHOD("_item_menu_id_pressed"), &EditorFileDialog::_item_menu_id_pressed); ClassDB::bind_method(D_METHOD("_item_db_selected"), &EditorFileDialog::_item_dc_selected); ClassDB::bind_method(D_METHOD("_dir_entered"), &EditorFileDialog::_dir_entered); ClassDB::bind_method(D_METHOD("_file_entered"), &EditorFileDialog::_file_entered); @@ -1232,6 +1365,15 @@ void EditorFileDialog::_bind_methods() { ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::POOL_STRING_ARRAY, "paths"))); ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir"))); + ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List"), "set_display_mode", "get_display_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR), "set_current_dir", "get_current_dir"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*"), "set_current_file", "get_current_file"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled"); + BIND_ENUM_CONSTANT(MODE_OPEN_FILE); BIND_ENUM_CONSTANT(MODE_OPEN_FILES); BIND_ENUM_CONSTANT(MODE_OPEN_DIR); @@ -1317,6 +1459,7 @@ EditorFileDialog::EditorFileDialog() { ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT | KEY_F); ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT | KEY_V); ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD | KEY_N); + ED_SHORTCUT("file_dialog/delete", TTR("Delete"), KEY_DELETE); ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD | KEY_D); ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD | KEY_UP); ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD | KEY_DOWN); @@ -1423,10 +1566,21 @@ EditorFileDialog::EditorFileDialog() { list_vb->add_child(memnew(Label(TTR("Directories & Files:")))); preview_hb->add_child(list_vb); + // Item (files and folders) list with context menu + item_list = memnew(ItemList); item_list->set_v_size_flags(SIZE_EXPAND_FILL); + item_list->connect("item_rmb_selected", this, "_item_list_item_rmb_selected"); + item_list->connect("rmb_clicked", this, "_item_list_rmb_clicked"); + item_list->set_allow_rmb_select(true); list_vb->add_child(item_list); + item_menu = memnew(PopupMenu); + item_menu->connect("id_pressed", this, "_item_menu_id_pressed"); + add_child(item_menu); + + // Other stuff + preview_vb = memnew(VBoxContainer); preview_hb->add_child(preview_vb); CenterContainer *prev_cc = memnew(CenterContainer); @@ -1465,9 +1619,11 @@ EditorFileDialog::EditorFileDialog() { confirm_save = memnew(ConfirmationDialog); confirm_save->set_as_toplevel(true); add_child(confirm_save); - confirm_save->connect("confirmed", this, "_save_confirm_pressed"); + remove_dialog = memnew(DependencyRemoveDialog); + add_child(remove_dialog); + makedialog = memnew(ConfirmationDialog); makedialog->set_title(TTR("Create Folder")); VBoxContainer *makevb = memnew(VBoxContainer); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 0599d222f3..f4a9a174e7 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -39,6 +39,9 @@ #include "scene/gui/split_container.h" #include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" + +class DependencyRemoveDialog; + /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -75,6 +78,14 @@ public: static RegisterFunc unregister_func; private: + enum ItemMenu { + ITEM_MENU_COPY_PATH, + ITEM_MENU_DELETE, + ITEM_MENU_REFRESH, + ITEM_MENU_NEW_FOLDER, + ITEM_MENU_SHOW_IN_EXPLORER + }; + ConfirmationDialog *makedialog; LineEdit *makedirname; @@ -83,6 +94,7 @@ private: //Button *action; VBoxContainer *vbox; Mode mode; + bool can_create_dir; LineEdit *dir; ToolButton *dir_prev; @@ -91,6 +103,7 @@ private: OptionButton *drives; ItemList *item_list; + PopupMenu *item_menu; TextureRect *preview; VBoxContainer *preview_vb; HSplitContainer *list_hb; @@ -100,6 +113,7 @@ private: OptionButton *filter; DirAccess *dir_access; ConfirmationDialog *confirm_save; + DependencyRemoveDialog *remove_dialog; ToolButton *mode_thumbnails; ToolButton *mode_list; @@ -146,6 +160,10 @@ private: void _items_clear_selection(); void _item_dc_selected(int p_item); + void _item_list_item_rmb_selected(int p_item, const Vector2 &p_pos); + void _item_list_rmb_clicked(const Vector2 &p_pos); + void _item_menu_id_pressed(int p_option); + void _select_drive(int p_idx); void _dir_entered(String p_dir); void _file_entered(const String &p_file); @@ -156,6 +174,8 @@ private: void _make_dir(); void _make_dir_confirm(); + void _delete_items(); + void _update_drives(); void _go_up(); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 1cc518ff31..d462cce908 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1244,8 +1244,10 @@ void EditorFileSystem::update_file(const String &p_file) { if (!FileAccess::exists(p_file)) { //was removed _delete_internal_files(p_file); - memdelete(fs->files[cpos]); - fs->files.remove(cpos); + if (cpos != -1) { // Might've never been part of the editor file system (*.* files deleted in Open dialog). + memdelete(fs->files[cpos]); + fs->files.remove(cpos); + } call_deferred("emit_signal", "filesystem_changed"); //update later return; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index fbf6c86c35..31ed86d05a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1394,11 +1394,13 @@ void EditorNode::_property_editor_back() { } void EditorNode::_menu_collapseall() { - property_editor->collapse_all_parent_nodes(); + + property_editor->collapse_all_folding(); } void EditorNode::_menu_expandall() { - property_editor->expand_all_parent_nodes(); + + property_editor->expand_all_folding(); } void EditorNode::_save_default_environment() { @@ -1495,7 +1497,7 @@ void EditorNode::_edit_current() { if (FileAccess::exists(base_path + ".import")) { editable_warning = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } else { - if (!get_edited_scene() || get_edited_scene()->get_filename() != base_path) { + if ((!get_edited_scene() || get_edited_scene()->get_filename() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") { editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene."); } } @@ -1674,7 +1676,6 @@ void EditorNode::_resource_selected(const RES &p_res, const String &p_property) void EditorNode::_run(bool p_current, const String &p_custom) { if (editor_run.get_status() == EditorRun::STATUS_PLAY) { - play_button->set_pressed(!_playing_edited); play_scene_button->set_pressed(_playing_edited); return; @@ -1806,6 +1807,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { play_button->set_pressed(true); play_button->set_icon(gui_base->get_icon("Reload", "EditorIcons")); } + stop_button->set_disabled(false); _playing_edited = p_current; } @@ -2277,6 +2279,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); play_custom_scene_button->set_pressed(false); play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); + stop_button->set_disabled(true); + if (bool(EDITOR_DEF("run/output/always_close_output_on_stop", true))) { for (int i = 0; i < bottom_panel_items.size(); i++) { if (bottom_panel_items[i].control == log) { @@ -5264,6 +5268,7 @@ EditorNode::EditorNode() { stop_button->set_icon(gui_base->get_icon("Stop", "EditorIcons")); stop_button->connect("pressed", this, "_menu_option", make_binds(RUN_STOP)); stop_button->set_tooltip(TTR("Stop the scene.")); + stop_button->set_disabled(true); stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8)); run_native = memnew(EditorRunNative); @@ -5441,7 +5446,7 @@ EditorNode::EditorNode() { property_editor->set_use_doc_hints(true); property_editor->set_hide_script(false); property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true))); - property_editor->set_use_folding(bool(EDITOR_DEF("interface/editor/expand_all_properties", false)) == false); + property_editor->set_use_folding(!bool(EDITOR_DEF("interface/editor/disable_inspector_folding", false))); property_editor->hide_top_label(); property_editor->register_text_enter(search_box); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 5d81fc6ea4..71c26244ee 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -670,13 +670,13 @@ EditorProfiler::EditorProfiler() { variables->set_hide_root(true); variables->set_columns(3); variables->set_column_titles_visible(true); - variables->set_column_title(0, "Name"); + variables->set_column_title(0, TTR("Name")); variables->set_column_expand(0, true); variables->set_column_min_width(0, 60); - variables->set_column_title(1, "Time"); + variables->set_column_title(1, TTR("Time")); variables->set_column_expand(1, false); variables->set_column_min_width(1, 60 * EDSCALE); - variables->set_column_title(2, "Calls"); + variables->set_column_title(2, TTR("Calls")); variables->set_column_expand(2, false); variables->set_column_min_width(2, 60 * EDSCALE); variables->connect("item_edited", this, "_item_edited"); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 638b23382d..2f73e459ed 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -416,6 +416,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["editors/3d/freelook/freelook_modifier_speed_factor"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_modifier_speed_factor", PROPERTY_HINT_RANGE, "0.0, 10.0, 0.1"); _initial_set("editors/3d/freelook/freelook_speed_zoom_link", false); + _initial_set("editors/2d/guides_color", Color(0.6, 0.0, 0.8)); _initial_set("editors/2d/bone_width", 5); _initial_set("editors/2d/bone_color1", Color(1.0, 1.0, 1.0, 0.9)); _initial_set("editors/2d/bone_color2", Color(0.75, 0.75, 0.75, 0.9)); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ae29b7420e..23c32a5793 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -793,6 +793,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // TextEdit theme->set_stylebox("normal", "TextEdit", style_widget); theme->set_stylebox("focus", "TextEdit", style_widget_hover); + theme->set_stylebox("read_only", "TextEdit", style_widget_disabled); theme->set_constant("side_margin", "TabContainer", 0); theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons")); theme->set_color("font_color", "TextEdit", font_color); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d18e97fe83..ddcdb5a321 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2294,7 +2294,7 @@ void CanvasItemEditor::_draw_focus() { void CanvasItemEditor::_draw_guides() { - Color guide_color = Color(0.6, 0.0, 0.8); + Color guide_color = EditorSettings::get_singleton()->get("editors/2d/guides_color"); Transform2D xform = viewport_scrollable->get_transform() * transform; // Guides already there @@ -4314,7 +4314,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { show_grid = false; show_helpers = false; - show_rulers = false; + show_rulers = true; show_guides = true; zoom = 1; grid_offset = Point2(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 214f24b386..3a443e1bf7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1039,6 +1039,18 @@ void ScriptTextEditor::_edit_option(int p_op) { if (scr.is_null()) return; + String delimiter = "#"; + List<String> comment_delimiters; + scr->get_language()->get_comment_delimiters(&comment_delimiters); + + for (List<String>::Element *E = comment_delimiters.front(); E; E = E->next()) { + String script_delimiter = E->get(); + if (script_delimiter.find(" ") == -1) { + delimiter = script_delimiter; + break; + } + } + tx->begin_complex_operation(); if (tx->is_selection_active()) { int begin = tx->get_selection_from_line(); @@ -1051,7 +1063,7 @@ void ScriptTextEditor::_edit_option(int p_op) { // Check if all lines in the selected block are commented bool is_commented = true; for (int i = begin; i <= end; i++) { - if (!tx->get_line(i).begins_with("#")) { + if (!tx->get_line(i).begins_with(delimiter)) { is_commented = false; break; } @@ -1060,12 +1072,12 @@ void ScriptTextEditor::_edit_option(int p_op) { String line_text = tx->get_line(i); if (line_text.strip_edges().empty()) { - line_text = "#"; + line_text = delimiter; } else { if (is_commented) { - line_text = line_text.substr(1, line_text.length()); + line_text = line_text.substr(delimiter.length(), line_text.length()); } else { - line_text = "#" + line_text; + line_text = delimiter + line_text; } } tx->set_line(i, line_text); @@ -1074,10 +1086,10 @@ void ScriptTextEditor::_edit_option(int p_op) { int begin = tx->cursor_get_line(); String line_text = tx->get_line(begin); - if (line_text.begins_with("#")) - line_text = line_text.substr(1, line_text.length()); + if (line_text.begins_with(delimiter)) + line_text = line_text.substr(delimiter.length(), line_text.length()); else - line_text = "#" + line_text; + line_text = delimiter + line_text; tx->set_line(begin, line_text); } tx->end_complex_operation(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 9fd41c1064..b855d2d4c4 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3389,6 +3389,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed preview_camera->set_toggle_mode(true); preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE); preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE); + preview_camera->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE); + preview_camera->set_h_grow_direction(GROW_DIRECTION_BEGIN); preview_camera->set_text(TTR("preview")); surface->add_child(preview_camera); preview_camera->hide(); @@ -4751,9 +4753,9 @@ VSplitContainer *SpatialEditor::get_shader_split() { return shader_split; } -HBoxContainer *SpatialEditor::get_palette_split() { +HSplitContainer *SpatialEditor::get_palette_split() { - return palette_split_container; + return palette_split; } void SpatialEditor::_request_gizmo(Object *p_obj) { @@ -5044,10 +5046,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { palette_split->set_v_size_flags(SIZE_EXPAND_FILL); vbc->add_child(palette_split); - palette_split_container = memnew(HBoxContainer); - palette_split_container->set_v_size_flags(SIZE_EXPAND_FILL); - palette_split->add_child(palette_split_container); - shader_split = memnew(VSplitContainer); shader_split->set_h_size_flags(SIZE_EXPAND_FILL); palette_split->add_child(shader_split); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index ab26a70f7f..0c2571017b 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -413,7 +413,6 @@ private: SpatialEditorViewport *viewports[VIEWPORTS_COUNT]; VSplitContainer *shader_split; HSplitContainer *palette_split; - HBoxContainer *palette_split_container; ///// @@ -608,7 +607,7 @@ public: void add_control_to_menu_panel(Control *p_control); VSplitContainer *get_shader_split(); - HBoxContainer *get_palette_split(); + HSplitContainer *get_palette_split(); Spatial *get_selected() { return selected; } diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 5cc81f156c..4d06342fe0 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -123,12 +123,14 @@ void TileMapEditor::_menu_option(int p_option) { return; undo_redo->create_action(TTR("Erase Selection")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { - _set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false, true); + _set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false); } } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); selection_active = false; @@ -171,7 +173,7 @@ void TileMapEditor::set_selected_tile(int p_tile) { } } -void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose, bool p_with_undo) { +void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose) { ERR_FAIL_COND(!node); @@ -184,17 +186,8 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose) return; //check that it's actually different - if (p_with_undo) { - - undo_redo->add_do_method(node, "set_cellv", Point2(p_pos), p_value, p_flip_h, p_flip_v, p_transpose); - undo_redo->add_do_method(node, "make_bitmask_area_dirty", Point2(p_pos)); - undo_redo->add_undo_method(node, "set_cellv", Point2(p_pos), prev_val, prev_flip_h, prev_flip_v, prev_transpose); - undo_redo->add_undo_method(node, "make_bitmask_area_dirty", Point2(p_pos)); - } else { - - node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose); - node->update_bitmask_area(Point2(p_pos)); - } + node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose); + node->update_bitmask_area(Point2(p_pos)); } void TileMapEditor::_text_entered(const String &p_text) { @@ -404,6 +397,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era } PoolVector<Vector2> points; + Vector<Vector2> non_preview_cache; int count = 0; int limit = 0; @@ -432,8 +426,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era bucket_cache_visited[loc] = true; bucket_cache.push_back(n); } else { - node->set_cellv(n, id, flip_h, flip_v, transpose); + if (non_preview_cache.find(n) >= 0) + continue; points.push_back(n); + non_preview_cache.push_back(n); } bucket_queue.push_back(Point2i(n.x, n.y + 1)); @@ -462,9 +458,10 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> p_points, const Dicti bool tr = p_op["transpose"]; for (int i = 0; i < len; i++) { - _set_cell(pr[i], id, xf, yf, tr); + node->make_bitmask_area_dirty(pr[i]); } + node->update_dirty_bitmask(); } void TileMapEditor::_erase_points(const PoolVector<Vector2> p_points) { @@ -730,10 +727,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { tool = TOOL_PAINTING; - paint_undo.clear(); - paint_undo[over_tile] = _get_op_from_cell(over_tile); - - _set_cell(over_tile, id, flip_h, flip_v, transpose); + undo_redo->create_action(TTR("Paint TileMap")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); } } else if (tool == TOOL_PICKING) { @@ -754,15 +749,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { int id = get_selected_tile(); - if (id != TileMap::INVALID_CELL && paint_undo.size()) { - - undo_redo->create_action(TTR("Paint TileMap")); - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + if (id != TileMap::INVALID_CELL) { - Point2 p = E->key(); - undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose); - undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); paint_undo.clear(); @@ -774,10 +763,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (id != TileMap::INVALID_CELL) { undo_redo->create_action(TTR("Line Draw")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { - _set_cell(E->key(), id, flip_h, flip_v, transpose, true); + _set_cell(E->key(), id, flip_h, flip_v, transpose); } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); paint_undo.clear(); @@ -791,12 +782,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (id != TileMap::INVALID_CELL) { undo_redo->create_action(TTR("Rectangle Paint")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { - _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true); + _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose); } } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); canvas_item_editor->update(); @@ -806,10 +799,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { Point2 ofs = over_tile - rectangle.position; undo_redo->create_action(TTR("Duplicate")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) { - _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true); + _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose); } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); copydata.clear(); @@ -822,28 +817,23 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } else if (tool == TOOL_BUCKET) { - Dictionary pop; - pop["id"] = node->get_cell(over_tile.x, over_tile.y); - pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); - pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); - pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); - PoolVector<Vector2> points = _bucket_fill(over_tile); if (points.size() == 0) return false; + undo_redo->create_action(TTR("Bucket Fill")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); + Dictionary op; op["id"] = get_selected_tile(); op["flip_h"] = flip_h; op["flip_v"] = flip_v; op["transpose"] = transpose; - undo_redo->create_action(TTR("Bucket Fill")); - - undo_redo->add_do_method(this, "_fill_points", points, op); - undo_redo->add_undo_method(this, "_fill_points", points, pop); + _fill_points(points, op); + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); undo_redo->commit_action(); // We want to keep the bucket-tool active @@ -885,6 +875,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { Point2 local = node->world_to_map(xform_inv.xform(mb->get_position())); + undo_redo->create_action(TTR("Erase TileMap")); + undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data")); + if (mb->get_shift()) { if (mb->get_control()) @@ -898,7 +891,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { tool = TOOL_ERASING; - paint_undo[local] = _get_op_from_cell(local); _set_cell(local, TileMap::INVALID_CELL); } @@ -908,18 +900,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } else { if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { - if (paint_undo.size()) { - undo_redo->create_action(TTR("Erase TileMap")); - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { - - Point2 p = E->key(); - undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false); - undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } - - undo_redo->commit_action(); - paint_undo.clear(); - } + undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data")); + undo_redo->commit_action(); if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { canvas_item_editor->update(); @@ -1006,10 +988,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { Point2i pos = points[i]; - if (!paint_undo.has(pos)) { - paint_undo[pos] = _get_op_from_cell(pos); - } - _set_cell(pos, TileMap::INVALID_CELL); } diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index ce58cc9708..b5f2618576 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -167,7 +167,7 @@ class TileMapEditor : public VBoxContainer { void _update_palette(); void _menu_option(int p_option); - void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false, bool p_with_undo = false); + void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false); void _canvas_mouse_enter(); void _canvas_mouse_exit(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index bbed7ff98d..eb2faa1ab1 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1015,21 +1015,47 @@ void AutotileEditor::_on_tool_clicked(int p_tool) { tile_set->autotile_clear_bitmask_map(get_current_tile()); workspace->update(); } else if (p_tool == SHAPE_DELETE) { - if (!edited_collision_shape.is_null()) { - Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile()); - int index; - for (int i = 0; i < sd.size(); i++) { - if (sd[i].shape == edited_collision_shape) { - index = i; - break; - } - } - if (index >= 0) { - sd.remove(index); - tile_set->tile_set_shapes(get_current_tile(), sd); - edited_collision_shape.unref(); - current_shape.resize(0); - workspace->update(); + if (creating_shape) { + creating_shape = false; + current_shape.resize(0); + workspace->update(); + } else { + switch (edit_mode) { + case EDITMODE_COLLISION: { + if (!edited_collision_shape.is_null()) { + Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile()); + int index; + for (int i = 0; i < sd.size(); i++) { + if (sd[i].shape == edited_collision_shape) { + index = i; + break; + } + } + if (index >= 0) { + sd.remove(index); + tile_set->tile_set_shapes(get_current_tile(), sd); + edited_collision_shape = Ref<ConcavePolygonShape2D>(); + current_shape.resize(0); + workspace->update(); + } + } + } break; + case EDITMODE_NAVIGATION: { + if (!edited_navigation_shape.is_null()) { + tile_set->autotile_set_navigation_polygon(get_current_tile(), Ref<NavigationPolygon>(), edited_shape_coord); + edited_navigation_shape = Ref<NavigationPolygon>(); + current_shape.resize(0); + workspace->update(); + } + } break; + case EDITMODE_OCCLUSION: { + if (!edited_occlusion_shape.is_null()) { + tile_set->autotile_set_light_occluder(get_current_tile(), Ref<OccluderPolygon2D>(), edited_shape_coord); + edited_occlusion_shape = Ref<OccluderPolygon2D>(); + current_shape.resize(0); + workspace->update(); + } + } break; } } } else if (p_tool == ZOOM_OUT) { diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 43c7f33cbe..b4d89526b0 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -213,7 +213,7 @@ private: } String sp = p.simplify_path(); project_path->set_text(sp); - set_message(TTR(" ")); // just so it does not disappear + set_message(" "); // just so it does not disappear get_ok()->call_deferred("grab_focus"); } @@ -508,7 +508,8 @@ public: } else if (current->has_setting("application/config/name")) { project_name->set_text(current->get("application/config/name")); } - project_name->grab_focus(); + + project_name->call_deferred("grab_focus"); create_dir->hide(); status_btn->hide(); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index d573a44cdd..11c7e07b6a 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2665,18 +2665,14 @@ TreeItem *PropertyEditor::get_parent_node(String p_path, HashMap<String, TreeIte item->set_editable(1, false); item->set_selectable(1, subsection_selectable); - if (use_folding || folding_behaviour != FB_UNDEFINED) { // Even if you disabled folding (expand all by default), you still can collapse all manually. + if (use_folding) { // if (!obj->editor_is_section_unfolded(p_path)) { updating_folding = true; - if (folding_behaviour == FB_COLLAPSEALL) - item->set_collapsed(true); - else if (folding_behaviour == FB_EXPANDALL || is_expandall_enabled) - item->set_collapsed(false); - else - item->set_collapsed(true); + item->set_collapsed(true); updating_folding = false; } item->set_metadata(0, p_path); + foldable_property_cache.push_back(p_path); } if (item->get_parent() == root) { @@ -2725,6 +2721,7 @@ void PropertyEditor::refresh() { void PropertyEditor::update_tree() { tree->clear(); + foldable_property_cache.clear(); if (!obj) return; @@ -3081,7 +3078,7 @@ void PropertyEditor::update_tree() { item->set_text(1, type + " ID: " + itos(id)); item->add_button(1, get_icon("EditResource", "EditorIcons")); } else { - item->set_text(1, "[Empty]"); + item->set_text(1, TTR("[Empty]")); } if (has_icon(p.hint_string, "EditorIcons")) { @@ -3733,7 +3730,7 @@ void PropertyEditor::_item_edited() { _edit_set(name, item->get_text(1), refresh_all); } } break; - // math types + // math types case Variant::VECTOR3: { @@ -4212,29 +4209,29 @@ void PropertyEditor::set_subsection_selectable(bool p_selectable) { update_tree(); } -bool PropertyEditor::is_expand_all_properties_enabled() const { - - return (use_folding == false); -} - void PropertyEditor::set_use_folding(bool p_enable) { use_folding = p_enable; tree->set_hide_folding(false); } -void PropertyEditor::collapse_all_parent_nodes() { - - folding_behaviour = FB_COLLAPSEALL; +void PropertyEditor::collapse_all_folding() { + if (!obj) + return; + for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) { + obj->editor_set_section_unfold(E->get(), false); + } update_tree(); - folding_behaviour = FB_UNDEFINED; } -void PropertyEditor::expand_all_parent_nodes() { +void PropertyEditor::expand_all_folding() { - folding_behaviour = FB_EXPANDALL; + if (!obj) + return; + for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) { + obj->editor_set_section_unfold(E->get(), true); + } update_tree(); - folding_behaviour = FB_UNDEFINED; } PropertyEditor::PropertyEditor() { @@ -4309,8 +4306,6 @@ PropertyEditor::PropertyEditor() { subsection_selectable = false; property_selectable = false; show_type_icons = false; // maybe one day will return. - folding_behaviour = FB_UNDEFINED; - is_expandall_enabled = bool(EDITOR_DEF("interface/editor/expand_all_properties", true)); } PropertyEditor::~PropertyEditor() { diff --git a/editor/property_editor.h b/editor/property_editor.h index a337a05e46..bcabccc6fd 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -203,18 +203,9 @@ class PropertyEditor : public Control { bool hide_script; bool use_folding; bool property_selectable; - bool is_expandall_enabled; - bool updating_folding; - enum FOLDING_BEHAVIOUR { - FB_UNDEFINED, - FB_COLLAPSEALL, - FB_EXPANDALL, - FB_EXPANDALL_FORCE - }; - FOLDING_BEHAVIOUR folding_behaviour; - + List<String> foldable_property_cache; HashMap<String, String> pending; String selected_property; @@ -314,10 +305,8 @@ public: void set_use_folding(bool p_enable); - bool is_expand_all_properties_enabled() const; - - void collapse_all_parent_nodes(); - void expand_all_parent_nodes(); + void collapse_all_folding(); + void expand_all_folding(); PropertyEditor(); ~PropertyEditor(); }; diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 7705e4e1b9..a1c1ec3351 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1853,7 +1853,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected"); inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded"); - auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", true); + auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false); inspect_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0); inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2); inspected_object_id = 0; diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 853761f689..fccd0c51aa 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -406,13 +406,13 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcut_clear_button->connect("pressed", this, "_clear_shortcut_search_box"); shortcuts = memnew(Tree); - vbc->add_margin_child("Shortcut List:", shortcuts, true); + vbc->add_margin_child(TTR("Shortcut List:"), shortcuts, true); shortcuts->set_columns(2); shortcuts->set_hide_root(true); //shortcuts->set_hide_folding(true); shortcuts->set_column_titles_visible(true); - shortcuts->set_column_title(0, "Name"); - shortcuts->set_column_title(1, "Binding"); + shortcuts->set_column_title(0, TTR("Name")); + shortcuts->set_column_title(1, TTR("Binding")); shortcuts->connect("button_pressed", this, "_shortcut_button_pressed"); press_a_key = memnew(ConfirmationDialog); diff --git a/editor/translations/README.md b/editor/translations/README.md index 351bc9e2d1..f30f4e61fb 100644 --- a/editor/translations/README.md +++ b/editor/translations/README.md @@ -16,5 +16,8 @@ Link if you missed it: https://hosted.weblate.org/projects/godot-engine/godot ## Adding new languages If you want to translate for a language which is not featured yet on Weblate, -open an issue on this repo to ask that the language is added, or contact -Akien/@akien-mga directly on IRC (#godotengine channel on Freenode). +you can add it (when logged in) by clicking the "Start new translation" +button at the bottom of the page. + +Alternatively, you can use this +[direct link](https://hosted.weblate.org/new-lang/godot-engine/godot/). |