1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Compare commits

..

1 commit

Author SHA1 Message Date
Piotr Kostrzewski abeca19d69
Merge 5bfe44a202 into 6afdb372b3 2025-01-04 09:59:31 +08:00
2 changed files with 5 additions and 12 deletions

View file

@ -13,8 +13,6 @@ const BIN_ACTION := "trash"
var extensions := {} ## Extension name: Extension class
var extension_selected := -1
var damaged_extension: String
## Extensions built using the versions in this array are considered compatible with the current Api
var legacy_api_versions = [5, 4]
class Extension:
@ -159,17 +157,14 @@ func _load_extension(extension_file_or_folder_name: StringName, internal := fals
if extension_json.has("supported_api_versions"):
var supported_api_versions = extension_json["supported_api_versions"]
var current_api_version = ExtensionsApi.get_api_version()
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 not current_api_version in supported_api_versions:
for legacy_version: int in legacy_api_versions:
if legacy_version in supported_api_versions:
supported_api_versions.append(current_api_version)
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"
@ -178,7 +173,7 @@ func _load_extension(extension_file_or_folder_name: StringName, internal := fals
var required_text := str(
"Extension works on API versions: %s" % str(supported_api_versions),
"\n",
"But Pixelorama's API version is: %s" % current_api_version
"But Pixelorama's API version is: %s" % ExtensionsApi.get_api_version()
)
Global.popup_error(str(err_text, required_text))
print("Incompatible API")

View file

@ -141,8 +141,6 @@ func add_animation(indices: Array, destination: int, from_tag: AnimationTag = nu
l = GroupLayer.new(project)
Global.LayerTypes.THREE_D:
l = Layer3D.new(project)
if l == null: # Ignore copying this layer if it isn't supported
continue
var cels := []
for f in project.frames:
cels.append(l.new_empty_cel())
@ -187,8 +185,8 @@ func add_animation(indices: Array, destination: int, from_tag: AnimationTag = nu
# add more types here if they have a copy_content() method
if src_cel is PixelCel:
var src_img: ImageExtended = src_cel.copy_content()
var copy: ImageExtended = new_cel.create_empty_content()
var src_img = src_cel.copy_content()
var copy := project.new_empty_image()
copy.blit_rect(
src_img, Rect2(Vector2.ZERO, src_img.get_size()), Vector2.ZERO
)