Skip to content

Commit ecae44c

Browse files
author
Patricio Guerra
authored
hotfix: wearables hiding themselves (#5508)
fix: wearables hiding themselves
1 parent c0a9916 commit ecae44c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/Tests/WearableItemShould.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,31 @@ public class WearableItemShould
88
{
99
private const string BODY_SHAPE = "male";
1010

11+
[Test]
12+
public void WearableCantHideItself()
13+
{
14+
var wearable = new WearableItem
15+
{
16+
data = new WearableItem.Data
17+
{
18+
category = WearableLiterals.Categories.UPPER_BODY,
19+
representations = new[]
20+
{
21+
new WearableItem.Representation
22+
{
23+
bodyShapes = new[] { BODY_SHAPE },
24+
overrideHides = new [] {WearableLiterals.Categories.UPPER_BODY }
25+
}
26+
},
27+
hides = new [] {WearableLiterals.Categories.UPPER_BODY }
28+
}
29+
};
30+
31+
string[] hides = wearable.GetHidesList(BODY_SHAPE);
32+
33+
Assert.IsTrue(!hides.Contains(WearableLiterals.Categories.UPPER_BODY), "Wearable does not contain its own category");
34+
}
35+
1136
[Test]
1237
public void GetHideCategoriesWhenIsSkin()
1338
{

unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/WearableItem.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ public string[] GetHidesList(string bodyShapeType)
247247
if (replaces != null)
248248
hides.UnionWith(replaces);
249249

250+
// Safeguard so no wearable can hide itself
251+
hides.Remove(data.category);
252+
250253
return hides.ToArray();
251254
}
252255

0 commit comments

Comments
 (0)