diff options
44 files changed, 194 insertions, 362 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21d6e110ce..aea1c8c5ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,11 +122,12 @@ recommend that you have a look at it to know what's important to take into account for a PR to be considered for merging. In addition to the following tips, also take a look at the -[Engine development guide](https://docs.godotengine.org/en/latest/development/cpp/) +[Engine development guide](https://docs.godotengine.org/en/latest/contributing/development/index.html) for an introduction to developing on Godot. -The [Contributing docs](https://docs.godotengine.org/en/latest/community/contributing/index.html) -also have important information on the PR workflow and the code style we use. +The [Contributing docs](https://docs.godotengine.org/en/latest/contributing/ways_to_contribute.html) +also have important information on the [PR workflow](https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html) +and the [code style](https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html) we use. ### Document your changes @@ -135,10 +136,10 @@ scripting APIs, you **must** update the class reference to document those. This is to ensure the documentation coverage doesn't decrease as contributions are merged. -[Update the documentation template](https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html#updating-the-documentation-template) +[Update documentation XML files](https://docs.godotengine.org/en/latest/contributing/documentation/updating_the_class_reference.html#updating-class-reference-when-working-on-the-engine) using your compiled binary, then fill in the descriptions. Follow the style guide described in the -[Docs writing guidelines](https://docs.godotengine.org/en/latest/community/contributing/docs_writing_guidelines.html). +[Writing guidelines](https://docs.godotengine.org/en/latest/contributing/documentation/docs_writing_guidelines.html). If your pull request modifies parts of the code in a non-obvious way, make sure to add comments in the code as well. This helps other people understand the @@ -164,7 +165,7 @@ applicable. Feel free to contribute standalone pull requests to add new tests or improve existing tests as well. -See [Unit testing](https://docs.godotengine.org/en/latest/development/cpp/unit_testing.html) +See [Unit testing](https://docs.godotengine.org/en/latest/contributing/development/core_and_modules/unit_testing.html) for information on writing tests in Godot's C++ codebase. ### Be nice to the Git history @@ -186,7 +187,7 @@ Internet). This [Git style guide](https://github.com/agis-/git-style-guide) has some good practices to have in mind. -See our [PR workflow](https://docs.godotengine.org/en/latest/community/contributing/pr_workflow.html) +See our [PR workflow](https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html) documentation for tips on using Git, amending commits and rebasing branches. ### Format your commit messages with readability in mind diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 98f4789163..fca87f6a56 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -499,7 +499,7 @@ </member> <member name="interface/editor/editor_language" type="String" setter="" getter=""> The language to use for the editor interface. - Translations are provided by the community. If you spot a mistake, [url=https://docs.godotengine.org/en/latest/community/contributing/editor_and_docs_localization.html]contribute to editor translations on Weblate![/url] + Translations are provided by the community. If you spot a mistake, [url=$DOCS_URL/contributing/documentation/editor_and_docs_localization.html]contribute to editor translations on Weblate![/url] </member> <member name="interface/editor/expand_to_title" type="bool" setter="" getter=""> Expanding main editor window content to the title, if supported by [DisplayServer]. See [constant DisplayServer.WINDOW_FLAG_EXTEND_TO_TITLE]. @@ -741,7 +741,7 @@ </member> <member name="text_editor/behavior/indent/type" type="int" setter="" getter=""> The indentation style to use (tabs or spaces). - [b]Note:[/b] The [url=https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_styleguide.html]GDScript style guide[/url] recommends using tabs for indentation. It is advised to change this setting only if you need to work on a project that currently uses spaces for indentation. + [b]Note:[/b] The [url=$DOCS_URL/getting_started/scripting/gdscript/gdscript_styleguide.html]GDScript style guide[/url] recommends using tabs for indentation. It is advised to change this setting only if you need to work on a project that currently uses spaces for indentation. </member> <member name="text_editor/behavior/navigation/drag_and_drop_selection" type="bool" setter="" getter=""> If [code]true[/code], allows drag-and-dropping text in the script editor to move text. Disable this if you find yourself accidentally drag-and-dropping text in the script editor. @@ -782,7 +782,7 @@ If [code]true[/code], the code completion tooltip will appear below the current line unless there is no space on screen below the current line. If [code]false[/code], the code completion tooltip will appear above the current line. </member> <member name="text_editor/completion/use_single_quotes" type="bool" setter="" getter=""> - If [code]true[/code], performs string autocompletion with single quotes. If [code]false[/code], performs string autocompletion with double quotes (which matches the [url=https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_styleguide.html]GDScript style guide[/url]). + If [code]true[/code], performs string autocompletion with single quotes. If [code]false[/code], performs string autocompletion with double quotes (which matches the [url=$DOCS_URL/tutorials/scripting/gdscript/gdscript_styleguide.html]GDScript style guide[/url]). </member> <member name="text_editor/help/class_reference_examples" type="int" setter="" getter=""> Controls which multi-line code blocks should be displayed in the editor help. This setting does not affect single-line code literals in the editor help. diff --git a/doc/classes/JavaScriptBridge.xml b/doc/classes/JavaScriptBridge.xml index 340c296eef..f79c11b334 100644 --- a/doc/classes/JavaScriptBridge.xml +++ b/doc/classes/JavaScriptBridge.xml @@ -5,7 +5,7 @@ </brief_description> <description> The JavaScriptBridge singleton is implemented only in the Web export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. - [b]Note:[/b] This singleton can be disabled at build-time to improve security. By default, the JavaScriptBridge singleton is enabled. Official export templates also have the JavaScriptBridge singleton enabled. See [url=$DOCS_URL/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. + [b]Note:[/b] This singleton can be disabled at build-time to improve security. By default, the JavaScriptBridge singleton is enabled. Official export templates also have the JavaScriptBridge singleton enabled. See [url=$DOCS_URL/contributing/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. </description> <tutorials> <link title="Exporting for the Web: Calling JavaScript from script">$DOCS_URL/tutorials/export/exporting_for_web.html#calling-javascript-from-script</link> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index e015bec134..a9e17f4666 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -24,6 +24,7 @@ [b]Note:[/b] The [code]script[/code] is not exposed like most properties. To set or get an object's [Script] in code, use [method set_script] and [method get_script], respectively. </description> <tutorials> + <link title="Object class introduction">$DOCS_URL/contributing/development/core_and_modules/object_class.html</link> <link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link> <link title="Object notifications">$DOCS_URL/tutorials/best_practices/godot_notifications.html</link> </tutorials> diff --git a/doc/classes/Variant.xml b/doc/classes/Variant.xml index 6b384d6a77..0a34faecd0 100644 --- a/doc/classes/Variant.xml +++ b/doc/classes/Variant.xml @@ -70,6 +70,6 @@ Modifications to a container will modify all references to it. A [Mutex] should be created to lock it if multi-threaded access is desired. </description> <tutorials> - <link title="Variant class">$DOCS_URL/development/cpp/variant_class.html</link> + <link title="Variant class introduction">$DOCS_URL/contributing/development/core_and_modules/variant_class.html</link> </tutorials> </class> diff --git a/drivers/gles3/storage/render_scene_buffers_gles3.cpp b/drivers/gles3/storage/render_scene_buffers_gles3.cpp index 65c4ca6131..19bf57df94 100644 --- a/drivers/gles3/storage/render_scene_buffers_gles3.cpp +++ b/drivers/gles3/storage/render_scene_buffers_gles3.cpp @@ -37,13 +37,14 @@ RenderSceneBuffersGLES3::~RenderSceneBuffersGLES3() { free_render_buffer_data(); } -void RenderSceneBuffersGLES3::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { +void RenderSceneBuffersGLES3::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton(); //internal_size.x = p_internal_size.x; // ignore for now //internal_size.y = p_internal_size.y; width = p_target_size.x; height = p_target_size.y; + //scaling_3d_mode = p_scaling_3d_mode //fsr_sharpness = p_fsr_sharpness; //texture_mipmap_bias = p_texture_mipmap_bias; render_target = p_render_target; diff --git a/drivers/gles3/storage/render_scene_buffers_gles3.h b/drivers/gles3/storage/render_scene_buffers_gles3.h index 52a7737910..d07a0812f6 100644 --- a/drivers/gles3/storage/render_scene_buffers_gles3.h +++ b/drivers/gles3/storage/render_scene_buffers_gles3.h @@ -81,7 +81,7 @@ public: private: public: virtual ~RenderSceneBuffersGLES3(); - virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override; + virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override; virtual void set_fsr_sharpness(float p_fsr_sharpness) override{}; virtual void set_texture_mipmap_bias(float p_texture_mipmap_bias) override{}; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index ba7e7f2877..df8adf01e4 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -143,6 +143,7 @@ void FindReplaceBar::unhandled_input(const Ref<InputEvent> &p_event) { } bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) { + text_editor->remove_secondary_carets(); String text = get_search_text(); Point2i pos = text_editor->search(text, p_flags, p_from_line, p_from_col); @@ -178,6 +179,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) } void FindReplaceBar::_replace() { + text_editor->remove_secondary_carets(); bool selection_enabled = text_editor->has_selection(0); Point2i selection_begin, selection_end; if (selection_enabled) { @@ -225,6 +227,7 @@ void FindReplaceBar::_replace() { } void FindReplaceBar::_replace_all() { + text_editor->remove_secondary_carets(); text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); // Line as x so it gets priority in comparison, column as y. Point2i orig_cursor(text_editor->get_caret_line(0), text_editor->get_caret_column(0)); diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.cpp b/editor/debugger/debug_adapter/debug_adapter_parser.cpp index d685db40d9..fc806ded5e 100644 --- a/editor/debugger/debug_adapter/debug_adapter_parser.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_parser.cpp @@ -213,7 +213,7 @@ Dictionary DebugAdapterParser::req_launch(const Dictionary &p_params) const { } EditorNode *editor = EditorNode::get_singleton(); - Error err = platform_string == "android" ? editor->run_play_native(device, idx) : editor->run_play_native(-1, idx); + Error err = platform_string == "android" ? editor->run_play_native(device * 10000 + idx) : editor->run_play_native(idx); if (err) { if (err == ERR_INVALID_PARAMETER && platform_string == "android") { return prepare_error_response(p_params, DAP::ErrorType::MISSING_DEVICE); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5baa58873e..9b1a5e028b 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -41,7 +41,7 @@ #include "editor/plugins/script_editor_plugin.h" #include "scene/gui/line_edit.h" -#define CONTRIBUTE_URL vformat("%s/community/contributing/updating_the_class_reference.html", VERSION_DOCS_URL) +#define CONTRIBUTE_URL vformat("%s/contributing/documentation/updating_the_class_reference.html", VERSION_DOCS_URL) DocTools *EditorHelp::doc = nullptr; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b1b40eb52a..d1af28f8cf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5067,8 +5067,8 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { return true; } -Error EditorNode::run_play_native(int p_idx, int p_platform) { - return run_native->run_native(p_idx, p_platform); +Error EditorNode::run_play_native(int p_id) { + return run_native->run_native(p_id); } void EditorNode::run_play() { diff --git a/editor/editor_node.h b/editor/editor_node.h index ae951808d5..c1090bf680 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -914,7 +914,7 @@ public: bool ensure_main_scene(bool p_from_native); - Error run_play_native(int p_idx, int p_platform); + Error run_play_native(int p_id); void run_play(); void run_play_current(); void run_play_custom(const String &p_custom); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 6c917a0c4f..f528053fee 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3805,6 +3805,8 @@ static bool _find_recursive_resources(const Variant &v, HashSet<Resource *> &res return true; } } + + resources_found.erase(r.ptr()); } break; default: { } diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index eab4e08cec..49723aa169 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -37,53 +37,27 @@ void EditorRunNative::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { - Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i); - if (eep.is_null()) { - continue; - } - Ref<ImageTexture> icon = eep->get_run_icon(); - if (!icon.is_null()) { - Ref<Image> im = icon->get_image(); - im = im->duplicate(); - im->clear_mipmaps(); - if (!im->is_empty()) { - im->resize(16 * EDSCALE, 16 * EDSCALE); - Ref<ImageTexture> small_icon = ImageTexture::create_from_image(im); - MenuButton *mb = memnew(MenuButton); - mb->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native).bind(i)); - mb->connect("pressed", callable_mp(this, &EditorRunNative::run_native).bind(-1, i)); - mb->set_icon(small_icon); - add_child(mb); - menus[i] = mb; - } - } - } + case NOTIFICATION_THEME_CHANGED: { + remote_debug->set_icon(get_theme_icon(SNAME("PlayRemote"), SNAME("EditorIcons"))); } break; - case NOTIFICATION_PROCESS: { bool changed = EditorExport::get_singleton()->poll_export_platforms() || first; if (changed) { - for (KeyValue<int, MenuButton *> &E : menus) { - Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E.key); - MenuButton *mb = E.value; - int dc = eep->get_options_count(); - - if (dc == 0) { - mb->hide(); - } else { - mb->get_popup()->clear(); - mb->show(); - if (dc == 1) { - mb->set_tooltip_text(eep->get_option_tooltip(0)); - } else { - mb->set_tooltip_text(eep->get_options_tooltip()); - for (int i = 0; i < dc; i++) { - mb->get_popup()->add_icon_item(eep->get_option_icon(i), eep->get_option_label(i)); - mb->get_popup()->set_item_tooltip(-1, eep->get_option_tooltip(i)); - } + remote_debug->get_popup()->clear(); + for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { + Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i); + if (eep.is_null()) { + continue; + } + int dc = MIN(eep->get_options_count(), 9000); + if (dc > 0) { + remote_debug->get_popup()->add_icon_item(eep->get_run_icon(), eep->get_name(), -1); + remote_debug->get_popup()->set_item_disabled(-1, true); + for (int j = 0; j < dc; j++) { + remote_debug->get_popup()->add_icon_item(eep->get_option_icon(j), eep->get_option_label(j), 10000 * i + j); + remote_debug->get_popup()->set_item_tooltip(-1, eep->get_option_tooltip(j)); + remote_debug->get_popup()->set_item_indent(-1, 2); } } } @@ -94,25 +68,22 @@ void EditorRunNative::_notification(int p_what) { } } -Error EditorRunNative::run_native(int p_idx, int p_platform) { - if (!EditorNode::get_singleton()->ensure_main_scene(true)) { - resume_idx = p_idx; - resume_platform = p_platform; +Error EditorRunNative::run_native(int p_id) { + if (p_id < 0) { return OK; } - Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(p_platform); - ERR_FAIL_COND_V(eep.is_null(), ERR_UNAVAILABLE); + int platform = p_id / 10000; + int idx = p_id % 10000; - if (p_idx == -1) { - if (eep->get_options_count() == 1) { - menus[p_platform]->get_popup()->hide(); - p_idx = 0; - } else { - return ERR_INVALID_PARAMETER; - } + if (!EditorNode::get_singleton()->ensure_main_scene(true)) { + resume_id = p_id; + return OK; } + Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(platform); + ERR_FAIL_COND_V(eep.is_null(), ERR_UNAVAILABLE); + Ref<EditorExportPreset> preset; for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) { @@ -151,7 +122,7 @@ Error EditorRunNative::run_native(int p_idx, int p_platform) { } eep->clear_messages(); - Error err = eep->run(preset, p_idx, flags); + Error err = eep->run(preset, idx, flags); result_dialog_log->clear(); if (eep->fill_log_messages(result_dialog_log, err)) { if (eep->get_worst_message_type() >= EditorExportPlatform::EXPORT_MESSAGE_ERROR) { @@ -162,7 +133,7 @@ Error EditorRunNative::run_native(int p_idx, int p_platform) { } void EditorRunNative::resume_run_native() { - run_native(resume_idx, resume_platform); + run_native(resume_id); } void EditorRunNative::_bind_methods() { @@ -174,6 +145,13 @@ bool EditorRunNative::is_deploy_debug_remote_enabled() const { } EditorRunNative::EditorRunNative() { + remote_debug = memnew(MenuButton); + remote_debug->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native)); + remote_debug->set_icon(get_theme_icon(SNAME("PlayRemote"), SNAME("EditorIcons"))); + remote_debug->set_tooltip_text(TTR("Remote Debug")); + + add_child(remote_debug); + result_dialog = memnew(AcceptDialog); result_dialog->set_title(TTR("Project Run")); result_dialog_log = memnew(RichTextLabel); @@ -184,6 +162,4 @@ EditorRunNative::EditorRunNative() { result_dialog->hide(); set_process(true); - resume_idx = 0; - resume_platform = 0; } diff --git a/editor/editor_run_native.h b/editor/editor_run_native.h index a87e27de97..2a5431e54b 100644 --- a/editor/editor_run_native.h +++ b/editor/editor_run_native.h @@ -42,18 +42,17 @@ class EditorRunNative : public HBoxContainer { RichTextLabel *result_dialog_log = nullptr; AcceptDialog *result_dialog = nullptr; - HashMap<int, MenuButton *> menus; + MenuButton *remote_debug = nullptr; bool first = true; - int resume_idx; - int resume_platform; + int resume_id = -1; protected: static void _bind_methods(); void _notification(int p_what); public: - Error run_native(int p_idx, int p_platform); + Error run_native(int p_id); bool is_deploy_debug_remote_enabled() const; void resume_run_native(); diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index df5d2dcd29..7136b4ceb6 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -480,7 +480,7 @@ void ProjectExportDialog::_enc_filters_changed(const String &p_filters) { } void ProjectExportDialog::_open_key_help_link() { - OS::get_singleton()->shell_open(vformat("%s/development/compiling/compiling_with_script_encryption_key.html", VERSION_DOCS_URL)); + OS::get_singleton()->shell_open(vformat("%s/contributing/development/compiling/compiling_with_script_encryption_key.html", VERSION_DOCS_URL)); } void ProjectExportDialog::_enc_pck_changed(bool p_pressed) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 6eed3e3e61..17cdab60c8 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2051,7 +2051,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected if (!fpath.ends_with("/")) { fpath = fpath.get_base_dir(); } - ScriptEditor::get_singleton()->open_text_file_create_dialog(fpath); + String dir = ProjectSettings::get_singleton()->globalize_path(fpath); + ScriptEditor::get_singleton()->open_text_file_create_dialog(dir); } break; } } diff --git a/editor/icons/PlayRemote.svg b/editor/icons/PlayRemote.svg new file mode 100644 index 0000000000..ea2195294f --- /dev/null +++ b/editor/icons/PlayRemote.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="m12.998 2.548-9.996.005a2.006 2.006 0 0 0-2.006 2v4.61c0 1.107.898 2.003 2.006 2.003h3.996v.9h-1.68v.381H3.001v2h2.315v.38h5.366v-.38H13v-2.004h-2.315v-.378H9.004v-.9h3.994a2.006 2.006 0 0 0 2.006-2.003v-4.61c0-1.106-.9-2.003-2.006-2.003zm-7.496 1.31 5 3-5 3z" style="fill:#e0e0e0;fill-opacity:1"/></svg> diff --git a/editor/icons/README.md b/editor/icons/README.md index 3159565180..d191000985 100644 --- a/editor/icons/README.md +++ b/editor/icons/README.md @@ -3,5 +3,5 @@ This folder contains all the icons used by Godot editor (except for platform icons which are located in their respective platform folder). -See [Editor icons](https://docs.godotengine.org/en/latest/development/editor/creating_icons.html) +See [Editor icons](https://docs.godotengine.org/en/latest/contributing/development/editor/creating_icons.html) in the documentation for details on creating icons for the Godot editor. diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index caa42b677c..2ca26ff2b9 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2553,9 +2553,9 @@ void ScriptEditor::open_script_create_dialog(const String &p_base_name, const St } void ScriptEditor::open_text_file_create_dialog(const String &p_base_path, const String &p_base_name) { - file_dialog->set_current_file(p_base_name); - file_dialog->set_current_dir(p_base_path); _menu_option(FILE_NEW_TEXTFILE); + file_dialog->set_current_dir(p_base_path); + file_dialog->set_current_file(p_base_name); open_textfile_after_create = false; } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 56dbdb49eb..d550c1e5d4 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -129,30 +129,32 @@ void VisualShaderGraphPlugin::set_connections(const List<VisualShader::Connectio void VisualShaderGraphPlugin::show_port_preview(VisualShader::Type p_type, int p_node_id, int p_port_id) { if (visual_shader->get_shader_type() == p_type && links.has(p_node_id) && links[p_node_id].output_ports.has(p_port_id)) { - for (const KeyValue<int, Port> &E : links[p_node_id].output_ports) { + Link &link = links[p_node_id]; + + for (const KeyValue<int, Port> &E : link.output_ports) { if (E.value.preview_button != nullptr) { E.value.preview_button->set_pressed(false); } } + bool is_dirty = link.preview_pos < 0; - if (links[p_node_id].preview_visible && !is_dirty() && links[p_node_id].preview_box != nullptr) { - links[p_node_id].graph_node->remove_child(links[p_node_id].preview_box); - memdelete(links[p_node_id].preview_box); - links[p_node_id].graph_node->reset_size(); - links[p_node_id].preview_visible = false; + if (!is_dirty && link.preview_visible && link.preview_box != nullptr) { + link.graph_node->remove_child(link.preview_box); + memdelete(link.preview_box); + link.preview_box = nullptr; + link.graph_node->reset_size(); + link.preview_visible = false; } - if (p_port_id != -1 && links[p_node_id].output_ports[p_port_id].preview_button != nullptr) { - if (is_dirty()) { - links[p_node_id].preview_pos = links[p_node_id].graph_node->get_child_count(); + if (p_port_id != -1 && link.output_ports[p_port_id].preview_button != nullptr) { + if (is_dirty) { + link.preview_pos = link.graph_node->get_child_count(); } VBoxContainer *vbox = memnew(VBoxContainer); - links[p_node_id].graph_node->add_child(vbox); - if (links[p_node_id].preview_pos != -1) { - links[p_node_id].graph_node->move_child(vbox, links[p_node_id].preview_pos); - } - links[p_node_id].graph_node->set_slot_draw_stylebox(vbox->get_index(), false); + link.graph_node->add_child(vbox); + link.graph_node->move_child(vbox, link.preview_pos); + link.graph_node->set_slot_draw_stylebox(vbox->get_index(), false); Control *offset = memnew(Control); offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE)); @@ -162,9 +164,9 @@ void VisualShaderGraphPlugin::show_port_preview(VisualShader::Type p_type, int p port_preview->setup(visual_shader, visual_shader->get_shader_type(), p_node_id, p_port_id); port_preview->set_h_size_flags(Control::SIZE_SHRINK_CENTER); vbox->add_child(port_preview); - links[p_node_id].preview_visible = true; - links[p_node_id].preview_box = vbox; - links[p_node_id].output_ports[p_port_id].preview_button->set_pressed(true); + link.preview_visible = true; + link.preview_box = vbox; + link.output_ports[p_port_id].preview_button->set_pressed(true); } } } @@ -329,14 +331,6 @@ void VisualShaderGraphPlugin::clear_links() { links.clear(); } -bool VisualShaderGraphPlugin::is_dirty() const { - return dirty; -} - -void VisualShaderGraphPlugin::make_dirty(bool p_enabled) { - dirty = p_enabled; -} - void VisualShaderGraphPlugin::register_link(VisualShader::Type p_type, int p_id, VisualShaderNode *p_visual_node, GraphNode *p_graph_node) { links.insert(p_id, { p_type, p_visual_node, p_graph_node, p_visual_node->get_output_port_for_preview() != -1, -1, HashMap<int, InputPort>(), HashMap<int, Port>(), nullptr, nullptr, nullptr, { nullptr, nullptr, nullptr } }); } @@ -426,7 +420,13 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool editor->_update_created_node(node); if (p_just_update) { - links[p_id].graph_node = node; + Link &link = links[p_id]; + + link.graph_node = node; + link.preview_box = nullptr; + link.preview_pos = -1; + link.output_ports.clear(); + link.input_ports.clear(); } else { register_link(p_type, p_id, vsnode.ptr(), node); } @@ -1916,15 +1916,12 @@ void VisualShaderEditor::_update_graph() { _update_varyings(); graph_plugin->clear_links(); - graph_plugin->make_dirty(true); graph_plugin->update_theme(); for (int n_i = 0; n_i < nodes.size(); n_i++) { graph_plugin->add_node(type, nodes[n_i], false); } - graph_plugin->make_dirty(false); - for (const VisualShader::Connection &E : node_connections) { int from = E.from_node; int from_idx = E.from_port; diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 88f5e3359c..c4f6b4952c 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -95,7 +95,6 @@ private: Ref<VisualShader> visual_shader; HashMap<int, Link> links; List<VisualShader::Connection> connections; - bool dirty = false; Color vector_expanded_color[4]; @@ -115,8 +114,6 @@ public: void clear_links(); void set_shader_type(VisualShader::Type p_type); bool is_preview_visible(int p_id) const; - bool is_dirty() const; - void make_dirty(bool p_enabled); void update_node(VisualShader::Type p_type, int p_id); void update_node_deferred(VisualShader::Type p_type, int p_node_id); void add_node(VisualShader::Type p_type, int p_id, bool p_just_update); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 0a1ae46927..397c43b14b 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -80,7 +80,7 @@ Ref<Script> GDScriptLanguage::make_template(const String &p_template, const Stri } processed_template = processed_template.replace("_BASE_", p_base_class_name) - .replace("_CLASS_", p_class_name) + .replace("_CLASS_", p_class_name.to_pascal_case()) .replace("_TS_", _get_indentation()); scr->set_source_code(processed_template); return scr; diff --git a/modules/gdscript/tests/README.md b/modules/gdscript/tests/README.md index 6e54085962..361d586d32 100644 --- a/modules/gdscript/tests/README.md +++ b/modules/gdscript/tests/README.md @@ -4,5 +4,5 @@ The `scripts/` folder contains integration tests in the form of GDScript files and output files. See the -[Integration tests for GDScript documentation](https://docs.godotengine.org/en/latest/development/cpp/unit_testing.html#integration-tests-for-gdscript) +[Integration tests for GDScript documentation](https://docs.godotengine.org/en/latest/contributing/development/core_and_modules/unit_testing.html#integration-tests-for-gdscript) for information about creating and running GDScript integration tests. diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs index 13a21ae8bc..0e46b63b59 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs @@ -437,48 +437,25 @@ namespace Godot /// <summary> /// Returns <see langword="true"/> if the <see cref="AABB"/> overlaps with <paramref name="with"/> /// (i.e. they have at least one point in common). - /// - /// If <paramref name="includeBorders"/> is <see langword="true"/>, - /// they will also be considered overlapping if their borders touch, - /// even without intersection. /// </summary> /// <param name="with">The other <see cref="AABB"/> to check for intersections with.</param> - /// <param name="includeBorders">Whether or not to consider borders.</param> /// <returns> /// A <see langword="bool"/> for whether or not they are intersecting. /// </returns> - public readonly bool Intersects(AABB with, bool includeBorders = false) + public readonly bool Intersects(AABB with) { - if (includeBorders) - { - if (_position.x > with._position.x + with._size.x) - return false; - if (_position.x + _size.x < with._position.x) - return false; - if (_position.y > with._position.y + with._size.y) - return false; - if (_position.y + _size.y < with._position.y) - return false; - if (_position.z > with._position.z + with._size.z) - return false; - if (_position.z + _size.z < with._position.z) - return false; - } - else - { - if (_position.x >= with._position.x + with._size.x) - return false; - if (_position.x + _size.x <= with._position.x) - return false; - if (_position.y >= with._position.y + with._size.y) - return false; - if (_position.y + _size.y <= with._position.y) - return false; - if (_position.z >= with._position.z + with._size.z) - return false; - if (_position.z + _size.z <= with._position.z) - return false; - } + if (_position.x >= with._position.x + with._size.x) + return false; + if (_position.x + _size.x <= with._position.x) + return false; + if (_position.y >= with._position.y + with._size.y) + return false; + if (_position.y + _size.y <= with._position.y) + return false; + if (_position.z >= with._position.z + with._size.z) + return false; + if (_position.z + _size.z <= with._position.z) + return false; return true; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs index 5aa1622bf8..90fdb14953 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs @@ -493,12 +493,6 @@ namespace Godot } } - /// <summary> - /// Returns the basis's rotation in the form of a quaternion. - /// See <see cref="GetEuler"/> if you need Euler angles, but keep in - /// mind that quaternions should generally be preferred to Euler angles. - /// </summary> - /// <returns>A <see cref="Quaternion"/> representing the basis's rotation.</returns> internal readonly Quaternion GetQuaternion() { real_t trace = Row0[0] + Row1[1] + Row2[2]; @@ -573,109 +567,6 @@ namespace Godot } /// <summary> - /// Get rows by index. Rows are not very useful for user code, - /// but are more efficient for some internal calculations. - /// </summary> - /// <param name="index">Which row.</param> - /// <exception cref="ArgumentOutOfRangeException"> - /// <paramref name="index"/> is not 0, 1 or 2. - /// </exception> - /// <returns>One of <c>Row0</c>, <c>Row1</c>, or <c>Row2</c>.</returns> - public readonly Vector3 GetRow(int index) - { - switch (index) - { - case 0: - return Row0; - case 1: - return Row1; - case 2: - return Row2; - default: - throw new ArgumentOutOfRangeException(nameof(index)); - } - } - - /// <summary> - /// Sets rows by index. Rows are not very useful for user code, - /// but are more efficient for some internal calculations. - /// </summary> - /// <param name="index">Which row.</param> - /// <param name="value">The vector to set the row to.</param> - /// <exception cref="ArgumentOutOfRangeException"> - /// <paramref name="index"/> is not 0, 1 or 2. - /// </exception> - public void SetRow(int index, Vector3 value) - { - switch (index) - { - case 0: - Row0 = value; - return; - case 1: - Row1 = value; - return; - case 2: - Row2 = value; - return; - default: - throw new ArgumentOutOfRangeException(nameof(index)); - } - } - - /// <summary> - /// This function considers a discretization of rotations into - /// 24 points on unit sphere, lying along the vectors (x, y, z) with - /// each component being either -1, 0, or 1, and returns the index - /// of the point best representing the orientation of the object. - /// It is mainly used by the <see cref="GridMap"/> editor. - /// - /// For further details, refer to the Godot source code. - /// </summary> - /// <returns>The orthogonal index.</returns> - public readonly int GetOrthogonalIndex() - { - var orth = this; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - var row = orth.GetRow(i); - - real_t v = row[j]; - - if (v > 0.5f) - { - v = 1.0f; - } - else if (v < -0.5f) - { - v = -1.0f; - } - else - { - v = 0f; - } - - row[j] = v; - - orth.SetRow(i, row); - } - } - - for (int i = 0; i < 24; i++) - { - if (orth == _orthoBases[i]) - { - return i; - } - } - - return 0; - } - - /// <summary> /// Returns the inverse of the matrix. /// </summary> /// <returns>The inverse matrix.</returns> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs index faee81a98a..cf8939a859 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs @@ -275,38 +275,19 @@ namespace Godot /// <summary> /// Returns <see langword="true"/> if the <see cref="Rect2i"/> overlaps with <paramref name="b"/> /// (i.e. they have at least one point in common). - /// - /// If <paramref name="includeBorders"/> is <see langword="true"/>, - /// they will also be considered overlapping if their borders touch, - /// even without intersection. /// </summary> /// <param name="b">The other <see cref="Rect2i"/> to check for intersections with.</param> - /// <param name="includeBorders">Whether or not to consider borders.</param> /// <returns>A <see langword="bool"/> for whether or not they are intersecting.</returns> - public readonly bool Intersects(Rect2i b, bool includeBorders = false) + public readonly bool Intersects(Rect2i b) { - if (includeBorders) - { - if (_position.x > b._position.x + b._size.x) - return false; - if (_position.x + _size.x < b._position.x) - return false; - if (_position.y > b._position.y + b._size.y) - return false; - if (_position.y + _size.y < b._position.y) - return false; - } - else - { - if (_position.x >= b._position.x + b._size.x) - return false; - if (_position.x + _size.x <= b._position.x) - return false; - if (_position.y >= b._position.y + b._size.y) - return false; - if (_position.y + _size.y <= b._position.y) - return false; - } + if (_position.x >= b._position.x + b._size.x) + return false; + if (_position.x + _size.x <= b._position.x) + return false; + if (_position.y >= b._position.y + b._size.y) + return false; + if (_position.y + _size.y <= b._position.y) + return false; return true; } diff --git a/platform/android/README.md b/platform/android/README.md index f6aabab708..01eb9c03a6 100644 --- a/platform/android/README.md +++ b/platform/android/README.md @@ -5,7 +5,7 @@ using [Gradle](https://gradle.org/) as a build system. ## Documentation -- [Compiling for Android](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_android.html) +- [Compiling for Android](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_android.html) - Instructions on building this platform port from source. - [Exporting for Android](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_android.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/ios/README.md b/platform/ios/README.md index 82c275ad31..0e1d6802cb 100644 --- a/platform/ios/README.md +++ b/platform/ios/README.md @@ -8,7 +8,7 @@ project template used for packaging the iOS export templates. ## Documentation -- [Compiling for iOS](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_ios.html) +- [Compiling for iOS](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_ios.html) - Instructions on building this platform port from source. - [Exporting for iOS](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_ios.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/linuxbsd/README.md b/platform/linuxbsd/README.md index efa8682062..c4f287cc6c 100644 --- a/platform/linuxbsd/README.md +++ b/platform/linuxbsd/README.md @@ -7,7 +7,7 @@ used by this platform. ## Documentation -- [Compiling for Linux/*BSD](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_linuxbsd.html) +- [Compiling for Linux/*BSD](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_linuxbsd.html) - Instructions on building this platform port from source. - [Exporting for Linux/*BSD](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_linux.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/macos/README.md b/platform/macos/README.md index feead80736..205c59e05d 100644 --- a/platform/macos/README.md +++ b/platform/macos/README.md @@ -11,7 +11,7 @@ packaging macOS export templates. ## Documentation -- [Compiling for macOS](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_macos.html) +- [Compiling for macOS](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_macos.html) - Instructions on building this platform port from source. - [Exporting for macOS](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_macos.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/uwp/README.md b/platform/uwp/README.md index 575f90e3c7..d69a8a8850 100644 --- a/platform/uwp/README.md +++ b/platform/uwp/README.md @@ -14,7 +14,7 @@ project template used for packaging the UWP export templates. ## Documentation -- [Compiling for Universal Windows Platform](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_uwp.html) +- [Compiling for Universal Windows Platform](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_uwp.html) - Instructions on building this platform port from source. - [Exporting for Universal Windows Platform](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_uwp.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/web/README.md b/platform/web/README.md index 1265ca09df..906eb508fe 100644 --- a/platform/web/README.md +++ b/platform/web/README.md @@ -10,7 +10,7 @@ this platform such as the html shell (web page). ## Documentation -- [Compiling for the Web](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_web.html) +- [Compiling for the Web](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_web.html) - Instructions on building this platform port from source. - [Exporting for the Web](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html) - Instructions on using the compiled export templates to export a project. diff --git a/platform/windows/README.md b/platform/windows/README.md index c04032ae1d..4c775576fe 100644 --- a/platform/windows/README.md +++ b/platform/windows/README.md @@ -7,7 +7,7 @@ used by this platform. ## Documentation -- [Compiling for Windows](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_windows.html) +- [Compiling for Windows](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_windows.html) - Instructions on building this platform port from source. - [Exporting for Windows](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_windows.html) - Instructions on using the compiled export templates to export a project. diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 7539810feb..4356e91e41 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -2086,9 +2086,11 @@ void CodeEdit::confirm_code_completion(bool p_replace) { int post_brace_pair = get_caret_column(i) < get_line(caret_line).length() ? _get_auto_brace_pair_close_at_pos(caret_line, get_caret_column(i)) : -1; // Strings do not nest like brackets, so ensure we don't add an additional closing pair. - if (has_string_delimiter(String::chr(last_completion_char)) && post_brace_pair != -1 && last_char_matches) { - remove_text(caret_line, get_caret_column(i), caret_line, get_caret_column(i) + 1); - adjust_carets_after_edit(i, caret_line, get_caret_column(i), caret_line, get_caret_column(i) + 1); + if (has_string_delimiter(String::chr(last_completion_char))) { + if (post_brace_pair != -1 && last_char_matches) { + remove_text(caret_line, get_caret_column(i), caret_line, get_caret_column(i) + 1); + adjust_carets_after_edit(i, caret_line, get_caret_column(i), caret_line, get_caret_column(i) + 1); + } } else { if (pre_brace_pair != -1 && pre_brace_pair != post_brace_pair && last_char_matches) { remove_text(caret_line, get_caret_column(i), caret_line, get_caret_column(i) + 1); diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 78d29e2a41..816248567b 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -251,7 +251,7 @@ RID RenderForwardMobile::RenderBufferDataForwardMobile::get_color_fbs(Framebuffe Size2i target_size = render_buffers->get_target_size(); Size2i internal_size = render_buffers->get_internal_size(); - // can't do our blit pass if resolutions don't match + // can't do our blit pass if resolutions don't match, this should already have been checked. ERR_FAIL_COND_V(target_size != internal_size, RID()); // - opaque pass @@ -715,20 +715,26 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color // setup rendering to render buffer screen_size = p_render_data->render_buffers->get_internal_size(); - if (rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES).is_null()) { - // can't do blit subpass + if (rb->get_scaling_3d_mode() != RS::VIEWPORT_SCALING_3D_MODE_OFF) { + // can't do blit subpass because we're scaling using_subpass_post_process = false; } else if (p_render_data->environment.is_valid() && (environment_get_glow_enabled(p_render_data->environment) || RSG::camera_attributes->camera_attributes_uses_auto_exposure(p_render_data->camera_attributes) || RSG::camera_attributes->camera_attributes_uses_dof(p_render_data->camera_attributes))) { - // can't do blit subpass + // can't do blit subpass because we're using post processes using_subpass_post_process = false; } if (scene_state.used_screen_texture || scene_state.used_depth_texture) { - // can't use our last two subpasses + // can't use our last two subpasses because we're reading from screen texture or depth texture using_subpass_transparent = false; using_subpass_post_process = false; } + // We do this last because our get_color_fbs creates and caches the framebuffer if we need it. + if (using_subpass_post_process && rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES).is_null()) { + // can't do blit subpass because we don't have all subpasses + using_subpass_post_process = false; + } + if (using_subpass_post_process) { // all as subpasses framebuffer = rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 1d45db8eaf..2a87c4fa8d 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -539,7 +539,7 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende tonemap.view_count = rb->get_view_count(); RID dest_fb; - if (fsr && can_use_effects && (internal_size.x != target_size.x || internal_size.y != target_size.y)) { + if (fsr && can_use_effects && rb->get_scaling_3d_mode() == RS::VIEWPORT_SCALING_3D_MODE_FSR) { // If we use FSR to upscale we need to write our result into an intermediate buffer. // Note that this is cached so we only create the texture the first time. RID dest_texture = rb->create_texture(SNAME("Tonemapper"), SNAME("destination"), _render_buffers_get_color_format(), RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT); @@ -556,10 +556,7 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende RD::get_singleton()->draw_command_end_label(); } - if (fsr && can_use_effects && (internal_size.x != target_size.x || internal_size.y != target_size.y)) { - // TODO Investigate? Does this work? We never write into our render target and we've already done so up above in our tonemapper. - // I think FSR should either work before our tonemapper or as an alternative of our tonemapper. - + if (fsr && can_use_effects && rb->get_scaling_3d_mode() == RS::VIEWPORT_SCALING_3D_MODE_FSR) { RD::get_singleton()->draw_command_begin_label("FSR 1.0 Upscale"); for (uint32_t v = 0; v < rb->get_view_count(); v++) { diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp index d67a848a40..31377a10a0 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp @@ -96,7 +96,7 @@ void RenderSceneBuffersRD::cleanup() { named_textures.clear(); } -void RenderSceneBuffersRD::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { +void RenderSceneBuffersRD::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton(); RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton(); @@ -104,12 +104,7 @@ void RenderSceneBuffersRD::configure(RID p_render_target, const Size2i p_interna target_size = p_target_size; internal_size = p_internal_size; - - // FIXME, right now we do this because only our clustered renderer supports FSR upscale - // this does mean that with linear upscale if we use subpasses, we could get into trouble. - if (!can_be_storage) { - internal_size = target_size; - } + scaling_3d_mode = p_scaling_3d_mode; if (p_use_taa) { // Use negative mipmap LOD bias when TAA is enabled to compensate for loss of sharpness. @@ -193,6 +188,7 @@ void RenderSceneBuffersRD::configure_for_reflections(const Size2i p_reflection_s target_size = p_reflection_size; internal_size = p_reflection_size; render_target = RID(); + scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF; fsr_sharpness = 0.0; msaa_3d = RS::VIEWPORT_MSAA_DISABLED; screen_space_aa = RS::VIEWPORT_SCREEN_SPACE_AA_DISABLED; diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h index ff946f410f..dc849fd56a 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h @@ -73,6 +73,7 @@ private: // The internal size of the textures we render 3D to in case we render at a lower resolution and upscale Size2i internal_size = Size2i(0, 0); + RS::ViewportScaling3DMode scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF; float fsr_sharpness = 0.2f; // Aliassing settings @@ -139,7 +140,7 @@ public: void set_vrs(RendererRD::VRS *p_vrs) { vrs = p_vrs; } void cleanup(); - virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override; + virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override; void configure_for_reflections(const Size2i p_reflection_size); virtual void set_fsr_sharpness(float p_fsr_sharpness) override; virtual void set_texture_mipmap_bias(float p_texture_mipmap_bias) override; @@ -172,6 +173,7 @@ public: _FORCE_INLINE_ uint32_t get_view_count() const { return view_count; } _FORCE_INLINE_ Size2i get_internal_size() const { return internal_size; } _FORCE_INLINE_ Size2i get_target_size() const { return target_size; } + _FORCE_INLINE_ RS::ViewportScaling3DMode get_scaling_3d_mode() const { return scaling_3d_mode; } _FORCE_INLINE_ float get_fsr_sharpness() const { return fsr_sharpness; } _FORCE_INLINE_ RS::ViewportMSAA get_msaa_3d() const { return msaa_3d; } _FORCE_INLINE_ RS::ViewportScreenSpaceAA get_screen_space_aa() const { return screen_space_aa; } diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index 05a3fccf1c..b82019dd9d 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -115,9 +115,8 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) { if (p_viewport->size.width == 0 || p_viewport->size.height == 0) { p_viewport->render_buffers.unref(); } else { - const float scaling_3d_scale = p_viewport->scaling_3d_scale; + float scaling_3d_scale = p_viewport->scaling_3d_scale; RS::ViewportScaling3DMode scaling_3d_mode = p_viewport->scaling_3d_mode; - bool scaling_enabled = true; if ((scaling_3d_mode == RS::VIEWPORT_SCALING_3D_MODE_FSR) && (scaling_3d_scale > 1.0)) { // FSR is not designed for downsampling. @@ -133,7 +132,7 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) { } if (scaling_3d_scale == 1.0) { - scaling_enabled = false; + scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF; } int width; @@ -141,36 +140,37 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) { int render_width; int render_height; - if (scaling_enabled) { - switch (scaling_3d_mode) { - case RS::VIEWPORT_SCALING_3D_MODE_BILINEAR: - // Clamp 3D rendering resolution to reasonable values supported on most hardware. - // This prevents freezing the engine or outright crashing on lower-end GPUs. - width = CLAMP(p_viewport->size.width * scaling_3d_scale, 1, 16384); - height = CLAMP(p_viewport->size.height * scaling_3d_scale, 1, 16384); - render_width = width; - render_height = height; - break; - case RS::VIEWPORT_SCALING_3D_MODE_FSR: - width = p_viewport->size.width; - height = p_viewport->size.height; - render_width = MAX(width * scaling_3d_scale, 1.0); // width / (width * scaling) - render_height = MAX(height * scaling_3d_scale, 1.0); - break; - default: - // This is an unknown mode. - WARN_PRINT_ONCE(vformat("Unknown scaling mode: %d. Disabling 3D resolution scaling.", scaling_3d_mode)); - width = p_viewport->size.width; - height = p_viewport->size.height; - render_width = width; - render_height = height; - break; - } - } else { - width = p_viewport->size.width; - height = p_viewport->size.height; - render_width = width; - render_height = height; + switch (scaling_3d_mode) { + case RS::VIEWPORT_SCALING_3D_MODE_BILINEAR: + // Clamp 3D rendering resolution to reasonable values supported on most hardware. + // This prevents freezing the engine or outright crashing on lower-end GPUs. + width = CLAMP(p_viewport->size.width * scaling_3d_scale, 1, 16384); + height = CLAMP(p_viewport->size.height * scaling_3d_scale, 1, 16384); + render_width = width; + render_height = height; + break; + case RS::VIEWPORT_SCALING_3D_MODE_FSR: + width = p_viewport->size.width; + height = p_viewport->size.height; + render_width = MAX(width * scaling_3d_scale, 1.0); // width / (width * scaling) + render_height = MAX(height * scaling_3d_scale, 1.0); + break; + case RS::VIEWPORT_SCALING_3D_MODE_OFF: + width = p_viewport->size.width; + height = p_viewport->size.height; + render_width = width; + render_height = height; + break; + default: + // This is an unknown mode. + WARN_PRINT_ONCE(vformat("Unknown scaling mode: %d. Disabling 3D resolution scaling.", scaling_3d_mode)); + scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF; + scaling_3d_scale = 1.0; + width = p_viewport->size.width; + height = p_viewport->size.height; + render_width = width; + render_height = height; + break; } p_viewport->internal_size = Size2(render_width, render_height); @@ -179,7 +179,7 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) { // to compensate for the loss of sharpness. const float texture_mipmap_bias = log2f(MIN(scaling_3d_scale, 1.0)) + p_viewport->texture_mipmap_bias; - p_viewport->render_buffers->configure(p_viewport->render_target, Size2i(render_width, render_height), Size2(width, height), p_viewport->fsr_sharpness, texture_mipmap_bias, p_viewport->msaa_3d, p_viewport->screen_space_aa, p_viewport->use_taa, p_viewport->use_debanding, p_viewport->view_count); + p_viewport->render_buffers->configure(p_viewport->render_target, Size2i(render_width, render_height), Size2(width, height), scaling_3d_mode, p_viewport->fsr_sharpness, texture_mipmap_bias, p_viewport->msaa_3d, p_viewport->screen_space_aa, p_viewport->use_taa, p_viewport->use_debanding, p_viewport->view_count); } } } diff --git a/servers/rendering/storage/render_scene_buffers.cpp b/servers/rendering/storage/render_scene_buffers.cpp index 1320199833..6369139aa6 100644 --- a/servers/rendering/storage/render_scene_buffers.cpp +++ b/servers/rendering/storage/render_scene_buffers.cpp @@ -34,8 +34,8 @@ void RenderSceneBuffers::_bind_methods() { ClassDB::bind_method(D_METHOD("configure", "render_target", "internal_size", "target_size", "fsr_sharpness", "texture_mipmap_bias", "msaa", "screen_space_aa", "use_taa", "use_debanding", "view_count"), &RenderSceneBuffers::configure); } -void RenderSceneBuffers::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { - GDVIRTUAL_CALL(_configure, p_render_target, p_internal_size, p_target_size, p_fsr_sharpness, p_texture_mipmap_bias, p_msaa, p_screen_space_aa, p_use_taa, p_use_debanding, p_view_count); +void RenderSceneBuffers::configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) { + GDVIRTUAL_CALL(_configure, p_render_target, p_internal_size, p_target_size, p_scaling_3d_mode, p_fsr_sharpness, p_texture_mipmap_bias, p_msaa, p_screen_space_aa, p_use_taa, p_use_debanding, p_view_count); }; void RenderSceneBuffers::set_fsr_sharpness(float p_fsr_sharpness) { diff --git a/servers/rendering/storage/render_scene_buffers.h b/servers/rendering/storage/render_scene_buffers.h index 83fc78ca1c..cf96a9f372 100644 --- a/servers/rendering/storage/render_scene_buffers.h +++ b/servers/rendering/storage/render_scene_buffers.h @@ -40,7 +40,7 @@ class RenderSceneBuffers : public RefCounted { protected: static void _bind_methods(); - GDVIRTUAL10(_configure, RID, Size2i, Size2i, float, float, RS::ViewportMSAA, RenderingServer::ViewportScreenSpaceAA, bool, bool, uint32_t) + GDVIRTUAL11(_configure, RID, Size2i, Size2i, RS::ViewportScaling3DMode, float, float, RS::ViewportMSAA, RenderingServer::ViewportScreenSpaceAA, bool, bool, uint32_t) GDVIRTUAL1(_set_fsr_sharpness, float) GDVIRTUAL1(_set_texture_mipmap_bias, float) GDVIRTUAL1(_set_use_debanding, bool) @@ -49,7 +49,7 @@ public: RenderSceneBuffers(){}; virtual ~RenderSceneBuffers(){}; - virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count); + virtual void configure(RID p_render_target, const Size2i p_internal_size, const Size2i p_target_size, RS::ViewportScaling3DMode p_scaling_3d_mode, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa_3d, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count); // for those settings that are unlikely to require buffers to be recreated, we'll add setters virtual void set_fsr_sharpness(float p_fsr_sharpness); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 6efe28a847..5785f5c273 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -802,7 +802,8 @@ public: enum ViewportScaling3DMode { VIEWPORT_SCALING_3D_MODE_BILINEAR, VIEWPORT_SCALING_3D_MODE_FSR, - VIEWPORT_SCALING_3D_MODE_MAX + VIEWPORT_SCALING_3D_MODE_MAX, + VIEWPORT_SCALING_3D_MODE_OFF = 255, // for internal use only }; virtual void viewport_set_use_xr(RID p_viewport, bool p_use_xr) = 0; diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h index c68560000c..5447c99a64 100644 --- a/tests/scene/test_code_edit.h +++ b/tests/scene/test_code_edit.h @@ -2930,7 +2930,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_NODE_PATH, "\"test", "\"test"); code_edit->update_code_completion_options(); code_edit->confirm_code_completion(); - CHECK(code_edit->get_line(0) == "\"\"test\"\""); + CHECK(code_edit->get_line(0) == "\"\"test\""); CHECK(code_edit->get_caret_column() == 7); code_edit->undo(); |