diff options
Diffstat (limited to 'editor')
46 files changed, 258 insertions, 108 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 236d1e884e..3182bca0eb 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1138,6 +1138,7 @@ void CodeTextEditor::move_lines_up() { int from_col = text_editor->get_selection_from_column(); int to_line = text_editor->get_selection_to_line(); int to_column = text_editor->get_selection_to_column(); + int cursor_line = text_editor->cursor_get_line(); for (int i = from_line; i <= to_line; i++) { int line_id = i; @@ -1155,7 +1156,9 @@ void CodeTextEditor::move_lines_up() { } int from_line_up = from_line > 0 ? from_line - 1 : from_line; int to_line_up = to_line > 0 ? to_line - 1 : to_line; + int cursor_line_up = cursor_line > 0 ? cursor_line - 1 : cursor_line; text_editor->select(from_line_up, from_col, to_line_up, to_column); + text_editor->cursor_set_line(cursor_line_up); } else { int line_id = text_editor->cursor_get_line(); int next_id = line_id - 1; @@ -1181,6 +1184,7 @@ void CodeTextEditor::move_lines_down() { int from_col = text_editor->get_selection_from_column(); int to_line = text_editor->get_selection_to_line(); int to_column = text_editor->get_selection_to_column(); + int cursor_line = text_editor->cursor_get_line(); for (int i = to_line; i >= from_line; i--) { int line_id = i; @@ -1198,7 +1202,9 @@ void CodeTextEditor::move_lines_down() { } int from_line_down = from_line < text_editor->get_line_count() ? from_line + 1 : from_line; int to_line_down = to_line < text_editor->get_line_count() ? to_line + 1 : to_line; + int cursor_line_down = cursor_line < text_editor->get_line_count() ? cursor_line + 1 : cursor_line; text_editor->select(from_line_down, from_col, to_line_down, to_column); + text_editor->cursor_set_line(cursor_line_down); } else { int line_id = text_editor->cursor_get_line(); int next_id = line_id + 1; diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 81b42da08e..baeb06794a 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -476,7 +476,6 @@ void EditorVisualProfiler::_graph_tex_draw() { /* if (hover_metric != -1 && frame_metrics[hover_metric].valid) { - int max_frames = frame_metrics.size(); int frame = frame_metrics[hover_metric].frame_number - (frame_metrics[last_metric].frame_number - max_frames + 1); if (frame < 0) @@ -671,7 +670,6 @@ Vector<Vector<String>> EditorVisualProfiler::get_data_as_csv() const { const Vector<EditorFrameProfiler::Metric::Category> &categories = frame_metrics[0].categories; for (int j = 0; j < categories.size(); j++) { - const EditorFrameProfiler::Metric::Category &c = categories[j]; signatures.push_back(c.signature); @@ -688,7 +686,6 @@ Vector<Vector<String>> EditorVisualProfiler::get_data_as_csv() const { int index = last_metric; for (int i = 0; i < frame_metrics.size(); i++) { - ++index; if (index >= frame_metrics.size()) { @@ -702,7 +699,6 @@ Vector<Vector<String>> EditorVisualProfiler::get_data_as_csv() const { const Vector<EditorFrameProfiler::Metric::Category> &frame_cat = frame_metrics[index].categories; for (int j = 0; j < frame_cat.size(); j++) { - const EditorFrameProfiler::Metric::Category &c = frame_cat[j]; values.write[it++] = String::num_real(c.total_time); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 248073c5a2..fd33115cda 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -487,8 +487,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da error->set_text_align(0, TreeItem::ALIGN_LEFT); String error_title; - // Include method name, when given, in error title. - if (!oe.source_func.empty()) { + if (oe.callstack.size() > 0) { + // If available, use the script's stack in the error title. + error_title = oe.callstack[oe.callstack.size() - 1].func + ": "; + } else if (!oe.source_func.empty()) { + // Otherwise try to use the C++ source function. error_title += oe.source_func + ": "; } // If we have a (custom) error message, use it as title, and add a C++ Error @@ -529,9 +532,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da cpp_source->set_metadata(0, source_meta); } - error->set_tooltip(0, tooltip); - error->set_tooltip(1, tooltip); - // Format stack trace. // stack_items_count is the number of elements to parse, with 3 items per frame // of the stack trace (script, method, line). @@ -548,10 +548,17 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da stack_trace->set_text(0, "<" + TTR("Stack Trace") + ">"); stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT); error->set_metadata(0, meta); + tooltip += TTR("Stack Trace:") + "\n"; } - stack_trace->set_text(1, infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()"); + + String frame_txt = infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()"; + tooltip += frame_txt + "\n"; + stack_trace->set_text(1, frame_txt); } + error->set_tooltip(0, tooltip); + error->set_tooltip(1, tooltip); + if (oe.warning) { warning_count++; } else { diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 5e87f866d8..527286583e 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -450,13 +450,13 @@ 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? (Can't be restored)")); + text->set_text(TTR("Remove selected files from the project? (no undo)\nYou can find the removed files in the system trash to restore them.")); set_size(Size2()); popup_centered(); } else { _build_removed_dependency_tree(removed_deps); owners->show(); - text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)")); + text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)\nYou can find the removed files in the system trash to restore them.")); popup_centered(Size2(500, 350)); } EditorFileSystem::get_singleton()->scan_changes(); diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp index 6767159721..8504d61d2f 100644 --- a/editor/doc_data.cpp +++ b/editor/doc_data.cpp @@ -569,12 +569,15 @@ void DocData::generate(bool p_basic_types) { method_list.sort(); Variant::get_constructor_list(Variant::Type(i), &method_list); - for (int j = 0; j < Variant::OP_AND; j++) { //showing above 'and' is pretty confusing and there are a lot of variations - + for (int j = 0; j < Variant::OP_AND; j++) { // Showing above 'and' is pretty confusing and there are a lot of variations. for (int k = 0; k < Variant::VARIANT_MAX; k++) { Variant::Type rt = Variant::get_operator_return_type(Variant::Operator(j), Variant::Type(i), Variant::Type(k)); - if (rt != Variant::NIL) { - //has operator + if (rt != Variant::NIL) { // Has operator. + // Skip String % operator as it's registered separately for each Variant arg type, + // we'll add it manually below. + if (i == Variant::STRING && Variant::Operator(j) == Variant::OP_MODULE) { + continue; + } MethodInfo mi; mi.name = "operator " + Variant::get_operator_name(Variant::Operator(j)); mi.return_val.type = rt; @@ -589,6 +592,21 @@ void DocData::generate(bool p_basic_types) { } } + if (i == Variant::STRING) { + // We skipped % operator above, and we register it manually once for Variant arg type here. + MethodInfo mi; + mi.name = "operator %"; + mi.return_val.type = Variant::STRING; + + PropertyInfo arg; + arg.name = "right"; + arg.type = Variant::NIL; + arg.usage = PROPERTY_USAGE_NIL_IS_VARIANT; + mi.arguments.push_back(arg); + + method_list.push_back(mi); + } + if (Variant::is_keyed(Variant::Type(i))) { MethodInfo mi; mi.name = "operator []"; @@ -718,6 +736,43 @@ void DocData::generate(bool p_basic_types) { } c.properties.push_back(pd); } + + List<StringName> utility_functions; + Variant::get_utility_function_list(&utility_functions); + utility_functions.sort_custom<StringName::AlphCompare>(); + for (List<StringName>::Element *E = utility_functions.front(); E; E = E->next()) { + MethodDoc md; + md.name = E->get(); + //return + if (Variant::has_utility_function_return_value(E->get())) { + PropertyInfo pi; + pi.type = Variant::get_utility_function_return_type(E->get()); + if (pi.type == Variant::NIL) { + pi.usage = PROPERTY_USAGE_NIL_IS_VARIANT; + } + DocData::ArgumentDoc ad; + argument_doc_from_arginfo(ad, pi); + md.return_type = ad.type; + } + + if (Variant::is_utility_function_vararg(E->get())) { + md.qualifiers = "vararg"; + } else { + for (int i = 0; i < Variant::get_utility_function_argument_count(E->get()); i++) { + PropertyInfo pi; + pi.type = Variant::get_utility_function_argument_type(E->get(), i); + pi.name = Variant::get_utility_function_argument_name(E->get(), i); + if (pi.type == Variant::NIL) { + pi.usage = PROPERTY_USAGE_NIL_IS_VARIANT; + } + DocData::ArgumentDoc ad; + argument_doc_from_arginfo(ad, pi); + md.arguments.push_back(ad); + } + } + + c.methods.push_back(md); + } } // Built-in script reference. @@ -1147,7 +1202,7 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri qualifiers += " qualifiers=\"" + m.qualifiers.xml_escape() + "\""; } - _write_string(f, 2, "<method name=\"" + m.name + "\"" + qualifiers + ">"); + _write_string(f, 2, "<method name=\"" + m.name.xml_escape() + "\"" + qualifiers + ">"); if (m.return_type != "") { String enum_text; diff --git a/editor/doc_data.h b/editor/doc_data.h index 5fa20c6f0c..2cb475d137 100644 --- a/editor/doc_data.h +++ b/editor/doc_data.h @@ -43,6 +43,9 @@ public: String enumeration; String default_value; bool operator<(const ArgumentDoc &p_arg) const { + if (name == p_arg.name) { + return type < p_arg.type; + } return name < p_arg.name; } }; @@ -55,6 +58,20 @@ public: String description; Vector<ArgumentDoc> arguments; bool operator<(const MethodDoc &p_method) const { + if (name == p_method.name) { + // Must be a constructor since there is no overloading. + // We want this arbitrary order for a class "Foo": + // - 1. Default constructor: Foo() + // - 2. Copy constructor: Foo(Foo) + // - 3+. Other constructors Foo(Bar, ...) based on first argument's name + if (arguments.size() == 0 || p_method.arguments.size() == 0) { // 1. + return arguments.size() < p_method.arguments.size(); + } + if (arguments[0].type == return_type || p_method.arguments[0].type == p_method.return_type) { // 2. + return (arguments[0].type == return_type) || (p_method.arguments[0].type != p_method.return_type); + } + return arguments[0] < p_method.arguments[0]; + } return name < p_method.name; } }; diff --git a/editor/editor_data.h b/editor/editor_data.h index 5037a6acb4..eec95554be 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -40,7 +40,6 @@ class EditorHistory { enum { - HISTORY_MAX = 64 }; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 97800fe961..3aeffede82 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -737,6 +737,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & _edit_filter_list(paths, p_preset->get_include_filter(), false); _edit_filter_list(paths, p_preset->get_exclude_filter(), true); + // Ignore import files, since these are automatically added to the jar later with the resources + _edit_filter_list(paths, String("*.import"), true); + // Get encryption filters. bool enc_pck = p_preset->get_enc_pck(); Vector<String> enc_in_filters; diff --git a/editor/editor_help.h b/editor/editor_help.h index 7c3edeb299..b69b6d7401 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -91,7 +91,6 @@ class EditorHelp : public VBoxContainer { GDCLASS(EditorHelp, VBoxContainer); enum Page { - PAGE_CLASS_LIST, PAGE_CLASS_DESC, PAGE_CLASS_PREV, diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d0d99e071a..2e796b2dcd 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1679,7 +1679,7 @@ void EditorNode::_dialog_action(String p_file) { if (err == ERR_FILE_CANT_OPEN || err == ERR_FILE_NOT_FOUND) { config.instance(); // new config } else if (err != OK) { - show_warning(TTR("Error trying to save layout!")); + show_warning(TTR("An error occurred while trying to save the editor layout.\nMake sure the editor's user data path is writable.")); return; } @@ -1691,7 +1691,7 @@ void EditorNode::_dialog_action(String p_file) { _update_layouts_menu(); if (p_file == "Default") { - show_warning(TTR("Default editor layout overridden.")); + show_warning(TTR("Default editor layout overridden.\nTo restore the Default layout to its base settings, use the Delete Layout option and delete the Default layout.")); } } break; @@ -1722,7 +1722,7 @@ void EditorNode::_dialog_action(String p_file) { _update_layouts_menu(); if (p_file == "Default") { - show_warning(TTR("Restored default layout to base settings.")); + show_warning(TTR("Restored the Default layout to its base settings.")); } } break; @@ -2705,10 +2705,14 @@ void EditorNode::_screenshot(bool p_use_utc) { } void EditorNode::_save_screenshot(NodePath p_path) { - SubViewport *viewport = Object::cast_to<SubViewport>(EditorInterface::get_singleton()->get_editor_viewport()->get_viewport()); - viewport->set_clear_mode(SubViewport::CLEAR_MODE_ONLY_NEXT_FRAME); - Ref<Image> img = viewport->get_texture()->get_data(); - viewport->set_clear_mode(SubViewport::CLEAR_MODE_ALWAYS); + Control *editor_viewport = EditorInterface::get_singleton()->get_editor_viewport(); + ERR_FAIL_COND_MSG(!editor_viewport, "Cannot get editor viewport."); + Viewport *viewport = editor_viewport->get_viewport(); + ERR_FAIL_COND_MSG(!viewport, "Cannot get editor viewport."); + Ref<ViewportTexture> texture = viewport->get_texture(); + ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get editor viewport texture."); + Ref<Image> img = texture->get_data(); + ERR_FAIL_COND_MSG(img.is_null(), "Cannot get editor viewport texture image."); Error error = img->save_png(p_path); ERR_FAIL_COND_MSG(error != OK, "Cannot save screenshot to file '" + p_path + "'."); } @@ -5561,46 +5565,51 @@ EditorNode::EditorNode() { { int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale"); - float custom_display_scale = EditorSettings::get_singleton()->get("interface/editor/custom_display_scale"); switch (display_scale) { case 0: { - // Try applying a suitable display scale automatically + // Try applying a suitable display scale automatically. #ifdef OSX_ENABLED editor_set_scale(DisplayServer::get_singleton()->screen_get_max_scale()); #else const int screen = DisplayServer::get_singleton()->window_get_current_screen(); - editor_set_scale(DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).x > 2000 ? 2.0 : 1.0); + float scale; + if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).y >= 1400) { + // hiDPI display. + scale = 2.0; + } else if (DisplayServer::get_singleton()->screen_get_size(screen).y <= 800) { + // Small loDPI display. Use a smaller display scale so that editor elements fit more easily. + // Icons won't look great, but this is better than having editor elements overflow from its window. + scale = 0.75; + } else { + scale = 1.0; + } + + editor_set_scale(scale); #endif } break; - case 1: { + case 1: editor_set_scale(0.75); - } break; - - case 2: { + break; + case 2: editor_set_scale(1.0); - } break; - - case 3: { + break; + case 3: editor_set_scale(1.25); - } break; - - case 4: { + break; + case 4: editor_set_scale(1.5); - } break; - - case 5: { + break; + case 5: editor_set_scale(1.75); - } break; - - case 6: { + break; + case 6: editor_set_scale(2.0); - } break; - - default: { - editor_set_scale(custom_display_scale); - } break; + break; + default: + editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale")); + break; } } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index e330713cfb..49d8e58955 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -866,6 +866,8 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name")); ClassDB::add_virtual_method(get_class_static(), MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "get_plugin_icon")); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen")); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index be3e9db8ed..828b639527 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -595,7 +595,6 @@ class EditorPropertyResource : public EditorProperty { GDCLASS(EditorPropertyResource, EditorProperty); enum MenuOption { - OBJ_MENU_LOAD = 0, OBJ_MENU_EDIT = 1, OBJ_MENU_CLEAR = 2, diff --git a/editor/editor_run.h b/editor/editor_run.h index a15d65d91b..08b1e74ed1 100644 --- a/editor/editor_run.h +++ b/editor/editor_run.h @@ -36,7 +36,6 @@ class EditorRun { public: enum Status { - STATUS_PLAY, STATUS_PAUSED, STATUS_STOP diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 79525ced51..768e5bccbc 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -441,7 +441,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Highlighted tabs and border width Color tab_color = highlight_tabs ? base_color.lerp(font_color, contrast) : base_color; - const int border_width = CLAMP(border_size, 0, 3) * EDSCALE; + // Ensure borders are visible when using an editor scale below 100%. + const int border_width = CLAMP(border_size, 0, 3) * MAX(1, EDSCALE); const int default_margin_size = 4; const int margin_size_extra = default_margin_size + CLAMP(border_size, 0, 3); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 2052319e3e..543546b152 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2363,7 +2363,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str if (p_paths.size() > 1 || p_paths[0] != "res://") { p_popup->add_icon_item(get_theme_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE); - p_popup->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete"), FILE_REMOVE); + p_popup->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Move to Trash"), FILE_REMOVE); } if (p_paths.size() == 1) { @@ -2665,7 +2665,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { editor = p_editor; path = "res://"; - ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_C); + // `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts. + ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C); ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D); ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE); ED_SHORTCUT("filesystem_dock/rename", TTR("Rename")); diff --git a/editor/icons/CanvasGroup.svg b/editor/icons/CanvasGroup.svg new file mode 100644 index 0000000000..232ae53231 --- /dev/null +++ b/editor/icons/CanvasGroup.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v6h-6v8h8v-6h6v-8zm2 2h4v4h-4z" fill="#a5b8f3" fill-opacity=".588235"/><path d="m1 1v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm12 0v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm-12 12v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0zm12 0v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0z" fill="#a5b7f4"/></svg> diff --git a/editor/icons/CodeEdit.svg b/editor/icons/CodeEdit.svg new file mode 100644 index 0000000000..0750b072e7 --- /dev/null +++ b/editor/icons/CodeEdit.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m29 1042.4h1v1h-1z" fill="#fefeff"/><path d="m3 1c-1.1046 0-2 .8954-2 2v10c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-10c0-1.1046-.89543-2-2-2zm0 2h10v10h-10zm2 1-1 1 1 1-1 1 1 1 2-2zm2 3v1h2v-1z" fill="#a5efac" transform="translate(0 1036.4)"/></g></svg> diff --git a/editor/icons/EditorCurveHandle.svg b/editor/icons/EditorCurveHandle.svg index ea69f4e4cc..e0f3256807 100644 --- a/editor/icons/EditorCurveHandle.svg +++ b/editor/icons/EditorCurveHandle.svg @@ -1 +1 @@ -<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><circle cx="5" cy="5" fill="#fefefe" r="2.75" stroke="#000" stroke-linecap="square"/></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" fill="#fefefe" r="4.4" stroke="#000" stroke-linecap="square" stroke-width="1.6"/></svg> diff --git a/editor/icons/EditorPathSharpHandle.svg b/editor/icons/EditorPathSharpHandle.svg index 328dc04677..5166930cca 100644 --- a/editor/icons/EditorPathSharpHandle.svg +++ b/editor/icons/EditorPathSharpHandle.svg @@ -1 +1 @@ -<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m-3.035534-10.106602h6.071068v6.071068h-6.071068z" fill="#fefefe" stroke="#000" stroke-linecap="square" transform="matrix(-.70710678 .70710678 -.70710678 -.70710678 0 0)"/></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m14.868629 8.0000002-6.8686288 6.8686288-6.8686293-6.8686288 6.8686293-6.8686293z" fill="#fefefe" stroke="#000" stroke-linecap="square" stroke-width="1.6"/></svg> diff --git a/editor/icons/EditorPathSmoothHandle.svg b/editor/icons/EditorPathSmoothHandle.svg index b498345d5a..2ab4f3a96a 100644 --- a/editor/icons/EditorPathSmoothHandle.svg +++ b/editor/icons/EditorPathSmoothHandle.svg @@ -1 +1 @@ -<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m1.5-8.5h7v7h-7z" fill="#fefefe" stroke="#000" stroke-linecap="square" transform="rotate(90)"/></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13.6 2.4v11.2h-11.2v-11.2z" fill="#fefefe" stroke="#000" stroke-linecap="square" stroke-width="1.6"/></svg> diff --git a/editor/import/collada.h b/editor/import/collada.h index aa0d42035f..2f6db93dbc 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -313,7 +313,6 @@ public: struct Node { enum Type { - TYPE_NODE, TYPE_JOINT, TYPE_SKELETON, //this bone is not collada, it's added afterwards as optimization diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 3a0e624a8f..ac2485fe31 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -205,7 +205,7 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options, r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "mipmaps/generate"), (p_preset == PRESET_3D ? true : false))); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "mipmaps/limit", PROPERTY_HINT_RANGE, "-1,256"), -1)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "roughness/mode", PROPERTY_HINT_ENUM, "Detect,Disabled,Red,Green,Blue,Alpha,Gray"), 0)); - r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "roughness/src_normal", PROPERTY_HINT_FILE, "*.png,*.jpg"), "")); + r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "roughness/src_normal", PROPERTY_HINT_FILE, "*.bmp,*.dds,*.exr,*.jpeg,*.jpg,*.hdr,*.png,*.svg,*.svgz,*.tga,*.webp"), "")); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/premult_alpha"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/invert_color"), false)); diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 397a958d8f..b7f7d637d2 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -1716,14 +1716,12 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector3 face_points[4]; for (int j=0;j<4;j++) { - float v[3]; v[0]=1.0; v[1]=1-2*((j>>1)&1); v[2]=v[1]*(1-2*(j&1)); for (int k=0;k<3;k++) { - if (i<3) face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1); else diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e1f2d2c045..fc433b5e63 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3389,7 +3389,6 @@ void CanvasItemEditor::_draw_selection() { if (canvas_item->_edit_use_rect()) { Vector2 pre_drag_endpoints[4] = { - pre_drag_xform.xform(se->pre_drag_rect.position), pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(se->pre_drag_rect.size.x, 0)), pre_drag_xform.xform(se->pre_drag_rect.position + se->pre_drag_rect.size), diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.h b/editor/plugins/collision_polygon_3d_editor_plugin.h index 98f499031a..bb4ee2185e 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.h +++ b/editor/plugins/collision_polygon_3d_editor_plugin.h @@ -44,7 +44,6 @@ class CollisionPolygon3DEditor : public HBoxContainer { UndoRedo *undo_redo; enum Mode { - MODE_CREATE, MODE_EDIT, diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.h b/editor/plugins/cpu_particles_3d_editor_plugin.h index 90300daf71..d6886a24dc 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.h +++ b/editor/plugins/cpu_particles_3d_editor_plugin.h @@ -38,7 +38,6 @@ class CPUParticles3DEditor : public GPUParticles3DEditorBase { GDCLASS(CPUParticles3DEditor, GPUParticles3DEditorBase); enum Menu { - MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE, MENU_OPTION_CLEAR_EMISSION_VOLUME, MENU_OPTION_RESTART diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.h b/editor/plugins/gpu_particles_2d_editor_plugin.h index 86e89bd0b0..f3ca20b71a 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.h +++ b/editor/plugins/gpu_particles_2d_editor_plugin.h @@ -42,7 +42,6 @@ class GPUParticles2DEditorPlugin : public EditorPlugin { GDCLASS(GPUParticles2DEditorPlugin, EditorPlugin); enum { - MENU_GENERATE_VISIBILITY_RECT, MENU_LOAD_EMISSION_MASK, MENU_CLEAR_EMISSION_MASK, diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.h b/editor/plugins/gpu_particles_3d_editor_plugin.h index 1665b3676a..ce376e4386 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.h +++ b/editor/plugins/gpu_particles_3d_editor_plugin.h @@ -71,7 +71,6 @@ class GPUParticles3DEditor : public GPUParticles3DEditorBase { GPUParticles3D *node; enum Menu { - MENU_OPTION_GENERATE_AABB, MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE, MENU_OPTION_CLEAR_EMISSION_VOLUME, diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h index 87586904a3..fa5e802869 100644 --- a/editor/plugins/item_list_editor_plugin.h +++ b/editor/plugins/item_list_editor_plugin.h @@ -49,7 +49,6 @@ protected: public: enum Flags { - FLAG_ICON = 1, FLAG_CHECKABLE = 2, FLAG_ID = 4, diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.h b/editor/plugins/mesh_instance_3d_editor_plugin.h index 77a2b8ec34..f42136942b 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.h +++ b/editor/plugins/mesh_instance_3d_editor_plugin.h @@ -40,7 +40,6 @@ class MeshInstance3DEditor : public Control { GDCLASS(MeshInstance3DEditor, Control); enum Menu { - MENU_OPTION_CREATE_STATIC_TRIMESH_BODY, MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE, MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE, diff --git a/editor/plugins/mesh_library_editor_plugin.h b/editor/plugins/mesh_library_editor_plugin.h index ea13303740..fafbce9243 100644 --- a/editor/plugins/mesh_library_editor_plugin.h +++ b/editor/plugins/mesh_library_editor_plugin.h @@ -46,7 +46,6 @@ class MeshLibraryEditor : public Control { int to_erase; enum { - MENU_OPTION_ADD_ITEM, MENU_OPTION_REMOVE_ITEM, MENU_OPTION_UPDATE_FROM_SCENE, diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h index d1f8a3b74a..6a80fd4d16 100644 --- a/editor/plugins/multimesh_editor_plugin.h +++ b/editor/plugins/multimesh_editor_plugin.h @@ -63,7 +63,6 @@ class MultiMeshEditor : public Control { SpinBox *populate_amount; enum Menu { - MENU_OPTION_POPULATE }; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index fdbf3415db..28acb26012 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6753,12 +6753,12 @@ void EditorNode3DGizmoPlugin::create_icon_material(const String &p_name, const R materials[p_name] = icons; } -void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool p_billboard) { +void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool p_billboard, const Ref<Texture2D> &p_icon) { Ref<StandardMaterial3D> handle_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D)); handle_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); handle_material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true); - Ref<Texture2D> handle_t = Node3DEditor::get_singleton()->get_theme_icon("Editor3DHandle", "EditorIcons"); + Ref<Texture2D> handle_t = p_icon != nullptr ? p_icon : Node3DEditor::get_singleton()->get_theme_icon("Editor3DHandle", "EditorIcons"); handle_material->set_point_size(handle_t->get_width()); handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle_t); handle_material->set_albedo(Color(1, 1, 1)); @@ -6842,7 +6842,7 @@ void EditorNode3DGizmoPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("create_material", "name", "color", "billboard", "on_top", "use_vertex_color"), &EditorNode3DGizmoPlugin::create_material, DEFVAL(false), DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("create_icon_material", "name", "texture", "on_top", "color"), &EditorNode3DGizmoPlugin::create_icon_material, DEFVAL(false), DEFVAL(Color(1, 1, 1, 1))); - ClassDB::bind_method(D_METHOD("create_handle_material", "name", "billboard"), &EditorNode3DGizmoPlugin::create_handle_material, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("create_handle_material", "name", "billboard", "texture"), &EditorNode3DGizmoPlugin::create_handle_material, DEFVAL(false), DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("add_material", "name", "material"), &EditorNode3DGizmoPlugin::add_material); ClassDB::bind_method(D_METHOD("get_material", "name", "gizmo"), &EditorNode3DGizmoPlugin::get_material); //, DEFVAL(Ref<EditorNode3DGizmo>())); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 4c4faef07f..2e98fcad4c 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -180,7 +180,6 @@ class Node3DEditorViewport : public Control { friend class Node3DEditor; friend class ViewportRotationControl; enum { - VIEW_TOP, VIEW_BOTTOM, VIEW_LEFT, @@ -554,7 +553,6 @@ public: static const unsigned int VIEWPORTS_COUNT = 4; enum ToolMode { - TOOL_MODE_SELECT, TOOL_MODE_MOVE, TOOL_MODE_ROTATE, @@ -568,7 +566,6 @@ public: }; enum ToolOptions { - TOOL_OPT_LOCAL_COORDS, TOOL_OPT_USE_SNAP, TOOL_OPT_OVERRIDE_CAMERA, @@ -634,7 +631,6 @@ private: } gizmo; enum MenuOption { - MENU_TOOL_SELECT, MENU_TOOL_MOVE, MENU_TOOL_ROTATE, @@ -866,7 +862,7 @@ protected: public: void create_material(const String &p_name, const Color &p_color, bool p_billboard = false, bool p_on_top = false, bool p_use_vertex_color = false); void create_icon_material(const String &p_name, const Ref<Texture2D> &p_texture, bool p_on_top = false, const Color &p_albedo = Color(1, 1, 1, 1)); - void create_handle_material(const String &p_name, bool p_billboard = false); + void create_handle_material(const String &p_name, bool p_billboard = false, const Ref<Texture2D> &p_texture = nullptr); void add_material(const String &p_name, Ref<StandardMaterial3D> p_material); Ref<StandardMaterial3D> get_material(const String &p_name, const Ref<EditorNode3DGizmo> &p_gizmo = Ref<EditorNode3DGizmo>()); diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h index 6a7dffc7f8..8a420d7c8d 100644 --- a/editor/plugins/path_2d_editor_plugin.h +++ b/editor/plugins/path_2d_editor_plugin.h @@ -76,7 +76,6 @@ class Path2DEditor : public HBoxContainer { }; enum Action { - ACTION_NONE, ACTION_MOVING_POINT, ACTION_MOVING_IN, diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index f53130c24d..280f6fafd8 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -224,6 +224,7 @@ void Path3DGizmo::redraw() { Ref<StandardMaterial3D> path_material = gizmo_plugin->get_material("path_material", this); Ref<StandardMaterial3D> path_thin_material = gizmo_plugin->get_material("path_thin_material", this); Ref<StandardMaterial3D> handles_material = gizmo_plugin->get_material("handles"); + Ref<StandardMaterial3D> sec_handles_material = gizmo_plugin->get_material("sec_handles"); Ref<Curve3D> c = path->get_curve(); if (c.is_null()) { @@ -281,7 +282,7 @@ void Path3DGizmo::redraw() { add_handles(handles, handles_material); } if (sec_handles.size()) { - add_handles(sec_handles, handles_material, false, true); + add_handles(sec_handles, sec_handles_material, false, true); } } } @@ -641,5 +642,6 @@ Path3DGizmoPlugin::Path3DGizmoPlugin() { Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8)); create_material("path_material", path_color); create_material("path_thin_material", Color(0.5, 0.5, 0.5)); - create_handle_material("handles"); + create_handle_material("handles", false, Node3DEditor::get_singleton()->get_theme_icon("EditorPathSmoothHandle", "EditorIcons")); + create_handle_material("sec_handles", false, Node3DEditor::get_singleton()->get_theme_icon("EditorCurveHandle", "EditorIcons")); } diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 29db284b44..0063bec9de 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -372,7 +372,6 @@ void ShaderEditor::_bind_methods() { void ShaderEditor::ensure_select_current() { /* if (tab_container->get_child_count() && tab_container->get_current_tab()>=0) { - ShaderTextEditor *ste = Object::cast_to<ShaderTextEditor>(tab_container->get_child(tab_container->get_current_tab())); if (!ste) return; diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index 904aed186a..e81a782ac8 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -69,7 +69,6 @@ class ShaderEditor : public PanelContainer { GDCLASS(ShaderEditor, PanelContainer); enum { - EDIT_UNDO, EDIT_REDO, EDIT_CUT, diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index f57616db1f..848704e830 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -43,7 +43,6 @@ class TileMapEditor : public VBoxContainer { GDCLASS(TileMapEditor, VBoxContainer); enum Tool { - TOOL_NONE, TOOL_PAINTING, TOOL_ERASING, @@ -58,7 +57,6 @@ class TileMapEditor : public VBoxContainer { }; enum Options { - OPTION_COPY, OPTION_ERASE_SELECTION, OPTION_FIX_INVALID, diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h index 248a1435fd..34643e85e4 100644 --- a/editor/plugins/version_control_editor_plugin.h +++ b/editor/plugins/version_control_editor_plugin.h @@ -43,7 +43,6 @@ class VersionControlEditorPlugin : public EditorPlugin { public: enum ChangeType { - CHANGE_TYPE_NEW = 0, CHANGE_TYPE_MODIFIED = 1, CHANGE_TYPE_RENAMED = 2, diff --git a/editor/project_export.cpp b/editor/project_export.cpp index e8c2b1f954..75509c7544 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -721,14 +721,19 @@ void ProjectExportDialog::_fill_resource_tree() { } bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes) { + p_item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); p_item->set_icon(0, presets->get_theme_icon("folder", "FileDialog")); p_item->set_text(0, p_dir->get_name() + "/"); + p_item->set_editable(0, true); + p_item->set_metadata(0, p_dir->get_path()); bool used = false; + bool checked = true; for (int i = 0; i < p_dir->get_subdir_count(); i++) { TreeItem *subdir = include_files->create_item(p_item); if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) { used = true; + checked = checked && subdir->is_checked(0); } else { memdelete(subdir); } @@ -750,10 +755,12 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem file->set_editable(0, true); file->set_checked(0, current->has_export_file(path)); file->set_metadata(0, path); + checked = checked && file->is_checked(0); used = true; } + p_item->set_checked(0, checked); return used; } @@ -775,13 +782,53 @@ void ProjectExportDialog::_tree_changed() { String path = item->get_metadata(0); bool added = item->is_checked(0); - if (added) { - current->add_export_file(path); + if (path.ends_with("/")) { + _check_dir_recursive(item, added); } else { - current->remove_export_file(path); + if (added) { + current->add_export_file(path); + } else { + current->remove_export_file(path); + } + } + _refresh_parent_checks(item); // Makes parent folder checked if all files/folders are checked. +} + +void ProjectExportDialog::_check_dir_recursive(TreeItem *p_dir, bool p_checked) { + for (TreeItem *child = p_dir->get_children(); child; child = child->get_next()) { + String path = child->get_metadata(0); + + child->set_checked(0, p_checked); + if (path.ends_with("/")) { + _check_dir_recursive(child, p_checked); + } else { + if (p_checked) { + get_current_preset()->add_export_file(path); + } else { + get_current_preset()->remove_export_file(path); + } + } } } +void ProjectExportDialog::_refresh_parent_checks(TreeItem *p_item) { + TreeItem *parent = p_item->get_parent(); + if (!parent) { + return; + } + + bool checked = true; + for (TreeItem *child = parent->get_children(); child; child = child->get_next()) { + checked = checked && child->is_checked(0); + if (!checked) { + break; + } + } + parent->set_checked(0, checked); + + _refresh_parent_checks(parent); +} + void ProjectExportDialog::_export_pck_zip() { export_pck_zip->popup_file_dialog(); } diff --git a/editor/project_export.h b/editor/project_export.h index 026daac2ad..b8ca0dd9f2 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -123,6 +123,8 @@ private: void _fill_resource_tree(); bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes); void _tree_changed(); + void _check_dir_recursive(TreeItem *p_dir, bool p_checked); + void _refresh_parent_checks(TreeItem *p_item); Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index e3c2ba83f2..167cd3ac35 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -61,6 +61,7 @@ class ProjectDialog : public ConfirmationDialog { GDCLASS(ProjectDialog, ConfirmationDialog); public: + bool is_folder_empty = true; enum Mode { MODE_NEW, MODE_IMPORT, @@ -218,7 +219,7 @@ private: // check if the specified install folder is empty, even though this is not an error, it is good to check here d->list_dir_begin(); - bool is_empty = true; + is_folder_empty = true; String n = d->get_next(); while (n != String()) { if (!n.begins_with(".")) { @@ -226,14 +227,14 @@ private: // and hidden files/folders to be present. // For instance, this lets users initialize a Git repository // and still be able to create a project in the directory afterwards. - is_empty = false; + is_folder_empty = false; break; } n = d->get_next(); } d->list_dir_end(); - if (!is_empty) { + if (!is_folder_empty) { set_message(TTR("Please choose an empty folder."), MESSAGE_WARNING, INSTALL_PATH); memdelete(d); get_ok()->set_disabled(true); @@ -258,7 +259,7 @@ private: } else { // check if the specified folder is empty, even though this is not an error, it is good to check here d->list_dir_begin(); - bool is_empty = true; + is_folder_empty = true; String n = d->get_next(); while (n != String()) { if (!n.begins_with(".")) { @@ -266,18 +267,18 @@ private: // and hidden files/folders to be present. // For instance, this lets users initialize a Git repository // and still be able to create a project in the directory afterwards. - is_empty = false; + is_folder_empty = false; break; } n = d->get_next(); } d->list_dir_end(); - if (!is_empty) { - set_message(TTR("Please choose an empty folder."), MESSAGE_ERROR); + if (!is_folder_empty) { + set_message(TTR("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING); memdelete(d); - get_ok()->set_disabled(true); - return ""; + get_ok()->set_disabled(false); + return valid_path; } } @@ -416,6 +417,11 @@ private: } } + void _nonempty_confirmation_ok_pressed() { + is_folder_empty = true; + ok_pressed(); + } + void ok_pressed() override { String dir = project_path->get_text(); @@ -454,6 +460,18 @@ private: } else { if (mode == MODE_NEW) { + // Before we create a project, check that the target folder is empty. + // If not, we need to ask the user if they're sure they want to do this. + if (!is_folder_empty) { + ConfirmationDialog *cd = memnew(ConfirmationDialog); + cd->set_title(TTR("Warning: This folder is not empty")); + cd->set_text(TTR("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?")); + cd->get_ok()->connect("pressed", callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed)); + get_parent()->add_child(cd); + cd->popup_centered(); + cd->grab_focus(); + return; + } ProjectSettings::CustomMap initial_settings; if (rasterizer_button_group->get_pressed_button()->get_meta("driver_name") == "Vulkan") { initial_settings["rendering/quality/driver/driver_name"] = "Vulkan"; @@ -2348,12 +2366,24 @@ ProjectManager::ProjectManager() { switch (display_scale) { case 0: { - // Try applying a suitable display scale automatically + // Try applying a suitable display scale automatically. #ifdef OSX_ENABLED editor_set_scale(DisplayServer::get_singleton()->screen_get_max_scale()); #else const int screen = DisplayServer::get_singleton()->window_get_current_screen(); - editor_set_scale(DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).x > 2000 ? 2.0 : 1.0); + float scale; + if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).y >= 1400) { + // hiDPI display. + scale = 2.0; + } else if (DisplayServer::get_singleton()->screen_get_size(screen).y <= 800) { + // Small loDPI display. Use a smaller display scale so that editor elements fit more easily. + // Icons won't look great, but this is better than having editor elements overflow from its window. + scale = 0.75; + } else { + scale = 1.0; + } + + editor_set_scale(scale); #endif } break; @@ -2375,9 +2405,9 @@ ProjectManager::ProjectManager() { case 6: editor_set_scale(2.0); break; - default: { + default: editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale")); - } break; + break; } // Define a minimum window size to prevent UI elements from overlapping or being cut off diff --git a/editor/project_manager.h b/editor/project_manager.h index 407dba0c94..212d693f1d 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -98,6 +98,7 @@ class ProjectManager : public Control { void _restart_confirm(); void _exit_dialog(); void _confirm_update_settings(); + void _nonempty_confirmation_ok_pressed(); void _load_recent_projects(); void _on_project_created(const String &dir); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index add5047c99..038b18a648 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1270,10 +1270,6 @@ void SceneTreeDock::_fill_path_renames(Vector<StringName> base_path, Vector<Stri } void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath>> *p_renames) { - if (!bool(EDITOR_DEF("editors/animation/autorename_animation_tracks", true))) { - return; - } - Vector<StringName> base_path; Node *n = p_node->get_parent(); while (n) { diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index c2c877bf68..119a499d0f 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -55,7 +55,6 @@ class SceneTreeDock : public VBoxContainer { GDCLASS(SceneTreeDock, VBoxContainer); enum Tool { - TOOL_NEW, TOOL_INSTANCE, TOOL_EXPAND_COLLAPSE, |