From a64f5f34293d3fa9bdf865c565d10e0a5199fa8a Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:16:17 +0300 Subject: [PATCH] Make ExtensionsAPI version 5 backwards compatible with version 4 This means that extensions that use version 4 can work in version 5, but not necessarily vice versa. Therefore we don't need to show a warning message when loading version 4 extensions. TODO: Find a better way to determine which API versions have backwards compatibility with each other. --- src/HandleExtensions.gd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/HandleExtensions.gd b/src/HandleExtensions.gd index 4e115f751..a0857ba31 100644 --- a/src/HandleExtensions.gd +++ b/src/HandleExtensions.gd @@ -159,6 +159,12 @@ func _load_extension(extension_file_or_folder_name: StringName, internal := fals var supported_api_versions = extension_json["supported_api_versions"] if typeof(supported_api_versions) == TYPE_ARRAY: supported_api_versions = PackedInt32Array(supported_api_versions) + # Extensions that support API version 4 are backwards compatible with version 5. + # Version 5 only adds new methods and does not break compatibility. + # TODO: Find a better way to determine which API versions + # have backwards compatibility with each other. + if 4 in supported_api_versions and not 5 in supported_api_versions: + supported_api_versions.append(5) if not ExtensionsApi.get_api_version() in supported_api_versions: var err_text := ( "The extension %s will not work on this version of Pixelorama \n"