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

feat: add forceRenderer property #5259

Merged
merged 12 commits into from
May 31, 2023
Merged

Conversation

Julieta11
Copy link
Contributor

@Julieta11 Julieta11 commented May 30, 2023

Fixes #5221

New property for profiles as discussed in ADR: decentraland/adr#239

@Julieta11
Copy link
Contributor Author

We have some places where we generate random profiles such as in browser-interface/packages/lib/decentraland/profiles/generateRandomUserProfile.ts. Should I add the forceRender property in these cases? Or should I leave as it is as the property has been defined as optional? @agusaldasoro @davidejensen

@davidejensen
Copy link
Member

@Julieta11 I think you can leave it as it is

@lorux0 lorux0 changed the base branch from feat/backpack-v2-polishment to dev May 31, 2023 18:53
@lorux0 lorux0 force-pushed the feat/backpack-force-renderer branch from 4b9d01a to 2862ae2 Compare May 31, 2023 19:12
@davidejensen davidejensen self-assigned this May 31, 2023
Copy link
Collaborator

@lorux0 lorux0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, approving anyways. Good job!

}

public override BaseModel GetDataFromJSON(string json) =>
Utils.SafeFromJson<AvatarModel>(json);


public AvatarModelDTO ToAvatarModelDto()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency should be inverted. The DTO should be in an outter layer from the model class. The model class should not depend on DTOs. So instead you should do:

AvatarModelDTO AvatarModelDTO.FromModel(avatarModel);
AvatarModel model = avatarModelDto.ToAvatarModel();

You can postpone this change tho, but please add the TODO comment

var payload = new SaveAvatarPayload()
{
avatar = avatar,
avatar = avatar.ToAvatarModelDto(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could replace the parameter to AvatarModelDTO instead of doing an implicit conversion

Copy link
Contributor

@sandrade-dcl sandrade-dcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but, please, before merging take a look to all the uses of forceRender value since I can see it could be null and it could provoke some unexpected errors like NullRefs.

@@ -221,7 +221,7 @@ async UniTaskVoid LoadUserProfileAsync(UserProfile userProfile, CancellationToke
model.skinColor = userProfile.avatar.skinColor;
model.hairColor = userProfile.avatar.hairColor;
model.eyesColor = userProfile.avatar.eyeColor;

model.forceRender = new HashSet<string>(userProfile.avatar.forceRender);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set a null value into the HashSet in case forceRender is null? maybe in that case we should asign an empty HashSet, right?

}

avatarSlotsHUDController.Recalculate(model.forceRender);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure nothing happens if we pass in a null value to the Recalculate() method.

@davidejensen davidejensen added the No QA Needed Issues which do not require QA testing label May 31, 2023
@davidejensen davidejensen marked this pull request as ready for review May 31, 2023 19:55
@davidejensen davidejensen merged commit ba1a149 into dev May 31, 2023
@davidejensen davidejensen deleted the feat/backpack-force-renderer branch May 31, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No QA Needed Issues which do not require QA testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Avatar Assembly overrides] Profile format changes
5 participants