From dab0d129e98c83c5802219d2c68ffa9a7d62c0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 18 Nov 2024 15:23:18 +0100 Subject: [PATCH] Remove dead code of alwaysLoaded --- Core/GDCore/Project/ResourcesManager.cpp | 7 ------- Core/GDCore/Project/ResourcesManager.h | 3 +-- .../tests/tilemapcollisionmaskruntimeobject.spec.js | 3 --- GDJS/Runtime/types/project-data.d.ts | 1 - GDevelop.js/__tests__/Core.js | 7 ------- newIDE/app/src/fixtures/GDevelopServicesTestData/index.js | 5 ----- 6 files changed, 1 insertion(+), 25 deletions(-) diff --git a/Core/GDCore/Project/ResourcesManager.cpp b/Core/GDCore/Project/ResourcesManager.cpp index 3b8f7b04fd66..b26c1706abdd 100644 --- a/Core/GDCore/Project/ResourcesManager.cpp +++ b/Core/GDCore/Project/ResourcesManager.cpp @@ -173,9 +173,6 @@ std::map ImageResource::GetProperties() properties[_("Smooth the image")] .SetValue(smooth ? "true" : "false") .SetType("Boolean"); - properties[_("Always loaded in memory")] - .SetValue(alwaysLoaded ? "true" : "false") - .SetType("Boolean"); return properties; } @@ -184,8 +181,6 @@ bool ImageResource::UpdateProperty(const gd::String& name, const gd::String& value) { if (name == _("Smooth the image")) smooth = value == "1"; - else if (name == _("Always loaded in memory")) - alwaysLoaded = value == "1"; return true; } @@ -569,14 +564,12 @@ void ImageResource::SetFile(const gd::String& newFile) { } void ImageResource::UnserializeFrom(const SerializerElement& element) { - alwaysLoaded = element.GetBoolAttribute("alwaysLoaded"); smooth = element.GetBoolAttribute("smoothed"); SetUserAdded(element.GetBoolAttribute("userAdded")); SetFile(element.GetStringAttribute("file")); } void ImageResource::SerializeTo(SerializerElement& element) const { - element.SetAttribute("alwaysLoaded", alwaysLoaded); element.SetAttribute("smoothed", smooth); element.SetAttribute("userAdded", IsUserAdded()); element.SetAttribute("file", GetFile()); diff --git a/Core/GDCore/Project/ResourcesManager.h b/Core/GDCore/Project/ResourcesManager.h index bc6d98c1312c..1e61f056cfbe 100644 --- a/Core/GDCore/Project/ResourcesManager.h +++ b/Core/GDCore/Project/ResourcesManager.h @@ -166,7 +166,7 @@ class GD_CORE_API Resource { */ class GD_CORE_API ImageResource : public Resource { public: - ImageResource() : Resource(), smooth(true), alwaysLoaded(false) { + ImageResource() : Resource(), smooth(true) { SetKind("image"); }; virtual ~ImageResource(){}; @@ -210,7 +210,6 @@ class GD_CORE_API ImageResource : public Resource { void SetSmooth(bool enable = true) { smooth = enable; } bool smooth; ///< True if smoothing filter is applied - bool alwaysLoaded; ///< True if the image must always be loaded in memory. private: gd::String file; }; diff --git a/Extensions/TileMap/tests/tilemapcollisionmaskruntimeobject.spec.js b/Extensions/TileMap/tests/tilemapcollisionmaskruntimeobject.spec.js index 07240ffb693d..b4cf99dd1cc3 100644 --- a/Extensions/TileMap/tests/tilemapcollisionmaskruntimeobject.spec.js +++ b/Extensions/TileMap/tests/tilemapcollisionmaskruntimeobject.spec.js @@ -10,7 +10,6 @@ describe('gdjs.TileMapCollisionMaskRuntimeObject', function () { metadata: '', name: 'SmallTiledMap.json', userAdded: true, - alwaysLoaded: true, }, { file: 'base/tests-utils/simple-tiled-map/FlippingTiledMap.json', @@ -18,7 +17,6 @@ describe('gdjs.TileMapCollisionMaskRuntimeObject', function () { metadata: '', name: 'FlippingTiledMap.json', userAdded: true, - alwaysLoaded: true, }, { file: 'base/tests-utils/simple-tiled-map/MiniTiledSet.json', @@ -26,7 +24,6 @@ describe('gdjs.TileMapCollisionMaskRuntimeObject', function () { metadata: '', name: 'MiniTiledSet.json', userAdded: true, - alwaysLoaded: true, }, ], }, diff --git a/GDJS/Runtime/types/project-data.d.ts b/GDJS/Runtime/types/project-data.d.ts index c6b23d620230..74be575fed11 100644 --- a/GDJS/Runtime/types/project-data.d.ts +++ b/GDJS/Runtime/types/project-data.d.ts @@ -397,7 +397,6 @@ declare interface ResourcesData { } declare interface ResourceData { - alwaysLoaded?: boolean; file: string; kind: ResourceKind; metadata: string; diff --git a/GDevelop.js/__tests__/Core.js b/GDevelop.js/__tests__/Core.js index 6bafa605f0e1..97cb8e9979b4 100644 --- a/GDevelop.js/__tests__/Core.js +++ b/GDevelop.js/__tests__/Core.js @@ -1282,21 +1282,14 @@ describe('libGD.js', function () { const properties = resource.getProperties(); expect(properties.get('Smooth the image').getValue()).toBe('true'); - expect(properties.get('Always loaded in memory').getValue()).toBe( - 'false' - ); // Note: updateProperty expect the booleans in an usual "0" or "1" format. resource.updateProperty('Smooth the image', '0'); - resource.updateProperty('Always loaded in memory', '1'); const updatedProperties = resource.getProperties(); expect(updatedProperties.get('Smooth the image').getValue()).toBe( 'false' ); - expect(updatedProperties.get('Always loaded in memory').getValue()).toBe( - 'true' - ); resource.delete(); project.delete(); diff --git a/newIDE/app/src/fixtures/GDevelopServicesTestData/index.js b/newIDE/app/src/fixtures/GDevelopServicesTestData/index.js index de248216f819..010ed4a7185c 100644 --- a/newIDE/app/src/fixtures/GDevelopServicesTestData/index.js +++ b/newIDE/app/src/fixtures/GDevelopServicesTestData/index.js @@ -3254,7 +3254,6 @@ const spaceshipSerializedObject = { const spaceshipSerializedResources = [ { - alwaysLoaded: false, file: 'https://example.com/player-ship1.png', origin: { name: 'gdevelop-asset-store', @@ -3267,7 +3266,6 @@ const spaceshipSerializedResources = [ userAdded: false, }, { - alwaysLoaded: false, file: 'https://example.com/player-ship2.png', origin: { name: 'gdevelop-asset-store', @@ -3382,7 +3380,6 @@ export const fakeAssetWithCustomObject: Asset = { }, resources: [ { - alwaysLoaded: false, file: 'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Hovered.png', kind: 'image', @@ -3396,7 +3393,6 @@ export const fakeAssetWithCustomObject: Asset = { }, }, { - alwaysLoaded: false, file: 'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Idle.png', kind: 'image', @@ -3410,7 +3406,6 @@ export const fakeAssetWithCustomObject: Asset = { }, }, { - alwaysLoaded: false, file: 'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Pressed.png', kind: 'image',