-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(colors): mark avatar's equipped colors as selected (#327)
## [SRV-1555](https://ready-player-me.atlassian.net/browse/SRV-1555) ## Description - Fixes #325. - These changes ensure that equipped colors are now taken into account when loading an avatar, instead of defaulting to the first color. ## How to Test - Open the AvatarCreatorWizard scene. - Create a new avatar using the template. - In the editor, navigate to the skin, eyebrow, hair, or beard category. - Verify that the displayed color matches what the avatar is currently wearing. https://github.com/user-attachments/assets/0a8c7992-ed94-4ece-8b66-9cf7bbbf2962 [SRV-1555]: https://ready-player-me.atlassian.net/browse/SRV-1555?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Harrison Hough <[email protected]>
- Loading branch information
1 parent
6117328
commit ebfa6ed
Showing
4 changed files
with
78 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Samples~/AvatarCreatorSamples/AvatarCreatorWizard/Scripts/Utils/AssetTypeHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using ReadyPlayerMe.AvatarCreator; | ||
|
||
namespace ReadyPlayerMe.Samples.AvatarCreatorWizard | ||
{ | ||
public static class AssetTypeHelper | ||
{ | ||
public static IEnumerable<AssetType> GetAssetTypesByFilter(AssetFilter filter) | ||
{ | ||
return Enum.GetValues(typeof(AssetType)) | ||
.Cast<AssetType>() | ||
.Where(assetType => | ||
{ | ||
var fieldInfo = typeof(AssetType).GetField(assetType.ToString()); | ||
var attribute = fieldInfo?.GetCustomAttribute<AssetTypeFilterAttribute>(); | ||
return attribute?.filter == filter; | ||
}); | ||
} | ||
} | ||
} |