Skip to content

Commit

Permalink
Remove dead code regarding "alwaysLoaded" (#7175)
Browse files Browse the repository at this point in the history
Only show in developer changelog
  • Loading branch information
Bouh authored Nov 20, 2024
1 parent e6343df commit 90004e3
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 25 deletions.
7 changes: 0 additions & 7 deletions Core/GDCore/Project/ResourcesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ std::map<gd::String, gd::PropertyDescriptor> 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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions Core/GDCore/Project/ResourcesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(){};
Expand Down Expand Up @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,20 @@ describe('gdjs.TileMapCollisionMaskRuntimeObject', function () {
metadata: '',
name: 'SmallTiledMap.json',
userAdded: true,
alwaysLoaded: true,
},
{
file: 'base/tests-utils/simple-tiled-map/FlippingTiledMap.json',
kind: 'json',
metadata: '',
name: 'FlippingTiledMap.json',
userAdded: true,
alwaysLoaded: true,
},
{
file: 'base/tests-utils/simple-tiled-map/MiniTiledSet.json',
kind: 'json',
metadata: '',
name: 'MiniTiledSet.json',
userAdded: true,
alwaysLoaded: true,
},
],
},
Expand Down
1 change: 0 additions & 1 deletion GDJS/Runtime/types/project-data.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ declare interface ResourcesData {
}

declare interface ResourceData {
alwaysLoaded?: boolean;
file: string;
kind: ResourceKind;
metadata: string;
Expand Down
7 changes: 0 additions & 7 deletions GDevelop.js/__tests__/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions newIDE/app/src/fixtures/GDevelopServicesTestData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3249,7 +3249,6 @@ const spaceshipSerializedObject = {

const spaceshipSerializedResources = [
{
alwaysLoaded: false,
file: 'https://example.com/player-ship1.png',
origin: {
name: 'gdevelop-asset-store',
Expand All @@ -3262,7 +3261,6 @@ const spaceshipSerializedResources = [
userAdded: false,
},
{
alwaysLoaded: false,
file: 'https://example.com/player-ship2.png',
origin: {
name: 'gdevelop-asset-store',
Expand Down Expand Up @@ -3377,7 +3375,6 @@ export const fakeAssetWithCustomObject: Asset = {
},
resources: [
{
alwaysLoaded: false,
file:
'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Hovered.png',
kind: 'image',
Expand All @@ -3391,7 +3388,6 @@ export const fakeAssetWithCustomObject: Asset = {
},
},
{
alwaysLoaded: false,
file:
'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Idle.png',
kind: 'image',
Expand All @@ -3405,7 +3401,6 @@ export const fakeAssetWithCustomObject: Asset = {
},
},
{
alwaysLoaded: false,
file:
'https://resources.gdevelop-app.com/assets/Custom objects/object_YellowButton_Pressed.png',
kind: 'image',
Expand Down

0 comments on commit 90004e3

Please sign in to comment.