From b3e8821966d8250cc324ea7f11edf63131a27aaa Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 5 Oct 2023 20:51:50 +0200 Subject: [PATCH] [godot] Fix const assignments in SpineAtlasResource::copy_from() --- spine-godot/spine_godot/SpineAtlasResource.cpp | 3 +-- spine-godot/spine_godot/SpineAtlasResource.h | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spine-godot/spine_godot/SpineAtlasResource.cpp b/spine-godot/spine_godot/SpineAtlasResource.cpp index 3dc42fd90..e588ac7af 100644 --- a/spine-godot/spine_godot/SpineAtlasResource.cpp +++ b/spine-godot/spine_godot/SpineAtlasResource.cpp @@ -239,9 +239,8 @@ Error SpineAtlasResource::copy_from(const Ref &p_resource) { const Ref &spineAtlas = static_cast &>(p_resource); this->clear(); this->atlas = spineAtlas->atlas; - spineAtlas->atlas = nullptr; this->texture_loader = spineAtlas->texture_loader; - spineAtlas->texture_loader = nullptr; + spineAtlas->clear_native_data(); this->source_path = spineAtlas->source_path; this->atlas_data = spineAtlas->atlas_data; diff --git a/spine-godot/spine_godot/SpineAtlasResource.h b/spine-godot/spine_godot/SpineAtlasResource.h index be504ae2a..5105d9606 100644 --- a/spine-godot/spine_godot/SpineAtlasResource.h +++ b/spine-godot/spine_godot/SpineAtlasResource.h @@ -76,6 +76,11 @@ public: Array get_textures(); Array get_normal_maps(); + + void clear_native_data() { + this->atlas = nullptr; + this->texture_loader = nullptr; + } }; class SpineAtlasResourceFormatLoader : public ResourceFormatLoader {