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

[SDK-607] Add selfie element #166

Merged
merged 9 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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