Skip to content

Commit

Permalink
replicate wearable-preview and EA
Browse files Browse the repository at this point in the history
  • Loading branch information
leanmendoza committed Sep 27, 2024
1 parent 1f588a9 commit 692780d
Show file tree
Hide file tree
Showing 3 changed files with 274 additions and 26 deletions.
31 changes: 15 additions & 16 deletions godot/src/decentraland_components/avatar/wearables/wearables.gd
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@ static func can_equip(wearable: DclItemEntityDefinition, body_shape_id: String)
static func compose_hidden_categories(
body_shape_id: String, force_render: PackedStringArray, wearables_by_category: Dictionary
) -> Array:
var result: Array = []
var previously_hidden: Dictionary = {}
var hidden: Array = []

for priority_category in Categories.HIDING_PRIORITY:
previously_hidden[priority_category] = []
if hidden.has(priority_category):
continue

var wearable: DclItemEntityDefinition = wearables_by_category.get(priority_category)
if wearable == null:
Expand All @@ -471,19 +471,13 @@ static func compose_hidden_categories(
continue

for category_to_hide in current_hides_list:
var hidden_categories = previously_hidden.get(category_to_hide)
if hidden_categories != null and hidden_categories.has(priority_category):
continue

previously_hidden[priority_category].push_back(category_to_hide)

if force_render.has(category_to_hide):
continue
if not hidden.has(category_to_hide):
hidden.push_back(category_to_hide)

if not result.has(category_to_hide):
result.push_back(category_to_hide)
for category in force_render:
hidden.erase(category)

return result
return hidden


static func get_wearable_facial_hashes(
Expand Down Expand Up @@ -562,12 +556,17 @@ static func get_curated_wearable_list(
else:
printerr("invalid wearable ", wearable_id)

ret.hidden_categories = compose_hidden_categories(
var unused_wearables = compose_hidden_categories(
body_shape_id, force_render, ret.wearables_by_category
)
for hide_category in ret.hidden_categories:
for hide_category in unused_wearables:
if ret.wearables_by_category.has(hide_category):
ret.wearables_by_category.erase(hide_category)

ret.hidden_categories = compose_hidden_categories(
body_shape_id, force_render, ret.wearables_by_category
)

ret.need_to_fetch = set_fallback_for_missing_needed_categories(
body_shape_id, ret.wearables_by_category, ret.hidden_categories
)
Expand Down
260 changes: 250 additions & 10 deletions godot/src/test/avatar/avatar_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@
"urn:decentraland:off-chain:base-avatars:keanu_hair",
"urn:decentraland:off-chain:base-avatars:granpa_beard"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "ForceRender and Skin",
Expand Down Expand Up @@ -55,7 +79,31 @@
"urn:decentraland:matic:collections-v2:0x0dc28547b88100eb6b3f3890f0501607aa5dd6be:0:3202",
"urn:decentraland:matic:collections-v2:0xbf83965191065487db0644812649d5238435c723:1:105312291668557186697918027683670432318895095400549111254310978934"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "Test A",
Expand All @@ -71,7 +119,31 @@
"urn:decentraland:ethereum:collections-v1:cybermike_cybersoldier_set:cybersoldier_leggings_lower_body:34",
"urn:decentraland:ethereum:collections-v1:cybermike_cybersoldier_set:cybersoldier_torso_upper_body:35"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "Test B",
Expand All @@ -90,7 +162,31 @@
"urn:decentraland:ethereum:collections-v1:halloween_2020:hwn_2020_ghostblaster_tiara:3855",
"urn:decentraland:matic:collections-v2:0xded1e53d7a43ac1844b66c0ca0f02627eb42e16d:3:315936875005671560093754083051011296956685286201647333762932932647"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "Female",
Expand All @@ -103,7 +199,31 @@
"urn:decentraland:off-chain:base-avatars:black_sun_glasses",
"urn:decentraland:off-chain:base-avatars:f_mouth_05"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "MarianoPlayground - pants not present",
Expand Down Expand Up @@ -149,7 +269,31 @@
"urn:decentraland:matic:collections-v2:0x2113853d20f7b6d08fa756c294fb6f36e9108b22:0:26",
"urn:decentraland:matic:collections-v2:0x2929bbb4f18b40ac52a7f0b91629c695e3f96504:2:210624583337114373395836055367340864637790190801098222508621955096"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "MarianoPlayground - pants not present v3",
Expand All @@ -164,7 +308,31 @@
"urn:decentraland:matic:collections-v2:0xbf83965191065487db0644812649d5238435c723:4:421249166674228746791672110734681729275580381602196445017243911444",
"urn:decentraland:matic:collections-v2:0xbf83965191065487db0644812649d5238435c723:7:737186041679900306885426193785693026232265667803843778780176844143"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "MarianoPlayground - feet not present",
Expand All @@ -177,7 +345,31 @@
"urn:decentraland:off-chain:base-avatars:f_eyes_08",
"urn:decentraland:off-chain:base-avatars:blue_star_earring"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "MarianoPlayground - green shadow not present",
Expand All @@ -200,7 +392,31 @@
"urn:decentraland:matic:collections-v2:0x07d03ca2c27f29ec3c4cf3afad857c5af13f61cd:7:737186041679900306885426193785693026232265667803843778780176842874",
"urn:decentraland:matic:collections-v2:0xc65c3e0dd85d993678e02a1407be7d804fae4667:2:210624583337114373395836055367340864637790190801098222508621955084"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "With lower body not hidden",
Expand All @@ -217,7 +433,31 @@
"urn:decentraland:matic:collections-v2:0x3ec01a62bbbad1b49a8a51b86d4d7eeffa0775c0:1:105312291668557186697918027683670432318895095400549111254310977684",
"urn:decentraland:matic:collections-v2:0x3338d5294e0312dd39f77a725a65e1ab8f009fd0:0:328"
],
"forceRender": []
"forceRender": [],
"eyes": {
"color": {
"r": 0.22265625,
"g": 0.484375,
"b": 0.69140625,
"a": 1
}
},
"hair": {
"color": {
"r": 0.12156863510608673,
"g": 0.08627451211214066,
"b": 0.07058823853731155,
"a": 1
}
},
"skin": {
"color": {
"r": 0.32156863808631897,
"g": 0.17254900932312012,
"b": 0.10980391502380371,
"a": 1
}
}
},
{
"ref": "mati test A 2024-09-26",
Expand Down
Loading

0 comments on commit 692780d

Please sign in to comment.