Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code of alwaysLoaded #7175

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Bouh marked this conversation as resolved.
Show resolved Hide resolved
},
{
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;
Bouh marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -3254,7 +3254,6 @@ const spaceshipSerializedObject = {

const spaceshipSerializedResources = [
{
alwaysLoaded: false,
file: 'https://example.com/player-ship1.png',
origin: {
name: 'gdevelop-asset-store',
Expand All @@ -3267,7 +3266,6 @@ const spaceshipSerializedResources = [
userAdded: false,
},
{
alwaysLoaded: false,
file: 'https://example.com/player-ship2.png',
origin: {
name: 'gdevelop-asset-store',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
Loading