Skip to content

Commit

Permalink
feat: change shortcode to model url (#152)
Browse files Browse the repository at this point in the history
<!-- Copy the TICKETID for this task from Jira and add it to the PR name
in brackets -->
<!-- PR name should look like: [TICKETID] My Pull Request -->

<!-- Add link for the ticket here editing the TICKETID-->

## [SDK-472](https://ready-player-me.atlassian.net/browse/SDK-472)

## Description

-   Replace API URLs with model URLs for shortcodes

<!-- Fill the section below with Added, Updated and Removed information.
-->
<!-- If there is no item under one of the lists remove it's title. -->

<!-- Testability -->

## How to Test

-   Add steps to locally test these changes

<!-- Update your progress with the task here -->

## Checklist

-   [ ] Tests written or updated for the changes.
-   [ ] Documentation is updated.
-   [ ] Changelog is updated.

<!--- Remember to copy the Changes Section into the commit message when
you close the PR -->





[SDK-472]:
https://ready-player-me.atlassian.net/browse/SDK-472?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
rk132 authored Nov 14, 2023
2 parents cc802ef + 7ce134c commit 4b09422
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Runtime/Operations/UrlProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class UrlProcessor : IOperation<AvatarContext>
{
private const string TAG = nameof(UrlProcessor);

private const string SHORT_CODE_BASE_URL = "https://api.readyplayer.me/v1/avatars";
private const string SHORT_CODE_BASE_URL = "https://models.readyplayer.me";
private const string GLB_EXTENSION = ".glb";
private const string JSON_EXTENSION = ".json";
private const string URL_STRING_IS_NULL = "Url string is null";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ReadyPlayerMe.Samples
public class AvatarLoadingExample : MonoBehaviour
{
[SerializeField][Tooltip("Set this to the URL or shortcode of the Ready Player Me Avatar you want to load.")]
private string avatarUrl = "https://api.readyplayer.me/v1/avatars/638df693d72bffc6fa17943c.glb";
private string avatarUrl = "https://models.readyplayer.me/638df693d72bffc6fa17943c.glb";

private GameObject avatar;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4465782, g: 0.49641186, b: 0.5748162, a: 1}
m_IndirectSpecularColor: {r: 0.44657832, g: 0.49641258, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -1874,7 +1874,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5ec678a30bb724ed9999a22a9e41d8af, type: 3}
m_Name:
m_EditorClassIdentifier:
avatarUrl: https://api.readyplayer.me/v1/avatars/638df693d72bffc6fa17943c.glb
avatarUrl: https://models.readyplayer.me/638df693d72bffc6fa17943c.glb
--- !u!114 &2024074594
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.57481617, a: 1}
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -534,7 +534,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
lodExampleUI: {fileID: 217845738}
avatarUrl: https://api.readyplayer.me/v1/avatars/638df693d72bffc6fa17943c.glb
avatarUrl: https://models.readyplayer.me/638df693d72bffc6fa17943c.glb
lodConfigs:
- {fileID: 11400000, guid: 99552ccf737554f2fab58e864f9416e4, type: 2}
- {fileID: 11400000, guid: 1d2a8b01037e24f54b99b6aa9a51f0db, type: 2}
Expand Down Expand Up @@ -1655,7 +1655,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 6930787863501114648}
m_HandleRect: {fileID: 6930787863501114655}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class MultipleAvatarLoadingExample : MonoBehaviour
[SerializeField][Tooltip("Set this to the URL or shortcodes of the Ready Player Me Avatar you want to load.")]
private string[] avatarUrls =
{
"https://api.readyplayer.me/v1/avatars/638df5fc5a7d322604bb3a58.glb",
"https://api.readyplayer.me/v1/avatars/638df70ed72bffc6fa179596.glb",
"https://api.readyplayer.me/v1/avatars/638df75e5a7d322604bb3dcd.glb",
"https://api.readyplayer.me/v1/avatars/638df7d1d72bffc6fa179763.glb"
"https://models.readyplayer.me/638df5fc5a7d322604bb3a58.glb",
"https://models.readyplayer.me/638df70ed72bffc6fa179596.glb",
"https://models.readyplayer.me/638df75e5a7d322604bb3dcd.glb",
"https://models.readyplayer.me/638df7d1d72bffc6fa179763.glb"
};
private List<GameObject> avatarList;

Expand Down Expand Up @@ -69,7 +69,7 @@ private IEnumerator LoadAvatars(HashSet<string> urlSet)
yield return new WaitUntil(() => !loading);
}
}

/// This method is called after the avatar has been loadded and setup in the scene and is used to set the position of the <c>GameObject</c> in the scene.
private void OnAvatarLoaded(GameObject avatar)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4465782, g: 0.49641186, b: 0.5748162, a: 1}
m_IndirectSpecularColor: {r: 0.44657832, g: 0.49641258, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -207,7 +207,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2143326212}
m_HandleRect: {fileID: 2143326211}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -1815,10 +1815,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
avatarUrls:
- https://api.readyplayer.me/v1/avatars/638df5fc5a7d322604bb3a58.glb
- https://api.readyplayer.me/v1/avatars/638df70ed72bffc6fa179596.glb
- https://api.readyplayer.me/v1/avatars/638df75e5a7d322604bb3dcd.glb
- https://api.readyplayer.me/v1/avatars/638df7d1d72bffc6fa179763.glb
- https://models.readyplayer.me/638df5fc5a7d322604bb3a58.glb
- https://models.readyplayer.me/638df70ed72bffc6fa179596.glb
- https://models.readyplayer.me/638df75e5a7d322604bb3dcd.glb
- https://models.readyplayer.me/638df7d1d72bffc6fa179763.glb
--- !u!114 &2024074594
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MultipleQualityAvatarLoadingExample : MonoBehaviour
{

[SerializeField]
private string avatarUrl = "https://api.readyplayer.me/v1/avatars/638df75e5a7d322604bb3dcd.glb";
private string avatarUrl = "https://models.readyplayer.me/638df75e5a7d322604bb3dcd.glb";
[SerializeField]
private Transform qualityContainerPrefab;
[SerializeField]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4465782, g: 0.49641186, b: 0.5748162, a: 1}
m_IndirectSpecularColor: {r: 0.44657832, g: 0.49641258, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -1814,7 +1814,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 224f12c77efd85442b0ee207215e2259, type: 3}
m_Name:
m_EditorClassIdentifier:
avatarUrl: https://api.readyplayer.me/v1/avatars/638df75e5a7d322604bb3dcd.glb
avatarUrl: https://models.readyplayer.me/638df75e5a7d322604bb3dcd.glb
qualityContainerPrefab: {fileID: 1853687888834283808, guid: 7e49cdc951d802d4d9bfdf45578ca7f8,
type: 3}
avatarConfigs:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Editor/AvatarAPITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ReadyPlayerMe.Core.Tests
{
public class AvatarAPITests
{
private const string AVATAR_API_AVATAR_URL = "https://api.readyplayer.me/v1/avatars/638df693d72bffc6fa17943c.glb";
private const string AVATAR_API_AVATAR_URL = "https://models.readyplayer.me/638df693d72bffc6fa17943c.glb";
private const int TEXTURE_SIZE_LOW = 256;
private const int TEXTURE_SIZE_MED = 512;
private const int TEXTURE_SIZE_HIGH = 1024;
Expand Down
14 changes: 7 additions & 7 deletions Tests/Editor/AvatarUriProcessTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ namespace ReadyPlayerMe.Core.Tests
public class AvatarUriProcessTests
{
private const string GUID = "633af24a573a46702919320f";
private const string GUID_URL = "https://api.readyplayer.me/v1/avatars/633af24a573a46702919320f.glb";
private const string GUID_URL = "https://models.readyplayer.me/633af24a573a46702919320f.glb";

private const string SHORT_CODE = "DDBWOI";
private const string SHORT_CODE_URL = "https://api.readyplayer.me/v1/avatars/DDBWOI.glb";
private const string SHORT_CODE_URL = "https://models.readyplayer.me/DDBWOI.glb";

private const string RANDOM_PARAM_HASH = "123456789";

private const string RANDOM_PARAM_HASH = "123456789";
private readonly AvatarUri expectedShortcodeUri = new AvatarUri
{
Guid = SHORT_CODE,
ModelUrl = $"{TestUtils.API_URL_PREFIX}{SHORT_CODE}{TestUtils.GLB_SUFFIX}",
ModelUrl = $"{TestUtils.MODELS_URL_PREFIX}{SHORT_CODE}{TestUtils.GLB_SUFFIX}",
LocalModelPath = $"{DirectoryUtility.GetAvatarSaveDirectory(SHORT_CODE, RANDOM_PARAM_HASH)}/{SHORT_CODE}{TestUtils.GLB_SUFFIX}",
MetadataUrl = $"{TestUtils.API_URL_PREFIX}{SHORT_CODE}{TestUtils.JSON_SUFFIX}",
MetadataUrl = $"{TestUtils.MODELS_URL_PREFIX}{SHORT_CODE}{TestUtils.JSON_SUFFIX}",
LocalMetadataPath = $"{DirectoryUtility.GetAvatarSaveDirectory(SHORT_CODE)}{SHORT_CODE}{TestUtils.JSON_SUFFIX}"
};

private readonly AvatarUri expectedUri = new AvatarUri
{
Guid = GUID,
ModelUrl = $"{TestUtils.API_URL_PREFIX}{GUID}{TestUtils.GLB_SUFFIX}",
ModelUrl = $"{TestUtils.MODELS_URL_PREFIX}{GUID}{TestUtils.GLB_SUFFIX}",
LocalModelPath = $"{DirectoryUtility.GetAvatarSaveDirectory(GUID, RANDOM_PARAM_HASH)}/{GUID}{TestUtils.GLB_SUFFIX}",
MetadataUrl = $"{TestUtils.API_URL_PREFIX}{GUID}{TestUtils.JSON_SUFFIX}",
MetadataUrl = $"{TestUtils.MODELS_URL_PREFIX}{GUID}{TestUtils.JSON_SUFFIX}",
LocalMetadataPath = $"{DirectoryUtility.GetAvatarSaveDirectory(GUID)}{GUID}{TestUtils.JSON_SUFFIX}"
};

Expand Down

0 comments on commit 4b09422

Please sign in to comment.