Skip to content

Commit

Permalink
[SDK-695] Add avatar creator poc sample (#182)
Browse files Browse the repository at this point in the history
## [SDK-695](https://ready-player-me.atlassian.net/browse/SDK-695)

## Description

- Add avatar creator POC sample using new elements
  • Loading branch information
rYuuk authored Dec 6, 2023
1 parent aeb1334 commit ce737b4
Show file tree
Hide file tree
Showing 25 changed files with 41,521 additions and 10 deletions.
18 changes: 10 additions & 8 deletions Runtime/AvatarCreator/UI/Elements/AssetSelectionElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,18 @@ public async Task LoadAssetData(OutfitGender gender)
/// Asynchronously loads the template data and creates button elements for each asset.
/// Buttons are created with icons fetched based on the asset's image URL and icon size.
/// </summary>
public async void LoadAndCreateButtons(OutfitGender gender)
public async Task LoadAndCreateButtons(OutfitGender gender)
{
await LoadAssetData(gender);
CreateButtons(assets.ToArray(), async (button, asset) =>
{
var webRequestDispatcher = new WebRequestDispatcher();
var url = iconSize > 0 ? $"{asset.ImageUrl}?w={iconSize}" : asset.ImageUrl;
var texture = await webRequestDispatcher.DownloadTexture(url);
button.SetIcon(texture);
});
CreateButtons(assets.ToArray(), OnButtonCreated);
}

private async void OnButtonCreated(ButtonElement button, PartnerAsset asset)
{
var webRequestDispatcher = new WebRequestDispatcher();
var url = iconSize > 0 ? $"{asset.ImageUrl}?w={iconSize}" : asset.ImageUrl;
var texture = await webRequestDispatcher.DownloadTexture(url);
button.SetIcon(texture);
}
}
}
3 changes: 3 additions & 0 deletions Samples~/AvatarCreatorPOC.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Samples~/AvatarCreatorPOC/Animation.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions Samples~/AvatarCreatorPOC/Animation/AnimationController.controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AnimationController
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 2944382419493117949}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1107 &2944382419493117949
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 4750699249463508156}
m_Position: {x: 302.5, y: 94, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 4750699249463508156}
--- !u!1102 &4750699249463508156
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pointing Forward
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 81bfdad495dec1848ae5e0145d9bfaca, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ce737b4

Please sign in to comment.