diff options
-rw-r--r-- | core/image.cpp | 2 | ||||
-rw-r--r-- | doc/classes/Expression.xml | 2 | ||||
-rw-r--r-- | doc/classes/PhysicsDirectSpaceState.xml | 2 | ||||
-rw-r--r-- | editor/code_editor.cpp | 182 | ||||
-rw-r--r-- | editor/code_editor.h | 17 | ||||
-rw-r--r-- | editor/editor_folding.cpp | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 8 | ||||
-rw-r--r-- | editor/editor_log.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 23 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 7 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 4 | ||||
-rw-r--r-- | modules/bullet/SCsub | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 4 | ||||
-rw-r--r-- | platform/windows/export/export.cpp | 4 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.cpp | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 7 | ||||
-rw-r--r-- | scene/main/node.h | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 7 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 4 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 2 |
22 files changed, 148 insertions, 147 deletions
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/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/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/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/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/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/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/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()]; } } |