diff options
36 files changed, 289 insertions, 276 deletions
diff --git a/.clang-format b/.clang-format index 3a2c39a174..237fd9ce30 100644 --- a/.clang-format +++ b/.clang-format @@ -116,6 +116,7 @@ Standard: Cpp03 --- ### ObjC specific config ### Language: ObjC +Standard: Cpp03 ObjCBlockIndentWidth: 4 # ObjCSpaceAfterProperty: false # ObjCSpaceBeforeProtocolList: true @@ -17,7 +17,6 @@ generous deed immortalized in the next stable release of Godot Engine. ## Gold sponsors Gamblify <https://www.gamblify.com> - GameDev.TV <https://gdev.tv/godot> Image Campus <https://www.imagecampus.edu.ar> ## Mini sponsors @@ -30,6 +29,7 @@ generous deed immortalized in the next stable release of Godot Engine. Christoph Woinke Edward Flick GameDev.net + GameDev.tv Hein-Pieter van Braam Jamal Alyafei Javary Games @@ -37,6 +37,8 @@ generous deed immortalized in the next stable release of Godot Engine. Justin Arnold Kyle Szklenski Leona Eden + Leonard Meagher + Ludosity AB Matthieu Huvé Maxim Karsten Mike King @@ -56,30 +58,34 @@ generous deed immortalized in the next stable release of Godot Engine. ## Gold donors Asdf + Brandon Waite cheese65536 David Gehrig Edward E + Florian Krick K9Kraken Manuele Finocchiaro Nathanael Beisiegel Officine Pixel S.n.c. Retro Village - Valorware Zashi Zaven Muradyan 13MHz Allen Schade Andreas Schüle + Asher Glick Austen McRae + Daniel James Daniel Lynn David Giardi Florian Breisch Gary Oberbrunner Gero Jay Horton - Johannes Wuensch + Jon Smith Jon Woodward + Jorge Bernal Joshua Lesperance Justo Delgado Baudí Krzysztof Dluzniewski @@ -89,8 +95,10 @@ generous deed immortalized in the next stable release of Godot Engine. paul gruenbacher Paul LaMotte Rob Messick + Scott Wadden Sergey Svenne Krap + Tom Langwaldt William Wold Wyatt Goodin Xananax @@ -107,10 +115,11 @@ generous deed immortalized in the next stable release of Godot Engine. Joan Fons John Krzysztof Jankowski - Laurence Bannister Lucas Ferreira Franca Markus Wiesner Nathan Lundquist + Pascal Grüter + Petr Malac Rami Robert Willes Robin Arys @@ -123,10 +132,8 @@ generous deed immortalized in the next stable release of Godot Engine. Alessandra Pereyra Alexey Dyadchenko - Amanda Haldy Benjamin W Flint Chau Siu Hung - Chris Brown Chris Goddard Chris Petrich Christian Leth Jeppesen @@ -139,13 +146,15 @@ generous deed immortalized in the next stable release of Godot Engine. Eric Monson Ethan Bennis Eugenio Hugo Salgüero Jáñez - Eulogio Enamorado Pallares flesk + gavlig GGGames.org + Giles Montgomery Giovanni Solimeno Guilherme Felipe de C. G. da Silva Heath Hayes Hysteria + Jalal Chaabane Jeppe Zapp Jose Malheiro Juan T Chen @@ -156,6 +165,7 @@ generous deed immortalized in the next stable release of Godot Engine. Marius Kamm Martin Eigel Marvin + Matt Eunson Max R.R. Collada Nick Nikitin Oliver Dick @@ -166,26 +176,28 @@ generous deed immortalized in the next stable release of Godot Engine. Ruben Soares Luis Samuel Judd Sofox + spilldata Stoned Xander Tobias Bocanegra WytRabbit Xavier Fumado Beltran - Zachariah Gibbons ## Silver donors 1D_Inc - 2drealms Adam Brunnmeier Adam Carr + Adam Nakonieczny Adam Smeltzer Adisibio Alder Stefano Alessandro Senese Alexander Gillberg Alexander Koppe + Alice Robinson Andreas Krampitz Anthony Bongiovanni + Arbor Interactive Arthur S. Muszynski Artur Barichello Aubrey Falconer @@ -200,19 +212,25 @@ generous deed immortalized in the next stable release of Godot Engine. Bryan Stevenson Carl Winder Carwyn Edwards + Chris Brown Chris Chapin Christian Baune Christian Winter + Christoffer Sundbom + Chris Wilson Collin Shooltz + Connor Hill Daniel Johnson - Daniel Kaplan DanielMaximiano + Daniel Reed David Cravens David May Dominik Wetzel DOXA Edward Herbert + Egon Elbre Elmeri '- Duy Kevin Nguyen + Emanuel Kotzayan Eric Martini Eric McCarthy Eric Williams @@ -232,11 +250,13 @@ generous deed immortalized in the next stable release of Godot Engine. Igor Buzatovic Jaime Ruiz-Borau Vizárraga Jako Danar + James A F Manley Jeff Hungerford Jeremy Kahn + Jesse Dubay Joao Senerchia Joel Fivat - Johan Lindberg + Johannes Wuensch Jonas Rudlang Jonas Yamazaki Jonathan G @@ -250,11 +270,11 @@ generous deed immortalized in the next stable release of Godot Engine. Juan Negrier Judd Julian Murgia - Justin Luk KC Chan Kevin Boyer - Kevin van Rooijen + Kiyohiro Kawamura (kyorohiro) Klagsam + KR McGinley KsyTek Games Kuan Cheang kycho @@ -269,7 +289,6 @@ generous deed immortalized in the next stable release of Godot Engine. Matt Welke Maxwell Mertcan Mermerkaya - mhilbrunner Michael Dürwald Michael Gringauz Michael Labbe @@ -284,9 +303,7 @@ generous deed immortalized in the next stable release of Godot Engine. Niclas Eriksen Nicolás Montaña Nicolas SAN AGUSTIN - nitenook Pan Ip - Pascal Grüter Patrick Nafarrete Paul Gieske Paul Mason @@ -298,37 +315,42 @@ generous deed immortalized in the next stable release of Godot Engine. Prokhorenko Leonid Psyagnostic Rafael - rayos Rémi Verschelde Ricardo Alcantara Richman Stewart + Robert Farr (Larington) Roger Burgess Roger Smith Roland Rząsa Roman Tinkov + Ryan Cheung + Ryan Hentz Sasori Olkof Sebastian Michailidis Shane Spoor + Simon Wenner Sootstone Theo Cranmore Théo Hay Thibault Barbaroux Thomas Bell Thomas Holmes + Thomas Kelly Thomas Kurz tiansheng li Tim Tim Drumheller Tom Larrow - Troy Austin + Torsten Crass Tryggve Sollid Tyler Stafos UltyX Vaiktorg Victor Viktor Ferenczi - Vladimir Soukup waka nya + Wayne Haak + werner mendizabal William Gervasio William Hogben Wout Standaert diff --git a/core/image.cpp b/core/image.cpp index 91c3d05a29..3d48db872c 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1789,7 +1789,7 @@ Error Image::decompress() { _image_decompress_pvrtc(this); else if (format == FORMAT_ETC && _image_decompress_etc1) _image_decompress_etc1(this); - else if (format >= FORMAT_ETC2_R11 && format <= FORMAT_ETC2_RGB8A1 && _image_decompress_etc1) + else if (format >= FORMAT_ETC2_R11 && format <= FORMAT_ETC2_RGB8A1 && _image_decompress_etc2) _image_decompress_etc2(this); else return ERR_UNAVAILABLE; diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml index b0a21d7f82..78623b359e 100644 --- a/doc/classes/Expression.xml +++ b/doc/classes/Expression.xml @@ -39,6 +39,7 @@ </argument> <description> Executes the expression that was previously parsed by [method parse] and returns the result. Before you use the returned object, you should check if the method failed by calling [method has_execute_failed]. + If you defined input variables in [method parse], you can specify their values in the inputs array, in the same order. </description> </method> <method name="get_error_text" qualifiers="const"> @@ -64,6 +65,7 @@ </argument> <description> Parses the expression and returns a [enum @GlobalScope.Error]. + You can optionally specify names of variables that may appear in the expression with [code]input_names[/code], so that you can bind them when it gets executed. </description> </method> </methods> diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState.xml index c4dc103b72..118010b3cf 100644 --- a/doc/classes/PhysicsDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState.xml @@ -21,7 +21,7 @@ </argument> <description> Checks whether the shape can travel to a point. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code]. - If the shape can not move, the returned array will be [code][0, 0][/code]. + If the shape can not move, the returned array will be [code][0, 0][/code] under Bullet, and empty under GodotPhysics. </description> </method> <method name="collide_shape"> diff --git a/doc/classes/ResourcePreloader.xml b/doc/classes/ResourcePreloader.xml index 002bcd891a..18d6e04d8e 100644 --- a/doc/classes/ResourcePreloader.xml +++ b/doc/classes/ResourcePreloader.xml @@ -4,7 +4,7 @@ Resource Preloader Node. </brief_description> <description> - Resource Preloader Node. This node is used to preload sub-resources inside a scene, so when the scene is loaded all the resources are ready to use and be retrieved from here. + This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. </description> <tutorials> </tutorials> @@ -19,6 +19,7 @@ <argument index="1" name="resource" type="Resource"> </argument> <description> + Adds a resource to the preloader with the given [code]name[/code]. If a resource with the given [code]name[/code] already exists, the new resource will be renamed to "[code]name[/code] N" where N is an incrementing number starting from 2. </description> </method> <method name="get_resource" qualifiers="const"> @@ -27,14 +28,14 @@ <argument index="0" name="name" type="String"> </argument> <description> - Return the resource given a text-id. + Returns the resource associated to [code]name[/code]. </description> </method> <method name="get_resource_list" qualifiers="const"> <return type="PoolStringArray"> </return> <description> - Return the list of resources inside the preloader. + Returns the list of resources inside the preloader. </description> </method> <method name="has_resource" qualifiers="const"> @@ -43,7 +44,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Return true if the preloader has a given resource. + Returns true if the preloader contains a resource associated to [code]name[/code]. </description> </method> <method name="remove_resource"> @@ -52,7 +53,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Remove a resource from the preloader by text id. + Removes the resource associated to [code]name[/code] from the preloader. </description> </method> <method name="rename_resource"> @@ -63,7 +64,7 @@ <argument index="1" name="newname" type="String"> </argument> <description> - Rename a resource inside the preloader, from a text-id to a new text-id. + Renames a resource inside the preloader from [code]name[/code] to [code]newname[/code]. </description> </method> </methods> diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 4ab9a72694..927d915bcd 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -31,6 +31,7 @@ #include "code_editor.h" #include "core/os/keyboard.h" +#include "core/string_builder.h" #include "editor/editor_scale.h" #include "editor_node.h" #include "editor_settings.h" @@ -673,18 +674,14 @@ void CodeTextEditor::_reset_zoom() { if (font.is_valid()) { EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14); font->set_size(14); - font_size_nb->set_text("14 (100%)"); } } void CodeTextEditor::_line_col_changed() { - line_nb->set_text(itos(text_editor->cursor_get_line() + 1)); - String line = text_editor->get_line(text_editor->cursor_get_line()); int positional_column = 0; - for (int i = 0; i < text_editor->cursor_get_column(); i++) { if (line[i] == '\t') { positional_column += text_editor->get_indent_size(); //tab size @@ -693,7 +690,14 @@ void CodeTextEditor::_line_col_changed() { } } - col_nb->set_text(itos(positional_column + 1)); + StringBuilder *sb = memnew(StringBuilder); + sb->append("("); + sb->append(itos(text_editor->cursor_get_line() + 1).lpad(3)); + sb->append(","); + sb->append(itos(positional_column + 1).lpad(3)); + sb->append(")"); + + line_and_col_txt->set_text(sb->as_string()); } void CodeTextEditor::_text_changed() { @@ -747,8 +751,6 @@ bool CodeTextEditor::_add_font_size(int p_delta) { if (font.is_valid()) { int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE); - font_size_nb->set_text(itos(new_size) + " (" + itos(100 * new_size / (14 * EDSCALE)) + "%)"); - if (new_size != font->get_size()) { EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE); font->set_size(new_size); @@ -1167,7 +1169,6 @@ void CodeTextEditor::_on_settings_change() { _update_font(); font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); - font_size_nb->set_text(itos(font_size) + " (" + itos(100 * font_size / (14 * EDSCALE)) + "%)"); // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( @@ -1188,17 +1189,48 @@ void CodeTextEditor::_text_changed_idle_timeout() { emit_signal("validate_script"); } -void CodeTextEditor::_notification(int p_what) { +void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) { + Ref<InputEventMouseButton> mb = p_event; + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + _warning_button_pressed(); + } +} - if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - _load_theme_settings(); - emit_signal("load_theme_settings"); +void CodeTextEditor::_warning_button_pressed() { + emit_signal("warning_pressed"); +} + +void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { + Ref<InputEventMouseButton> mb = p_event; + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + emit_signal("error_pressed"); } - if (p_what == NOTIFICATION_THEME_CHANGED) { - _update_font(); +} + +void CodeTextEditor::_notification(int p_what) { + + switch (p_what) { + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + _load_theme_settings(); + emit_signal("load_theme_settings"); + } break; + case NOTIFICATION_THEME_CHANGED: { + _update_font(); + } break; + case NOTIFICATION_ENTER_TREE: { + warning_button->set_icon(get_icon("NodeWarning", "EditorIcons")); + } break; + default: + break; } } +void CodeTextEditor::set_warning_nb(int p_warning_nb) { + warning_count_label->set_text(itos(p_warning_nb)); + warning_count_label->set_visible(p_warning_nb > 0); + warning_button->set_visible(p_warning_nb > 0); +} + void CodeTextEditor::_bind_methods() { ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input); @@ -1209,9 +1241,14 @@ void CodeTextEditor::_bind_methods() { ClassDB::bind_method("_code_complete_timer_timeout", &CodeTextEditor::_code_complete_timer_timeout); ClassDB::bind_method("_complete_request", &CodeTextEditor::_complete_request); ClassDB::bind_method("_font_resize_timeout", &CodeTextEditor::_font_resize_timeout); + ClassDB::bind_method("_error_pressed", &CodeTextEditor::_error_pressed); + ClassDB::bind_method("_warning_button_pressed", &CodeTextEditor::_warning_button_pressed); + ClassDB::bind_method("_warning_label_gui_input", &CodeTextEditor::_warning_label_gui_input); ADD_SIGNAL(MethodInfo("validate_script")); ADD_SIGNAL(MethodInfo("load_theme_settings")); + ADD_SIGNAL(MethodInfo("warning_pressed")); + ADD_SIGNAL(MethodInfo("error_pressed")); } void CodeTextEditor::set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud) { @@ -1226,15 +1263,16 @@ CodeTextEditor::CodeTextEditor() { ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS); ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD | KEY_0); + text_editor = memnew(TextEdit); + add_child(text_editor); + text_editor->set_v_size_flags(SIZE_EXPAND_FILL); + + // Added second to it opens at the bottom, so it won't shift the entire text editor when opening find_replace_bar = memnew(FindReplaceBar); add_child(find_replace_bar); find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); find_replace_bar->hide(); - text_editor = memnew(TextEdit); - add_child(text_editor); - text_editor->set_v_size_flags(SIZE_EXPAND_FILL); - find_replace_bar->set_text_edit(text_editor); text_editor->set_show_line_numbers(true); @@ -1258,95 +1296,50 @@ CodeTextEditor::CodeTextEditor() { error_line = 0; error_column = 0; + // Error + ScrollContainer *scroll = memnew(ScrollContainer); + scroll->set_h_size_flags(SIZE_EXPAND_FILL); + scroll->set_v_size_flags(SIZE_EXPAND_FILL); + scroll->set_enable_v_scroll(false); + status_bar->add_child(scroll); + error = memnew(Label); - status_bar->add_child(error); - error->set_autowrap(true); - error->set_valign(Label::VALIGN_CENTER); - error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch + scroll->add_child(error); + error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); error->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); error->set_mouse_filter(MOUSE_FILTER_STOP); + error->connect("gui_input", this, "_error_pressed"); find_replace_bar->connect("error", error, "set_text"); - status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible - - warning_label = memnew(Label); - status_bar->add_child(warning_label); - warning_label->set_align(Label::ALIGN_RIGHT); - warning_label->set_valign(Label::VALIGN_CENTER); - warning_label->set_v_size_flags(SIZE_FILL); - warning_label->set_default_cursor_shape(CURSOR_POINTING_HAND); - warning_label->set_mouse_filter(MOUSE_FILTER_STOP); - warning_label->set_text(TTR("Warnings:")); - warning_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + // Warnings + warning_button = memnew(ToolButton); + status_bar->add_child(warning_button); + warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); + warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND); + warning_button->connect("pressed", this, "_warning_button_pressed"); + warning_button->set_tooltip(TTR("Warnings")); warning_count_label = memnew(Label); status_bar->add_child(warning_count_label); - warning_count_label->set_valign(Label::VALIGN_CENTER); - warning_count_label->set_v_size_flags(SIZE_FILL); - warning_count_label->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch - warning_count_label->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch - warning_count_label->set_custom_minimum_size(Size2(40, 1) * EDSCALE); + warning_count_label->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); warning_count_label->set_align(Label::ALIGN_RIGHT); warning_count_label->set_default_cursor_shape(CURSOR_POINTING_HAND); warning_count_label->set_mouse_filter(MOUSE_FILTER_STOP); + warning_count_label->set_tooltip(TTR("Warnings")); + warning_count_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor")); warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - warning_count_label->set_text("0"); - - Label *font_size_txt = memnew(Label); - status_bar->add_child(font_size_txt); - font_size_txt->set_align(Label::ALIGN_RIGHT); - font_size_txt->set_valign(Label::VALIGN_CENTER); - font_size_txt->set_v_size_flags(SIZE_FILL); - font_size_txt->set_text(TTR("Font Size:")); - font_size_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - font_size_nb = memnew(Label); - status_bar->add_child(font_size_nb); - font_size_nb->set_valign(Label::VALIGN_CENTER); - font_size_nb->set_v_size_flags(SIZE_FILL); - font_size_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch - font_size_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch - font_size_nb->set_custom_minimum_size(Size2(100, 1) * EDSCALE); - font_size_nb->set_align(Label::ALIGN_RIGHT); - font_size_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - Label *line_txt = memnew(Label); - status_bar->add_child(line_txt); - line_txt->set_align(Label::ALIGN_RIGHT); - line_txt->set_valign(Label::VALIGN_CENTER); - line_txt->set_v_size_flags(SIZE_FILL); - line_txt->set_text(TTR("Line:")); - line_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - line_nb = memnew(Label); - status_bar->add_child(line_nb); - line_nb->set_valign(Label::VALIGN_CENTER); - line_nb->set_v_size_flags(SIZE_FILL); - line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch - line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch - line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); - line_nb->set_align(Label::ALIGN_RIGHT); - line_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - Label *col_txt = memnew(Label); - status_bar->add_child(col_txt); - col_txt->set_align(Label::ALIGN_RIGHT); - col_txt->set_valign(Label::VALIGN_CENTER); - col_txt->set_v_size_flags(SIZE_FILL); - col_txt->set_text(TTR("Col:")); - col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - col_nb = memnew(Label); - status_bar->add_child(col_nb); - col_nb->set_valign(Label::VALIGN_CENTER); - col_nb->set_v_size_flags(SIZE_FILL); - col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch - col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch - col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); - col_nb->set_align(Label::ALIGN_RIGHT); - col_nb->set("custom_constants/margin_right", 0); - col_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + warning_count_label->connect("gui_input", this, "_warning_label_gui_input"); + + set_warning_nb(0); + + // Line and column + line_and_col_txt = memnew(Label); + status_bar->add_child(line_and_col_txt); + line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); + line_and_col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + line_and_col_txt->set_tooltip(TTR("Line and column numbers")); + line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); text_editor->connect("gui_input", this, "_text_editor_gui_input"); text_editor->connect("cursor_changed", this, "_line_col_changed"); @@ -1365,7 +1358,6 @@ CodeTextEditor::CodeTextEditor() { font_resize_val = 0; font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); - font_size_nb->set_text(itos(font_size) + " (" + itos(100 * font_size / (14 * EDSCALE)) + "%)"); font_resize_timer = memnew(Timer); add_child(font_resize_timer); font_resize_timer->set_one_shot(true); diff --git a/editor/code_editor.h b/editor/code_editor.h index 96fc5b79e5..14ce3254ea 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -142,12 +142,12 @@ class CodeTextEditor : public VBoxContainer { TextEdit *text_editor; FindReplaceBar *find_replace_bar; HBoxContainer *status_bar; - Label *warning_label; + + ToolButton *warning_button; Label *warning_count_label; - Label *line_nb; - Label *col_nb; - Label *font_size_nb; + Label *line_and_col_txt; + Label *info; Timer *idle; Timer *code_complete_timer; @@ -176,6 +176,10 @@ class CodeTextEditor : public VBoxContainer { CodeTextEditorCodeCompleteFunc code_complete_func; void *code_complete_ud; + void _warning_label_gui_input(const Ref<InputEvent> &p_event); + void _warning_button_pressed(); + void _error_pressed(const Ref<InputEvent> &p_event); + protected: virtual void _load_theme_settings() {} virtual void _validate_script() {} @@ -212,15 +216,14 @@ public: Variant get_edit_state(); void set_edit_state(const Variant &p_state); + void set_warning_nb(int p_warning_nb); + void update_editor_settings(); void set_error(const String &p_error); void set_error_pos(int p_line, int p_column); void update_line_and_column() { _line_col_changed(); } TextEdit *get_text_edit() { return text_editor; } FindReplaceBar *get_find_replace_bar() { return find_replace_bar; } - Label *get_error_label() const { return error; } - Label *get_warning_label() const { return warning_label; } - Label *get_warning_count_label() const { return warning_count_label; } virtual void apply_code() {} void goto_error(); diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index 6ab41c641d..6b13d19d33 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -173,7 +173,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) { for (int i = 0; i < unfolds.size(); i += 2) { NodePath path = unfolds[i]; PoolVector<String> un = unfolds[i + 1]; - Node *node = p_scene->get_node(path); + Node *node = p_scene->get_node_or_null(path); if (!node) { continue; } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f8cee6883b..7061d38a2a 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1423,10 +1423,6 @@ EditorHelp::EditorHelp() { EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true); - find_bar = memnew(FindBar); - add_child(find_bar); - find_bar->hide(); - class_desc = memnew(RichTextLabel); add_child(class_desc); class_desc->set_v_size_flags(SIZE_EXPAND_FILL); @@ -1434,6 +1430,10 @@ EditorHelp::EditorHelp() { class_desc->connect("meta_clicked", this, "_class_desc_select"); class_desc->connect("gui_input", this, "_class_desc_input"); + // Added second so it opens at the bottom so it won't offset the entire widget + find_bar = memnew(FindBar); + add_child(find_bar); + find_bar->hide(); find_bar->set_rich_text_label(class_desc); class_desc->set_selection_enabled(true); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 803d7e10f7..aaca47622d 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -65,7 +65,6 @@ void EditorLog::_notification(int p_what) { } else if (p_what == NOTIFICATION_THEME_CHANGED) { Ref<DynamicFont> df_output_code = get_font("output_source", "EditorFonts"); if (df_output_code.is_valid()) { - df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE); if (log != NULL) { log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); } @@ -132,7 +131,6 @@ void EditorLog::_bind_methods() { EditorLog::EditorLog() { VBoxContainer *vb = this; - add_constant_override("separation", get_constant("separation", "VBoxContainer")); HBoxContainer *hb = memnew(HBoxContainer); vb->add_child(hb); @@ -163,6 +161,8 @@ EditorLog::EditorLog() { current = Thread::get_caller_id(); + add_constant_override("separation", get_constant("separation", "VBoxContainer")); + EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this); } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 60dc156782..c747e8fe5c 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -273,18 +273,12 @@ void ScriptTextEditor::_set_theme_for_script() { } } -void ScriptTextEditor::_toggle_warning_pannel(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - warnings_panel->set_visible(!warnings_panel->is_visible()); - } +void ScriptTextEditor::_toggle_warning_pannel() { + warnings_panel->set_visible(!warnings_panel->is_visible()); } -void ScriptTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - code_editor->goto_error(); - } +void ScriptTextEditor::_error_pressed() { + code_editor->goto_error(); } void ScriptTextEditor::_warning_clicked(Variant p_line) { @@ -468,7 +462,7 @@ void ScriptTextEditor::_validate_script() { } } - code_editor->get_warning_count_label()->set_text(itos(warnings.size())); + code_editor->set_warning_nb(warnings.size()); warnings_panel->clear(); warnings_panel->push_table(3); for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) { @@ -1427,7 +1421,7 @@ ScriptTextEditor::ScriptTextEditor() { code_editor = memnew(CodeTextEditor); editor_box->add_child(code_editor); - code_editor->add_constant_override("separation", 0); + code_editor->add_constant_override("separation", 2); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->connect("validate_script", this, "_validate_script"); code_editor->connect("load_theme_settings", this, "_load_theme_settings"); @@ -1445,9 +1439,8 @@ ScriptTextEditor::ScriptTextEditor() { warnings_panel->set_focus_mode(FOCUS_CLICK); warnings_panel->hide(); - code_editor->get_error_label()->connect("gui_input", this, "_error_pressed"); - code_editor->get_warning_label()->connect("gui_input", this, "_toggle_warning_pannel"); - code_editor->get_warning_count_label()->connect("gui_input", this, "_toggle_warning_pannel"); + code_editor->connect("error_pressed", this, "_error_pressed"); + code_editor->connect("warning_pressed", this, "_toggle_warning_pannel"); warnings_panel->connect("meta_clicked", this, "_warning_clicked"); update_settings(); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 856e442d82..6e88fc2301 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -125,8 +125,8 @@ protected: void _code_complete_script(const String &p_code, List<String> *r_options, bool &r_force); void _load_theme_settings(); void _set_theme_for_script(); - void _toggle_warning_pannel(const Ref<InputEvent> &p_event); - void _error_pressed(const Ref<InputEvent> &p_event); + void _toggle_warning_pannel(); + void _error_pressed(); void _warning_clicked(Variant p_line); void _notification(int p_what); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index b712cfc9d3..a84dc6f297 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -40,10 +40,8 @@ void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) { void SpriteFramesEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_PHYSICS_PROCESS) { - } - if (p_what == NOTIFICATION_ENTER_TREE) { + load->set_icon(get_icon("Load", "EditorIcons")); copy->set_icon(get_icon("ActionCopy", "EditorIcons")); paste->set_icon(get_icon("ActionPaste", "EditorIcons")); @@ -54,14 +52,9 @@ void SpriteFramesEditor::_notification(int p_what) { _delete->set_icon(get_icon("Remove", "EditorIcons")); new_anim->set_icon(get_icon("New", "EditorIcons")); remove_anim->set_icon(get_icon("Remove", "EditorIcons")); - } - - if (p_what == NOTIFICATION_READY) { + } else if (p_what == NOTIFICATION_READY) { - //NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); - } - - if (p_what == NOTIFICATION_DRAW) { + add_constant_override("autohide", 1); // Fixes the dragger always showing up. } } @@ -673,31 +666,25 @@ void SpriteFramesEditor::_bind_methods() { SpriteFramesEditor::SpriteFramesEditor() { - //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel")); - - split = memnew(HSplitContainer); - add_child(split); - VBoxContainer *vbc_animlist = memnew(VBoxContainer); - split->add_child(vbc_animlist); + add_child(vbc_animlist); vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE); - //vbc_animlist->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *sub_vb = memnew(VBoxContainer); - vbc_animlist->add_margin_child(TTR("Animations"), sub_vb, true); + vbc_animlist->add_margin_child(TTR("Animations:"), sub_vb, true); sub_vb->set_v_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hbc_animlist = memnew(HBoxContainer); sub_vb->add_child(hbc_animlist); - new_anim = memnew(Button); - new_anim->set_flat(true); + new_anim = memnew(ToolButton); + new_anim->set_tooltip(TTR("New Animation")); hbc_animlist->add_child(new_anim); new_anim->set_h_size_flags(SIZE_EXPAND_FILL); new_anim->connect("pressed", this, "_animation_add"); - remove_anim = memnew(Button); - remove_anim->set_flat(true); + remove_anim = memnew(ToolButton); + remove_anim->set_tooltip(TTR("Remove Animation")); hbc_animlist->add_child(remove_anim); remove_anim->connect("pressed", this, "_animation_remove"); @@ -722,56 +709,47 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_loop->connect("pressed", this, "_animation_loop_changed"); VBoxContainer *vbc = memnew(VBoxContainer); - split->add_child(vbc); + add_child(vbc); vbc->set_h_size_flags(SIZE_EXPAND_FILL); sub_vb = memnew(VBoxContainer); - vbc->add_margin_child(TTR("Animation Frames"), sub_vb, true); + vbc->add_margin_child(TTR("Animation Frames:"), sub_vb, true); HBoxContainer *hbc = memnew(HBoxContainer); sub_vb->add_child(hbc); - //animations = memnew( ItemList ); - - load = memnew(Button); - load->set_flat(true); + load = memnew(ToolButton); load->set_tooltip(TTR("Load Resource")); hbc->add_child(load); - copy = memnew(Button); - copy->set_flat(true); + copy = memnew(ToolButton); copy->set_tooltip(TTR("Copy")); hbc->add_child(copy); - paste = memnew(Button); - paste->set_flat(true); + paste = memnew(ToolButton); paste->set_tooltip(TTR("Paste")); hbc->add_child(paste); - empty = memnew(Button); - empty->set_flat(true); + empty = memnew(ToolButton); empty->set_tooltip(TTR("Insert Empty (Before)")); hbc->add_child(empty); - empty2 = memnew(Button); - empty2->set_flat(true); + empty2 = memnew(ToolButton); empty2->set_tooltip(TTR("Insert Empty (After)")); hbc->add_child(empty2); hbc->add_spacer(false); - move_up = memnew(Button); - move_up->set_flat(true); + move_up = memnew(ToolButton); move_up->set_tooltip(TTR("Move (Before)")); hbc->add_child(move_up); - move_down = memnew(Button); - move_down->set_flat(true); + move_down = memnew(ToolButton); move_down->set_tooltip(TTR("Move (After)")); hbc->add_child(move_down); - _delete = memnew(Button); - _delete->set_flat(true); + _delete = memnew(ToolButton); + _delete->set_tooltip(TTR("Delete")); hbc->add_child(_delete); file = memnew(EditorFileDialog); @@ -787,7 +765,6 @@ SpriteFramesEditor::SpriteFramesEditor() { tree->set_fixed_column_width(thumbnail_size * 3 / 2); tree->set_max_text_lines(2); tree->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); - //tree->set_min_icon_size(Size2(thumbnail_size,thumbnail_size)); tree->set_drag_forwarding(this); sub_vb->add_child(tree); diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index 3ef4ba290b..55dd10074e 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -39,25 +39,25 @@ #include "scene/gui/split_container.h" #include "scene/gui/tree.h" -class SpriteFramesEditor : public PanelContainer { - - GDCLASS(SpriteFramesEditor, PanelContainer); - - Button *load; - Button *_delete; - Button *copy; - Button *paste; - Button *empty; - Button *empty2; - Button *move_up; - Button *move_down; +class SpriteFramesEditor : public HSplitContainer { + + GDCLASS(SpriteFramesEditor, HSplitContainer); + + ToolButton *load; + ToolButton *_delete; + ToolButton *copy; + ToolButton *paste; + ToolButton *empty; + ToolButton *empty2; + ToolButton *move_up; + ToolButton *move_down; ItemList *tree; bool loading_scene; int sel; HSplitContainer *split; - Button *new_anim; - Button *remove_anim; + ToolButton *new_anim; + ToolButton *remove_anim; Tree *animations; SpinBox *anim_speed; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 7ce4029476..e31851b3f1 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1526,6 +1526,13 @@ void ProjectManager::_open_selected_projects_ask() { } int config_version = (int)cf->get_value("", "config_version", 0); + + // Check if the config_version property was empty or 0 + if (config_version == 0) { + ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf)); + ask_update_settings->popup_centered_minsize(); + return; + } // Check if we need to convert project settings from an earlier engine version if (config_version < ProjectSettings::CONFIG_VERSION) { ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf)); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 4f1928d20c..268a765994 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -2414,8 +2414,8 @@ void ParticlesGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Particles AABB")); - ur->add_do_method(particles, "set_custom_aabb", particles->get_visibility_aabb()); - ur->add_undo_method(particles, "set_custom_aabb", p_restore); + ur->add_do_method(particles, "set_visibility_aabb", particles->get_visibility_aabb()); + ur->add_undo_method(particles, "set_visibility_aabb", p_restore); ur->commit_action(); } diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub index 0416dd7f5f..7e714ba43f 100644 --- a/modules/bullet/SCsub +++ b/modules/bullet/SCsub @@ -187,8 +187,8 @@ if env['builtin_bullet']: thirdparty_sources = [thirdparty_dir + file for file in bullet2_src] env_bullet.Append(CPPPATH=[thirdparty_dir]) - if env['target'] == "debug" or env['target'] == "release_debug": - env_bullet.Append(CCFLAGS=['-DBT_DEBUG']) + # if env['target'] == "debug" or env['target'] == "release_debug": + # env_bullet.Append(CCFLAGS=['-DBT_DEBUG']) env_thirdparty = env_bullet.Clone() env_thirdparty.disable_warnings() diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py index cd356ce513..5fd5971fd1 100644 --- a/modules/gdnative/gdnative_builders.py +++ b/modules/gdnative/gdnative_builders.py @@ -213,7 +213,7 @@ def _build_gdnative_api_struct_source(api): 'extern const godot_gdnative_core_api_struct api_struct = {', '\tGDNATIVE_' + api['core']['type'] + ',', '\t{' + str(api['core']['version']['major']) + ', ' + str(api['core']['version']['minor']) + '},', - '\tNULL,', + '\t(const godot_gdnative_api_struct *)&api_1_1,', '\t' + str(len(api['extensions'])) + ',', '\tgdnative_extensions_pointers,', ] diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 966c02d4ec..98871ddec3 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1083,7 +1083,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a if (argc >= 1) { methodstr = String(*argptrs[0]) + " (via call)"; if (err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { - err.argument -= 1; + err.argument += 1; } } } else if (methodstr == "free") { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index af189fdb7e..7334e8a8cc 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3494,16 +3494,20 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); if ((tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING)) { - Variant constant = tokenizer->get_token_constant(); - String icon_path = constant.operator String(); +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + Variant constant = tokenizer->get_token_constant(); + String icon_path = constant.operator String(); - String abs_icon_path = icon_path.is_rel_path() ? self_path.get_base_dir().plus_file(icon_path).simplify_path() : icon_path; - if (!FileAccess::exists(abs_icon_path)) { - _set_error("No class icon found at: " + abs_icon_path); - return; - } + String abs_icon_path = icon_path.is_rel_path() ? self_path.get_base_dir().plus_file(icon_path).simplify_path() : icon_path; + if (!FileAccess::exists(abs_icon_path)) { + _set_error("No class icon found at: " + abs_icon_path); + return; + } - p_class->icon_path = icon_path; + p_class->icon_path = icon_path; + } +#endif tokenizer->advance(); } else { diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj index f9e9f41977..9a5dd24bb1 100644 --- a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj +++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj @@ -8,6 +8,7 @@ <RootNamespace>GodotSharpTools</RootNamespace> <AssemblyName>GodotSharpTools</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <BaseIntermediateOutputPath>obj</BaseIntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index d3efa288e9..cc9822e319 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -156,10 +156,20 @@ void MonoBottomPanel::_build_project_pressed() { if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path())) return; // No solution to build - String scripts_metadata_path = GodotSharpDirs::get_res_metadata_dir().plus_file("scripts_metadata.editor"); - Error metadata_err = CSharpProject::generate_scripts_metadata(GodotSharpDirs::get_project_csproj_path(), scripts_metadata_path); + String scripts_metadata_path_editor = GodotSharpDirs::get_res_metadata_dir().plus_file("scripts_metadata.editor"); + String scripts_metadata_path_player = GodotSharpDirs::get_res_metadata_dir().plus_file("scripts_metadata.editor_player"); + + Error metadata_err = CSharpProject::generate_scripts_metadata(GodotSharpDirs::get_project_csproj_path(), scripts_metadata_path_editor); ERR_FAIL_COND(metadata_err != OK); + if (FileAccess::exists(scripts_metadata_path_editor)) { + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + Error copy_err = da->copy(scripts_metadata_path_editor, scripts_metadata_path_player); + + ERR_EXPLAIN("Failed to copy scripts metadata file"); + ERR_FAIL_COND(copy_err != OK); + } + bool build_success = GodotSharpBuilds::get_singleton()->build_project_blocking("Tools"); if (build_success) { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 3f80d19fa1..6b65c1a529 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -282,7 +282,9 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt NSWindow *window = (NSWindow *)[notification object]; CGFloat newBackingScaleFactor = [window backingScaleFactor]; CGFloat oldBackingScaleFactor = [[[notification userInfo] objectForKey:@"NSBackingPropertyOldScaleFactorKey"] doubleValue]; - [OS_OSX::singleton->window_view setWantsBestResolutionOpenGLSurface:YES]; + if (OS_OSX::singleton->is_hidpi_allowed()) { + [OS_OSX::singleton->window_view setWantsBestResolutionOpenGLSurface:YES]; + } if (newBackingScaleFactor != oldBackingScaleFactor) { //Set new display scale and window size diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index ca2f71ca18..141ab96370 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -73,7 +73,7 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> } #endif - String icon_path = p_preset->get("application/icon"); + String icon_path = ProjectSettings::get_singleton()->globalize_path(p_preset->get("application/icon")); String file_verion = p_preset->get("application/file_version"); String product_version = p_preset->get("application/product_version"); String company_name = p_preset->get("application/company_name"); @@ -137,7 +137,7 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_options) { EditorExportPlatformPC::get_export_options(r_options); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_GLOBAL_FILE, "*.ico"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.ico"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/file_version"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/product_version"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/company_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Company Name"), "")); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index dced688899..41cee7335e 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -134,7 +134,7 @@ void CanvasItemMaterial::_update_shader() { code += "\tint total_frames = particles_anim_h_frames * particles_anim_v_frames;\n"; code += "\tint frame = int(float(total_frames) * INSTANCE_CUSTOM.z);\n"; code += "\tif (particles_anim_loop) {\n"; - code += "\t\tframe = abs(frame) % total_frames;\n"; + code += "\t\tframe = int(abs(frame) % total_frames);\n"; code += "\t} else {\n"; code += "\t\tframe = clamp(frame, 0, total_frames - 1);\n"; code += "\t}\n"; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 21feb6e226..eaed1da0ba 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -594,7 +594,7 @@ void CPUParticles2D::_particles_process(float p_delta) { if (restart_time >= prev_time) { restart = true; if (fractional_delta) { - local_delta = (1.0 - restart_time + time) * lifetime; + local_delta = (lifetime - restart_time + time) * lifetime; } } else if (restart_time < time) { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index a3fa2ac98d..6b70eef662 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -382,36 +382,30 @@ void Sprite3D::_draw() { VS::get_singleton()->immediate_clear(immediate); if (!texture.is_valid()) - return; //no texuture no life + return; Vector2 tsize = texture->get_size(); if (tsize.x == 0 || tsize.y == 0) return; - Size2i s; - Rect2 src_rect; - - if (region) { - - s = region_rect.size; - src_rect = region_rect; - } else { - s = texture->get_size(); - s = s / Size2(hframes, vframes); + Rect2 base_rect; + if (region) + base_rect = region_rect; + else + base_rect = Rect2(0, 0, texture->get_width(), texture->get_height()); - src_rect.size = s; - src_rect.position.x += (frame % hframes) * s.x; - src_rect.position.y += (frame / hframes) * s.y; - } + Size2 frame_size = base_rect.size / Size2(hframes, vframes); + Point2 frame_offset = Point2(frame % hframes, frame / hframes); + frame_offset *= frame_size; - Point2 ofs = get_offset(); + Point2 dest_offset = get_offset(); if (is_centered()) - ofs -= s / 2; - - Rect2 dst_rect(ofs, s); + dest_offset -= frame_size / 2; + Rect2 src_rect(base_rect.position + frame_offset, frame_size); + Rect2 final_dst_rect(dest_offset, frame_size); Rect2 final_rect; Rect2 final_src_rect; - if (!texture->get_rect_region(dst_rect, src_rect, final_rect, final_src_rect)) + if (!texture->get_rect_region(final_dst_rect, src_rect, final_rect, final_src_rect)) return; if (final_rect.size.x == 0 || final_rect.size.y == 0) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 09fbb39866..4abde6cc0f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2645,24 +2645,26 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } case KEY_UP: { - if (k->get_shift()) - _pre_shift_selection(); if (k->get_alt()) { scancode_handled = false; break; } #ifndef APPLE_STYLE_KEYS if (k->get_command()) { - _scroll_lines_up(); - break; - } #else if (k->get_command() && k->get_alt()) { +#endif _scroll_lines_up(); break; } + if (k->get_shift()) { + _pre_shift_selection(); + } + +#ifdef APPLE_STYLE_KEYS if (k->get_command()) { + cursor_set_line(0); } else #endif @@ -2696,24 +2698,24 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } case KEY_DOWN: { - if (k->get_shift()) - _pre_shift_selection(); if (k->get_alt()) { scancode_handled = false; break; } #ifndef APPLE_STYLE_KEYS if (k->get_command()) { - _scroll_lines_down(); - break; - } - #else if (k->get_command() && k->get_alt()) { +#endif _scroll_lines_down(); break; } + if (k->get_shift()) { + _pre_shift_selection(); + } + +#ifdef APPLE_STYLE_KEYS if (k->get_command()) { cursor_set_line(get_last_unhidden_line(), true, false, 9999); } else diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 6aa3891035..04d7107fa4 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1311,7 +1311,7 @@ Node *Node::_get_child_by_name(const StringName &p_name) const { return NULL; } -Node *Node::_get_node(const NodePath &p_path) const { +Node *Node::get_node_or_null(const NodePath &p_path) const { if (!data.inside_tree && p_path.is_absolute()) { ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree."); @@ -1376,7 +1376,7 @@ Node *Node::_get_node(const NodePath &p_path) const { Node *Node::get_node(const NodePath &p_path) const { - Node *node = _get_node(p_path); + Node *node = get_node_or_null(p_path); if (!node) { ERR_EXPLAIN("Node not found: " + p_path); ERR_FAIL_COND_V(!node, NULL); @@ -1386,7 +1386,7 @@ Node *Node::get_node(const NodePath &p_path) const { bool Node::has_node(const NodePath &p_path) const { - return _get_node(p_path) != NULL; + return get_node_or_null(p_path) != NULL; } Node *Node::find_node(const String &p_mask, bool p_recursive, bool p_owned) const { @@ -2709,6 +2709,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("get_child", "idx"), &Node::get_child); ClassDB::bind_method(D_METHOD("has_node", "path"), &Node::has_node); ClassDB::bind_method(D_METHOD("get_node", "path"), &Node::get_node); + ClassDB::bind_method(D_METHOD("get_node_or_null", "path"), &Node::get_node_or_null); ClassDB::bind_method(D_METHOD("get_parent"), &Node::get_parent); ClassDB::bind_method(D_METHOD("find_node", "mask", "recursive", "owned"), &Node::find_node, DEFVAL(true), DEFVAL(true)); ClassDB::bind_method(D_METHOD("find_parent", "mask"), &Node::find_parent); diff --git a/scene/main/node.h b/scene/main/node.h index 1c451ef567..e6189389cb 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -153,7 +153,6 @@ private: void _print_tree_pretty(const String prefix, const bool last); void _print_tree(const Node *p_node); - Node *_get_node(const NodePath &p_path) const; Node *_get_child_by_name(const StringName &p_name) const; void _replace_connections_target(Node *p_new_target); @@ -252,6 +251,7 @@ public: Node *get_child(int p_index) const; bool has_node(const NodePath &p_path) const; Node *get_node(const NodePath &p_path) const; + Node *get_node_or_null(const NodePath &p_path) const; Node *find_node(const String &p_mask, bool p_recursive = true, bool p_owned = true) const; bool has_node_and_resource(const NodePath &p_path) const; Node *get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<StringName> &r_leftover_subpath, bool p_last_is_property = true) const; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index f713851090..689f18a09d 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1154,13 +1154,14 @@ void SceneTree::_update_root_rect() { float viewport_aspect = desired_res.aspect(); float video_mode_aspect = video_mode.aspect(); + if (use_font_oversampling && stretch_aspect == STRETCH_ASPECT_IGNORE) { + WARN_PRINT("Font oversampling only works with the resize modes 'Keep Width', 'Keep Height', and 'Expand'."); + } + if (stretch_aspect == STRETCH_ASPECT_IGNORE || ABS(viewport_aspect - video_mode_aspect) < CMP_EPSILON) { //same aspect or ignore aspect viewport_size = desired_res; screen_size = video_mode; - if (use_font_oversampling) { - WARN_PRINT("Font oversampling only works with the following resize modes 'Keep Width', 'Keep Height', and 'Expand'.") - } } else if (viewport_aspect < video_mode_aspect) { // screen ratio is smaller vertically diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index a50a09f095..078d880d0e 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -145,6 +145,7 @@ #include "scene/resources/mesh_library.h" #include "scene/resources/packed_scene.h" #include "scene/resources/particles_material.h" +#include "scene/resources/physics_material.h" #include "scene/resources/plane_shape.h" #include "scene/resources/polygon_path_finder.h" #include "scene/resources/primitive_meshes.h" @@ -207,7 +208,6 @@ #include "scene/3d/visibility_notifier.h" #include "scene/animation/skeleton_ik.h" #include "scene/resources/environment.h" -#include "scene/resources/physics_material.h" #endif static Ref<ResourceFormatSaverText> resource_saver_text; @@ -602,8 +602,8 @@ void register_scene_types() { ClassDB::register_class<SpatialVelocityTracker>(); - ClassDB::register_class<PhysicsMaterial>(); #endif + ClassDB::register_class<PhysicsMaterial>(); ClassDB::register_class<World>(); ClassDB::register_class<Environment>(); ClassDB::register_class<World2D>(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index ea810edf8c..f28a67b493 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -55,7 +55,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { Node *p_name; \ if (p_id & FLAG_ID_IS_PATH) { \ NodePath np = node_paths[p_id & FLAG_MASK]; \ - p_name = ret_nodes[0]->_get_node(np); \ + p_name = ret_nodes[0]->get_node_or_null(np); \ } else { \ ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, NULL); \ p_name = ret_nodes[p_id & FLAG_MASK]; \ @@ -342,7 +342,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } for (int i = 0; i < editable_instances.size(); i++) { - Node *ei = ret_nodes[0]->_get_node(editable_instances[i]); + Node *ei = ret_nodes[0]->get_node_or_null(editable_instances[i]); if (ei) { ret_nodes[0]->set_editable_instance(ei, true); } diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 5a2e7245a2..3c83de91fd 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -614,7 +614,7 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, if (coords.size() == 0) { return autotile_get_icon_coordinate(p_id); } else { - return coords[Math::random(0, (int)coords.size())]; + return coords[Math::rand() % coords.size()]; } } diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index a89b70d1ea..d95e0e2da1 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -324,7 +324,7 @@ String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShade String u = "uniform sampler2D " + make_unique_id(p_type, p_id, "tex"); switch (texture_type) { case TYPE_DATA: break; - case TYPE_COLOR: u += " : hint_color"; break; + case TYPE_COLOR: u += " : hint_albedo"; break; case TYPE_NORMALMAP: u += " : hint_normal"; break; } return u + ";"; @@ -554,7 +554,7 @@ String VisualShaderNodeCubeMap::generate_global(Shader::Mode p_mode, VisualShade String u = "uniform sampler2DCube " + make_unique_id(p_type, p_id, "cube"); switch (texture_type) { case TYPE_DATA: break; - case TYPE_COLOR: u += " : hint_color"; break; + case TYPE_COLOR: u += " : hint_albedo"; break; case TYPE_NORMALMAP: u += " : hint_normal"; break; } return u + ";"; |