From 29e235b341ca50c7dd6d16e35630fe2e52b7e9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 24 Aug 2022 20:06:03 +0200 Subject: [PATCH 1/8] Add FileAccess::get_access_type() (cherry picked from commit 8c6b2fbb908261d29a6692dd7a816464c28520d2) --- core/os/file_access.cpp | 4 ++++ core/os/file_access.h | 1 + 2 files changed, 5 insertions(+) diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 709266dd218..770ca0593d4 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -117,6 +117,10 @@ FileAccess::CreateFunc FileAccess::get_create_func(AccessType p_access) { return create_func[p_access]; }; +FileAccess::AccessType FileAccess::get_access_type() const { + return _access_type; +} + String FileAccess::fix_path(const String &p_path) const { //helper used by file accesses that use a single filesystem diff --git a/core/os/file_access.h b/core/os/file_access.h index c6253518522..232e3d5260c 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -59,6 +59,7 @@ public: virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) = 0; protected: + AccessType get_access_type() const; String fix_path(const String &p_path) const; virtual Error _open(const String &p_path, int p_mode_flags) = 0; ///< open a file virtual uint64_t _get_modified_time(const String &p_file) = 0; From 9644e9a04675ccfb6fb2f7487f5f0178bd1294d7 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 25 Aug 2022 13:07:54 +0800 Subject: [PATCH 2/8] Fix missing URL text in the classref (cherry picked from commit a90c348a86d60cdabac9e7f5d1109beeaa52b506) --- doc/classes/AnimationNodeStateMachineTransition.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index 03564ff20a4..1b1fcf79d74 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -11,7 +11,7 @@ - Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the [AnimationTree] that can be controlled from code (see [url=$DOCS_URL/tutorials/animation/animation_tree.html#controlling-from-code][/url]). For example, if [member AnimationTree.tree_root] is an [AnimationNodeStateMachine] and [member advance_condition] is set to [code]"idle"[/code]: + Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the [AnimationTree] that can be controlled from code (see [url=$DOCS_URL/tutorials/animation/animation_tree.html#controlling-from-code]Using AnimationTree[/url]). For example, if [member AnimationTree.tree_root] is an [AnimationNodeStateMachine] and [member advance_condition] is set to [code]"idle"[/code]: [codeblock] $animation_tree["parameters/conditions/idle"] = is_on_floor and (linear_velocity.x == 0) [/codeblock] From 5d0cd8659bcddd5ecd4fb7797c93d57dec343cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Thu, 25 Aug 2022 08:42:34 +0200 Subject: [PATCH 3/8] Fix forwarding of CLI arguments taking an option (cherry picked from commit 335a4099dedd950c5b6d45f6b1b1a464bf39341e) --- main/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index b73d3526e65..f241f7fe15d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -509,10 +509,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(I->get()); forwardable_cli_arguments[CLI_SCOPE_PROJECT].push_back(I->get()); } - if (I->get() == "--single-window" || - I->get() == "--audio-driver" || + if (I->get() == "--audio-driver" || I->get() == "--video-driver") { - forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(I->get()); + if (I->next()) { + forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(I->get()); + forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(I->next()->get()); + } } #endif From 44af8794384e18b0c82e9e5170dda46588f32a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 26 Aug 2022 14:06:56 +0200 Subject: [PATCH 4/8] Linux: Fix GNU ld detection for pck_embed linker script (cherry picked from commit fce3602a1e892cbc35fb3aa409bdae835a37be4f) --- platform/x11/detect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 27c1a8cd0b2..592c8bbb5f4 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -416,7 +416,9 @@ def configure(env): import subprocess import re - linker_version_str = subprocess.check_output([env.subst(env["LINK"]), "-Wl,--version"]).decode("utf-8") + linker_version_str = subprocess.check_output( + [env.subst(env["LINK"]), "-Wl,--version"] + env.subst(env["LINKFLAGS"]) + ).decode("utf-8") gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) if not gnu_ld_version: print( From 4f3c12c23d0748d604cb9e24e3576d83f875fbec Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Tue, 2 Aug 2022 09:11:05 +0200 Subject: [PATCH 5/8] UPNP: Don't delete mappings when adding mappings Don't delete previous mappings when adding a new mapping. This was a old workaround that seems to cause issues. (cherry picked from commit 2685cc7bb6708df745317fd2f078bc945555e4f8) --- modules/upnp/upnp.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index e0a9cb75af3..745876dc4a9 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -320,8 +320,6 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot return UPNP_RESULT_NO_GATEWAY; } - dev->delete_port_mapping(port, proto); - return dev->add_port_mapping(port, port_internal, desc, proto, duration); } From 6e953971801bf6dc76109bc7ca0878de1df9c55d Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Sun, 28 Aug 2022 14:38:54 +0200 Subject: [PATCH 6/8] Update UPnP documentation Adds more details, especially about caveats, failure modes and pitfalls (cherry picked from commit be41c097691acfd3f5559a28262730f086c46845) --- modules/upnp/doc_classes/UPNP.xml | 29 ++++++++++++++++--------- modules/upnp/doc_classes/UPNPDevice.xml | 4 ++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml index 552fbe3d295..60f6a1d6d09 100644 --- a/modules/upnp/doc_classes/UPNP.xml +++ b/modules/upnp/doc_classes/UPNP.xml @@ -1,16 +1,15 @@ - UPNP network functions. + Universal Plug and Play (UPnP) functions for network device discovery, querying and port forwarding. - Provides UPNP functionality to discover [UPNPDevice]s on the local network and execute commands on them, like managing port mappings (port forwarding) and querying the local and remote network IP address. Note that methods on this class are synchronous and block the calling thread. - To forward a specific port: + This class can be used to discover compatible [UPNPDevice]s on the local network and execute commands on them, like managing port mappings (for port forwarding/NAT traversal) and querying the local and remote network IP address. Note that methods on this class are synchronous and block the calling thread. + To forward a specific port (here [code]7777[/code], note both [method discover] and [method add_port_mapping] can return errors that should be checked): [codeblock] - const PORT = 7777 var upnp = UPNP.new() - upnp.discover(2000, 2, "InternetGatewayDevice") - upnp.add_port_mapping(port) + upnp.discover() + upnp.add_port_mapping(7777) [/codeblock] To close a specific port (e.g. after you have finished using it): [codeblock] @@ -21,7 +20,7 @@ # Emitted when UPnP port mapping setup is completed (regardless of success or failure). signal upnp_completed(error) - # Replace this with your own server port number between 1025 and 65535. + # Replace this with your own server port number between 1024 and 65535. const SERVER_PORT = 3928 var thread = null @@ -48,6 +47,14 @@ # Wait for thread finish here to handle game exit while the thread is running. thread.wait_to_finish() [/codeblock] + [b]Terminology:[/b] In the context of UPnP networking, "gateway" (or "internet gateway device", short IGD) refers to network devices that allow computers in the local network to access the internet ("wide area network", WAN). These gateways are often also called "routers". + [b]Pitfalls:[/b] + - As explained above, these calls are blocking and shouldn't be run on the main thread, especially as they can block for multiple seconds at a time. Use threading! + - Networking is physical and messy. Packets get lost in transit or get filtered, addresses, free ports and assigned mappings change, and devices may leave or join the network at any time. Be mindful of this, be diligent when checking and handling errors, and handle these gracefully if you can: add clear error UI, timeouts and re-try handling. + - Port mappings may change (and be removed) at any time, and the remote/external IP address of the gateway can change likewise. You should consider re-querying the external IP and try to update/refresh the port mapping periodically (for example, every 5 minutes and on networking failures). + - Not all devices support UPnP, and some users disable UPnP support. You need to handle this (e.g. documenting and requiring the user to manually forward ports, or adding alternative methods of NAT traversal, like a relay/mirror server, or NAT hole punching, STUN/TURN, etc.). + - Consider what happens on mapping conflicts. Maybe multiple users on the same network would like to play your game at the same time, or maybe another application uses the same port. Make the port configurable, and optimally choose a port automatically (re-trying with a different port on failure). + [b]Further reading:[/b] If you want to know more about UPnP (and the Internet Gateway Device (IGD) and Port Control Protocol (PCP) specifically), [url=https://en.wikipedia.org/wiki/Universal_Plug_and_Play]Wikipedia[/url] is a good first stop, the specification can be found at the [url=https://openconnectivity.org/developer/specifications/upnp-resources/upnp/]Open Connectivity Foundation[/url] and Godot's implementation is based on the [url=https://github.com/miniupnp/miniupnp]MiniUPnP client[/url]. @@ -67,9 +74,11 @@ - Adds a mapping to forward the external [code]port[/code] (between 1 and 65535) on the default gateway (see [method get_gateway]) to the [code]internal_port[/code] on the local machine for the given protocol [code]proto[/code] (either [code]TCP[/code] or [code]UDP[/code], with UDP being the default). If a port mapping for the given port and protocol combination already exists on that gateway device, this method tries to overwrite it. If that is not desired, you can retrieve the gateway manually with [method get_gateway] and call [method add_port_mapping] on it, if any. + Adds a mapping to forward the external [code]port[/code] (between 1 and 65535, although recommended to use port 1024 or above) on the default gateway (see [method get_gateway]) to the [code]internal_port[/code] on the local machine for the given protocol [code]proto[/code] (either [code]TCP[/code] or [code]UDP[/code], with UDP being the default). If a port mapping for the given port and protocol combination already exists on that gateway device, this method tries to overwrite it. If that is not desired, you can retrieve the gateway manually with [method get_gateway] and call [method add_port_mapping] on it, if any. Note that forwarding a well-known port (below 1024) with UPnP may fail depending on the device. + Depending on the gateway device, if a mapping for that port already exists, it will either be updated or it will refuse this command due to that conflict, especially if the existing mapping for that port wasn't created via UPnP or points to a different network address (or device) than this one. If [code]internal_port[/code] is [code]0[/code] (the default), the same port number is used for both the external and the internal port (the [code]port[/code] value). - The description ([code]desc[/code]) is shown in some router UIs and can be used to point out which application added the mapping. The mapping's lease duration can be limited by specifying a [code]duration[/code] (in seconds). However, some routers are incompatible with one or both of these, so use with caution and add fallback logic in case of errors to retry without them if in doubt. + The description ([code]desc[/code]) is shown in some routers management UIs and can be used to point out which application added the mapping. + The mapping's lease [code]duration[/code] can be limited by specifying a duration in seconds. The default of [code]0[/code] means no duration, i.e. a permanent lease and notably some devices only support these permanent leases. Note that whether permanent or not, this is only a request and the gateway may still decide at any point to remove the mapping (which usually happens on a reboot of the gateway, when its external IP address changes, or on some models when it detects a port mapping has become inactive, i.e. had no traffic for multiple minutes). If not [code]0[/code] (permanent), the allowed range according to spec is between [code]120[/code] (2 minutes) and [code]86400[/code] seconds (24 hours). See [enum UPNPResult] for possible return values. @@ -84,7 +93,7 @@ - Deletes the port mapping for the given port and protocol combination on the default gateway (see [method get_gateway]) if one exists. [code]port[/code] must be a valid port between 1 and 65535, [code]proto[/code] can be either [code]TCP[/code] or [code]UDP[/code]. See [enum UPNPResult] for possible return values. + Deletes the port mapping for the given port and protocol combination on the default gateway (see [method get_gateway]) if one exists. [code]port[/code] must be a valid port between 1 and 65535, [code]proto[/code] can be either [code]TCP[/code] or [code]UDP[/code]. May be refused for mappings pointing to addresses other than this one, for well-known ports (below 1024), or for mappings not added via UPnP. See [enum UPNPResult] for possible return values. diff --git a/modules/upnp/doc_classes/UPNPDevice.xml b/modules/upnp/doc_classes/UPNPDevice.xml index 1bf1d22a514..ab61613725c 100644 --- a/modules/upnp/doc_classes/UPNPDevice.xml +++ b/modules/upnp/doc_classes/UPNPDevice.xml @@ -1,10 +1,10 @@ - UPNP device. + Universal Plug and Play (UPnP) device. - UPNP device. See [UPNP] for UPNP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread. + Universal Plug and Play (UPnP) device. See [UPNP] for UPnP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread. From 77a4615031dc1c76acdeb073f656d8bcfa4534a9 Mon Sep 17 00:00:00 2001 From: Kongfa Waroros Date: Sat, 6 Feb 2021 20:32:21 +0700 Subject: [PATCH 7/8] Update all AnimationTree's editors when editing (cherry picked from commit 0f17fe642c8ec21b7877cd3f6911f22ba0874255) --- editor/plugins/animation_tree_editor_plugin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 891657720cc..9c706b45107 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -57,10 +57,11 @@ void AnimationTreeEditor::edit(AnimationTree *p_tree) { Vector path; if (tree && tree->has_meta("_tree_edit_path")) { path = tree->get_meta("_tree_edit_path"); - edit_path(path); } else { current_root = 0; } + + edit_path(path); } void AnimationTreeEditor::_path_button_pressed(int p_path) { @@ -127,6 +128,11 @@ void AnimationTreeEditor::edit_path(const Vector &p_path) { } else { current_root = 0; edited_path = button_path; + + for (int i = 0; i < editors.size(); i++) { + editors[i]->edit(Ref()); + editors[i]->hide(); + } } _update_path(); From f624acef429745b74989c38f646b627cacf19bd2 Mon Sep 17 00:00:00 2001 From: Atlinx Date: Mon, 29 Aug 2022 18:27:43 -0400 Subject: [PATCH 8/8] Add missing parameters for signal in docs (cherry picked from commit 0e3097c023fa4562d44fa102bd2ef8e456f8901a) --- doc/classes/EditorProperty.xml | 2 ++ editor/editor_inspector.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index 9c0c2555c87..4c65029df4b 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -90,6 +90,8 @@ + + Do not emit this manually, use the [method emit_changed] method instead. diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index c0257cbfcc4..9832db63268 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -758,7 +758,7 @@ void EditorProperty::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checked"), "set_checked", "is_checked"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_red"), "set_draw_red", "is_draw_red"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keying"), "set_keying", "is_keying"); - ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); + ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), PropertyInfo(Variant::STRING, "field"), PropertyInfo(Variant::BOOL, "changing"))); ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::POOL_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value"))); ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property"))); ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));