Skip to content

Commit

Permalink
[SDK-607] Add selfie element (#166)
Browse files Browse the repository at this point in the history
## [SDK-607](https://ready-player-me.atlassian.net/browse/SDK-607)

## Description

- Added selfie element
- Clean up elements prefab and scripts
  • Loading branch information
rYuuk authored Nov 29, 2023
1 parent c986eac commit 7c47e45
Show file tree
Hide file tree
Showing 19 changed files with 751 additions and 1,335 deletions.
18 changes: 7 additions & 11 deletions Runtime/AvatarCreator/AvatarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace ReadyPlayerMe.AvatarCreator
public class AvatarManager : IDisposable
{
private const string TAG = nameof(AvatarManager);
private readonly BodyType bodyType;
private readonly AvatarAPIRequests avatarAPIRequests;
private readonly string avatarConfigParameters;
private readonly InCreatorAvatarLoader inCreatorAvatarLoader;
Expand All @@ -24,13 +23,10 @@ public class AvatarManager : IDisposable
public string AvatarId => avatarId;
private string avatarId;

/// <param name="bodyType">Body type of avatar</param>
/// <param name="avatarConfig">Config for downloading preview avatar</param>
/// <param name="token">Cancellation token</param>
public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, CancellationToken token = default)
public AvatarManager(AvatarConfig avatarConfig = null, CancellationToken token = default)
{
this.bodyType = bodyType;

if (avatarConfig != null)
{
avatarConfigParameters = AvatarConfigProcessor.ProcessAvatarConfiguration(avatarConfig);
Expand All @@ -46,7 +42,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel
/// </summary>
/// <param name="avatarProperties">Properties which describes avatar</param>
/// <returns>Avatar gameObject</returns>
public async Task<(GameObject, AvatarProperties)> CreateAvatar(AvatarProperties avatarProperties)
public async Task<(GameObject avatarGameObject, AvatarProperties avatarProperties)> CreateAvatar(AvatarProperties avatarProperties)
{
GameObject avatar = null;
try
Expand All @@ -59,7 +55,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel
}

avatarId = avatarProperties.Id;
avatar = await GetAvatar(avatarId, true);
avatar = await GetAvatar(avatarId, avatarProperties.BodyType, true);
}
catch (Exception e)
{
Expand All @@ -75,7 +71,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel
/// </summary>
/// <param name="id">Template id</param>
/// <returns>Avatar gameObject</returns>
public async Task<(GameObject, AvatarProperties)> CreateAvatarFromTemplate(string id)
public async Task<(GameObject, AvatarProperties)> CreateAvatarFromTemplate(string id, BodyType bodyType)
{
GameObject avatar = null;
var avatarProperties = new AvatarProperties();
Expand All @@ -93,7 +89,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel
}

avatarId = avatarProperties.Id;
avatar = await GetAvatar(avatarId, true);
avatar = await GetAvatar(avatarId, bodyType, true);
}
catch (Exception e)
{
Expand Down Expand Up @@ -138,7 +134,7 @@ public async void PrecompileAvatar(string id, PrecompileData precompileData)
/// <param name="id">Avatar id</param>
/// <param name="isPreview">Whether its a preview avatar</param>
/// <returns>Avatar gameObject</returns>
public async Task<GameObject> GetAvatar(string id, bool isPreview = false)
public async Task<GameObject> GetAvatar(string id, BodyType bodyType, bool isPreview = false)
{
avatarId = id;
byte[] data;
Expand Down Expand Up @@ -166,7 +162,7 @@ public async Task<GameObject> GetAvatar(string id, bool isPreview = false)
/// <param name="assetId"></param>
/// <param name="category"></param>
/// <returns>Avatar gameObject</returns>
public async Task<GameObject> UpdateAsset(Category category, object assetId)
public async Task<GameObject> UpdateAsset(Category category,BodyType bodyType, object assetId)
{
var payload = new AvatarProperties
{
Expand Down
8 changes: 0 additions & 8 deletions Runtime/AvatarCreator/Elements.meta

This file was deleted.

24 changes: 0 additions & 24 deletions Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs

This file was deleted.

78 changes: 0 additions & 78 deletions Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs

This file was deleted.

Loading

0 comments on commit 7c47e45

Please sign in to comment.