From fd8f38c240bf045ce2ba1891a9a68ff088234215 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 18 May 2023 19:22:22 +0200 Subject: Revert "Make EditorToaster's handler thread-safe" This reverts commit 3a5bc7455eddd87feb8a70d3270a16c69a2c90f6. --- editor/editor_toaster.cpp | 17 ++++++++--------- editor/editor_toaster.h | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 866a6db2a6..10c3e963af 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -145,12 +145,6 @@ void EditorToaster::_notification(int p_what) { } void EditorToaster::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) { - // This may be called from a thread. Since we will deal with non-thread-safe elements, - // we have to put it in the queue for safety. - callable_mp_static(&EditorToaster::_error_handler_impl).bind(p_file, p_line, p_error, p_errorexp, p_editor_notify, p_type).call_deferred(); -} - -void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type) { if (!EditorToaster::get_singleton() || !EditorToaster::get_singleton()->is_inside_tree()) { return; } @@ -164,8 +158,13 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const int show_all_setting = EDITOR_GET("interface/editor/show_internal_errors_in_toast_notifications"); if (p_editor_notify || (show_all_setting == 0 && in_dev) || show_all_setting == 1) { - String err_str = !p_errorexp.is_empty() ? p_errorexp : p_error; - String tooltip_str = p_file + ":" + itos(p_line); + String err_str; + if (p_errorexp && p_errorexp[0]) { + err_str = String::utf8(p_errorexp); + } else { + err_str = String::utf8(p_error); + } + String tooltip_str = String::utf8(p_file) + ":" + itos(p_line); if (!p_editor_notify) { if (p_type == ERR_HANDLER_WARNING) { @@ -175,7 +174,7 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const } } - Severity severity = ((ErrorHandlerType)p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR; + Severity severity = (p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR; EditorToaster::get_singleton()->popup_str(err_str, severity, tooltip_str); } } diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h index 4837756b4e..6b834f8288 100644 --- a/editor/editor_toaster.h +++ b/editor/editor_toaster.h @@ -89,7 +89,6 @@ private: const double default_message_duration = 5.0; static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type); - static void _error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type); void _update_vbox_position(); void _update_disable_notifications_button(); void _auto_hide_or_free_toasts(); -- cgit v1.2.3 From 912b3afb96ab7a4d094a2fee86591ba7376d0aac Mon Sep 17 00:00:00 2001 From: Samuele Panzeri Date: Thu, 18 May 2023 19:22:22 +0200 Subject: Fix skeleton 3d editor crash in RC3 Control notifies a theme changed before the editor has entered the tree (cherry picked from commit a103cd76bbabbaac05c1024b0fcc73745199cbfb) --- editor/editor_inspector.cpp | 5 +++++ editor/editor_inspector.h | 1 + editor/plugins/skeleton_3d_editor_plugin.cpp | 13 +++++-------- editor/plugins/skeleton_3d_editor_plugin.h | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 8498ddecd6..8118e202fe 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1516,6 +1516,11 @@ void EditorInspectorSection::fold() { queue_redraw(); } +void EditorInspectorSection::set_bg_color(const Color &p_bg_color) { + bg_color = p_bg_color; + queue_redraw(); +} + bool EditorInspectorSection::has_revertable_properties() const { return !revertable_properties.is_empty(); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 76fe929ce4..51a1164350 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -297,6 +297,7 @@ public: VBoxContainer *get_vbox(); void unfold(); void fold(); + void set_bg_color(const Color &p_bg_color); bool has_revertable_properties() const; void property_can_revert_changed(const String &p_path, bool p_can_revert); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 285d2e77b2..3d442d24e4 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -695,9 +695,6 @@ void Skeleton3DEditor::update_joint_tree() { } } -void Skeleton3DEditor::update_editors() { -} - void Skeleton3DEditor::create_editors() { set_h_size_flags(SIZE_EXPAND_FILL); set_focus_mode(FOCUS_ALL); @@ -797,10 +794,8 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_insert_all_button); // Bone tree. - const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor")); - - EditorInspectorSection *bones_section = memnew(EditorInspectorSection); - bones_section->setup("bones", "Bones", skeleton, section_color, true); + bones_section = memnew(EditorInspectorSection); + bones_section->setup("bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true); add_child(bones_section); bones_section->unfold(); @@ -831,7 +826,6 @@ void Skeleton3DEditor::create_editors() { void Skeleton3DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - create_editors(); update_joint_tree(); joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed)); @@ -857,6 +851,7 @@ void Skeleton3DEditor::_notification(int p_what) { key_scale_button->set_icon(get_theme_icon(SNAME("KeyScale"), SNAME("EditorIcons"))); key_insert_button->set_icon(get_theme_icon(SNAME("Key"), SNAME("EditorIcons"))); key_insert_all_button->set_icon(get_theme_icon(SNAME("NewKey"), SNAME("EditorIcons"))); + bones_section->set_bg_color(get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); update_joint_tree(); } break; @@ -945,6 +940,8 @@ void fragment() { handles_mesh_instance->set_cast_shadows_setting(GeometryInstance3D::SHADOW_CASTING_SETTING_OFF); handles_mesh.instantiate(); handles_mesh_instance->set_mesh(handles_mesh); + + create_editors(); } void Skeleton3DEditor::update_bone_original() { diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 3eb840cfa9..f5184976a4 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -132,6 +132,8 @@ class Skeleton3DEditor : public VBoxContainer { Button *key_insert_button = nullptr; Button *key_insert_all_button = nullptr; + EditorInspectorSection *bones_section = nullptr; + EditorFileDialog *file_dialog = nullptr; bool keyable = false; @@ -146,7 +148,6 @@ class Skeleton3DEditor : public VBoxContainer { EditorFileDialog *file_export_lib = nullptr; void update_joint_tree(); - void update_editors(); void create_editors(); -- cgit v1.2.3 From c37259b1812c2c4e01bea8afd13e4206ff14ded0 Mon Sep 17 00:00:00 2001 From: VolTer Date: Thu, 18 May 2023 19:22:22 +0200 Subject: Add WorkerThreadPool documentation (cherry picked from commit bd257092daedde5d35a8dd5c1436eb4b01d25dde) --- doc/classes/WorkerThreadPool.xml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/doc/classes/WorkerThreadPool.xml b/doc/classes/WorkerThreadPool.xml index fced54ae7f..887dfbdcc0 100644 --- a/doc/classes/WorkerThreadPool.xml +++ b/doc/classes/WorkerThreadPool.xml @@ -1,10 +1,50 @@ + A singleton that allocates some [Thread]s on startup, used to offload tasks to these threads. + The [WorkerThreadPool] singleton allocates a set of [Thread]s (called worker threads) on project startup and provides methods for offloading tasks to them. This can be used for simple multithreading without having to create [Thread]s. + Tasks hold the [Callable] to be run by the threads. [WorkerThreadPool] can be used to create regular tasks, which will be taken by one worker thread, or group tasks, which can be distributed between multiple worker threads. Group tasks execute the [Callable] multiple times, which makes them useful for iterating over a lot of elements, such as the enemies in an arena. + Here's a sample on how to offload an expensive function to worker threads: + [codeblocks] + [gdscript] + var enemies = [] # An array to be filled with enemies. + + func process_enemy_ai(enemy_index): + var processed_enemy = enemies[enemy_index] + # Expensive logic... + + func _process(delta): + var task_id = WorkerThreadPool.add_group_task(process_enemy_ai, enemies.size()) + # Other code... + WorkerThreadPool.wait_for_group_task_completion(task_id) + # Other code that depends on the enemy AI already being processed. + [/gdscript] + [csharp] + private List<Node> _enemies = new List<Node>(); // A list to be filled with enemies. + + private void ProcessEnemyAI(int enemyIndex) + { + Node processedEnemy = _enemies[enemyIndex]; + // Expensive logic here. + } + + public override void _Process(double delta) + { + long taskId = WorkerThreadPool.AddGroupTask(Callable.From<int>(ProcessEnemyAI), _enemies.Count); + // Other code... + WorkerThreadPool.WaitForGroupTaskCompletion(taskId); + // Other code that depends on the enemy AI already being processed. + } + [/csharp] + [/codeblocks] + The above code relies on the number of elements in the [code]enemies[/code] array remaining constant during the multithreaded part. + [b]Note:[/b] Using this singleton could affect performance negatively if the task being distributed between threads is not computationally expensive. + $DOCS_URL/tutorials/performance/using_multiple_threads.html + $DOCS_URL/tutorials/performance/thread_safe_apis.html @@ -15,6 +55,9 @@ + Adds [param action] as a group task to be executed by the worker threads. The [Callable] will be called a number of times based on [param elements], with the first thread calling it with the value [code]0[/code] as a parameter, and each consecutive execution incrementing this value by 1 until it reaches [code]element - 1[/code]. + The number of threads the task is distributed to is defined by [param tasks_needed], where the default value [code]-1[/code] means it is distributed to all worker threads. [param high_priority] determines if the task has a high priority or a low priority (default). You can optionally provide a [param description] to help with debugging. + Returns a group task ID that can be used by other methods. @@ -23,36 +66,44 @@ + Adds [param action] as a task to be executed by a worker thread. [param high_priority] determines if the task has a high priority or a low priority (default). You can optionally provide a [param description] to help with debugging. + Returns a task ID that can be used by other methods. + Returns how many times the [Callable] of the group task with the given ID has already been executed by the worker threads. + [b]Note:[/b] If a thread has started executing the [Callable] but is yet to finish, it won't be counted. + Returns [code]true[/code] if the group task with the given ID is completed. + Returns [code]true[/code] if the task with the given ID is completed. + Pauses the thread that calls this method until the group task with the given ID is completed. + Pauses the thread that calls this method until the task with the given ID is completed. -- cgit v1.2.3 From 1f7a5f61444734c74d784b17e7785ea72bbf9be2 Mon Sep 17 00:00:00 2001 From: Ninni Pipping Date: Thu, 18 May 2023 19:22:22 +0200 Subject: Document limitations of placeholder textures (cherry picked from commit bd2e3770070821bcc6b3b81d8a0d2ff394a98622) --- doc/classes/PlaceholderCubemap.xml | 1 + doc/classes/PlaceholderCubemapArray.xml | 1 + doc/classes/PlaceholderTexture2D.xml | 1 + doc/classes/PlaceholderTexture2DArray.xml | 1 + doc/classes/PlaceholderTexture3D.xml | 1 + doc/classes/PlaceholderTextureLayered.xml | 1 + 6 files changed, 6 insertions(+) diff --git a/doc/classes/PlaceholderCubemap.xml b/doc/classes/PlaceholderCubemap.xml index 0892b023a2..a44799489c 100644 --- a/doc/classes/PlaceholderCubemap.xml +++ b/doc/classes/PlaceholderCubemap.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [Cubemap] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). diff --git a/doc/classes/PlaceholderCubemapArray.xml b/doc/classes/PlaceholderCubemapArray.xml index c7a7e9154c..ff9f172476 100644 --- a/doc/classes/PlaceholderCubemapArray.xml +++ b/doc/classes/PlaceholderCubemapArray.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [CubemapArray] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). diff --git a/doc/classes/PlaceholderTexture2D.xml b/doc/classes/PlaceholderTexture2D.xml index c889055e4d..f6a1e4bc25 100644 --- a/doc/classes/PlaceholderTexture2D.xml +++ b/doc/classes/PlaceholderTexture2D.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [Texture2D] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). diff --git a/doc/classes/PlaceholderTexture2DArray.xml b/doc/classes/PlaceholderTexture2DArray.xml index a749e8c039..e5a699c7c5 100644 --- a/doc/classes/PlaceholderTexture2DArray.xml +++ b/doc/classes/PlaceholderTexture2DArray.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [Texture2D] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). diff --git a/doc/classes/PlaceholderTexture3D.xml b/doc/classes/PlaceholderTexture3D.xml index ccd3c94fc2..81a1743f5b 100644 --- a/doc/classes/PlaceholderTexture3D.xml +++ b/doc/classes/PlaceholderTexture3D.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [Texture3D] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). diff --git a/doc/classes/PlaceholderTextureLayered.xml b/doc/classes/PlaceholderTextureLayered.xml index 8cc6dd606a..36013159d3 100644 --- a/doc/classes/PlaceholderTextureLayered.xml +++ b/doc/classes/PlaceholderTextureLayered.xml @@ -7,6 +7,7 @@ This class is used when loading a project that uses a [TextureLayered] subclass in 2 conditions: - When running the project exported in dedicated server mode, only the texture's dimensions are kept (as they may be relied upon for gameplay purposes or positioning of other elements). This allows reducing the exported PCK's size significantly. - When this subclass is missing due to using a different engine version or build (e.g. modules disabled). + [b]Note:[/b] This is not intended to be used as an actual texture for rendering. It is not guaranteed to work like one in shaders or materials (for example when calculating UV). -- cgit v1.2.3 From 945d669da071ffdf1eac967463e916de888d1568 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Thu, 18 May 2023 19:22:22 +0200 Subject: Fix property usage docs referring to removed network flag (cherry picked from commit fc92ee6bf4b546893b9bf2960a436d56251b0994) --- doc/classes/@GlobalScope.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 8c84a55ba0..8941951a31 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2843,10 +2843,10 @@ The property is read-only in the [EditorInspector]. - Default usage (storage, editor and network). + Default usage (storage and editor). - Default usage but without showing the property in the editor (storage, network). + Default usage but without showing the property in the editor (storage). Flag for a normal method. -- cgit v1.2.3 From 3e8f0b4b7509e136dccbf315cab8ccce9396adb6 Mon Sep 17 00:00:00 2001 From: Alex Drozd Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Exclude overriden properties from Property Descriptions section (cherry picked from commit 28f391f301e55755d3c2bd0055d783da4ef5e122) --- editor/editor_help.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index acbc3ce0dc..bbcf3573ff 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -841,14 +841,15 @@ void EditorHelp::_update_doc() { // Properties overview HashSet skip_methods; - bool has_properties = cd.properties.size() != 0; - if (cd.is_script_doc) { - has_properties = false; - for (int i = 0; i < cd.properties.size(); i++) { - if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.strip_edges().is_empty()) { - continue; - } - has_properties = true; + bool has_properties = false; + bool has_property_descriptions = false; + for (const DocData::PropertyDoc &prop : cd.properties) { + if (cd.is_script_doc && prop.name.begins_with("_") && prop.description.strip_edges().is_empty()) { + continue; + } + has_properties = true; + if (!prop.overridden) { + has_property_descriptions = true; break; } } @@ -1527,7 +1528,7 @@ void EditorHelp::_update_doc() { } // Property descriptions - if (has_properties) { + if (has_property_descriptions) { section_line.push_back(Pair(TTR("Property Descriptions"), class_desc->get_paragraph_count() - 2)); _push_title_font(); class_desc->add_text(TTR("Property Descriptions")); -- cgit v1.2.3 From 7f0d8bcade9005a053e9dbaf6444dda2724918e4 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Docs: Point to @GDScript in GDscript (script impl) (cherry picked from commit ad21fb0f9261de6a3b82b5267253efb5f6a019fa) --- modules/gdscript/doc_classes/GDScript.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml index 1a102bd16f..0651d33e66 100644 --- a/modules/gdscript/doc_classes/GDScript.xml +++ b/modules/gdscript/doc_classes/GDScript.xml @@ -5,7 +5,8 @@ A script implemented in the GDScript programming language. The script extends the functionality of all objects that instantiate it. - [method new] creates a new instance of the script. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes. + Calling [method new] creates a new instance of the script. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes. + If you are looking for GDScript's built-in functions, see [@GDScript] instead. $DOCS_URL/tutorials/scripting/gdscript/index.html -- cgit v1.2.3 From 9a88b47cb1a1f893d178a085eb67c9ca39d4f210 Mon Sep 17 00:00:00 2001 From: voidshine Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Document MIDI zero velocity quirk (cherry picked from commit 06d02928b76c7af82f12de482a509bf82dcc2892) --- doc/classes/@GlobalScope.xml | 4 ++-- doc/classes/InputEventMIDI.xml | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 8941951a31..e98419ff8f 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2436,10 +2436,10 @@ Enum value which doesn't correspond to any MIDI message. This is used to initialize [enum MIDIMessage] properties with a generic state. - MIDI note OFF message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. + MIDI note OFF message. Not all MIDI devices send this event; some send [constant MIDI_MESSAGE_NOTE_ON] with zero velocity instead. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. - MIDI note ON message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. + MIDI note ON message. Some MIDI devices send this event with velocity zero instead of [constant MIDI_MESSAGE_NOTE_OFF], but implementations vary. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. MIDI aftertouch message. This message is most often sent by pressing down on the key after it "bottoms out". diff --git a/doc/classes/InputEventMIDI.xml b/doc/classes/InputEventMIDI.xml index e4ba380741..513e56dc09 100644 --- a/doc/classes/InputEventMIDI.xml +++ b/doc/classes/InputEventMIDI.xml @@ -81,7 +81,8 @@ Returns a value indicating the type of message for this MIDI signal. This is a member of the [enum MIDIMessage] enum. For MIDI messages between 0x80 and 0xEF, only the left half of the bits are returned as this value, as the other part is the channel (ex: 0x94 becomes 0x9). For MIDI messages from 0xF0 to 0xFF, the value is returned as-is. Notes will return [constant MIDI_MESSAGE_NOTE_ON] when activated, but they might not always return [constant MIDI_MESSAGE_NOTE_OFF] when deactivated, therefore your code should treat the input as stopped if some period of time has passed. - For more information, see the MIDI message status byte list chart linked above. + Some MIDI devices may send [constant MIDI_MESSAGE_NOTE_ON] with zero velocity instead of [constant MIDI_MESSAGE_NOTE_OFF]. + For more information, see the note in [member velocity] and the MIDI message status byte list chart linked above. The pitch index number of this MIDI signal. This value ranges from 0 to 127. On a piano, middle C is 60, and A440 is 69, see the "MIDI note" column of the piano key frequency chart on Wikipedia for more information. @@ -90,7 +91,8 @@ The pressure of the MIDI signal. This value ranges from 0 to 127. For many devices, this value is always zero. - The velocity of the MIDI signal. This value ranges from 0 to 127. For a piano, this corresponds to how quickly the key was pressed, and is rarely above about 110 in practice. Note that some MIDI devices may send a [constant MIDI_MESSAGE_NOTE_ON] message with zero velocity and expect this to be treated the same as a [constant MIDI_MESSAGE_NOTE_OFF] message, but device implementations vary so Godot reports event data exactly as received. + The velocity of the MIDI signal. This value ranges from 0 to 127. For a piano, this corresponds to how quickly the key was pressed, and is rarely above about 110 in practice. + [b]Note:[/b] Some MIDI devices may send a [constant MIDI_MESSAGE_NOTE_ON] message with zero velocity and expect this to be treated the same as a [constant MIDI_MESSAGE_NOTE_OFF] message, but device implementations vary so Godot reports event data exactly as received. Depending on the hardware and the needs of the game/app, this MIDI quirk can be handled robustly with a couple lines of script (check for [constant MIDI_MESSAGE_NOTE_ON] with velocity zero). -- cgit v1.2.3 From 7d5d5b7bd10f6fad498ec6764a3aac9745f96e1d Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Fix crash when trying to create bones from Control (cherry picked from commit 6a120107b330c5859f934080fc4dca1c83c3a6ab) --- editor/plugins/canvas_item_editor_plugin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f0911ce71d..bb951fbd62 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4594,6 +4594,9 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->create_action(TTR("Create Custom Bone2D(s) from Node(s)")); for (const KeyValue &E : selection) { Node2D *n2d = Object::cast_to(E.key); + if (!n2d) { + continue; + } Bone2D *new_bone = memnew(Bone2D); String new_bone_name = n2d->get_name(); -- cgit v1.2.3 From 238b8357a313dcb90c86f95a0d52c99dee444875 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 18 May 2023 19:22:23 +0200 Subject: [TLS] Fix crashes trying to use TLS when not available. If no StreamPeerTLS implementation is available, HTTPClient and WebSocketPeer will now correctly refuse to connect using TLS returning ERR_UNAVAILABLE. Similarly, ENetConnection will refuse to setup DTLS when PacketPeerDTLS is not available. (cherry picked from commit eeac6f8c7f070a9f4674bfa51ec35c57516311c0) --- core/io/http_client_tcp.cpp | 1 + modules/websocket/wsl_peer.cpp | 4 +++- thirdparty/enet/godot.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index 3788fa501e..2f45238951 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -60,6 +60,7 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, Refis_server(), ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V_MSG(tls_options.is_valid() && !StreamPeerTLS::is_available(), ERR_UNAVAILABLE, "HTTPS is not available in this build."); ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER); if (conn_port < 0) { diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 8a150c8561..aedc82bfcf 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -332,7 +332,7 @@ void WSLPeer::_do_client_handshake() { if (connection == tcp) { // Start SSL handshake tls = Ref(StreamPeerTLS::create()); - ERR_FAIL_COND_MSG(tls.is_null(), "SSL is not available in this build."); + ERR_FAIL_COND(tls.is_null()); if (tls->connect_to_stream(tcp, requested_host, tls_options) != OK) { close(-1); return; // Error. @@ -504,6 +504,8 @@ Error WSLPeer::connect_to_url(const String &p_url, Ref p_options) { path = "/"; } + ERR_FAIL_COND_V_MSG(use_tls && !StreamPeerTLS::is_available(), ERR_UNAVAILABLE, "WSS is not available in this build."); + requested_url = p_url; requested_host = host; diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index ea7f4957a2..2cbfe59fc6 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -436,6 +436,7 @@ ENetSocket enet_socket_create(ENetSocketType type) { } int enet_host_dtls_server_setup(ENetHost *host, void *p_options) { + ERR_FAIL_COND_V_MSG(!DTLSServer::is_available(), -1, "DTLS server is not available in this build."); ENetGodotSocket *sock = (ENetGodotSocket *)host->socket; if (!sock->can_upgrade()) { return -1; @@ -446,6 +447,7 @@ int enet_host_dtls_server_setup(ENetHost *host, void *p_options) { } int enet_host_dtls_client_setup(ENetHost *host, const char *p_for_hostname, void *p_options) { + ERR_FAIL_COND_V_MSG(!PacketPeerDTLS::is_available(), -1, "DTLS is not available in this build."); ENetGodotSocket *sock = (ENetGodotSocket *)host->socket; if (!sock->can_upgrade()) { return -1; -- cgit v1.2.3 From 589306a9d81c8d63c86269c53990c52fb6d1b503 Mon Sep 17 00:00:00 2001 From: Ninni Pipping Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Make `TouchScreenButton` connections reference counted Prevents errors when assigning the same texture to both slots (cherry picked from commit 0648cc65b2c9bd8a48f3da74ea2c17898cd2b425) --- scene/2d/touch_screen_button.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 4c8c4f1e16..7da2fc3cb3 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -42,7 +42,7 @@ void TouchScreenButton::set_texture_normal(const Ref &p_texture) { } texture_normal = p_texture; if (texture_normal.is_valid()) { - texture_normal->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + texture_normal->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); } queue_redraw(); } @@ -60,7 +60,7 @@ void TouchScreenButton::set_texture_pressed(const Ref &p_texture_pres } texture_pressed = p_texture_pressed; if (texture_pressed.is_valid()) { - texture_pressed->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + texture_pressed->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); } queue_redraw(); } -- cgit v1.2.3 From eced93a3f57765a7c82b522314511c5e93c48971 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 18 May 2023 21:41:34 +0200 Subject: Revert "Improve the UX of ViewportTexture in the editor" This reverts commit b91b8fce43ab9cb9f8c96f8c640acc801774b6b5. --- doc/classes/ViewportTexture.xml | 1 - editor/editor_properties.cpp | 1 + scene/main/viewport.cpp | 46 +++-------------------------------------- scene/main/viewport.h | 2 -- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/doc/classes/ViewportTexture.xml b/doc/classes/ViewportTexture.xml index 36390863cf..8ecda45bd6 100644 --- a/doc/classes/ViewportTexture.xml +++ b/doc/classes/ViewportTexture.xml @@ -17,7 +17,6 @@ The path to the [Viewport] node to display. This is relative to the scene root, not to the node which uses the texture. - [b]Note:[/b] In the editor, it is automatically updated when the target viewport's node path changes due to renaming or moving the viewport or its ancestors. At runtime, it may not be able to automatically update due to the inability to determine the scene root. diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 348e1ead4a..01a574def6 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3998,6 +3998,7 @@ void EditorPropertyResource::_viewport_selected(const NodePath &p_path) { Ref vt; vt.instantiate(); vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node)); + vt->setup_local_to_scene(); emit_changed(get_edited_property(), vt); update_property(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4aaa2e8f5b..8bdcd9302f 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -72,9 +72,10 @@ void ViewportTexture::setup_local_to_scene() { if (vp) { vp->viewport_textures.erase(this); - vp = nullptr; } + vp = nullptr; + if (loc_scene->is_ready()) { _setup_local_to_scene(loc_scene); } else { @@ -90,24 +91,8 @@ void ViewportTexture::set_viewport_path_in_scene(const NodePath &p_path) { path = p_path; - if (vp) { - vp->viewport_textures.erase(this); - vp = nullptr; - } - - if (proxy_ph.is_valid()) { - RS::get_singleton()->free(proxy_ph); - } - if (proxy.is_valid()) { - RS::get_singleton()->free(proxy); - } - proxy_ph = RID(); - proxy = RID(); - - if (get_local_scene() && !path.is_empty()) { + if (get_local_scene()) { setup_local_to_scene(); - } else { - emit_changed(); } } @@ -186,8 +171,6 @@ void ViewportTexture::_setup_local_to_scene(const Node *p_loc_scene) { proxy = RS::get_singleton()->texture_proxy_create(vp->texture_rid); } vp_pending = false; - - emit_changed(); } void ViewportTexture::_bind_methods() { @@ -425,28 +408,9 @@ int Viewport::_sub_window_find(Window *p_window) { return -1; } -void Viewport::_update_viewport_path() { - if (viewport_textures.is_empty()) { - return; - } - - Node *scene_root = get_scene_file_path().is_empty() ? get_owner() : this; - if (!scene_root && is_inside_tree()) { - scene_root = get_tree()->get_edited_scene_root(); - } - if (scene_root && (scene_root == this || scene_root->is_ancestor_of(this))) { - NodePath path_in_scene = scene_root->get_path_to(this); - for (ViewportTexture *E : viewport_textures) { - E->path = path_in_scene; - } - } -} - void Viewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - _update_viewport_path(); - if (get_parent()) { parent = get_parent()->get_viewport(); RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid()); @@ -539,10 +503,6 @@ void Viewport::_notification(int p_what) { RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, RID()); } break; - case NOTIFICATION_PATH_RENAMED: { - _update_viewport_path(); - } break; - case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (!get_tree()) { return; diff --git a/scene/main/viewport.h b/scene/main/viewport.h index de0abec052..e88e0628dd 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -317,8 +317,6 @@ private: Ref default_texture; HashSet viewport_textures; - void _update_viewport_path(); - SDFOversize sdf_oversize = SDF_OVERSIZE_120_PERCENT; SDFScale sdf_scale = SDF_SCALE_50_PERCENT; -- cgit v1.2.3 From 5fe254e8f681f400f2ebab187486998f499387f9 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 18 May 2023 19:22:23 +0200 Subject: Update the changelog for 4.0.3 --- CHANGELOG.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e9f9920fc..6fd83b898c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,9 +63,12 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea - Rename internal root canvas group to start with underscore ([GH-76149](https://github.com/godotengine/godot/pull/76149)). - Make acos and asin safe ([GH-76906](https://github.com/godotengine/godot/pull/76906)). +#### Documentation + +- Exclude overridden properties from Property Descriptions section ([GH-77027](https://github.com/godotengine/godot/pull/77027)). + #### Editor -- Make EditorToaster's handler thread-safe ([GH-71670](https://github.com/godotengine/godot/pull/71670)). - Prevent off-screen controls in editor ([GH-73646](https://github.com/godotengine/godot/pull/73646)). - Re-enable script editor File menu shortcuts when the menu is hidden ([GH-74319](https://github.com/godotengine/godot/pull/74319)). - Prevent color conversion of the big Godot logo ([GH-75653](https://github.com/godotengine/godot/pull/75653)). @@ -73,7 +76,6 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea - Adjust size of some dialogs ([GH-75895](https://github.com/godotengine/godot/pull/75895)). - Change cursor consistently when panning in the 2D Editor ([GH-75997](https://github.com/godotengine/godot/pull/75997)). - Validate renderer selection in project manager and expose default renderer setting as an enum ([GH-76331](https://github.com/godotengine/godot/pull/76331)). -- Improve the UX of ViewportTexture in the editor ([GH-64388](https://github.com/godotengine/godot/pull/64388)). - Close built-in shaders when closing scene ([GH-75864](https://github.com/godotengine/godot/pull/75864)). - Command Palette search now also uses original English command names ([GH-76523](https://github.com/godotengine/godot/pull/76523)). - Preserve scene unique names when saving branch as scene ([GH-76609](https://github.com/godotengine/godot/pull/76609)). @@ -96,7 +98,7 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea - Use DXT1 when compressing PNGs with RGB format ([GH-76516](https://github.com/godotengine/godot/pull/76516)). - gltf: Permit sparse accessors without a bufferView ([GH-76875](https://github.com/godotengine/godot/pull/76875)). -#### Network +#### Networking - Poll LSP/DAP clients for connection status updates ([GH-75850](https://github.com/godotengine/godot/pull/75850)). @@ -189,6 +191,7 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea - Fix Node arrays appear as Object arrays in the inspector ([GH-76530](https://github.com/godotengine/godot/pull/76530)). - Fix CollisionShape2D editor crashes ([GH-76546](https://github.com/godotengine/godot/pull/76546), [GH-76798](https://github.com/godotengine/godot/pull/76798)). - Fix 2D shader preview draws over uniform ([GH-76555](https://github.com/godotengine/godot/pull/76555)). +- Fix crash when trying to create bones from Control ([GH-77160](https://github.com/godotengine/godot/pull/77160)). #### Export @@ -241,6 +244,10 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea - Fix NavigationObstacles not being added to avoidance simulation ([GH-75756](https://github.com/godotengine/godot/pull/75756)). - Fix NavigationMesh baking for HeightMapShape ([GH-76212](https://github.com/godotengine/godot/pull/76212)). +#### Networking + +- Fix crashes trying to use TLS when not available ([GH-77011](https://github.com/godotengine/godot/pull/77011)). + #### Particles - Properly calculate lifetime_split for particles ([GH-73313](https://github.com/godotengine/godot/pull/73313)). -- cgit v1.2.3