diff --git a/Assets/TestScenes/PolyToolkitCmd/PolyToolkitCmd.cs b/Assets/TestScenes/PolyToolkitCmd/PolyToolkitCmd.cs index 8308726..77f86a4 100644 --- a/Assets/TestScenes/PolyToolkitCmd/PolyToolkitCmd.cs +++ b/Assets/TestScenes/PolyToolkitCmd/PolyToolkitCmd.cs @@ -543,7 +543,7 @@ private void CmdShow(string[] args) { for (int i = 0; i < currentResults.Count; i++) { PolyAsset asset = currentResults[i]; PrintLn("[{0}]: {1}\n ID: {2}\n Author: {3}\n Formats: {4}\n", - i, asset.displayName, asset.name, asset.authorName, + i, asset.displayName, asset.assetId, asset.authorName, FormatListToString(asset.formats)); } } @@ -576,10 +576,10 @@ private void CmdImp(string[] args) { PrintLn("Importing asset... May take a while. Please wait!"); PolyApi.Import(assetToImport, options, (PolyAsset asset, PolyStatusOr result) => { if (!result.Ok) { - PrintLn("ERROR: failed to import {0}: {1}", asset.name, result.Status); + PrintLn("ERROR: failed to import {0}: {1}", asset.assetId, result.Status); return; } - PrintLn("Successfully imported asset '{0}' ({1})", asset.name, asset.displayName); + PrintLn("Successfully imported asset '{0}' ({1})", asset.assetId, asset.displayName); if (currentAsset != null) { Destroy(currentAsset); @@ -611,13 +611,13 @@ private void CmdThumb(string[] args) { PrintLn("Fetching thumbnail... Please wait."); PolyApi.FetchThumbnail(assetToUse, (PolyAsset asset, PolyStatus status) => { if (status.ok) { - PrintLn("Successfully fetched thumbnail for asset '{0}'", asset.name); + PrintLn("Successfully fetched thumbnail for asset '{0}'", asset.assetId); imageDisplay.sprite = Sprite.Create(asset.thumbnailTexture, new Rect(0, 0, asset.thumbnailTexture.width, asset.thumbnailTexture.height), Vector2.zero); imageDisplay.gameObject.SetActive(true); } else { - PrintLn("*** Error loading thumbnail for asset '{0}': {1}", asset.name, status); + PrintLn("*** Error loading thumbnail for asset '{0}': {1}", asset.assetId, status); } }); } diff --git a/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserManager.cs b/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserManager.cs index 14d8de2..7bd9414 100644 --- a/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserManager.cs +++ b/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserManager.cs @@ -385,7 +385,7 @@ private void OnRequestForSpecificAssetResult(PolyStatusOr result) { PtDebug.Log("ABM: get asset request received result."); assetResult = result.Value; - if (!thumbnailCache.TryGet(assetResult.name, out assetResult.thumbnailTexture)) { + if (!thumbnailCache.TryGet(assetResult.assetId, out assetResult.thumbnailTexture)) { FetchThumbnail(assetResult); } } else { @@ -402,7 +402,7 @@ private void FinishFetchingThumbnails(PolyStatusOr result) if (result.Ok) { List assetsMissingThumbnails = new List(); foreach (PolyAsset asset in listAssetsResult.Value.assets) { - if (!thumbnailCache.TryGet(asset.name, out asset.thumbnailTexture)) { + if (!thumbnailCache.TryGet(asset.assetId, out asset.thumbnailTexture)) { assetsMissingThumbnails.Add(asset); } } @@ -423,7 +423,7 @@ private void FetchThumbnail(PolyAsset asset) { /// private void OnThumbnailFetched(PolyAsset asset, PolyStatus status) { if (status.ok) { - thumbnailCache.Put(asset.name, asset.thumbnailTexture); + thumbnailCache.Put(asset.assetId, asset.thumbnailTexture); // Preserve the texture so it survives round-trips to play mode and back. asset.thumbnailTexture.hideFlags = HideFlags.HideAndDontSave; } @@ -439,7 +439,7 @@ private HashSet GetAssetsInUse() { HashSet assetsInUse = new HashSet(); if (listAssetsResult == null || !listAssetsResult.Ok) return assetsInUse; foreach (var asset in listAssetsResult.Value.assets) { - assetsInUse.Add(asset.name); + assetsInUse.Add(asset.assetId); } return assetsInUse; } @@ -453,7 +453,7 @@ private HashSet GetAssetsInUse() { /// Import options. public void StartDownloadAndImport(PolyAsset asset, string ptAssetLocalPath, EditTimeImportOptions options) { if (!assetsBeingDownloaded.Add(asset)) return; - PtDebug.LogFormat("ABM: starting to fetch asset {0} ({1}) -> {2}", asset.name, asset.displayName, + PtDebug.LogFormat("ABM: starting to fetch asset {0} ({1}) -> {2}", asset.assetId, asset.displayName, ptAssetLocalPath); // Prefer glTF1 to glTF2. @@ -498,7 +498,7 @@ public void ClearCaches() { private void OnFetchFinished(PolyStatus status, PolyAsset asset, bool isGltf2, string ptAssetLocalPath, EditTimeImportOptions options) { if (!status.ok) { - Debug.LogErrorFormat("Error fetching asset {0} ({1}): {2}", asset.name, asset.displayName, status); + Debug.LogErrorFormat("Error fetching asset {0} ({1}): {2}", asset.assetId, asset.displayName, status); EditorUtility.DisplayDialog("Download Error", string.Format("*** Error downloading asset '{0}'. Try again later.", asset.displayName), "OK"); PtAnalytics.SendEvent(PtAnalytics.Action.IMPORT_FAILED, "Asset fetch failed"); diff --git a/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserWindow.cs b/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserWindow.cs index bdb360f..07a2243 100644 --- a/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserWindow.cs +++ b/Packages/icosa-api-client-unity/Editor/AssetBrowser/AssetBrowserWindow.cs @@ -38,7 +38,7 @@ public class AssetBrowserWindow : EditorWindow { /// /// URL of the user's profile page. /// - private const string USER_PROFILE_URL = "https://poly.google.com/user"; + private const string USER_PROFILE_URL = "https://icosa.gallery/user"; /// /// Width and height of each asset thumbnail image in the grid. @@ -106,7 +106,7 @@ public class AssetBrowserWindow : EditorWindow { /// Texture to use for the title bar. /// private const string TITLE_TEX = "Editor/Textures/PolyToolkitTitle.png"; - + /// /// Texture to use for the back button (back arrow) if the skin is Unity pro. /// @@ -116,12 +116,12 @@ public class AssetBrowserWindow : EditorWindow { /// Texture to use for the back button (back arrow) if the skin is Unity personal. /// private const string BACK_ARROW_DARK_TEX = "Editor/Textures/BackArrowDark.png"; - + /// /// Texture to use for the back button bar background if the skin is Unity pro. /// private const string DARK_GREY_TEX = "Editor/Textures/DarkGrey.png"; - + /// /// Texture to use for the back button bar background if the skin is Unity personal. /// @@ -202,12 +202,12 @@ private enum UiMode { /// The texture to use in place of a thumbnail when loading the thumbnail. /// private Texture2D loadingTex = null; - + /// /// The texture to use for the back button (back arrow). /// private Texture2D backArrowTex = null; - + /// /// Texture used for back button bar background. /// @@ -297,7 +297,7 @@ public static void BrowsePolyAssets2() { /// /// The ID of the asset that was just imported. public void HandleAssetImported(string assetId) { - if (selectedAsset != null && assetId == selectedAsset.name) { + if (selectedAsset != null && assetId == selectedAsset.assetId) { justImported = true; } } @@ -417,8 +417,8 @@ private bool DrawHeader(out int topMargin) { /// private void DrawTitleBar(bool withSignInUi) { GUI.DrawTexture(new Rect(0, 0, position.width, TITLE_BAR_HEIGHT), Texture2D.whiteTexture); - - GUIStyle titleStyle = new GUIStyle (GUI.skin.label); + + GUIStyle titleStyle = new GUIStyle (GUI.skin.label); titleStyle.margin = new RectOffset(TITLE_IMAGE_PADDING, TITLE_IMAGE_PADDING, TITLE_IMAGE_PADDING, TITLE_IMAGE_PADDING); if (GUILayout.Button(titleTex, titleStyle, @@ -505,7 +505,7 @@ private void DrawBrowseUi() { menu.ShowAsContext(); } guiHelper.EndHorizontal(); - + // Draw the "Asset type" toggles. bool showAssetTypeFilter = (CATEGORIES[selectedCategory].key != KEY_YOUR_LIKES); @@ -578,7 +578,7 @@ private void DrawSearchUi() { if (searchClicked && searchTerms.Trim().Length > 0) { // Note: for privacy reasons we don't log the search terms, just the fact that a search was made. PtAnalytics.SendEvent(PtAnalytics.Action.BROWSE_SEARCHED); - + string assetId; if (SearchTermIsAssetPage(searchTerms, out assetId)) { manager.StartRequestForSpecificAsset(assetId); @@ -621,7 +621,7 @@ private void DrawResultsGrid() { } if (manager.CurrentResult == null) { - return; + return; } if (manager.CurrentResult != null && !manager.CurrentResult.Status.ok) { @@ -641,7 +641,7 @@ private void DrawResultsGrid() { return; } - + if (manager.CurrentResult.Value.assets == null || manager.CurrentResult.Value.assets.Count == 0) { GUILayout.Space(30); @@ -724,7 +724,7 @@ private void DrawResultsGrid() { guiHelper.EndHorizontal(); GUILayout.Space(10); - + bool loadMoreClicked = false; if (manager.resultHasMorePages) { // If the current response has at least another page of results left, show the load more button. @@ -738,7 +738,7 @@ private void DrawResultsGrid() { guiHelper.EndVertical(); guiHelper.EndScrollView(); - + if (loadMoreClicked) { manager.GetNextPageRequest(); return; @@ -859,7 +859,7 @@ private void StartRequest() { } } else if (mode == UiMode.SEARCH) { PolyListAssetsRequest request = new PolyListAssetsRequest(); - request.keywords = searchTerms; + request.keywords = searchTerms; manager.StartRequest(request); } else { throw new System.Exception("Unexpected UI mode for StartQuery: " + mode); @@ -915,14 +915,14 @@ private void DrawDetailsUi() { detailsScrollPos = guiHelper.BeginScrollView(detailsScrollPos); const float width = 150; - + guiHelper.BeginHorizontal(); GUILayout.Label(selectedAsset.displayName, detailsTitleStyle); guiHelper.EndHorizontal(); guiHelper.BeginHorizontal(); GUILayout.Label(selectedAsset.authorName, EditorStyles.wordWrappedLabel); - + GUILayout.FlexibleSpace(); if (GUILayout.Button("View on Web", GUILayout.MaxWidth(100))) { PtAnalytics.SendEvent(PtAnalytics.Action.BROWSE_VIEW_ON_WEB); @@ -970,7 +970,7 @@ private void DrawDetailsUi() { guiHelper.EndScrollView(); return; } - + GUILayout.Space(5); GUILayout.Label("Import Options", EditorStyles.boldLabel); GUILayout.Space(5); @@ -1000,7 +1000,7 @@ private void DrawDetailsUi() { PtSettings.Instance.defaultImportOptions.alsoInstantiate = importOptions.alsoInstantiate; } SendImportOptionMutationAnalytics(oldOptions, importOptions); - + GUILayout.Space(10); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); GUILayout.Space(10); @@ -1013,7 +1013,7 @@ private void DrawDetailsUi() { GUILayout.FlexibleSpace(); guiHelper.EndHorizontal(); GUILayout.Space(5); - + if (!File.Exists(PtUtils.ToAbsolutePath(ptAssetLocalPath))) { GUILayout.Label(PolyInternalUtils.ATTRIBUTION_NOTICE, EditorStyles.wordWrappedLabel); } else { diff --git a/Packages/icosa-api-client-unity/Editor/Importer/PolyImporter.cs b/Packages/icosa-api-client-unity/Editor/Importer/PolyImporter.cs index 340b8f1..019d542 100644 --- a/Packages/icosa-api-client-unity/Editor/Importer/PolyImporter.cs +++ b/Packages/icosa-api-client-unity/Editor/Importer/PolyImporter.cs @@ -209,7 +209,7 @@ private static void ExecuteImportRequest(ImportRequest request) { // If this is a third-party asset, we need to update the attributions file. AttributionFileGenerator.Generate(/* showUi */ false); - EditorWindow.GetWindow().HandleAssetImported(request.polyAsset.name); + EditorWindow.GetWindow().HandleAssetImported(request.polyAsset.assetId); // Select the prefab in the editor so the user knows where it is. AssetDatabase.Refresh(); diff --git a/Packages/icosa-api-client-unity/Editor/PtUtils.cs b/Packages/icosa-api-client-unity/Editor/PtUtils.cs index a26bda8..0adc4c0 100644 --- a/Packages/icosa-api-client-unity/Editor/PtUtils.cs +++ b/Packages/icosa-api-client-unity/Editor/PtUtils.cs @@ -96,7 +96,7 @@ public static string GetPtAssetBaseName(PolyAsset asset) { return string.Format("{0}_{1}_{2}", SanitizeToUseAsFileName(asset.displayName), SanitizeToUseAsFileName(asset.authorName), - SanitizeToUseAsFileName(asset.name).Replace("assets_", "")); + SanitizeToUseAsFileName(asset.assetId).Replace("assets_", "")); } public static string GetPtBaseLocalPath() { diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/AsyncImporter.cs b/Packages/icosa-api-client-unity/Runtime/Internal/AsyncImporter.cs index 1be9702..21ede26 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/AsyncImporter.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/AsyncImporter.cs @@ -77,7 +77,7 @@ public void ImportAsync(PolyAsset asset, PolyFormat format, PolyImportOptions op private static void BackgroundThreadProc(object userData) { ImportOperation operation = (ImportOperation)userData; - try { + try { using (TextReader reader = new StreamReader(new MemoryStream(operation.format.root.contents), Encoding.UTF8)) { operation.importState = ImportGltf.BeginImport( operation.format.formatType == PolyFormatType.GLTF ? GltfSchemaVersion.GLTF1 : GltfSchemaVersion.GLTF2, @@ -105,7 +105,7 @@ public void Update() { if (finishedOperations.Count == 0) return; operation = finishedOperations.Dequeue(); } - + if (!operation.status.ok) { // Import failed. operation.callback(operation.status, root: null, meshCreator: null); diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/AttributionGeneration.cs b/Packages/icosa-api-client-unity/Runtime/Internal/AttributionGeneration.cs index e448ba0..91e5212 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/AttributionGeneration.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/AttributionGeneration.cs @@ -26,7 +26,7 @@ public static class AttributionGeneration { /// File header. /// public static readonly string FILE_HEADER = - "This project uses the following items from Poly (http://poly.google.com):"; + "This project uses the following items from Icosa Gallery (http://icosa.gallery):"; /// /// Information on the Creative Commons license for the attribution file. /// diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/ImportGltf.cs b/Packages/icosa-api-client-unity/Runtime/Internal/ImportGltf.cs index 1a9b211..ba82ba0 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/ImportGltf.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/ImportGltf.cs @@ -122,8 +122,9 @@ public static GltfImportResult Import( private static GltfRootBase DeserializeGltfRoot(GltfSchemaVersion gltfVersion, JsonTextReader reader) { switch (gltfVersion) { - case GltfSchemaVersion.GLTF1: { - var gltf1Root = kSerializer.Deserialize(reader); + case GltfSchemaVersion.GLTF1: + { + Gltf1Root gltf1Root = kSerializer.Deserialize(reader); if (gltf1Root == null || gltf1Root.nodes == null) { throw new Exception("Failed to parse GLTF1. File is empty or in the wrong format."); } @@ -786,12 +787,12 @@ static List CreateMeshPrecursorsFromPrimitive(ImportState state, ChangeBasisAndApplyScale(data, Semantic.UnitlessVector, state.scaleFactor); mesh.normals = (Vector3[]) data; break; - case "COLOR": + case "COLOR": case "COLOR_0": { Color[] colors = data as Color[]; if (colors == null) { Debug.LogWarningFormat( - "Unsupported: color buffer of type {0}", + "Unsupported: color buffer of type {0}", data == null ? "null" : data.GetType().ToString()); break; } diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/PolyMainInternal.cs b/Packages/icosa-api-client-unity/Runtime/Internal/PolyMainInternal.cs index c575d46..a0c1e27 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/PolyMainInternal.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/PolyMainInternal.cs @@ -242,7 +242,7 @@ public void Import(PolyAsset asset, PolyImportOptions options, PolyApi.ImportCal PolyFormat gltfFormat = asset.GetFormatIfExists(PolyFormatType.GLTF); PolyFormat gltf2Format = asset.GetFormatIfExists(PolyFormatType.GLTF_2); - if (gltf2Format != null && gltfFormat == null) { + if (gltf2Format != null) { FetchAndImportFormat(asset, gltf2Format, options, callback); } else if (gltfFormat != null) { FetchAndImportFormat(asset, gltfFormat, options, callback); diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/ThumbnailFetcher.cs b/Packages/icosa-api-client-unity/Runtime/Internal/ThumbnailFetcher.cs index 89c4c91..97e0d7b 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/ThumbnailFetcher.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/ThumbnailFetcher.cs @@ -64,7 +64,7 @@ public void Fetch() { long cacheAgeMaxMillis = asset.IsMutable ? 0 : CACHE_MAX_AGE_MILLIS; PolyMainInternal.Instance.webRequestManager.EnqueueRequest(MakeRequest, ProcessResponse, cacheAgeMaxMillis); } - + private UnityWebRequest MakeRequest() { string url = asset.thumbnail.url; // If an image size hint was provided, forward it to the server if the server supports it. @@ -83,7 +83,7 @@ private void ProcessResponse(PolyStatus status, int responseCode, byte[] data) { asset.thumbnailTexture.LoadImage(data); } else { Debug.LogWarningFormat("Failed to fetch thumbnail for asset {0} ({1}): {2}", - asset.name, asset.displayName, status); + asset.assetId, asset.displayName, status); } if (callback != null) { callback(asset, status); diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/api_clients/poly_client/PolyClient.cs b/Packages/icosa-api-client-unity/Runtime/Internal/api_clients/poly_client/PolyClient.cs index 8f476ff..0744fa9 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/api_clients/poly_client/PolyClient.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/api_clients/poly_client/PolyClient.cs @@ -265,12 +265,16 @@ public static PolyStatus ParseAsset(JObject asset, out PolyAsset polyAsset) { return PolyStatus.Error("Asset has no visibility set."); } - polyAsset.name = asset["name"].ToString(); + polyAsset.assetId = asset["assetId"].ToString(); + polyAsset.displayName = asset["name"].ToString(); polyAsset.authorName = asset["authorName"].ToString(); if (asset["thumbnail"] != null) { IJEnumerable thumbnailElements = asset["thumbnail"].AsJEnumerable(); - polyAsset.thumbnail = new PolyFile(thumbnailElements["relativePath"].ToString(), - thumbnailElements["url"].ToString(), thumbnailElements["contentType"].ToString()); + polyAsset.thumbnail = new PolyFile( + thumbnailElements["relativePath"]?.ToString(), + thumbnailElements["url"]?.ToString(), + thumbnailElements["contentType"]?.ToString() + ); } if (asset["formats"] == null) { @@ -407,13 +411,10 @@ public void SendRequest(PolyRequest request, Action public void GetAsset(string assetId, Action callback, bool isRecursion = false) { - // If the user passed in a raw asset ID (no "assets/" prefix), fix it. - if (!assetId.StartsWith("assets/")) { - assetId = "assets/" + assetId; - } PolyMainInternal.Instance.webRequestManager.EnqueueRequest( () => { string url = String.Format("{0}/v1/{1}?{2}", GetBaseUrl(), assetId, PolyMainInternal.Instance.apiKeyUrlParam); + Debug.Log(url); return GetRequest(url, "text/text"); }, (PolyStatus status, int responseCode, byte[] response) => { diff --git a/Packages/icosa-api-client-unity/Runtime/Internal/model/util/WebRequestManager.cs b/Packages/icosa-api-client-unity/Runtime/Internal/model/util/WebRequestManager.cs index c969159..5d57dac 100644 --- a/Packages/icosa-api-client-unity/Runtime/Internal/model/util/WebRequestManager.cs +++ b/Packages/icosa-api-client-unity/Runtime/Internal/model/util/WebRequestManager.cs @@ -26,7 +26,7 @@ namespace PolyToolkitInternal.client.model.util { /// /// Manages web requests, limiting how many can happen simultaneously at any given time and re-using /// buffers as much as possible to avoid reallocation and garbage collection. - /// + /// /// Not *all* web requests must be routed through this class. Small, infrequent web requests can be made directly /// via UnityWebRequest without using this class. However, larger or frequent requests should use this, since this /// will avoid the expensive allocation of numerous download buffers (a typical UnityWebRequest allocates many @@ -230,6 +230,7 @@ private IEnumerator HandleWebRequest(PendingRequest request, BufferHolder buffer bool cacheHit = false; byte[] cacheData = null; bool cacheReadDone = false; + Debug.Log(webRequest.url); cache.RequestRead(webRequest.url, request.maxAgeMillis, (bool success, byte[] data) => { cacheHit = success; cacheData = data; diff --git a/Packages/icosa-api-client-unity/Runtime/Scripts/PolyApi.cs b/Packages/icosa-api-client-unity/Runtime/Scripts/PolyApi.cs index c58c4ae..5fdd5f9 100644 --- a/Packages/icosa-api-client-unity/Runtime/Scripts/PolyApi.cs +++ b/Packages/icosa-api-client-unity/Runtime/Scripts/PolyApi.cs @@ -45,7 +45,7 @@ public static void Init(PolyAuthConfig? authConfig = null, PolyCacheConfig? cach Shutdown(); PtSettings.Init(); PolyMainInternal.Init(authConfig, cacheConfig); - Authenticator.Initialize(authConfig ?? PtSettings.Instance.authConfig); + Authenticator.Initialize(authConfig ?? PtSettings.Instance.authConfig); initialized = true; } @@ -200,13 +200,13 @@ public static void ListLikedAssets(PolyListLikedAssetsRequest request, ListAsset /// /// Gets an asset by name (id). /// - /// The name (id) of the asset to get. Note that even though this + /// The name (id) of the asset to get. Note that even though this /// is called 'name', it does not mean the asset's display name, but its unique ID. /// Example: "assets/5vbJ5vildOq". /// The callback to call when the request finishes. - public static void GetAsset(string name, GetAssetCallback callback) { + public static void GetAsset(string assetId, GetAssetCallback callback) { CheckInitialized(); - PolyMainInternal.Instance.GetAsset(name, callback); + PolyMainInternal.Instance.GetAsset(assetId, callback); } /// @@ -295,7 +295,7 @@ private static void CheckInitialized() { "using Poly API methods."); } } - + /// /// Clears the local web cache. This is asynchronous (the cache will be cleared in the background). /// @@ -313,7 +313,7 @@ public static void ClearCache() { /// of assets imported at runtime that you are using in your scene or project. public static string GenerateAttributions(bool includeStatic = true, List runtimeAssets = null) { StringBuilder sb = new StringBuilder(); - + bool hasHeader = false; if (includeStatic) { // Append static file first, because it includes the header. diff --git a/Packages/icosa-api-client-unity/Runtime/Scripts/PolyTypes.cs b/Packages/icosa-api-client-unity/Runtime/Scripts/PolyTypes.cs index d89cf86..2476e9c 100644 --- a/Packages/icosa-api-client-unity/Runtime/Scripts/PolyTypes.cs +++ b/Packages/icosa-api-client-unity/Runtime/Scripts/PolyTypes.cs @@ -31,13 +31,19 @@ public class PolyAsset { /// /// Format of the URL to a particular asset, given its ID. /// - private const string URL_FORMAT = "https://poly.google.com/view/{0}"; + private const string URL_FORMAT = "https://icosa.gallery/view/{0}"; /// - /// Identifier for the asset. This is an alphanumeric string that identifies the asset, - /// but is not meant for display. For example, "assets/L1o2e3m4I5p6s7u8m". + /// For backwards compatibility with Poly API - same as assetId but with "assets/" prefix. + /// For example, "assets/L1o2e3m4I5p6s7u8m". + /// Not to be confused with displayName which is the human readable name /// public string name; /// + /// Identifier for the asset. This is an alphanumeric string that identifies the asset, + /// but is not meant for display. For example, "L1o2e3m4I5p6s7u8m". + /// + public string assetId; + /// /// Human-readable name of the asset. /// public string displayName; @@ -119,7 +125,7 @@ public bool IsMutable { /// public string Url { get { - return string.Format(URL_FORMAT, name.Replace("assets/", "")); + return string.Format(URL_FORMAT, assetId); } } @@ -424,7 +430,7 @@ public override string ToString() { return AutoStringify.Stringify(this); } } - + /// /// Represents a set of Poly request parameters determining which of the user's assets should be returned. /// null values mean "don't filter by this parameter". @@ -436,11 +442,11 @@ public class PolyListUserAssetsRequest : PolyRequest { public PolyFormatFilter? formatFilter = null; public PolyListUserAssetsRequest() { } - + /// /// Returns a ListUserAssetsRequest that requests the user's latest assets. /// - public static PolyListUserAssetsRequest MyNewest() { + public static PolyListUserAssetsRequest MyNewest() { PolyListUserAssetsRequest myNewest = new PolyListUserAssetsRequest(); myNewest.orderBy = PolyOrderBy.NEWEST; return myNewest; @@ -466,11 +472,11 @@ public class PolyListLikedAssetsRequest : PolyRequest { public string name = "me"; public PolyListLikedAssetsRequest() { } - + /// /// Returns a ListUserAssetsRequest that requests the user's most recently liked assets. /// - public static PolyListLikedAssetsRequest MyLiked() { + public static PolyListLikedAssetsRequest MyLiked() { PolyListLikedAssetsRequest myLiked = new PolyListLikedAssetsRequest(); myLiked.orderBy = PolyOrderBy.LIKED_TIME; return myLiked;